From 5b774abe3f791bcfab2703aeca429bbbef35a985 Mon Sep 17 00:00:00 2001 From: David Li Date: Wed, 4 Feb 2026 16:33:02 +0900 Subject: [PATCH] test: adjust type names in validation suite --- src/docs/clickhouse.md | 2 +- src/pixi.lock | 10 ++-- .../queries/type/literal/boolean.txtcase | 17 +++++++ .../queries/type/literal/date.txtcase | 4 ++ .../queries/type/literal/decimal.txtcase | 17 +++++++ .../queries/type/literal/float32.txtcase | 17 +++++++ .../queries/type/literal/float64.txtcase | 17 +++++++ .../queries/type/literal/int16.txtcase | 17 +++++++ .../queries/type/literal/int32.txtcase | 17 +++++++ .../queries/type/literal/int64.txtcase | 18 +++++++ .../queries/type/literal/string.txtcase | 17 +++++++ .../queries/type/literal/time.txtcase | 1 + .../queries/type/literal/timestamp.txtcase | 1 + .../queries/type/literal/timestamptz.txtcase | 5 ++ .../queries/type/select/binary.txtcase | 2 + .../queries/type/select/boolean.txtcase | 4 ++ .../queries/type/select/date.txtcase | 3 +- .../queries/type/select/decimal.txtcase | 4 ++ .../queries/type/select/float32.txtcase | 4 ++ .../queries/type/select/float64.txtcase | 4 ++ .../queries/type/select/int16.txtcase | 4 ++ .../queries/type/select/int32.txtcase | 4 ++ .../queries/type/select/int64.txtcase | 5 ++ .../queries/type/select/string.txtcase | 3 +- .../queries/type/select/time.txtcase | 1 + .../queries/type/select/timestamp.txtcase | 3 +- .../queries/type/select/timestamptz.txtcase | 3 +- src/validation/tests/clickhouse.py | 1 + src/validation/tests/test_statement.py | 47 ++++++++++++++----- 29 files changed, 228 insertions(+), 24 deletions(-) create mode 100644 src/validation/queries/type/literal/boolean.txtcase create mode 100644 src/validation/queries/type/literal/decimal.txtcase create mode 100644 src/validation/queries/type/literal/float32.txtcase create mode 100644 src/validation/queries/type/literal/float64.txtcase create mode 100644 src/validation/queries/type/literal/int16.txtcase create mode 100644 src/validation/queries/type/literal/int32.txtcase create mode 100644 src/validation/queries/type/literal/int64.txtcase create mode 100644 src/validation/queries/type/literal/string.txtcase diff --git a/src/docs/clickhouse.md b/src/docs/clickhouse.md index bd2afdb..a2a922f 100644 --- a/src/docs/clickhouse.md +++ b/src/docs/clickhouse.md @@ -57,4 +57,4 @@ Note: The example above is for Python using the [adbc-driver-manager](https://py {{ footnotes|safe }} -[clickhouse]: +[clickhouse]: https://clickhouse.com/ diff --git a/src/pixi.lock b/src/pixi.lock index 16b5ccc..6920406 100644 --- a/src/pixi.lock +++ b/src/pixi.lock @@ -38,7 +38,7 @@ environments: - pypi: https://files.pythonhosted.org/packages/98/df/0a1755e750013a2081e863e7cd37e0cdd02664372c754e5560099eb7aa44/cffi-2.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl - pypi: https://files.pythonhosted.org/packages/f5/83/6ab5883f57c9c801ce5e5677242328aa45592be8a00644310a008d04f922/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl - pypi: https://files.pythonhosted.org/packages/88/39/799be3f2f0f38cc727ee3b4f1445fe6d5e4133064ec2e4115069418a5bb6/cloudpickle-3.1.2-py3-none-any.whl - - pypi: git+https://github.com/adbc-drivers/dev#c02d70fb0bfb3c84a7bafbf06cacfbeec02679e5 + - pypi: git+https://github.com/adbc-drivers/dev#fd33b34735c1820276a303b8f763bacf1cbc54e9 - pypi: https://files.pythonhosted.org/packages/44/83/a2960d2c975836daa629a73995134fd86520c101412578c57da3d2aa71ee/doit-0.36.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/53/32/256df3dbaa198c58539ad94f9a41e98c2c8ff23f126b8f5f52c7dcd0a738/duckdb-1.4.4-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl - pypi: https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl @@ -98,7 +98,7 @@ environments: - pypi: https://files.pythonhosted.org/packages/a9/f5/a2c23eb03b61a0b8747f211eb716446c826ad66818ddc7810cc2cc19b3f2/cffi-2.0.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl - pypi: https://files.pythonhosted.org/packages/7d/62/73a6d7450829655a35bb88a88fca7d736f9882a27eacdca2c6d505b57e2e/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl - pypi: https://files.pythonhosted.org/packages/88/39/799be3f2f0f38cc727ee3b4f1445fe6d5e4133064ec2e4115069418a5bb6/cloudpickle-3.1.2-py3-none-any.whl - - pypi: git+https://github.com/adbc-drivers/dev#c02d70fb0bfb3c84a7bafbf06cacfbeec02679e5 + - pypi: git+https://github.com/adbc-drivers/dev#fd33b34735c1820276a303b8f763bacf1cbc54e9 - pypi: https://files.pythonhosted.org/packages/44/83/a2960d2c975836daa629a73995134fd86520c101412578c57da3d2aa71ee/doit-0.36.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/09/5b/3e7aa490841784d223de61beb2ae64e82331501bf5a415dc87a0e27b4663/duckdb-1.4.4-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl - pypi: https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl @@ -151,7 +151,7 @@ environments: - pypi: https://files.pythonhosted.org/packages/4a/d2/a6c0296814556c68ee32009d9c2ad4f85f2707cdecfd7727951ec228005d/cffi-2.0.0-cp313-cp313-macosx_11_0_arm64.whl - pypi: https://files.pythonhosted.org/packages/97/45/4b3a1239bbacd321068ea6e7ac28875b03ab8bc0aa0966452db17cd36714/charset_normalizer-3.4.4-cp313-cp313-macosx_10_13_universal2.whl - pypi: https://files.pythonhosted.org/packages/88/39/799be3f2f0f38cc727ee3b4f1445fe6d5e4133064ec2e4115069418a5bb6/cloudpickle-3.1.2-py3-none-any.whl - - pypi: git+https://github.com/adbc-drivers/dev#c02d70fb0bfb3c84a7bafbf06cacfbeec02679e5 + - pypi: git+https://github.com/adbc-drivers/dev#fd33b34735c1820276a303b8f763bacf1cbc54e9 - pypi: https://files.pythonhosted.org/packages/44/83/a2960d2c975836daa629a73995134fd86520c101412578c57da3d2aa71ee/doit-0.36.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/a6/7b/64e68a7b857ed0340045501535a0da99ea5d9d5ea3708fec0afb8663eb27/duckdb-1.4.4-cp313-cp313-macosx_11_0_arm64.whl - pypi: https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl @@ -206,7 +206,7 @@ environments: - pypi: https://files.pythonhosted.org/packages/c4/26/b9924fa27db384bdcd97ab83b4f0a8058d96ad9626ead570674d5e737d90/charset_normalizer-3.4.4-cp313-cp313-win_amd64.whl - pypi: https://files.pythonhosted.org/packages/88/39/799be3f2f0f38cc727ee3b4f1445fe6d5e4133064ec2e4115069418a5bb6/cloudpickle-3.1.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl - - pypi: git+https://github.com/adbc-drivers/dev#c02d70fb0bfb3c84a7bafbf06cacfbeec02679e5 + - pypi: git+https://github.com/adbc-drivers/dev#fd33b34735c1820276a303b8f763bacf1cbc54e9 - pypi: https://files.pythonhosted.org/packages/44/83/a2960d2c975836daa629a73995134fd86520c101412578c57da3d2aa71ee/doit-0.36.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/a4/f0/620323fd87062ea43e527a2d5ed9e55b525e0847c17d3b307094ddab98a2/duckdb-1.4.4-cp313-cp313-win_amd64.whl - pypi: https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl @@ -328,7 +328,7 @@ packages: - pyarrow>=14.0.1 ; extra == 'test' - pytest ; extra == 'test' requires_python: '>=3.10' -- pypi: git+https://github.com/adbc-drivers/dev#c02d70fb0bfb3c84a7bafbf06cacfbeec02679e5 +- pypi: git+https://github.com/adbc-drivers/dev#fd33b34735c1820276a303b8f763bacf1cbc54e9 name: adbc-drivers-dev version: '0.1' requires_dist: diff --git a/src/validation/queries/type/literal/boolean.txtcase b/src/validation/queries/type/literal/boolean.txtcase new file mode 100644 index 0000000..3e0bd00 --- /dev/null +++ b/src/validation/queries/type/literal/boolean.txtcase @@ -0,0 +1,17 @@ +// Copyright (c) 2026 ADBC Drivers Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// part: metadata +[tags] +sql-type-name = "Boolean" diff --git a/src/validation/queries/type/literal/date.txtcase b/src/validation/queries/type/literal/date.txtcase index 2752d25..967a675 100644 --- a/src/validation/queries/type/literal/date.txtcase +++ b/src/validation/queries/type/literal/date.txtcase @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// part: metadata +[tags] +sql-type-name = "Date32" + // part: query SELECT CAST('2023-05-15' AS Date32) AS res diff --git a/src/validation/queries/type/literal/decimal.txtcase b/src/validation/queries/type/literal/decimal.txtcase new file mode 100644 index 0000000..a19c0ca --- /dev/null +++ b/src/validation/queries/type/literal/decimal.txtcase @@ -0,0 +1,17 @@ +// Copyright (c) 2026 ADBC Drivers Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// part: metadata +[tags] +sql-type-name = "Decimal" diff --git a/src/validation/queries/type/literal/float32.txtcase b/src/validation/queries/type/literal/float32.txtcase new file mode 100644 index 0000000..7008b60 --- /dev/null +++ b/src/validation/queries/type/literal/float32.txtcase @@ -0,0 +1,17 @@ +// Copyright (c) 2026 ADBC Drivers Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// part: metadata +[tags] +sql-type-name = "Float32" diff --git a/src/validation/queries/type/literal/float64.txtcase b/src/validation/queries/type/literal/float64.txtcase new file mode 100644 index 0000000..8af1316 --- /dev/null +++ b/src/validation/queries/type/literal/float64.txtcase @@ -0,0 +1,17 @@ +// Copyright (c) 2026 ADBC Drivers Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// part: metadata +[tags] +sql-type-name = "Float64" diff --git a/src/validation/queries/type/literal/int16.txtcase b/src/validation/queries/type/literal/int16.txtcase new file mode 100644 index 0000000..7263d28 --- /dev/null +++ b/src/validation/queries/type/literal/int16.txtcase @@ -0,0 +1,17 @@ +// Copyright (c) 2026 ADBC Drivers Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// part: metadata +[tags] +sql-type-name = "Int16" diff --git a/src/validation/queries/type/literal/int32.txtcase b/src/validation/queries/type/literal/int32.txtcase new file mode 100644 index 0000000..6d9dca6 --- /dev/null +++ b/src/validation/queries/type/literal/int32.txtcase @@ -0,0 +1,17 @@ +// Copyright (c) 2026 ADBC Drivers Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// part: metadata +[tags] +sql-type-name = "Int32" diff --git a/src/validation/queries/type/literal/int64.txtcase b/src/validation/queries/type/literal/int64.txtcase new file mode 100644 index 0000000..cb1fe01 --- /dev/null +++ b/src/validation/queries/type/literal/int64.txtcase @@ -0,0 +1,18 @@ +// Copyright (c) 2026 ADBC Drivers Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// part: metadata + +[tags] +sql-type-name = "Int64" diff --git a/src/validation/queries/type/literal/string.txtcase b/src/validation/queries/type/literal/string.txtcase new file mode 100644 index 0000000..e150392 --- /dev/null +++ b/src/validation/queries/type/literal/string.txtcase @@ -0,0 +1,17 @@ +// Copyright (c) 2026 ADBC Drivers Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// part: metadata +[tags] +sql-type-name = "String" diff --git a/src/validation/queries/type/literal/time.txtcase b/src/validation/queries/type/literal/time.txtcase index 4cafc5a..b94f940 100644 --- a/src/validation/queries/type/literal/time.txtcase +++ b/src/validation/queries/type/literal/time.txtcase @@ -20,3 +20,4 @@ SELECT CAST('13:45:31' AS TIME) AS res [tags] broken-vendor = "ClickHouse Time type is not supported in Arrow format export" +sql-type-name = "Time" diff --git a/src/validation/queries/type/literal/timestamp.txtcase b/src/validation/queries/type/literal/timestamp.txtcase index ec2188f..1ba5451 100644 --- a/src/validation/queries/type/literal/timestamp.txtcase +++ b/src/validation/queries/type/literal/timestamp.txtcase @@ -16,6 +16,7 @@ [tags] caveats = ["ClickHouse datetime without timezone is interpreted in **server** timezone"] +sql-type-name = "DateTime64 (no time zone)" // part: query diff --git a/src/validation/queries/type/literal/timestamptz.txtcase b/src/validation/queries/type/literal/timestamptz.txtcase index 1f341f6..8544153 100644 --- a/src/validation/queries/type/literal/timestamptz.txtcase +++ b/src/validation/queries/type/literal/timestamptz.txtcase @@ -12,6 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +// part: metadata + +[tags] +sql-type-name = "DateTime64 (with time zone)" + // part: query SELECT CAST('2023-05-15 13:45:30' AS DateTime64(6, 'UTC')) AS res diff --git a/src/validation/queries/type/select/binary.txtcase b/src/validation/queries/type/select/binary.txtcase index 6049706..8fb5c75 100644 --- a/src/validation/queries/type/select/binary.txtcase +++ b/src/validation/queries/type/select/binary.txtcase @@ -14,6 +14,8 @@ // part: metadata +hide = true + [tags] broken-vendor = "ClickHouse has no dedicated bytestring type; it is the same as the string type, and by default all strings are treated as Arrow strings, meaning binary data in ClickHouse results in invalid string data in Arrow" diff --git a/src/validation/queries/type/select/boolean.txtcase b/src/validation/queries/type/select/boolean.txtcase index d5f7300..68d5c9a 100644 --- a/src/validation/queries/type/select/boolean.txtcase +++ b/src/validation/queries/type/select/boolean.txtcase @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// part: metadata +[tags] +sql-type-name = "Boolean" + // part: setup_query CREATE TABLE test_boolean ( diff --git a/src/validation/queries/type/select/date.txtcase b/src/validation/queries/type/select/date.txtcase index 9706f64..7c17730 100644 --- a/src/validation/queries/type/select/date.txtcase +++ b/src/validation/queries/type/select/date.txtcase @@ -15,7 +15,8 @@ // part: metadata [tags] -caveats = ["ClickHouse Date32 has limited range (1900-01-01 to 2299-12-31)"] +caveats = ["Date32 has limited range (1900-01-01 to 2299-12-31)"] +sql-type-name = "Date32" // part: setup_query diff --git a/src/validation/queries/type/select/decimal.txtcase b/src/validation/queries/type/select/decimal.txtcase index f23785f..355ce17 100644 --- a/src/validation/queries/type/select/decimal.txtcase +++ b/src/validation/queries/type/select/decimal.txtcase @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// part: metadata +[tags] +sql-type-name = "Decimal" + // part: setup_query CREATE TABLE test_decimal ( diff --git a/src/validation/queries/type/select/float32.txtcase b/src/validation/queries/type/select/float32.txtcase index 513d56d..bbce3c8 100644 --- a/src/validation/queries/type/select/float32.txtcase +++ b/src/validation/queries/type/select/float32.txtcase @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// part: metadata +[tags] +sql-type-name = "Float32" + // part: setup_query CREATE TABLE test_float32 ( diff --git a/src/validation/queries/type/select/float64.txtcase b/src/validation/queries/type/select/float64.txtcase index 35763f9..a562df4 100644 --- a/src/validation/queries/type/select/float64.txtcase +++ b/src/validation/queries/type/select/float64.txtcase @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// part: metadata +[tags] +sql-type-name = "Float64" + // part: setup_query CREATE TABLE test_float64 ( diff --git a/src/validation/queries/type/select/int16.txtcase b/src/validation/queries/type/select/int16.txtcase index 669b226..fbdfc12 100644 --- a/src/validation/queries/type/select/int16.txtcase +++ b/src/validation/queries/type/select/int16.txtcase @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// part: metadata +[tags] +sql-type-name = "Int16" + // part: setup_query CREATE TABLE test_int16 ( diff --git a/src/validation/queries/type/select/int32.txtcase b/src/validation/queries/type/select/int32.txtcase index c1cc5c8..5b17b19 100644 --- a/src/validation/queries/type/select/int32.txtcase +++ b/src/validation/queries/type/select/int32.txtcase @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// part: metadata +[tags] +sql-type-name = "Int32" + // part: setup_query CREATE TABLE test_int32 ( diff --git a/src/validation/queries/type/select/int64.txtcase b/src/validation/queries/type/select/int64.txtcase index 0cb06d4..6fd6bd3 100644 --- a/src/validation/queries/type/select/int64.txtcase +++ b/src/validation/queries/type/select/int64.txtcase @@ -12,6 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +// part: metadata + +[tags] +sql-type-name = "Int64" + // part: setup_query CREATE TABLE test_int64 ( diff --git a/src/validation/queries/type/select/string.txtcase b/src/validation/queries/type/select/string.txtcase index fda2db8..c6480e7 100644 --- a/src/validation/queries/type/select/string.txtcase +++ b/src/validation/queries/type/select/string.txtcase @@ -13,9 +13,8 @@ // limitations under the License. // part: metadata - [tags] -caveats = ["Special characters like {} are not supported due to clickhouse crate parameter parsing"] +sql-type-name = "String" // part: setup_query diff --git a/src/validation/queries/type/select/time.txtcase b/src/validation/queries/type/select/time.txtcase index 8ba88a5..dbaa697 100644 --- a/src/validation/queries/type/select/time.txtcase +++ b/src/validation/queries/type/select/time.txtcase @@ -16,3 +16,4 @@ [tags] broken-vendor = "ClickHouse Time type is not supported in Arrow format export" +sql-type-name = "Time" diff --git a/src/validation/queries/type/select/timestamp.txtcase b/src/validation/queries/type/select/timestamp.txtcase index 7791b0d..74f7e76 100644 --- a/src/validation/queries/type/select/timestamp.txtcase +++ b/src/validation/queries/type/select/timestamp.txtcase @@ -15,7 +15,8 @@ // part: metadata [tags] -caveats = ["ClickHouse DateTime64(6) has limited range (1900 to 2299)"] +caveats = ["DateTime64 has limited range (1900 to 2299)"] +sql-type-name = "DateTime64 (no time zone)" // part: setup_query diff --git a/src/validation/queries/type/select/timestamptz.txtcase b/src/validation/queries/type/select/timestamptz.txtcase index eadce74..73aa749 100644 --- a/src/validation/queries/type/select/timestamptz.txtcase +++ b/src/validation/queries/type/select/timestamptz.txtcase @@ -15,7 +15,8 @@ // part: metadata [tags] -caveats = ["ClickHouse DateTime64(6, 'UTC') has limited range (1900 to 2262)"] +caveats = ["DateTime64 has limited range (1900 to 2299)"] +sql-type-name = "DateTime64 (with time zone)" // part: setup_query diff --git a/src/validation/tests/clickhouse.py b/src/validation/tests/clickhouse.py index 807a218..451a07b 100644 --- a/src/validation/tests/clickhouse.py +++ b/src/validation/tests/clickhouse.py @@ -26,6 +26,7 @@ class ClickHouseQuirks(model.DriverQuirks): short_version = "25.12" features = model.DriverFeatures( statement_bind=False, + statement_prepare=False, current_catalog="", current_schema="db", supported_xdbc_fields=[], diff --git a/src/validation/tests/test_statement.py b/src/validation/tests/test_statement.py index 91d981e..9ef9133 100644 --- a/src/validation/tests/test_statement.py +++ b/src/validation/tests/test_statement.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import adbc_driver_manager import adbc_drivers_validation.tests.statement as statement_tests -import pytest from . import clickhouse @@ -23,16 +23,37 @@ def pytest_generate_tests(metafunc) -> None: class TestStatement(statement_tests.TestStatement): - @pytest.mark.xfail(reason="prepare() not implemented") - def test_prepare(self, driver, conn) -> None: - super().test_prepare(driver, conn) - - @pytest.mark.xfail(reason="prepare() not implemented") - def test_parameter_execute(self, driver, conn) -> None: - super().test_parameter_execute(driver, conn) - - @pytest.mark.xfail( - reason="ClickHouse lightweight updates require special table settings" - ) def test_rows_affected(self, driver, conn) -> None: - super().test_rows_affected(driver, conn) + # ClickHouse doesn't like UPDATE, so truncate the upstream test + table_name = "test_rows_affected" + with conn.cursor() as cursor: + cursor.adbc_statement.set_sql_query( + driver.drop_table(table_name="test_rows_affected") + ) + try: + cursor.adbc_statement.execute_update() + except adbc_driver_manager.Error as e: + # Some databases have no way to do DROP IF EXISTS + if not driver.is_table_not_found(table_name=table_name, error=e): + raise + + quoted_name = driver.quote_identifier(table_name) + cursor.adbc_statement.set_sql_query(f"CREATE TABLE {quoted_name} (id INT)") + rows_affected = cursor.adbc_statement.execute_update() + + if ( + driver.features.statement_rows_affected + and driver.features.statement_rows_affected_ddl + ): + assert rows_affected == 0 + else: + assert rows_affected == -1 + + cursor.adbc_statement.set_sql_query( + f"INSERT INTO {quoted_name} (id) VALUES (1)" + ) + rows_affected = cursor.adbc_statement.execute_update() + if driver.features.statement_rows_affected: + assert rows_affected == 1 + else: + assert rows_affected == -1