sqlglot 27.28.0__tar.gz → 27.29.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sqlglot-27.28.0 → sqlglot-27.29.0}/CHANGELOG.md +162 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/PKG-INFO +1 -1
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/__init__.py +1 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/_version.py +3 -3
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/bigquery.py +1 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/dialect.py +45 -7
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/duckdb.py +17 -3
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/mysql.py +1 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/postgres.py +14 -2
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/snowflake.py +55 -18
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/spark.py +3 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/sqlite.py +1 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/executor/__init__.py +5 -10
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/executor/python.py +1 -29
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/expressions.py +102 -12
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/generator.py +16 -2
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/helper.py +0 -42
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/lineage.py +1 -1
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/qualify.py +5 -5
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/qualify_columns.py +89 -9
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/qualify_tables.py +33 -23
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/simplify.py +12 -7
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/parser.py +16 -8
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot.egg-info/PKG-INFO +1 -1
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_bigquery.py +26 -1
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_dialect.py +26 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_duckdb.py +27 -1
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_postgres.py +10 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_snowflake.py +75 -8
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_spark.py +28 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_trino.py +4 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/identity.sql +1 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/annotate_functions.sql +300 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/annotate_types.sql +6 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/normalize.sql +1 -1
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/qualify_columns.sql +7 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/qualify_columns__invalid.sql +2 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/qualify_tables.sql +1 -1
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/simplify.sql +32 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_executor.py +91 -46
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_expressions.py +5 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_lineage.py +46 -4
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_optimizer.py +26 -18
- {sqlglot-27.28.0 → sqlglot-27.29.0}/.gitignore +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/.gitpod.yml +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/.pre-commit-config.yaml +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/CONTRIBUTING.md +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/LICENSE +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/MANIFEST.in +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/Makefile +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/README.md +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/pyproject.toml +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/setup.cfg +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/setup.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/__main__.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/_typing.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/__init__.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/athena.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/clickhouse.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/databricks.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/doris.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/dremio.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/drill.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/druid.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/dune.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/exasol.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/fabric.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/hive.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/materialize.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/oracle.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/presto.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/prql.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/redshift.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/risingwave.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/singlestore.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/solr.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/spark2.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/starrocks.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/tableau.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/teradata.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/trino.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/dialects/tsql.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/diff.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/errors.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/executor/context.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/executor/env.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/executor/table.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/jsonpath.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/__init__.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/annotate_types.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/canonicalize.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/eliminate_ctes.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/eliminate_joins.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/eliminate_subqueries.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/isolate_table_selects.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/merge_subqueries.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/normalize.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/normalize_identifiers.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/optimize_joins.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/optimizer.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/pushdown_predicates.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/pushdown_projections.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/scope.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/optimizer/unnest_subqueries.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/planner.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/py.typed +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/schema.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/serde.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/time.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/tokens.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/transforms.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot/trie.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot.egg-info/SOURCES.txt +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot.egg-info/dependency_links.txt +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot.egg-info/requires.txt +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot.egg-info/top_level.txt +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglot.png +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglotrs/Cargo.lock +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglotrs/Cargo.toml +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglotrs/benches/dialect_settings.json +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglotrs/benches/long.rs +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglotrs/benches/token_type_settings.json +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglotrs/benches/tokenizer_dialect_settings.json +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglotrs/benches/tokenizer_settings.json +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglotrs/pyproject.toml +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglotrs/src/lib.rs +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglotrs/src/settings.rs +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglotrs/src/token.rs +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglotrs/src/tokenizer.rs +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/sqlglotrs/src/trie.rs +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/__init__.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/__init__.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_athena.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_clickhouse.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_databricks.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_doris.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_dremio.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_drill.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_druid.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_dune.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_exasol.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_fabric.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_hive.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_materialize.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_mysql.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_oracle.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_pipe_syntax.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_presto.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_prql.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_redshift.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_risingwave.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_singlestore.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_solr.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_sqlite.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_starrocks.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_tableau.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_teradata.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/dialects/test_tsql.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/jsonpath/LICENSE +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/jsonpath/cts.json +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/canonicalize.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/eliminate_ctes.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/eliminate_joins.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/eliminate_subqueries.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/isolate_table_selects.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/merge_subqueries.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/normalize_identifiers.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/optimize_joins.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/optimizer.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/pushdown_cte_alias_columns.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/pushdown_predicates.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/pushdown_projections.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/qualify_columns__with_invisible.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/qualify_columns_ddl.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/quote_identifiers.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/call_center.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/catalog_page.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/catalog_returns.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/catalog_sales.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/customer.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/customer_address.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/customer_demographics.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/date_dim.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/household_demographics.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/income_band.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/inventory.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/item.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/promotion.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/reason.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/ship_mode.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/store.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/store_returns.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/store_sales.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/time_dim.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/tpc-ds.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/warehouse.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/web_page.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/web_returns.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/web_sales.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-ds/web_site.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-h/customer.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-h/lineitem.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-h/nation.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-h/orders.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-h/part.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-h/partsupp.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-h/region.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-h/supplier.csv.gz +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/tpc-h/tpc-h.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/optimizer/unnest_subqueries.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/partial.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/fixtures/pretty.sql +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/gen_fixtures.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/helpers.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_build.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_dialect_imports.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_diff.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_docs.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_generator.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_helper.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_jsonpath.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_parser.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_schema.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_serde.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_time.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_tokens.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_transforms.py +0 -0
- {sqlglot-27.28.0 → sqlglot-27.29.0}/tests/test_transpile.py +0 -0
|
@@ -1,6 +1,167 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
## [v27.28.0] - 2025-10-21
|
|
5
|
+
### :boom: BREAKING CHANGES
|
|
6
|
+
- due to [`2238ac2`](https://github.com/tobymao/sqlglot/commit/2238ac27478bd272ba39928bbec1075c4191ee1b) - transpile timestamp literals in datediff fixes [#6083](https://github.com/tobymao/sqlglot/pull/6083) *(PR [#6086](https://github.com/tobymao/sqlglot/pull/6086) by [@georgesittas](https://github.com/georgesittas))*:
|
|
7
|
+
|
|
8
|
+
transpile timestamp literals in datediff fixes #6083 (#6086)
|
|
9
|
+
|
|
10
|
+
- due to [`c49ba0e`](https://github.com/tobymao/sqlglot/commit/c49ba0eee21f7776703d2a26c6641b4a32a1cff7) - Annotate type for snowflake WIDTH_BUCKET function *(PR [#6078](https://github.com/tobymao/sqlglot/pull/6078) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
11
|
+
|
|
12
|
+
Annotate type for snowflake WIDTH_BUCKET function (#6078)
|
|
13
|
+
|
|
14
|
+
- due to [`fbc1f13`](https://github.com/tobymao/sqlglot/commit/fbc1f1335eecaaaab4fc93ddbb74611a4df0aea7) - annotate type for Snowflake CONVERT_TIMEZONE function *(PR [#6076](https://github.com/tobymao/sqlglot/pull/6076) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
|
|
15
|
+
|
|
16
|
+
annotate type for Snowflake CONVERT_TIMEZONE function (#6076)
|
|
17
|
+
|
|
18
|
+
- due to [`70e977c`](https://github.com/tobymao/sqlglot/commit/70e977c5edfb495529d38a9096cb40762a9b5d7b) - annotate type for Snowflake DATE_TRUNC function *(PR [#6080](https://github.com/tobymao/sqlglot/pull/6080) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
|
|
19
|
+
|
|
20
|
+
annotate type for Snowflake DATE_TRUNC function (#6080)
|
|
21
|
+
|
|
22
|
+
- due to [`e9cf146`](https://github.com/tobymao/sqlglot/commit/e9cf146a4a6cd78f6a59c195e7ec12240b836e5e) - annotate type for Snowflake DATE_PART function *(PR [#6079](https://github.com/tobymao/sqlglot/pull/6079) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
|
|
23
|
+
|
|
24
|
+
annotate type for Snowflake DATE_PART function (#6079)
|
|
25
|
+
|
|
26
|
+
- due to [`5109890`](https://github.com/tobymao/sqlglot/commit/510989043d18baa17502a971262462814a2eb5be) - VALUES with ORDER BY/LIMIT/OFFSET *(PR [#6094](https://github.com/tobymao/sqlglot/pull/6094) by [@geooo109](https://github.com/geooo109))*:
|
|
27
|
+
|
|
28
|
+
VALUES with ORDER BY/LIMIT/OFFSET (#6094)
|
|
29
|
+
|
|
30
|
+
- due to [`6fe5824`](https://github.com/tobymao/sqlglot/commit/6fe58247888c326093618657fb027e482d82d107) - Annotate type for hour, minute, second functions *(PR [#6100](https://github.com/tobymao/sqlglot/pull/6100) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
31
|
+
|
|
32
|
+
Annotate type for hour, minute, second functions (#6100)
|
|
33
|
+
|
|
34
|
+
- due to [`a4d07a0`](https://github.com/tobymao/sqlglot/commit/a4d07a07eefbdaf88d30df2310a9533afdc75a82) - Annotate type for snowflake EXTRACT function *(PR [#6099](https://github.com/tobymao/sqlglot/pull/6099) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
35
|
+
|
|
36
|
+
Annotate type for snowflake EXTRACT function (#6099)
|
|
37
|
+
|
|
38
|
+
- due to [`483770b`](https://github.com/tobymao/sqlglot/commit/483770b816fab14b7eb7222974ed2c99045302a7) - Annotate type for snowflake TIME_SLICE function *(PR [#6098](https://github.com/tobymao/sqlglot/pull/6098) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
39
|
+
|
|
40
|
+
Annotate type for snowflake TIME_SLICE function (#6098)
|
|
41
|
+
|
|
42
|
+
- due to [`06f40f9`](https://github.com/tobymao/sqlglot/commit/06f40f900ce693ba4203514e422cba8cda0dbb07) - don't simplify x XOR x due to NULL semantics *(PR [#6115](https://github.com/tobymao/sqlglot/pull/6115) by [@geooo109](https://github.com/geooo109))*:
|
|
43
|
+
|
|
44
|
+
don't simplify x XOR x due to NULL semantics (#6115)
|
|
45
|
+
|
|
46
|
+
- due to [`c286cee`](https://github.com/tobymao/sqlglot/commit/c286cee54ab93e1fd0b3be658f7e767e3e00afe9) - Annotate type for snowflake MONTHNAME function *(PR [#6116](https://github.com/tobymao/sqlglot/pull/6116) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
47
|
+
|
|
48
|
+
Annotate type for snowflake MONTHNAME function (#6116)
|
|
49
|
+
|
|
50
|
+
- due to [`1a34788`](https://github.com/tobymao/sqlglot/commit/1a34788025bdd8a018c4bb9214f72152e68bdd14) - Annotate type for snowflake PREVIOUS_DAY function *(PR [#6117](https://github.com/tobymao/sqlglot/pull/6117) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
51
|
+
|
|
52
|
+
Annotate type for snowflake PREVIOUS_DAY function (#6117)
|
|
53
|
+
|
|
54
|
+
- due to [`533faf8`](https://github.com/tobymao/sqlglot/commit/533faf87b6df351070b565dd1fe9ce4e13b6c46e) - transpile duckdb `READ_PARQUET` to `parquet.<path>` closes [#6122](https://github.com/tobymao/sqlglot/pull/6122) *(commit by [@georgesittas](https://github.com/georgesittas))*:
|
|
55
|
+
|
|
56
|
+
transpile duckdb `READ_PARQUET` to `parquet.<path>` closes #6122
|
|
57
|
+
|
|
58
|
+
- due to [`cd4e557`](https://github.com/tobymao/sqlglot/commit/cd4e557658b1384f36c9a1ef9da5a09b893229b1) - Annotate type for snowflake RANDOM function *(PR [#6124](https://github.com/tobymao/sqlglot/pull/6124) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*:
|
|
59
|
+
|
|
60
|
+
Annotate type for snowflake RANDOM function (#6124)
|
|
61
|
+
|
|
62
|
+
- due to [`fe63d84`](https://github.com/tobymao/sqlglot/commit/fe63d84f1bd365b22221f348d79c0546aa3118b0) - annotate type for Snowflake MONTHS_BETWEEN function *(PR [#6120](https://github.com/tobymao/sqlglot/pull/6120) by [@fivetran-MichaelLee](https://github.com/fivetran-MichaelLee))*:
|
|
63
|
+
|
|
64
|
+
annotate type for Snowflake MONTHS_BETWEEN function (#6120)
|
|
65
|
+
|
|
66
|
+
- due to [`598d09b`](https://github.com/tobymao/sqlglot/commit/598d09b036d938c90a44955d67175ea868090ba2) - annotate type for Snowflake DATEADD function *(PR [#6089](https://github.com/tobymao/sqlglot/pull/6089) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
|
|
67
|
+
|
|
68
|
+
annotate type for Snowflake DATEADD function (#6089)
|
|
69
|
+
|
|
70
|
+
- due to [`b98bcee`](https://github.com/tobymao/sqlglot/commit/b98bcee148ba426816e166dbfa9ba8e0979aae21) - Annotate type for snowflake next_day function *(PR [#6125](https://github.com/tobymao/sqlglot/pull/6125) by [@fivetran-ashashankar](https://github.com/fivetran-ashashankar))*:
|
|
71
|
+
|
|
72
|
+
Annotate type for snowflake next_day function (#6125)
|
|
73
|
+
|
|
74
|
+
- due to [`e2129c6`](https://github.com/tobymao/sqlglot/commit/e2129c6766ca1f10ff6663bec98be984abb33c91) - Do not consider BIT_COUNT an aggregate function *(PR [#6135](https://github.com/tobymao/sqlglot/pull/6135) by [@VaggelisD](https://github.com/VaggelisD))*:
|
|
75
|
+
|
|
76
|
+
Do not consider BIT_COUNT an aggregate function (#6135)
|
|
77
|
+
|
|
78
|
+
- due to [`d136414`](https://github.com/tobymao/sqlglot/commit/d136414e520270ac9ab2fd8e9df4691d269b3af0) - avoid simplifying AND with NULL *(PR [#6148](https://github.com/tobymao/sqlglot/pull/6148) by [@geooo109](https://github.com/geooo109))*:
|
|
79
|
+
|
|
80
|
+
avoid simplifying AND with NULL (#6148)
|
|
81
|
+
|
|
82
|
+
- due to [`3a334f3`](https://github.com/tobymao/sqlglot/commit/3a334f376b9766b6b99fdf195ae763bb44976ec4) - annotate type for boolnot snowflake function *(PR [#6141](https://github.com/tobymao/sqlglot/pull/6141) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*:
|
|
83
|
+
|
|
84
|
+
annotate type for boolnot snowflake function (#6141)
|
|
85
|
+
|
|
86
|
+
- due to [`99949cc`](https://github.com/tobymao/sqlglot/commit/99949ccd3ff81b524edeae437d874b86250dbb5b) - avoid needlessly copying in lineage *(PR [#6150](https://github.com/tobymao/sqlglot/pull/6150) by [@georgesittas](https://github.com/georgesittas))*:
|
|
87
|
+
|
|
88
|
+
avoid needlessly copying in lineage (#6150)
|
|
89
|
+
|
|
90
|
+
- due to [`4e36f9d`](https://github.com/tobymao/sqlglot/commit/4e36f9dd6a854b378c9bbf6b2e9811045affc63d) - Annotate type for snowflake TIMEADD function *(PR [#6134](https://github.com/tobymao/sqlglot/pull/6134) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
91
|
+
|
|
92
|
+
Annotate type for snowflake TIMEADD function (#6134)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
### :sparkles: New Features
|
|
96
|
+
- [`c49ba0e`](https://github.com/tobymao/sqlglot/commit/c49ba0eee21f7776703d2a26c6641b4a32a1cff7) - **optimizer**: Annotate type for snowflake WIDTH_BUCKET function *(PR [#6078](https://github.com/tobymao/sqlglot/pull/6078) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
97
|
+
- [`fbc1f13`](https://github.com/tobymao/sqlglot/commit/fbc1f1335eecaaaab4fc93ddbb74611a4df0aea7) - **optimizer**: annotate type for Snowflake CONVERT_TIMEZONE function *(PR [#6076](https://github.com/tobymao/sqlglot/pull/6076) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
|
|
98
|
+
- [`70e977c`](https://github.com/tobymao/sqlglot/commit/70e977c5edfb495529d38a9096cb40762a9b5d7b) - **optimizer**: annotate type for Snowflake DATE_TRUNC function *(PR [#6080](https://github.com/tobymao/sqlglot/pull/6080) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
|
|
99
|
+
- [`e9cf146`](https://github.com/tobymao/sqlglot/commit/e9cf146a4a6cd78f6a59c195e7ec12240b836e5e) - **optimizer**: annotate type for Snowflake DATE_PART function *(PR [#6079](https://github.com/tobymao/sqlglot/pull/6079) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
|
|
100
|
+
- [`cdf3b1b`](https://github.com/tobymao/sqlglot/commit/cdf3b1b34dc044064d0a5ba7ff22723b8ae33e5d) - **optimizer**: Annotate type for snowflake add_months function *(PR [#6097](https://github.com/tobymao/sqlglot/pull/6097) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
101
|
+
- [`6fe5824`](https://github.com/tobymao/sqlglot/commit/6fe58247888c326093618657fb027e482d82d107) - **optimizer**: Annotate type for hour, minute, second functions *(PR [#6100](https://github.com/tobymao/sqlglot/pull/6100) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
102
|
+
- [`483770b`](https://github.com/tobymao/sqlglot/commit/483770b816fab14b7eb7222974ed2c99045302a7) - **optimizer**: Annotate type for snowflake TIME_SLICE function *(PR [#6098](https://github.com/tobymao/sqlglot/pull/6098) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
103
|
+
- [`071a995`](https://github.com/tobymao/sqlglot/commit/071a9954aad220c1e13ba7a6714a083058a8e03f) - **tsql**: add support for iso_week on DATEPART *(PR [#6111](https://github.com/tobymao/sqlglot/pull/6111) by [@lBilali](https://github.com/lBilali))*
|
|
104
|
+
- :arrow_lower_right: *addresses issue [#6110](https://github.com/tobymao/sqlglot/issues/6110) opened by [@lBilali](https://github.com/lBilali)*
|
|
105
|
+
- [`c286cee`](https://github.com/tobymao/sqlglot/commit/c286cee54ab93e1fd0b3be658f7e767e3e00afe9) - **optimizer**: Annotate type for snowflake MONTHNAME function *(PR [#6116](https://github.com/tobymao/sqlglot/pull/6116) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
106
|
+
- [`1a34788`](https://github.com/tobymao/sqlglot/commit/1a34788025bdd8a018c4bb9214f72152e68bdd14) - **optimizer**: Annotate type for snowflake PREVIOUS_DAY function *(PR [#6117](https://github.com/tobymao/sqlglot/pull/6117) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
107
|
+
- [`533faf8`](https://github.com/tobymao/sqlglot/commit/533faf87b6df351070b565dd1fe9ce4e13b6c46e) - **spark**: transpile duckdb `READ_PARQUET` to `parquet.<path>` closes [#6122](https://github.com/tobymao/sqlglot/pull/6122) *(commit by [@georgesittas](https://github.com/georgesittas))*
|
|
108
|
+
- [`cd4e557`](https://github.com/tobymao/sqlglot/commit/cd4e557658b1384f36c9a1ef9da5a09b893229b1) - **optimizer**: Annotate type for snowflake RANDOM function *(PR [#6124](https://github.com/tobymao/sqlglot/pull/6124) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
|
|
109
|
+
- [`fe63d84`](https://github.com/tobymao/sqlglot/commit/fe63d84f1bd365b22221f348d79c0546aa3118b0) - **optimizer**: annotate type for Snowflake MONTHS_BETWEEN function *(PR [#6120](https://github.com/tobymao/sqlglot/pull/6120) by [@fivetran-MichaelLee](https://github.com/fivetran-MichaelLee))*
|
|
110
|
+
- [`7cb7598`](https://github.com/tobymao/sqlglot/commit/7cb7598e13260aa45c851dc620b4994ddfa089fe) - **optimizer**: Annotate type for snowflake TIME_FROM_PARTS function *(PR [#6119](https://github.com/tobymao/sqlglot/pull/6119) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
111
|
+
- [`598d09b`](https://github.com/tobymao/sqlglot/commit/598d09b036d938c90a44955d67175ea868090ba2) - **optimizer**: annotate type for Snowflake DATEADD function *(PR [#6089](https://github.com/tobymao/sqlglot/pull/6089) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
|
|
112
|
+
- [`b98bcee`](https://github.com/tobymao/sqlglot/commit/b98bcee148ba426816e166dbfa9ba8e0979aae21) - **optimizer**: Annotate type for snowflake next_day function *(PR [#6125](https://github.com/tobymao/sqlglot/pull/6125) by [@fivetran-ashashankar](https://github.com/fivetran-ashashankar))*
|
|
113
|
+
- [`fe1927f`](https://github.com/tobymao/sqlglot/commit/fe1927f28600e2d8863a4e7f06e6a21bf6ff7f9c) - **duckdb**: Transpile unix_micros to epoch_us *(PR [#6127](https://github.com/tobymao/sqlglot/pull/6127) by [@vchan](https://github.com/vchan))*
|
|
114
|
+
- [`a531f10`](https://github.com/tobymao/sqlglot/commit/a531f107235c29ac6a7e627a323f00b8ecf7023d) - **duckdb**: transpile TimeSub *(PR [#6142](https://github.com/tobymao/sqlglot/pull/6142) by [@toriwei](https://github.com/toriwei))*
|
|
115
|
+
- [`b1a9dff`](https://github.com/tobymao/sqlglot/commit/b1a9dfff52a0ffbb0b7c8bfedb0a90e245b97851) - make qualify faster by owly resetting scope when needed *(PR [#6081](https://github.com/tobymao/sqlglot/pull/6081) by [@tobymao](https://github.com/tobymao))*
|
|
116
|
+
- [`3a334f3`](https://github.com/tobymao/sqlglot/commit/3a334f376b9766b6b99fdf195ae763bb44976ec4) - **optimizer**: annotate type for boolnot snowflake function *(PR [#6141](https://github.com/tobymao/sqlglot/pull/6141) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
|
|
117
|
+
- [`4e36f9d`](https://github.com/tobymao/sqlglot/commit/4e36f9dd6a854b378c9bbf6b2e9811045affc63d) - **optimizer**: Annotate type for snowflake TIMEADD function *(PR [#6134](https://github.com/tobymao/sqlglot/pull/6134) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
118
|
+
|
|
119
|
+
### :bug: Bug Fixes
|
|
120
|
+
- [`2238ac2`](https://github.com/tobymao/sqlglot/commit/2238ac27478bd272ba39928bbec1075c4191ee1b) - **duckdb**: transpile timestamp literals in datediff fixes [#6083](https://github.com/tobymao/sqlglot/pull/6083) *(PR [#6086](https://github.com/tobymao/sqlglot/pull/6086) by [@georgesittas](https://github.com/georgesittas))*
|
|
121
|
+
- [`bef541c`](https://github.com/tobymao/sqlglot/commit/bef541cec36f8c4295f815c3f5cd22491738901b) - **parser**: query mods and set ops in FROM-first syntax *(PR [#6092](https://github.com/tobymao/sqlglot/pull/6092) by [@geooo109](https://github.com/geooo109))*
|
|
122
|
+
- :arrow_lower_right: *fixes issue [#6088](https://github.com/tobymao/sqlglot/issues/6088) opened by [@denis-komarov](https://github.com/denis-komarov)*
|
|
123
|
+
- :arrow_lower_right: *fixes issue [#6091](https://github.com/tobymao/sqlglot/issues/6091) opened by [@denis-komarov](https://github.com/denis-komarov)*
|
|
124
|
+
- :arrow_lower_right: *fixes issue [#6093](https://github.com/tobymao/sqlglot/issues/6093) opened by [@denis-komarov](https://github.com/denis-komarov)*
|
|
125
|
+
- [`5109890`](https://github.com/tobymao/sqlglot/commit/510989043d18baa17502a971262462814a2eb5be) - **parser**: VALUES with ORDER BY/LIMIT/OFFSET *(PR [#6094](https://github.com/tobymao/sqlglot/pull/6094) by [@geooo109](https://github.com/geooo109))*
|
|
126
|
+
- :arrow_lower_right: *fixes issue [#6087](https://github.com/tobymao/sqlglot/issues/6087) opened by [@denis-komarov](https://github.com/denis-komarov)*
|
|
127
|
+
- [`4b062c8`](https://github.com/tobymao/sqlglot/commit/4b062c850bd9867be0d622f3f526762fa2b72302) - consume more syntax for cubes/rollups fixes [#6101](https://github.com/tobymao/sqlglot/pull/6101) *(commit by [@georgesittas](https://github.com/georgesittas))*
|
|
128
|
+
- [`f00866a`](https://github.com/tobymao/sqlglot/commit/f00866aeb8b7f51e27173c688225fe16d777eb1a) - **duckdb**: 1 arg FORMAT func *(PR [#6109](https://github.com/tobymao/sqlglot/pull/6109) by [@geooo109](https://github.com/geooo109))*
|
|
129
|
+
- :arrow_lower_right: *fixes issue [#6108](https://github.com/tobymao/sqlglot/issues/6108) opened by [@erindru](https://github.com/erindru)*
|
|
130
|
+
- [`77dfd5a`](https://github.com/tobymao/sqlglot/commit/77dfd5a41bb9ce5450e0f6b7a78c953c8ade14d5) - lineage does not modify sql input if expression *(PR [#6113](https://github.com/tobymao/sqlglot/pull/6113) by [@snovik75](https://github.com/snovik75))*
|
|
131
|
+
- :arrow_lower_right: *fixes issue [#6112](https://github.com/tobymao/sqlglot/issues/6112) opened by [@snovik75](https://github.com/snovik75)*
|
|
132
|
+
- [`06f40f9`](https://github.com/tobymao/sqlglot/commit/06f40f900ce693ba4203514e422cba8cda0dbb07) - **optimizer**: don't simplify x XOR x due to NULL semantics *(PR [#6115](https://github.com/tobymao/sqlglot/pull/6115) by [@geooo109](https://github.com/geooo109))*
|
|
133
|
+
- :arrow_lower_right: *fixes issue [#6104](https://github.com/tobymao/sqlglot/issues/6104) opened by [@dllggyx](https://github.com/dllggyx)*
|
|
134
|
+
- [`03e2dff`](https://github.com/tobymao/sqlglot/commit/03e2dff9b074dc228cf3854ff1f4357e091aa9b3) - allow parsing `analyze` as an identifier fixes [#6123](https://github.com/tobymao/sqlglot/pull/6123) *(commit by [@georgesittas](https://github.com/georgesittas))*
|
|
135
|
+
- [`8744431`](https://github.com/tobymao/sqlglot/commit/874443148c8ec2a773dfaca5da10d3587a49de3e) - transpile bigquery DATETIME_DIFF to duckdb *(PR [#6126](https://github.com/tobymao/sqlglot/pull/6126) by [@toriwei](https://github.com/toriwei))*
|
|
136
|
+
- :arrow_lower_right: *fixes issue [#6107](https://github.com/tobymao/sqlglot/issues/6107) opened by [@izeigerman](https://github.com/izeigerman)*
|
|
137
|
+
- [`b94e81b`](https://github.com/tobymao/sqlglot/commit/b94e81b42b89c75625b2da779c0f53777d9b6b48) - **optimizer**: avoid removing string literals from WHERE clause *(PR [#6131](https://github.com/tobymao/sqlglot/pull/6131) by [@geooo109](https://github.com/geooo109))*
|
|
138
|
+
- :arrow_lower_right: *fixes issue [#6128](https://github.com/tobymao/sqlglot/issues/6128) opened by [@dllggyx](https://github.com/dllggyx)*
|
|
139
|
+
- [`e2129c6`](https://github.com/tobymao/sqlglot/commit/e2129c6766ca1f10ff6663bec98be984abb33c91) - **optimizer**: Do not consider BIT_COUNT an aggregate function *(PR [#6135](https://github.com/tobymao/sqlglot/pull/6135) by [@VaggelisD](https://github.com/VaggelisD))*
|
|
140
|
+
- :arrow_lower_right: *fixes issue [#6130](https://github.com/tobymao/sqlglot/issues/6130) opened by [@dllggyx](https://github.com/dllggyx)*
|
|
141
|
+
- [`03bfeed`](https://github.com/tobymao/sqlglot/commit/03bfeed56c5c2f143ce2e1be38d519f902d19961) - **starrocks**: disable IS TRUE/FALSE syntax support *(PR [#6145](https://github.com/tobymao/sqlglot/pull/6145) by [@petrikoro](https://github.com/petrikoro))*
|
|
142
|
+
- :arrow_lower_right: *fixes issue [#6144](https://github.com/tobymao/sqlglot/issues/6144) opened by [@petrikoro](https://github.com/petrikoro)*
|
|
143
|
+
- [`d136414`](https://github.com/tobymao/sqlglot/commit/d136414e520270ac9ab2fd8e9df4691d269b3af0) - **optimizer**: avoid simplifying AND with NULL *(PR [#6148](https://github.com/tobymao/sqlglot/pull/6148) by [@geooo109](https://github.com/geooo109))*
|
|
144
|
+
- :arrow_lower_right: *fixes issue [#6136](https://github.com/tobymao/sqlglot/issues/6136) opened by [@dllggyx](https://github.com/dllggyx)*
|
|
145
|
+
- [`1fd9991`](https://github.com/tobymao/sqlglot/commit/1fd99911a60f0543fbc79221a8c6a6f232ed0a2a) - **clickhouse**: NOT + IN precedence *(PR [#6149](https://github.com/tobymao/sqlglot/pull/6149) by [@georgesittas](https://github.com/georgesittas))*
|
|
146
|
+
- :arrow_lower_right: *fixes issue [#6143](https://github.com/tobymao/sqlglot/issues/6143) opened by [@mlipiev](https://github.com/mlipiev)*
|
|
147
|
+
|
|
148
|
+
### :recycle: Refactors
|
|
149
|
+
- [`58dbce3`](https://github.com/tobymao/sqlglot/commit/58dbce30da5ab94af82247ab8a7eb85200d9b8af) - bq static type annotators *(PR [#6103](https://github.com/tobymao/sqlglot/pull/6103) by [@geooo109](https://github.com/geooo109))*
|
|
150
|
+
- [`c970235`](https://github.com/tobymao/sqlglot/commit/c97023549623fe5974d6bff57e64339eff74187e) - clean up MONTHNAME test *(commit by [@geooo109](https://github.com/geooo109))*
|
|
151
|
+
|
|
152
|
+
### :wrench: Chores
|
|
153
|
+
- [`d36ba87`](https://github.com/tobymao/sqlglot/commit/d36ba8774a2a4b53c122e3b78086ce0f09e77244) - **optimizer**: add tests for Snowflake DATE_FROM_PARTS function *(PR [#6077](https://github.com/tobymao/sqlglot/pull/6077) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
|
|
154
|
+
- [`2bc05cf`](https://github.com/tobymao/sqlglot/commit/2bc05cf3bd53b874a1505c747e38f8a6a1dbf8c7) - **optimizer**: add tests for Snowflake DATEDIFF function *(PR [#6090](https://github.com/tobymao/sqlglot/pull/6090) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
|
|
155
|
+
- [`a4d07a0`](https://github.com/tobymao/sqlglot/commit/a4d07a07eefbdaf88d30df2310a9533afdc75a82) - **optimizer**: Annotate type for snowflake EXTRACT function *(PR [#6099](https://github.com/tobymao/sqlglot/pull/6099) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
156
|
+
- [`ab1da2e`](https://github.com/tobymao/sqlglot/commit/ab1da2e54a83e29d708047d4b3f8abcc1094229d) - **optimizer**: add type annotation tests for snowflake LAST_DAY function *(PR [#6105](https://github.com/tobymao/sqlglot/pull/6105) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
157
|
+
- [`4e24c0a`](https://github.com/tobymao/sqlglot/commit/4e24c0ad92e7071a1f1537886173e29999b46f72) - **optimizer**: add type annotation tests for snowflake TIMESTAMPDIFF function *(PR [#6138](https://github.com/tobymao/sqlglot/pull/6138) by [@fivetran-MichaelLee](https://github.com/fivetran-MichaelLee))*
|
|
158
|
+
- [`ae8571f`](https://github.com/tobymao/sqlglot/commit/ae8571fdec71587188e45fe087e1967f5ba641bc) - **optimizer**: add type annotation tests for snowflake TIMEDIFF *(PR [#6140](https://github.com/tobymao/sqlglot/pull/6140) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
|
|
159
|
+
- [`3059320`](https://github.com/tobymao/sqlglot/commit/30593202b30001933f05747937975013754b75fa) - copy by default in `lineage` *(commit by [@georgesittas](https://github.com/georgesittas))*
|
|
160
|
+
- [`99949cc`](https://github.com/tobymao/sqlglot/commit/99949ccd3ff81b524edeae437d874b86250dbb5b) - avoid needlessly copying in lineage *(PR [#6150](https://github.com/tobymao/sqlglot/pull/6150) by [@georgesittas](https://github.com/georgesittas))*
|
|
161
|
+
- [`e7756d8`](https://github.com/tobymao/sqlglot/commit/e7756d8e9f347bfba3f861463890bf57e532cc54) - **optimizer**: add annotation tests for snowflake's BOOLXOR *(PR [#6154](https://github.com/tobymao/sqlglot/pull/6154) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
|
|
162
|
+
- [`72e43e3`](https://github.com/tobymao/sqlglot/commit/72e43e3ea08f9dce5a32654060a56f2ee31bea8f) - **optimizer**: add type annotation tests for snowflake's TIMESTAMPADD function *(PR [#6146](https://github.com/tobymao/sqlglot/pull/6146) by [@fivetran-ashashankar](https://github.com/fivetran-ashashankar))*
|
|
163
|
+
|
|
164
|
+
|
|
4
165
|
## [v27.27.0] - 2025-10-13
|
|
5
166
|
### :boom: BREAKING CHANGES
|
|
6
167
|
- due to [`c67276d`](https://github.com/tobymao/sqlglot/commit/c67276d5be970252e14d1817d8498fc9985222d9) - Annotate type for snowflake RADIANS function. *(PR [#6064](https://github.com/tobymao/sqlglot/pull/6064) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
@@ -7885,3 +8046,4 @@ Changelog
|
|
|
7885
8046
|
[v27.25.0]: https://github.com/tobymao/sqlglot/compare/v27.24.2...v27.25.0
|
|
7886
8047
|
[v27.26.0]: https://github.com/tobymao/sqlglot/compare/v27.25.2...v27.26.0
|
|
7887
8048
|
[v27.27.0]: https://github.com/tobymao/sqlglot/compare/v27.26.0...v27.27.0
|
|
8049
|
+
[v27.28.0]: https://github.com/tobymao/sqlglot/compare/v27.27.0...v27.28.0
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '27.
|
|
32
|
-
__version_tuple__ = version_tuple = (27,
|
|
31
|
+
__version__ = version = '27.29.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (27, 29, 0)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g7f550f22d'
|
|
@@ -44,9 +44,11 @@ DATETIME_DELTA = t.Union[
|
|
|
44
44
|
exp.DatetimeSub,
|
|
45
45
|
exp.TimeAdd,
|
|
46
46
|
exp.TimeSub,
|
|
47
|
+
exp.TimestampAdd,
|
|
47
48
|
exp.TimestampSub,
|
|
48
49
|
exp.TsOrDsAdd,
|
|
49
50
|
]
|
|
51
|
+
DATETIME_ADD = (exp.DateAdd, exp.TimeAdd, exp.DatetimeAdd, exp.TsOrDsAdd, exp.TimestampAdd)
|
|
50
52
|
|
|
51
53
|
if t.TYPE_CHECKING:
|
|
52
54
|
from sqlglot._typing import B, E, F
|
|
@@ -539,6 +541,10 @@ class Dialect(metaclass=_Dialect):
|
|
|
539
541
|
# STRING type (Snowflake's case) or can be of any type
|
|
540
542
|
TRY_CAST_REQUIRES_STRING: t.Optional[bool] = None
|
|
541
543
|
|
|
544
|
+
# Whether the double negation can be applied
|
|
545
|
+
# Not safe with MySQL and SQLite due to type coercion (may not return boolean)
|
|
546
|
+
SAFE_TO_ELIMINATE_DOUBLE_NEGATION = True
|
|
547
|
+
|
|
542
548
|
# --- Autofilled ---
|
|
543
549
|
|
|
544
550
|
tokenizer_class = Tokenizer
|
|
@@ -765,8 +771,12 @@ class Dialect(metaclass=_Dialect):
|
|
|
765
771
|
exp.TimeAdd,
|
|
766
772
|
exp.TimeSub,
|
|
767
773
|
},
|
|
774
|
+
exp.DataType.Type.TIMESTAMPLTZ: {
|
|
775
|
+
exp.TimestampLtzFromParts,
|
|
776
|
+
},
|
|
768
777
|
exp.DataType.Type.TIMESTAMPTZ: {
|
|
769
778
|
exp.CurrentTimestampLTZ,
|
|
779
|
+
exp.TimestampTzFromParts,
|
|
770
780
|
},
|
|
771
781
|
exp.DataType.Type.TIMESTAMP: {
|
|
772
782
|
exp.CurrentTimestamp,
|
|
@@ -778,10 +788,17 @@ class Dialect(metaclass=_Dialect):
|
|
|
778
788
|
},
|
|
779
789
|
exp.DataType.Type.TINYINT: {
|
|
780
790
|
exp.Day,
|
|
781
|
-
exp.
|
|
791
|
+
exp.DayOfWeek,
|
|
792
|
+
exp.DayOfWeekIso,
|
|
793
|
+
exp.DayOfMonth,
|
|
794
|
+
exp.DayOfYear,
|
|
782
795
|
exp.Week,
|
|
783
|
-
exp.
|
|
796
|
+
exp.WeekOfYear,
|
|
797
|
+
exp.Month,
|
|
784
798
|
exp.Quarter,
|
|
799
|
+
exp.Year,
|
|
800
|
+
exp.YearOfWeek,
|
|
801
|
+
exp.YearOfWeekIso,
|
|
785
802
|
},
|
|
786
803
|
exp.DataType.Type.VARCHAR: {
|
|
787
804
|
exp.ArrayConcat,
|
|
@@ -1682,11 +1699,7 @@ def date_delta_to_binary_interval_op(
|
|
|
1682
1699
|
def date_delta_to_binary_interval_op_sql(self: Generator, expression: DATETIME_DELTA) -> str:
|
|
1683
1700
|
this = expression.this
|
|
1684
1701
|
unit = unit_to_var(expression)
|
|
1685
|
-
op = (
|
|
1686
|
-
"+"
|
|
1687
|
-
if isinstance(expression, (exp.DateAdd, exp.TimeAdd, exp.DatetimeAdd, exp.TsOrDsAdd))
|
|
1688
|
-
else "-"
|
|
1689
|
-
)
|
|
1702
|
+
op = "+" if isinstance(expression, DATETIME_ADD) else "-"
|
|
1690
1703
|
|
|
1691
1704
|
to_type: t.Optional[exp.DATA_TYPE] = None
|
|
1692
1705
|
if cast:
|
|
@@ -1965,6 +1978,15 @@ def sequence_sql(self: Generator, expression: exp.GenerateSeries | exp.GenerateD
|
|
|
1965
1978
|
return self.func("SEQUENCE", start, end, step)
|
|
1966
1979
|
|
|
1967
1980
|
|
|
1981
|
+
def build_like(expr_type: t.Type[E]) -> t.Callable[[t.List], E | exp.Escape]:
|
|
1982
|
+
def _builder(args: t.List) -> E | exp.Escape:
|
|
1983
|
+
like_expr = expr_type(this=seq_get(args, 0), expression=seq_get(args, 1))
|
|
1984
|
+
escape = seq_get(args, 2)
|
|
1985
|
+
return exp.Escape(this=like_expr, expression=escape) if escape else like_expr
|
|
1986
|
+
|
|
1987
|
+
return _builder
|
|
1988
|
+
|
|
1989
|
+
|
|
1968
1990
|
def build_regexp_extract(expr_type: t.Type[E]) -> t.Callable[[t.List, Dialect], E]:
|
|
1969
1991
|
def _builder(args: t.List, dialect: Dialect) -> E:
|
|
1970
1992
|
return expr_type(
|
|
@@ -2075,3 +2097,19 @@ def build_replace_with_optional_replacement(args: t.List) -> exp.Replace:
|
|
|
2075
2097
|
expression=seq_get(args, 1),
|
|
2076
2098
|
replacement=seq_get(args, 2) or exp.Literal.string(""),
|
|
2077
2099
|
)
|
|
2100
|
+
|
|
2101
|
+
|
|
2102
|
+
def regexp_replace_global_modifier(expression: exp.RegexpReplace) -> exp.Expression | None:
|
|
2103
|
+
modifiers = expression.args.get("modifiers")
|
|
2104
|
+
single_replace = expression.args.get("single_replace")
|
|
2105
|
+
occurrence = expression.args.get("occurrence")
|
|
2106
|
+
|
|
2107
|
+
if not single_replace and (not occurrence or (occurrence.is_int and occurrence.to_py() == 0)):
|
|
2108
|
+
if not modifiers or modifiers.is_string:
|
|
2109
|
+
# Append 'g' to the modifiers if they are not provided since
|
|
2110
|
+
# the semantics of REGEXP_REPLACE from the input dialect
|
|
2111
|
+
# is to replace all occurrences of the pattern.
|
|
2112
|
+
value = "" if not modifiers else modifiers.name
|
|
2113
|
+
modifiers = exp.Literal.string(value + "g")
|
|
2114
|
+
|
|
2115
|
+
return modifiers
|
|
@@ -39,6 +39,7 @@ from sqlglot.dialects.dialect import (
|
|
|
39
39
|
explode_to_unnest_sql,
|
|
40
40
|
no_make_interval_sql,
|
|
41
41
|
groupconcat_sql,
|
|
42
|
+
regexp_replace_global_modifier,
|
|
42
43
|
)
|
|
43
44
|
from sqlglot.generator import unsupported_args
|
|
44
45
|
from sqlglot.helper import seq_get
|
|
@@ -414,6 +415,7 @@ class DuckDB(Dialect):
|
|
|
414
415
|
"LIST_SORT": exp.SortArray.from_arg_list,
|
|
415
416
|
"LIST_TRANSFORM": exp.Transform.from_arg_list,
|
|
416
417
|
"LIST_VALUE": lambda args: exp.Array(expressions=args),
|
|
418
|
+
"MAKE_DATE": exp.DateFromParts.from_arg_list,
|
|
417
419
|
"MAKE_TIME": exp.TimeFromParts.from_arg_list,
|
|
418
420
|
"MAKE_TIMESTAMP": _build_make_timestamp,
|
|
419
421
|
"QUANTILE_CONT": exp.PercentileCont.from_arg_list,
|
|
@@ -427,6 +429,7 @@ class DuckDB(Dialect):
|
|
|
427
429
|
expression=seq_get(args, 1),
|
|
428
430
|
replacement=seq_get(args, 2),
|
|
429
431
|
modifiers=seq_get(args, 3),
|
|
432
|
+
single_replace=True,
|
|
430
433
|
),
|
|
431
434
|
"SHA256": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(256)),
|
|
432
435
|
"STRFTIME": build_formatted_time(exp.TimeToStr, "duckdb"),
|
|
@@ -695,7 +698,6 @@ class DuckDB(Dialect):
|
|
|
695
698
|
exp.BitwiseXorAgg: rename_func("BIT_XOR"),
|
|
696
699
|
exp.CommentColumnConstraint: no_comment_column_constraint_sql,
|
|
697
700
|
exp.CosineDistance: rename_func("LIST_COSINE_DISTANCE"),
|
|
698
|
-
exp.CurrentDate: lambda *_: "CURRENT_DATE",
|
|
699
701
|
exp.CurrentTime: lambda *_: "CURRENT_TIME",
|
|
700
702
|
exp.CurrentTimestamp: lambda *_: "CURRENT_TIMESTAMP",
|
|
701
703
|
exp.DayOfMonth: rename_func("DAYOFMONTH"),
|
|
@@ -754,7 +756,7 @@ class DuckDB(Dialect):
|
|
|
754
756
|
e.this,
|
|
755
757
|
e.expression,
|
|
756
758
|
e.args.get("replacement"),
|
|
757
|
-
e
|
|
759
|
+
regexp_replace_global_modifier(e),
|
|
758
760
|
),
|
|
759
761
|
exp.RegexpLike: rename_func("REGEXP_MATCHES"),
|
|
760
762
|
exp.RegexpILike: lambda self, e: self.func(
|
|
@@ -779,9 +781,11 @@ class DuckDB(Dialect):
|
|
|
779
781
|
exp.Time: no_time_sql,
|
|
780
782
|
exp.TimeDiff: _timediff_sql,
|
|
781
783
|
exp.Timestamp: no_timestamp_sql,
|
|
784
|
+
exp.TimestampAdd: date_delta_to_binary_interval_op(),
|
|
782
785
|
exp.TimestampDiff: lambda self, e: self.func(
|
|
783
786
|
"DATE_DIFF", exp.Literal.string(e.unit), e.expression, e.this
|
|
784
787
|
),
|
|
788
|
+
exp.TimestampSub: date_delta_to_binary_interval_op(),
|
|
785
789
|
exp.TimestampTrunc: timestamptrunc_sql(),
|
|
786
790
|
exp.TimeStrToDate: lambda self, e: self.sql(exp.cast(e.this, exp.DataType.Type.DATE)),
|
|
787
791
|
exp.TimeStrToTime: timestrtotime_sql,
|
|
@@ -799,7 +803,7 @@ class DuckDB(Dialect):
|
|
|
799
803
|
exp.cast(e.expression, exp.DataType.Type.TIMESTAMP),
|
|
800
804
|
exp.cast(e.this, exp.DataType.Type.TIMESTAMP),
|
|
801
805
|
),
|
|
802
|
-
exp.UnixMicros:
|
|
806
|
+
exp.UnixMicros: lambda self, e: self.func("EPOCH_US", _implicit_datetime_cast(e.this)),
|
|
803
807
|
exp.UnixToStr: lambda self, e: self.func(
|
|
804
808
|
"STRFTIME", self.func("TO_TIMESTAMP", e.this), self.format_time(e)
|
|
805
809
|
),
|
|
@@ -989,6 +993,16 @@ class DuckDB(Dialect):
|
|
|
989
993
|
return f"CAST({self.func('TRY_STRPTIME', expression.this, formatted_time)} AS DATE)"
|
|
990
994
|
return f"CAST({str_to_time_sql(self, expression)} AS DATE)"
|
|
991
995
|
|
|
996
|
+
def currentdate_sql(self, expression: exp.CurrentDate) -> str:
|
|
997
|
+
if not expression.this:
|
|
998
|
+
return "CURRENT_DATE"
|
|
999
|
+
|
|
1000
|
+
expr = exp.Cast(
|
|
1001
|
+
this=exp.AtTimeZone(this=exp.CurrentTimestamp(), zone=expression.this),
|
|
1002
|
+
to=exp.DataType(this=exp.DataType.Type.DATE),
|
|
1003
|
+
)
|
|
1004
|
+
return self.sql(expr)
|
|
1005
|
+
|
|
992
1006
|
def parsejson_sql(self, expression: exp.ParseJSON) -> str:
|
|
993
1007
|
arg = expression.this
|
|
994
1008
|
if expression.args.get("safe"):
|
|
@@ -163,6 +163,7 @@ class MySQL(Dialect):
|
|
|
163
163
|
SUPPORTS_USER_DEFINED_TYPES = False
|
|
164
164
|
SUPPORTS_SEMI_ANTI_JOIN = False
|
|
165
165
|
SAFE_DIVISION = True
|
|
166
|
+
SAFE_TO_ELIMINATE_DOUBLE_NEGATION = False
|
|
166
167
|
|
|
167
168
|
# https://prestodb.io/docs/current/functions/datetime.html#mysql-date-functions
|
|
168
169
|
TIME_MAPPING = {
|
|
@@ -37,6 +37,7 @@ from sqlglot.dialects.dialect import (
|
|
|
37
37
|
count_if_to_sum,
|
|
38
38
|
groupconcat_sql,
|
|
39
39
|
Version,
|
|
40
|
+
regexp_replace_global_modifier,
|
|
40
41
|
)
|
|
41
42
|
from sqlglot.generator import unsupported_args
|
|
42
43
|
from sqlglot.helper import is_int, seq_get
|
|
@@ -203,6 +204,7 @@ def _build_regexp_replace(args: t.List, dialect: DialectType = None) -> exp.Rege
|
|
|
203
204
|
# Any one of `start`, `N` and `flags` can be column references, meaning that
|
|
204
205
|
# unless we can statically see that the last argument is a non-integer string
|
|
205
206
|
# (eg. not '0'), then it's not possible to construct the correct AST
|
|
207
|
+
regexp_replace = None
|
|
206
208
|
if len(args) > 3:
|
|
207
209
|
last = args[-1]
|
|
208
210
|
if not is_int(last.name):
|
|
@@ -214,9 +216,10 @@ def _build_regexp_replace(args: t.List, dialect: DialectType = None) -> exp.Rege
|
|
|
214
216
|
if last.is_type(*exp.DataType.TEXT_TYPES):
|
|
215
217
|
regexp_replace = exp.RegexpReplace.from_arg_list(args[:-1])
|
|
216
218
|
regexp_replace.set("modifiers", last)
|
|
217
|
-
return regexp_replace
|
|
218
219
|
|
|
219
|
-
|
|
220
|
+
regexp_replace = regexp_replace or exp.RegexpReplace.from_arg_list(args)
|
|
221
|
+
regexp_replace.set("single_replace", True)
|
|
222
|
+
return regexp_replace
|
|
220
223
|
|
|
221
224
|
|
|
222
225
|
def _unix_to_time_sql(self: Postgres.Generator, expression: exp.UnixToTime) -> str:
|
|
@@ -651,6 +654,15 @@ class Postgres(Dialect):
|
|
|
651
654
|
exp.Rand: rename_func("RANDOM"),
|
|
652
655
|
exp.RegexpLike: lambda self, e: self.binary(e, "~"),
|
|
653
656
|
exp.RegexpILike: lambda self, e: self.binary(e, "~*"),
|
|
657
|
+
exp.RegexpReplace: lambda self, e: self.func(
|
|
658
|
+
"REGEXP_REPLACE",
|
|
659
|
+
e.this,
|
|
660
|
+
e.expression,
|
|
661
|
+
e.args.get("replacement"),
|
|
662
|
+
e.args.get("position"),
|
|
663
|
+
e.args.get("occurrence"),
|
|
664
|
+
regexp_replace_global_modifier(e),
|
|
665
|
+
),
|
|
654
666
|
exp.Select: transforms.preprocess(
|
|
655
667
|
[
|
|
656
668
|
transforms.eliminate_semi_and_anti_joins,
|
|
@@ -8,10 +8,10 @@ from sqlglot.dialects.dialect import (
|
|
|
8
8
|
NormalizationStrategy,
|
|
9
9
|
annotate_with_type_lambda,
|
|
10
10
|
build_timetostr_or_tochar,
|
|
11
|
+
build_like,
|
|
11
12
|
binary_from_function,
|
|
12
13
|
build_default_decimal_type,
|
|
13
14
|
build_replace_with_optional_replacement,
|
|
14
|
-
build_timestamp_from_parts,
|
|
15
15
|
date_delta_sql,
|
|
16
16
|
date_trunc_to_time,
|
|
17
17
|
datestrtodate_sql,
|
|
@@ -362,15 +362,6 @@ def _build_regexp_extract(expr_type: t.Type[E]) -> t.Callable[[t.List], E]:
|
|
|
362
362
|
return _builder
|
|
363
363
|
|
|
364
364
|
|
|
365
|
-
def _build_like(expr_type: t.Type[E]) -> t.Callable[[t.List], E | exp.Escape]:
|
|
366
|
-
def _builder(args: t.List) -> E | exp.Escape:
|
|
367
|
-
like_expr = expr_type(this=args[0], expression=args[1])
|
|
368
|
-
escape = seq_get(args, 2)
|
|
369
|
-
return exp.Escape(this=like_expr, expression=escape) if escape else like_expr
|
|
370
|
-
|
|
371
|
-
return _builder
|
|
372
|
-
|
|
373
|
-
|
|
374
365
|
def _regexpextract_sql(self, expression: exp.RegexpExtract | exp.RegexpExtractAll) -> str:
|
|
375
366
|
# Other dialects don't support all of the following parameters, so we need to
|
|
376
367
|
# generate default values as necessary to ensure the transpilation is correct
|
|
@@ -551,6 +542,34 @@ def _annotate_reverse(self: TypeAnnotator, expression: exp.Reverse) -> exp.Rever
|
|
|
551
542
|
return expression
|
|
552
543
|
|
|
553
544
|
|
|
545
|
+
def _annotate_timestamp_from_parts(
|
|
546
|
+
self: TypeAnnotator, expression: exp.TimestampFromParts
|
|
547
|
+
) -> exp.TimestampFromParts:
|
|
548
|
+
"""Annotate TimestampFromParts with correct type based on arguments.
|
|
549
|
+
TIMESTAMP_FROM_PARTS with time_zone -> TIMESTAMPTZ
|
|
550
|
+
TIMESTAMP_FROM_PARTS without time_zone -> TIMESTAMP (defaults to TIMESTAMP_NTZ)
|
|
551
|
+
"""
|
|
552
|
+
self._annotate_args(expression)
|
|
553
|
+
|
|
554
|
+
if expression.args.get("zone"):
|
|
555
|
+
self._set_type(expression, exp.DataType.Type.TIMESTAMPTZ)
|
|
556
|
+
else:
|
|
557
|
+
self._set_type(expression, exp.DataType.Type.TIMESTAMP)
|
|
558
|
+
|
|
559
|
+
return expression
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
def _build_timestamp_from_parts(args: t.List) -> exp.Func:
|
|
563
|
+
"""Build TimestampFromParts with support for both syntaxes:
|
|
564
|
+
1. TIMESTAMP_FROM_PARTS(year, month, day, hour, minute, second [, nanosecond] [, time_zone])
|
|
565
|
+
2. TIMESTAMP_FROM_PARTS(date_expr, time_expr) - Snowflake specific
|
|
566
|
+
"""
|
|
567
|
+
if len(args) == 2:
|
|
568
|
+
return exp.TimestampFromParts(this=seq_get(args, 0), expression=seq_get(args, 1))
|
|
569
|
+
|
|
570
|
+
return exp.TimestampFromParts.from_arg_list(args)
|
|
571
|
+
|
|
572
|
+
|
|
554
573
|
def _annotate_date_or_time_add(self: TypeAnnotator, expression: E) -> E:
|
|
555
574
|
self._annotate_args(expression)
|
|
556
575
|
|
|
@@ -588,6 +607,8 @@ class Snowflake(Dialect):
|
|
|
588
607
|
exp.Degrees,
|
|
589
608
|
exp.Exp,
|
|
590
609
|
exp.MonthsBetween,
|
|
610
|
+
exp.RegrValx,
|
|
611
|
+
exp.RegrValy,
|
|
591
612
|
exp.Sin,
|
|
592
613
|
exp.Sinh,
|
|
593
614
|
exp.Tan,
|
|
@@ -680,6 +701,10 @@ class Snowflake(Dialect):
|
|
|
680
701
|
exp.DataType.Type.BOOLEAN: {
|
|
681
702
|
*Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.BOOLEAN],
|
|
682
703
|
exp.Boolnot,
|
|
704
|
+
exp.Booland,
|
|
705
|
+
exp.Boolor,
|
|
706
|
+
exp.EqualNull,
|
|
707
|
+
exp.IsNullValue,
|
|
683
708
|
exp.Search,
|
|
684
709
|
},
|
|
685
710
|
exp.DataType.Type.DATE: {
|
|
@@ -734,8 +759,11 @@ class Snowflake(Dialect):
|
|
|
734
759
|
else exp.DataType.Type.TIMESTAMPTZ,
|
|
735
760
|
),
|
|
736
761
|
exp.DateAdd: _annotate_date_or_time_add,
|
|
737
|
-
exp.Reverse: _annotate_reverse,
|
|
738
762
|
exp.TimeAdd: _annotate_date_or_time_add,
|
|
763
|
+
exp.GreatestIgnoreNulls: lambda self, e: self._annotate_by_args(e, "expressions"),
|
|
764
|
+
exp.LeastIgnoreNulls: lambda self, e: self._annotate_by_args(e, "expressions"),
|
|
765
|
+
exp.Reverse: _annotate_reverse,
|
|
766
|
+
exp.TimestampFromParts: _annotate_timestamp_from_parts,
|
|
739
767
|
}
|
|
740
768
|
|
|
741
769
|
TIME_MAPPING = {
|
|
@@ -889,10 +917,10 @@ class Snowflake(Dialect):
|
|
|
889
917
|
"TIMEDIFF": _build_datediff,
|
|
890
918
|
"TIMESTAMPADD": _build_date_time_add(exp.DateAdd),
|
|
891
919
|
"TIMESTAMPDIFF": _build_datediff,
|
|
892
|
-
"TIMESTAMPFROMPARTS":
|
|
893
|
-
"TIMESTAMP_FROM_PARTS":
|
|
894
|
-
"TIMESTAMPNTZFROMPARTS":
|
|
895
|
-
"TIMESTAMP_NTZ_FROM_PARTS":
|
|
920
|
+
"TIMESTAMPFROMPARTS": _build_timestamp_from_parts,
|
|
921
|
+
"TIMESTAMP_FROM_PARTS": _build_timestamp_from_parts,
|
|
922
|
+
"TIMESTAMPNTZFROMPARTS": _build_timestamp_from_parts,
|
|
923
|
+
"TIMESTAMP_NTZ_FROM_PARTS": _build_timestamp_from_parts,
|
|
896
924
|
"TRY_PARSE_JSON": lambda args: exp.ParseJSON(this=seq_get(args, 0), safe=True),
|
|
897
925
|
"TRY_TO_DATE": _build_datetime("TRY_TO_DATE", exp.DataType.Type.DATE, safe=True),
|
|
898
926
|
"TRY_TO_TIME": _build_datetime("TRY_TO_TIME", exp.DataType.Type.TIME, safe=True),
|
|
@@ -916,9 +944,11 @@ class Snowflake(Dialect):
|
|
|
916
944
|
"TO_JSON": exp.JSONFormat.from_arg_list,
|
|
917
945
|
"VECTOR_L2_DISTANCE": exp.EuclideanDistance.from_arg_list,
|
|
918
946
|
"ZEROIFNULL": _build_if_from_zeroifnull,
|
|
919
|
-
"LIKE":
|
|
920
|
-
"ILIKE":
|
|
947
|
+
"LIKE": build_like(exp.Like),
|
|
948
|
+
"ILIKE": build_like(exp.ILike),
|
|
921
949
|
"SEARCH": _build_search,
|
|
950
|
+
"WEEKISO": exp.WeekOfYear.from_arg_list,
|
|
951
|
+
"WEEKOFYEAR": exp.Week.from_arg_list,
|
|
922
952
|
}
|
|
923
953
|
FUNCTIONS.pop("PREDICT")
|
|
924
954
|
|
|
@@ -1624,9 +1654,16 @@ class Snowflake(Dialect):
|
|
|
1624
1654
|
exp.UnixToTime: rename_func("TO_TIMESTAMP"),
|
|
1625
1655
|
exp.Uuid: rename_func("UUID_STRING"),
|
|
1626
1656
|
exp.VarMap: lambda self, e: var_map_sql(self, e, "OBJECT_CONSTRUCT"),
|
|
1627
|
-
exp.
|
|
1657
|
+
exp.Booland: rename_func("BOOLAND"),
|
|
1658
|
+
exp.Boolor: rename_func("BOOLOR"),
|
|
1659
|
+
exp.WeekOfYear: rename_func("WEEKISO"),
|
|
1660
|
+
exp.YearOfWeek: rename_func("YEAROFWEEK"),
|
|
1661
|
+
exp.YearOfWeekIso: rename_func("YEAROFWEEKISO"),
|
|
1628
1662
|
exp.Xor: rename_func("BOOLXOR"),
|
|
1629
1663
|
exp.ByteLength: rename_func("OCTET_LENGTH"),
|
|
1664
|
+
exp.ArrayConcatAgg: lambda self, e: self.func(
|
|
1665
|
+
"ARRAY_FLATTEN", exp.ArrayAgg(this=e.this)
|
|
1666
|
+
),
|
|
1630
1667
|
}
|
|
1631
1668
|
|
|
1632
1669
|
SUPPORTED_JSON_PATH_PARTS = {
|
|
@@ -6,6 +6,7 @@ from sqlglot import exp
|
|
|
6
6
|
from sqlglot.dialects.dialect import (
|
|
7
7
|
Version,
|
|
8
8
|
rename_func,
|
|
9
|
+
build_like,
|
|
9
10
|
unit_to_var,
|
|
10
11
|
timestampdiff_sql,
|
|
11
12
|
build_date_delta,
|
|
@@ -147,6 +148,8 @@ class Spark(Spark2):
|
|
|
147
148
|
offset=1,
|
|
148
149
|
safe=True,
|
|
149
150
|
),
|
|
151
|
+
"LIKE": build_like(exp.Like),
|
|
152
|
+
"ILIKE": build_like(exp.ILike),
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
PLACEHOLDER_PARSERS = {
|