From 5be7ac9f8a82e8b850d8e5cac53a0d67771d8060 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 00:21:18 +0000 Subject: [PATCH 1/4] fix(deps): update dependency sqlglot to >=23.4,<25.17 --- poetry.lock | 12 ++++++------ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/poetry.lock b/poetry.lock index c767e8a0dfa9..c4be1082e607 100644 --- a/poetry.lock +++ b/poetry.lock @@ -6883,18 +6883,18 @@ sqlcipher = ["sqlcipher3_binary"] [[package]] name = "sqlglot" -version = "25.15.0" +version = "25.16.0" description = "An easily customizable SQL parser and transpiler" optional = false python-versions = ">=3.7" files = [ - {file = "sqlglot-25.15.0-py3-none-any.whl", hash = "sha256:86bb8c4214cc39e93f51776a50fe74fae3b1a61c21710a05e7913aa4b30ec1d7"}, - {file = "sqlglot-25.15.0.tar.gz", hash = "sha256:b6bb428a3c0845021a02becf343efe5ad97a3f2d0f1a0472b2b9877188cdf646"}, + {file = "sqlglot-25.16.0-py3-none-any.whl", hash = "sha256:508575d2b6db7edd1cdc83a147a2bdc4cea38a4b68ec1c6314065798dd830b13"}, + {file = "sqlglot-25.16.0.tar.gz", hash = "sha256:41c32c900629e7a28dd1b0411f82d84da77732bc69b21e2308bd2b00fa04cc3a"}, ] [package.extras] -dev = ["duckdb (>=0.6)", "maturin (>=1.4,<2.0)", "mypy", "pandas", "pandas-stubs", "pdoc", "pre-commit", "python-dateutil", "ruff (==0.4.3)", "types-python-dateutil", "typing-extensions"] -rs = ["sqlglotrs (==0.2.8)"] +dev = ["duckdb (>=0.6)", "maturin (>=1.4,<2.0)", "mypy", "pandas", "pandas-stubs", "pdoc", "pre-commit", "python-dateutil", "pytz", "ruff (==0.4.3)", "types-python-dateutil", "types-pytz", "typing-extensions"] +rs = ["sqlglotrs (==0.2.9)"] [[package]] name = "stack-data" @@ -7891,4 +7891,4 @@ visualization = ["graphviz"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "9b9daab1d5b33cf034142e77e7e1a734ae9d60f2b4d5c8723337656a254cc36f" +content-hash = "bc5da5a4e0a7840fd31c6bff7f515596cfbf73090520021402121f6f6aece563" diff --git a/pyproject.toml b/pyproject.toml index 172eff41425b..fc4c16586183 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ atpublic = ">=2.3,<6" parsy = ">=2,<3" python-dateutil = ">=2.8.2,<3" pytz = ">=2022.7" -sqlglot = ">=23.4,<25.16" +sqlglot = ">=23.4,<25.17" toolz = ">=0.11,<1" typing-extensions = ">=4.3.0,<5" numpy = { version = ">=1.23.2,<3", optional = true } From 8ba54dcc6d5c73b752a5cc3658db06d8673ce966 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 23 Aug 2024 06:46:38 -0400 Subject: [PATCH 2/4] chore(deps): bump sqlglot --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 5ce878a6e76d..69ba83179515 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -256,7 +256,7 @@ sortedcontainers==2.4.0 ; python_version >= "3.10" and python_version < "4.0" soupsieve==2.6 ; python_version >= "3.10" and python_version < "3.13" sphobjinv==2.3.1.1 ; python_version >= "3.10" and python_version < "3.13" sqlalchemy==2.0.32 ; python_version >= "3.10" and python_version < "3.13" -sqlglot==25.15.0 ; python_version >= "3.10" and python_version < "4.0" +sqlglot==25.16.0 ; python_version >= "3.10" and python_version < "4.0" stack-data==0.6.3 ; python_version >= "3.10" and python_version < "4.0" statsmodels==0.14.2 ; python_version >= "3.10" and python_version < "3.13" tabulate==0.9.0 ; python_version >= "3.10" and python_version < "3.13" From 8046d3f13668db5c5023787b3ba7f90c2192a9d0 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 23 Aug 2024 06:50:04 -0400 Subject: [PATCH 3/4] chore(sql): update snapshots --- .../test_functions/test_cast_string_col/timestamp/out.sql | 2 +- .../tests/snapshots/test_functions/test_timestamp_cast/out1.sql | 2 +- .../tests/snapshots/test_functions/test_timestamp_cast/out2.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ibis/backends/clickhouse/tests/snapshots/test_functions/test_cast_string_col/timestamp/out.sql b/ibis/backends/clickhouse/tests/snapshots/test_functions/test_cast_string_col/timestamp/out.sql index 65f976d317ba..ee12a783ada1 100644 --- a/ibis/backends/clickhouse/tests/snapshots/test_functions/test_cast_string_col/timestamp/out.sql +++ b/ibis/backends/clickhouse/tests/snapshots/test_functions/test_cast_string_col/timestamp/out.sql @@ -1,3 +1,3 @@ SELECT - CAST("t0"."string_col" AS Nullable(DATETIME)) AS "Cast(string_col, timestamp)" + CAST("t0"."string_col" AS Nullable(DateTime)) AS "Cast(string_col, timestamp)" FROM "functional_alltypes" AS "t0" \ No newline at end of file diff --git a/ibis/backends/clickhouse/tests/snapshots/test_functions/test_timestamp_cast/out1.sql b/ibis/backends/clickhouse/tests/snapshots/test_functions/test_timestamp_cast/out1.sql index 8c45bbd7d6d7..132fa875a3e1 100644 --- a/ibis/backends/clickhouse/tests/snapshots/test_functions/test_timestamp_cast/out1.sql +++ b/ibis/backends/clickhouse/tests/snapshots/test_functions/test_timestamp_cast/out1.sql @@ -1,3 +1,3 @@ SELECT - CAST("t0"."timestamp_col" AS DATETIME) AS "Cast(timestamp_col, !timestamp)" + CAST("t0"."timestamp_col" AS DateTime) AS "Cast(timestamp_col, !timestamp)" FROM "functional_alltypes" AS "t0" \ No newline at end of file diff --git a/ibis/backends/clickhouse/tests/snapshots/test_functions/test_timestamp_cast/out2.sql b/ibis/backends/clickhouse/tests/snapshots/test_functions/test_timestamp_cast/out2.sql index daa10c3b5e60..a4ab25218241 100644 --- a/ibis/backends/clickhouse/tests/snapshots/test_functions/test_timestamp_cast/out2.sql +++ b/ibis/backends/clickhouse/tests/snapshots/test_functions/test_timestamp_cast/out2.sql @@ -1,3 +1,3 @@ SELECT - CAST("t0"."int_col" AS DATETIME) AS "Cast(int_col, !timestamp)" + CAST("t0"."int_col" AS DateTime) AS "Cast(int_col, !timestamp)" FROM "functional_alltypes" AS "t0" \ No newline at end of file From 83630aafed6f362717b41cda49b3239b40f4093e Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 23 Aug 2024 07:04:41 -0400 Subject: [PATCH 4/4] fix(sqlglot): manually cast to avoid incorrect optimization --- ibis/backends/sql/compilers/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ibis/backends/sql/compilers/base.py b/ibis/backends/sql/compilers/base.py index a8f80bb16e34..c81ad0f22f63 100644 --- a/ibis/backends/sql/compilers/base.py +++ b/ibis/backends/sql/compilers/base.py @@ -534,7 +534,9 @@ def if_(self, condition, true, false: sge.Expression | None = None) -> sge.If: ) def cast(self, arg, to: dt.DataType) -> sge.Cast: - return sg.cast(sge.convert(arg), to=self.type_mapper.from_ibis(to), copy=False) + return sge.Cast( + this=sge.convert(arg), to=self.type_mapper.from_ibis(to), copy=False + ) def _prepare_params(self, params): result = {}