sqlglot 27.21.0__tar.gz → 27.22.1__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.
Potentially problematic release.
This version of sqlglot might be problematic. Click here for more details.
- {sqlglot-27.21.0 → sqlglot-27.22.1}/CHANGELOG.md +151 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/PKG-INFO +2 -2
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/_version.py +3 -3
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/dialect.py +7 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/hive.py +66 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/snowflake.py +1 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/spark2.py +17 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/tsql.py +11 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/expressions.py +10 -1
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/generator.py +12 -3
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/optimize_joins.py +38 -4
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/parser.py +41 -25
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot.egg-info/PKG-INFO +2 -2
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot.egg-info/requires.txt +1 -1
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglotrs/Cargo.lock +1 -1
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglotrs/Cargo.toml +1 -1
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_duckdb.py +6 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_hive.py +38 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_mysql.py +3 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_snowflake.py +5 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_spark.py +22 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_tsql.py +13 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/identity.sql +4 -1
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/annotate_functions.sql +24 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/optimize_joins.sql +1 -1
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/optimizer.sql +55 -17
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/tpc-ds.sql +226 -225
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-h/tpc-h.sql +12 -12
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_parser.py +0 -11
- {sqlglot-27.21.0 → sqlglot-27.22.1}/.gitignore +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/.gitpod.yml +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/.pre-commit-config.yaml +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/CONTRIBUTING.md +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/LICENSE +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/MANIFEST.in +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/Makefile +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/README.md +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/pyproject.toml +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/setup.cfg +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/setup.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/__init__.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/__main__.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/_typing.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/__init__.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/athena.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/bigquery.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/clickhouse.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/databricks.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/doris.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/dremio.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/drill.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/druid.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/duckdb.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/dune.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/exasol.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/fabric.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/materialize.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/mysql.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/oracle.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/postgres.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/presto.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/prql.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/redshift.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/risingwave.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/singlestore.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/solr.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/spark.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/sqlite.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/starrocks.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/tableau.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/teradata.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/dialects/trino.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/diff.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/errors.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/executor/__init__.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/executor/context.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/executor/env.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/executor/python.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/executor/table.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/helper.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/jsonpath.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/lineage.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/__init__.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/annotate_types.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/canonicalize.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/eliminate_ctes.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/eliminate_joins.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/eliminate_subqueries.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/isolate_table_selects.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/merge_subqueries.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/normalize.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/normalize_identifiers.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/optimizer.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/pushdown_predicates.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/pushdown_projections.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/qualify.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/qualify_columns.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/qualify_tables.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/scope.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/simplify.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/optimizer/unnest_subqueries.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/planner.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/py.typed +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/schema.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/serde.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/time.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/tokens.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/transforms.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot/trie.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot.egg-info/SOURCES.txt +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot.egg-info/dependency_links.txt +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot.egg-info/top_level.txt +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglot.png +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglotrs/benches/dialect_settings.json +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglotrs/benches/long.rs +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglotrs/benches/token_type_settings.json +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglotrs/benches/tokenizer_dialect_settings.json +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglotrs/benches/tokenizer_settings.json +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglotrs/pyproject.toml +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglotrs/src/lib.rs +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglotrs/src/settings.rs +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglotrs/src/token.rs +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglotrs/src/tokenizer.rs +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/sqlglotrs/src/trie.rs +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/__init__.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/__init__.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_athena.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_bigquery.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_clickhouse.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_databricks.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_dialect.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_doris.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_dremio.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_drill.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_druid.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_dune.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_exasol.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_fabric.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_materialize.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_oracle.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_pipe_syntax.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_postgres.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_presto.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_prql.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_redshift.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_risingwave.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_singlestore.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_solr.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_sqlite.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_starrocks.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_tableau.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_teradata.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/dialects/test_trino.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/jsonpath/LICENSE +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/jsonpath/cts.json +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/annotate_types.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/canonicalize.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/eliminate_ctes.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/eliminate_joins.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/eliminate_subqueries.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/isolate_table_selects.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/merge_subqueries.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/normalize.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/normalize_identifiers.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/pushdown_cte_alias_columns.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/pushdown_predicates.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/pushdown_projections.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/qualify_columns.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/qualify_columns__invalid.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/qualify_columns__with_invisible.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/qualify_columns_ddl.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/qualify_tables.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/quote_identifiers.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/simplify.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/call_center.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/catalog_page.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/catalog_returns.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/catalog_sales.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/customer.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/customer_address.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/customer_demographics.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/date_dim.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/household_demographics.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/income_band.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/inventory.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/item.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/promotion.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/reason.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/ship_mode.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/store.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/store_returns.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/store_sales.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/time_dim.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/warehouse.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/web_page.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/web_returns.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/web_sales.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-ds/web_site.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-h/customer.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-h/lineitem.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-h/nation.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-h/orders.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-h/part.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-h/partsupp.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-h/region.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/tpc-h/supplier.csv.gz +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/optimizer/unnest_subqueries.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/partial.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/fixtures/pretty.sql +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/gen_fixtures.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/helpers.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_build.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_dialect_imports.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_diff.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_docs.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_executor.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_expressions.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_generator.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_helper.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_jsonpath.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_lineage.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_optimizer.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_schema.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_serde.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_time.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_tokens.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_transforms.py +0 -0
- {sqlglot-27.21.0 → sqlglot-27.22.1}/tests/test_transpile.py +0 -0
|
@@ -1,6 +1,155 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
## [v27.22.0] - 2025-10-08
|
|
5
|
+
### :boom: BREAKING CHANGES
|
|
6
|
+
- due to [`6beb917`](https://github.com/tobymao/sqlglot/commit/6beb9172dffd0aaea46b75477485060737e774b9) - Annotate type for snowflake ROUND function *(PR [#6032](https://github.com/tobymao/sqlglot/pull/6032) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
7
|
+
|
|
8
|
+
Annotate type for snowflake ROUND function (#6032)
|
|
9
|
+
|
|
10
|
+
- due to [`0939d69`](https://github.com/tobymao/sqlglot/commit/0939d69223a860581b1c30cc2f762294946b93f3) - move odbc date literal handling in t-sql closes [#6037](https://github.com/tobymao/sqlglot/pull/6037) *(PR [#6044](https://github.com/tobymao/sqlglot/pull/6044) by [@georgesittas](https://github.com/georgesittas))*:
|
|
11
|
+
|
|
12
|
+
move odbc date literal handling in t-sql closes #6037 (#6044)
|
|
13
|
+
|
|
14
|
+
- due to [`56c8b3b`](https://github.com/tobymao/sqlglot/commit/56c8b3bbff7451b9049e1a168716bb41222a86ed) - Support CHANGE COLUMN statements in Hive and CHANGE/ALTER COLUMN statements in Spark *(PR [#6004](https://github.com/tobymao/sqlglot/pull/6004) by [@tsamaras](https://github.com/tsamaras))*:
|
|
15
|
+
|
|
16
|
+
Support CHANGE COLUMN statements in Hive and CHANGE/ALTER COLUMN statements in Spark (#6004)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### :sparkles: New Features
|
|
20
|
+
- [`6beb917`](https://github.com/tobymao/sqlglot/commit/6beb9172dffd0aaea46b75477485060737e774b9) - **optimizer**: Annotate type for snowflake ROUND function *(PR [#6032](https://github.com/tobymao/sqlglot/pull/6032) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
21
|
+
- [`8e03ad9`](https://github.com/tobymao/sqlglot/commit/8e03ad9dd087ebc72bf58cb6383607c0ce2e8f8f) - **optimizer**: Annotate type for snowflake MOD function *(PR [#6031](https://github.com/tobymao/sqlglot/pull/6031) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
22
|
+
- [`15b3fac`](https://github.com/tobymao/sqlglot/commit/15b3fac3dd5efd4c347ac40055f07a9be5906802) - **mysql**: support `FOR ORDINALITY` clause in `COLUMN` expression *(PR [#6046](https://github.com/tobymao/sqlglot/pull/6046) by [@georgesittas](https://github.com/georgesittas))*
|
|
23
|
+
- :arrow_lower_right: *addresses issue [#6039](https://github.com/tobymao/sqlglot/issues/6039) opened by [@jdddog](https://github.com/jdddog)*
|
|
24
|
+
- [`56c8b3b`](https://github.com/tobymao/sqlglot/commit/56c8b3bbff7451b9049e1a168716bb41222a86ed) - **hive,spark**: Support CHANGE COLUMN statements in Hive and CHANGE/ALTER COLUMN statements in Spark *(PR [#6004](https://github.com/tobymao/sqlglot/pull/6004) by [@tsamaras](https://github.com/tsamaras))*
|
|
25
|
+
|
|
26
|
+
### :bug: Bug Fixes
|
|
27
|
+
- [`6a6ca92`](https://github.com/tobymao/sqlglot/commit/6a6ca927c4e6e06f5cb38ad1153a8b556999ef90) - **parser**: Allow nested GROUPING SETS *(PR [#6041](https://github.com/tobymao/sqlglot/pull/6041) by [@VaggelisD](https://github.com/VaggelisD))*
|
|
28
|
+
- :arrow_lower_right: *fixes issue [#6038](https://github.com/tobymao/sqlglot/issues/6038) opened by [@denis-komarov](https://github.com/denis-komarov)*
|
|
29
|
+
- [`41baeaa`](https://github.com/tobymao/sqlglot/commit/41baeaa1530c5419c945409133e3b7caa5250ec7) - **optimizer**: more robust CROSS JOIN substitution and JOIN reordering *(PR [#6021](https://github.com/tobymao/sqlglot/pull/6021) by [@geooo109](https://github.com/geooo109))*
|
|
30
|
+
- :arrow_lower_right: *fixes issue [#6009](https://github.com/tobymao/sqlglot/issues/6009) opened by [@kyle-cheung](https://github.com/kyle-cheung)*
|
|
31
|
+
- [`e2f299f`](https://github.com/tobymao/sqlglot/commit/e2f299f5ad18d75a394e55bd1ee59ed243d77e54) - allow subqueries to have modifiers closes [#6014](https://github.com/tobymao/sqlglot/pull/6014) *(PR [#6034](https://github.com/tobymao/sqlglot/pull/6034) by [@tobymao](https://github.com/tobymao))*
|
|
32
|
+
- [`0d65266`](https://github.com/tobymao/sqlglot/commit/0d6526693f8e7dda9b7c180d31c364bde91afc72) - parse lambda for arg_min/max arguments closes [#6036](https://github.com/tobymao/sqlglot/pull/6036) *(PR [#6042](https://github.com/tobymao/sqlglot/pull/6042) by [@georgesittas](https://github.com/georgesittas))*
|
|
33
|
+
- [`0939d69`](https://github.com/tobymao/sqlglot/commit/0939d69223a860581b1c30cc2f762294946b93f3) - move odbc date literal handling in t-sql closes [#6037](https://github.com/tobymao/sqlglot/pull/6037) *(PR [#6044](https://github.com/tobymao/sqlglot/pull/6044) by [@georgesittas](https://github.com/georgesittas))*
|
|
34
|
+
- [`65848e5`](https://github.com/tobymao/sqlglot/commit/65848e5a3e4c1cb26e6ca4deb7819a282838c3c2) - **tsql**: UPDATE with OPTIONS *(PR [#6043](https://github.com/tobymao/sqlglot/pull/6043) by [@geooo109](https://github.com/geooo109))*
|
|
35
|
+
- :arrow_lower_right: *fixes issue [#6033](https://github.com/tobymao/sqlglot/issues/6033) opened by [@ligfx](https://github.com/ligfx)*
|
|
36
|
+
|
|
37
|
+
### :recycle: Refactors
|
|
38
|
+
- [`8f00c80`](https://github.com/tobymao/sqlglot/commit/8f00c804a67209a5eca1fcb28aeb95941c58e583) - _parse_in expr len check *(commit by [@geooo109](https://github.com/geooo109))*
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## [v27.21.0] - 2025-10-07
|
|
42
|
+
### :boom: BREAKING CHANGES
|
|
43
|
+
- due to [`3c7b5c0`](https://github.com/tobymao/sqlglot/commit/3c7b5c0e2dc071b7b9f6da308ba58a3a43da93dc) - Annotate type for snowflake SOUNDEX_P123 function *(PR [#5987](https://github.com/tobymao/sqlglot/pull/5987) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
44
|
+
|
|
45
|
+
Annotate type for snowflake SOUNDEX_P123 function (#5987)
|
|
46
|
+
|
|
47
|
+
- due to [`f25e42e`](https://github.com/tobymao/sqlglot/commit/f25e42e3f5b3b7b671bd724ba7b09a9b07d13995) - annotate type for Snowflake REGEXP_INSTR function *(PR [#5978](https://github.com/tobymao/sqlglot/pull/5978) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
|
|
48
|
+
|
|
49
|
+
annotate type for Snowflake REGEXP_INSTR function (#5978)
|
|
50
|
+
|
|
51
|
+
- due to [`13cb26e`](https://github.com/tobymao/sqlglot/commit/13cb26e2f29373538d60a8124ddebf95fd22a8d8) - annotate type for Snowflake REGEXP_SUBSTR_ALL function *(PR [#5979](https://github.com/tobymao/sqlglot/pull/5979) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
|
|
52
|
+
|
|
53
|
+
annotate type for Snowflake REGEXP_SUBSTR_ALL function (#5979)
|
|
54
|
+
|
|
55
|
+
- due to [`4ce683e`](https://github.com/tobymao/sqlglot/commit/4ce683eb8ac5716a334cbd7625438b9f89623c7a) - Annotate type for snowflake UNICODE function *(PR [#5993](https://github.com/tobymao/sqlglot/pull/5993) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
56
|
+
|
|
57
|
+
Annotate type for snowflake UNICODE function (#5993)
|
|
58
|
+
|
|
59
|
+
- due to [`c7657fb`](https://github.com/tobymao/sqlglot/commit/c7657fbd27a4350c424ef65947471ab9ec086831) - remove `unalias_group_by` transformation since it is unsafe *(PR [#5997](https://github.com/tobymao/sqlglot/pull/5997) by [@georgesittas](https://github.com/georgesittas))*:
|
|
60
|
+
|
|
61
|
+
remove `unalias_group_by` transformation since it is unsafe (#5997)
|
|
62
|
+
|
|
63
|
+
- due to [`587196c`](https://github.com/tobymao/sqlglot/commit/587196c9c2d122f73f9deb7e87c2831f27f6ed02) - Annotate type for snowflake STRTOK_TO_ARRAY function *(PR [#5994](https://github.com/tobymao/sqlglot/pull/5994) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
64
|
+
|
|
65
|
+
Annotate type for snowflake STRTOK_TO_ARRAY function (#5994)
|
|
66
|
+
|
|
67
|
+
- due to [`bced710`](https://github.com/tobymao/sqlglot/commit/bced71084ffb3a8f7a11db843777f05b68f367da) - Annotate type for snowflake STRTOK function. *(PR [#5991](https://github.com/tobymao/sqlglot/pull/5991) by [@georgesittas](https://github.com/georgesittas))*:
|
|
68
|
+
|
|
69
|
+
Annotate type for snowflake STRTOK function. (#5991)
|
|
70
|
+
|
|
71
|
+
- due to [`be1cdc8`](https://github.com/tobymao/sqlglot/commit/be1cdc81b511d462b710b50941d5c2770d901e91) - Fix roundtrip of ~ operator *(PR [#6017](https://github.com/tobymao/sqlglot/pull/6017) by [@VaggelisD](https://github.com/VaggelisD))*:
|
|
72
|
+
|
|
73
|
+
Fix roundtrip of ~ operator (#6017)
|
|
74
|
+
|
|
75
|
+
- due to [`74a13f2`](https://github.com/tobymao/sqlglot/commit/74a13f2a548b9cd41061e835cb3cd9dd2a5a9fb3) - Annotate type for snowflake DIV0 and DIVNULL functions *(PR [#6008](https://github.com/tobymao/sqlglot/pull/6008) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
76
|
+
|
|
77
|
+
Annotate type for snowflake DIV0 and DIVNULL functions (#6008)
|
|
78
|
+
|
|
79
|
+
- due to [`fec2b31`](https://github.com/tobymao/sqlglot/commit/fec2b31956f2debdad7c53744a577894cd8d747c) - Annotate type for snowflake SEARCH function *(PR [#5985](https://github.com/tobymao/sqlglot/pull/5985) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
80
|
+
|
|
81
|
+
Annotate type for snowflake SEARCH function (#5985)
|
|
82
|
+
|
|
83
|
+
- due to [`27a76cd`](https://github.com/tobymao/sqlglot/commit/27a76cdfe4212f16f945521eb3997580eacf1d61) - Annotate type for snowflake COT, SIN and TAN functions *(PR [#6022](https://github.com/tobymao/sqlglot/pull/6022) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
84
|
+
|
|
85
|
+
Annotate type for snowflake COT, SIN and TAN functions (#6022)
|
|
86
|
+
|
|
87
|
+
- due to [`0911276`](https://github.com/tobymao/sqlglot/commit/091127663ab4cb94b02be5aa40c6a46dd7f89243) - annotate type for Snowflake EXP function *(PR [#6007](https://github.com/tobymao/sqlglot/pull/6007) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
|
|
88
|
+
|
|
89
|
+
annotate type for Snowflake EXP function (#6007)
|
|
90
|
+
|
|
91
|
+
- due to [`a96d50e`](https://github.com/tobymao/sqlglot/commit/a96d50e14bed5e87ff2dce9c545e0c48897b64d6) - annotate type for Snowflake COSH function *(PR [#6006](https://github.com/tobymao/sqlglot/pull/6006) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
|
|
92
|
+
|
|
93
|
+
annotate type for Snowflake COSH function (#6006)
|
|
94
|
+
|
|
95
|
+
- due to [`4df58e0`](https://github.com/tobymao/sqlglot/commit/4df58e0f0b8985590fb29a8ab6ba0ced987ac5b9) - annotate type for Snowflake DEGREES function *(PR [#6027](https://github.com/tobymao/sqlglot/pull/6027) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
|
|
96
|
+
|
|
97
|
+
annotate type for Snowflake DEGREES function (#6027)
|
|
98
|
+
|
|
99
|
+
- due to [`db71a20`](https://github.com/tobymao/sqlglot/commit/db71a2023aaeca2ffda782ae7b91fdee356c402e) - annotate type for Snowflake COS function *(PR [#6028](https://github.com/tobymao/sqlglot/pull/6028) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
|
|
100
|
+
|
|
101
|
+
annotate type for Snowflake COS function (#6028)
|
|
102
|
+
|
|
103
|
+
- due to [`5dd2ed3`](https://github.com/tobymao/sqlglot/commit/5dd2ed3c69cf9e8c3e327297e0cc932f0954e108) - bump sqlglotrs to 0.7.0 *(commit by [@georgesittas](https://github.com/georgesittas))*:
|
|
104
|
+
|
|
105
|
+
bump sqlglotrs to 0.7.0
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
### :sparkles: New Features
|
|
109
|
+
- [`3c7b5c0`](https://github.com/tobymao/sqlglot/commit/3c7b5c0e2dc071b7b9f6da308ba58a3a43da93dc) - **optimizer**: Annotate type for snowflake SOUNDEX_P123 function *(PR [#5987](https://github.com/tobymao/sqlglot/pull/5987) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
110
|
+
- [`475c09b`](https://github.com/tobymao/sqlglot/commit/475c09bd27179db4d186638645698dd4ad6553cd) - **optimizer**: Annotate type for snowflake TRANSLATE function *(PR [#5992](https://github.com/tobymao/sqlglot/pull/5992) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
111
|
+
- [`f25e42e`](https://github.com/tobymao/sqlglot/commit/f25e42e3f5b3b7b671bd724ba7b09a9b07d13995) - **optimizer**: annotate type for Snowflake REGEXP_INSTR function *(PR [#5978](https://github.com/tobymao/sqlglot/pull/5978) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
|
|
112
|
+
- [`13cb26e`](https://github.com/tobymao/sqlglot/commit/13cb26e2f29373538d60a8124ddebf95fd22a8d8) - **optimizer**: annotate type for Snowflake REGEXP_SUBSTR_ALL function *(PR [#5979](https://github.com/tobymao/sqlglot/pull/5979) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
|
|
113
|
+
- [`4ce683e`](https://github.com/tobymao/sqlglot/commit/4ce683eb8ac5716a334cbd7625438b9f89623c7a) - **optimizer**: Annotate type for snowflake UNICODE function *(PR [#5993](https://github.com/tobymao/sqlglot/pull/5993) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
114
|
+
- [`587196c`](https://github.com/tobymao/sqlglot/commit/587196c9c2d122f73f9deb7e87c2831f27f6ed02) - **optimizer**: Annotate type for snowflake STRTOK_TO_ARRAY function *(PR [#5994](https://github.com/tobymao/sqlglot/pull/5994) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
115
|
+
- [`bced710`](https://github.com/tobymao/sqlglot/commit/bced71084ffb3a8f7a11db843777f05b68f367da) - **optimizer**: Annotate type for snowflake STRTOK function. *(PR [#5991](https://github.com/tobymao/sqlglot/pull/5991) by [@georgesittas](https://github.com/georgesittas))*
|
|
116
|
+
- [`74a13f2`](https://github.com/tobymao/sqlglot/commit/74a13f2a548b9cd41061e835cb3cd9dd2a5a9fb3) - **optimizer**: Annotate type for snowflake DIV0 and DIVNULL functions *(PR [#6008](https://github.com/tobymao/sqlglot/pull/6008) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
117
|
+
- [`fec2b31`](https://github.com/tobymao/sqlglot/commit/fec2b31956f2debdad7c53744a577894cd8d747c) - **optimizer**: Annotate type for snowflake SEARCH function *(PR [#5985](https://github.com/tobymao/sqlglot/pull/5985) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
118
|
+
- [`27a76cd`](https://github.com/tobymao/sqlglot/commit/27a76cdfe4212f16f945521eb3997580eacf1d61) - **optimizer**: Annotate type for snowflake COT, SIN and TAN functions *(PR [#6022](https://github.com/tobymao/sqlglot/pull/6022) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
119
|
+
- [`8b48f7b`](https://github.com/tobymao/sqlglot/commit/8b48f7b985342cfcc45bc2b94540a1a2bf5995c4) - **optimizer**: Annotate type for snowflake SIGN and ABS functions *(PR [#6025](https://github.com/tobymao/sqlglot/pull/6025) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
120
|
+
- [`0911276`](https://github.com/tobymao/sqlglot/commit/091127663ab4cb94b02be5aa40c6a46dd7f89243) - **optimizer**: annotate type for Snowflake EXP function *(PR [#6007](https://github.com/tobymao/sqlglot/pull/6007) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
|
|
121
|
+
- [`a96d50e`](https://github.com/tobymao/sqlglot/commit/a96d50e14bed5e87ff2dce9c545e0c48897b64d6) - **optimizer**: annotate type for Snowflake COSH function *(PR [#6006](https://github.com/tobymao/sqlglot/pull/6006) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
|
|
122
|
+
- [`4df58e0`](https://github.com/tobymao/sqlglot/commit/4df58e0f0b8985590fb29a8ab6ba0ced987ac5b9) - **optimizer**: annotate type for Snowflake DEGREES function *(PR [#6027](https://github.com/tobymao/sqlglot/pull/6027) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
|
|
123
|
+
- [`db71a20`](https://github.com/tobymao/sqlglot/commit/db71a2023aaeca2ffda782ae7b91fdee356c402e) - **optimizer**: annotate type for Snowflake COS function *(PR [#6028](https://github.com/tobymao/sqlglot/pull/6028) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
|
|
124
|
+
|
|
125
|
+
### :bug: Bug Fixes
|
|
126
|
+
- [`51b1bb1`](https://github.com/tobymao/sqlglot/commit/51b1bb178fa952edc13b2cbc6f624d30b0bde798) - move `WATERMARK` logic to risingwave fixes [#5989](https://github.com/tobymao/sqlglot/pull/5989) *(commit by [@georgesittas](https://github.com/georgesittas))*
|
|
127
|
+
- [`033ddf0`](https://github.com/tobymao/sqlglot/commit/033ddf04da895f1f5d38aff5361b2ae0793fefea) - **optimizer**: convert INNER JOINs to LEFT JOINs when merging LEFT JOIN subqueries *(PR [#5980](https://github.com/tobymao/sqlglot/pull/5980) by [@geooo109](https://github.com/geooo109))*
|
|
128
|
+
- :arrow_lower_right: *fixes issue [#5969](https://github.com/tobymao/sqlglot/issues/5969) opened by [@karta0807913](https://github.com/karta0807913)*
|
|
129
|
+
- [`c7657fb`](https://github.com/tobymao/sqlglot/commit/c7657fbd27a4350c424ef65947471ab9ec086831) - remove `unalias_group_by` transformation since it is unsafe *(PR [#5997](https://github.com/tobymao/sqlglot/pull/5997) by [@georgesittas](https://github.com/georgesittas))*
|
|
130
|
+
- :arrow_lower_right: *fixes issue [#5995](https://github.com/tobymao/sqlglot/issues/5995) opened by [@capricornsky0119](https://github.com/capricornsky0119)*
|
|
131
|
+
- [`b6f9694`](https://github.com/tobymao/sqlglot/commit/b6f9694c535cdd1403a63036cc246fda4e6d4d22) - **optimizer**: avoid merging subquery with JOIN when outer query uses JOIN *(PR [#5999](https://github.com/tobymao/sqlglot/pull/5999) by [@geooo109](https://github.com/geooo109))*
|
|
132
|
+
- [`23fd7b9`](https://github.com/tobymao/sqlglot/commit/23fd7b9116541b96e5d89389e862c6004e92d109) - respect multi-part Column units instead of converting to Var *(PR [#6005](https://github.com/tobymao/sqlglot/pull/6005) by [@georgesittas](https://github.com/georgesittas))*
|
|
133
|
+
- [`be1cdc8`](https://github.com/tobymao/sqlglot/commit/be1cdc81b511d462b710b50941d5c2770d901e91) - **duckdb**: Fix roundtrip of ~ operator *(PR [#6017](https://github.com/tobymao/sqlglot/pull/6017) by [@VaggelisD](https://github.com/VaggelisD))*
|
|
134
|
+
- :arrow_lower_right: *fixes issue [#6016](https://github.com/tobymao/sqlglot/issues/6016) opened by [@denis-komarov](https://github.com/denis-komarov)*
|
|
135
|
+
- [`27c278f`](https://github.com/tobymao/sqlglot/commit/27c278f562f5ce98a1a4d31f8e66f148a1f42236) - **parser**: Allow LIMIT with % percentage *(PR [#6019](https://github.com/tobymao/sqlglot/pull/6019) by [@VaggelisD](https://github.com/VaggelisD))*
|
|
136
|
+
- [`39bf3f8`](https://github.com/tobymao/sqlglot/commit/39bf3f893389663796cdd799ef0f1e684f315a01) - **parser**: Allow CUBE & ROLLUP inside GROUPING SETS *(PR [#6018](https://github.com/tobymao/sqlglot/pull/6018) by [@VaggelisD](https://github.com/VaggelisD))*
|
|
137
|
+
- :arrow_lower_right: *fixes issue [#6015](https://github.com/tobymao/sqlglot/issues/6015) opened by [@denis-komarov](https://github.com/denis-komarov)*
|
|
138
|
+
- [`ba7ad34`](https://github.com/tobymao/sqlglot/commit/ba7ad341d5ee1298b8fe54be11ca6252c1a44c99) - **duckdb**: Parse ROW type as STRUCT *(PR [#6020](https://github.com/tobymao/sqlglot/pull/6020) by [@VaggelisD](https://github.com/VaggelisD))*
|
|
139
|
+
- :arrow_lower_right: *fixes issue [#6012](https://github.com/tobymao/sqlglot/issues/6012) opened by [@denis-komarov](https://github.com/denis-komarov)*
|
|
140
|
+
- [`718d6bb`](https://github.com/tobymao/sqlglot/commit/718d6bbf7f40e5b3e99563e2f1ac9eadeff57c3d) - handle unicode heredoc tags & Rust grapheme clusters properly *(PR [#6024](https://github.com/tobymao/sqlglot/pull/6024) by [@georgesittas](https://github.com/georgesittas))*
|
|
141
|
+
- :arrow_lower_right: *fixes issue [#6010](https://github.com/tobymao/sqlglot/issues/6010) opened by [@denis-komarov](https://github.com/denis-komarov)*
|
|
142
|
+
- [`c8cfb9d`](https://github.com/tobymao/sqlglot/commit/c8cfb9db2e789be2dc7f8a154082a9210b736502) - **snowflake**: transpile ARRAY_CONTAINS with VARIANT CAST *(PR [#6029](https://github.com/tobymao/sqlglot/pull/6029) by [@geooo109](https://github.com/geooo109))*
|
|
143
|
+
- :arrow_lower_right: *fixes issue [#6026](https://github.com/tobymao/sqlglot/issues/6026) opened by [@Birkman](https://github.com/Birkman)*
|
|
144
|
+
|
|
145
|
+
### :wrench: Chores
|
|
146
|
+
- [`1b1c6f8`](https://github.com/tobymao/sqlglot/commit/1b1c6f8d418371d49f0d3511baf3c5e35dd3ef42) - coerce type for EXTRACT canonicalization *(PR [#5998](https://github.com/tobymao/sqlglot/pull/5998) by [@geooo109](https://github.com/geooo109))*
|
|
147
|
+
- :arrow_lower_right: *addresses issue [#5996](https://github.com/tobymao/sqlglot/issues/5996) opened by [@snovik75](https://github.com/snovik75)*
|
|
148
|
+
- [`f00ae73`](https://github.com/tobymao/sqlglot/commit/f00ae735c8f185b4c6c132373c9fa9bbe58e37b7) - **optimizer**: Annotate type for sqrt function *(PR [#6003](https://github.com/tobymao/sqlglot/pull/6003) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
|
|
149
|
+
- [`ac97f14`](https://github.com/tobymao/sqlglot/commit/ac97f14ee1a576a276018f6c9ae1237ecf9ceda7) - simplify `SEARCH` Snowflake instantiation *(commit by [@georgesittas](https://github.com/georgesittas))*
|
|
150
|
+
- [`5dd2ed3`](https://github.com/tobymao/sqlglot/commit/5dd2ed3c69cf9e8c3e327297e0cc932f0954e108) - bump sqlglotrs to 0.7.0 *(commit by [@georgesittas](https://github.com/georgesittas))*
|
|
151
|
+
|
|
152
|
+
|
|
4
153
|
## [v27.20.0] - 2025-09-30
|
|
5
154
|
### :boom: BREAKING CHANGES
|
|
6
155
|
- due to [`13a30df`](https://github.com/tobymao/sqlglot/commit/13a30dfa37096df5bfc2c31538325c40a49f7917) - Annotate type for snowflake TRY_BASE64_DECODE_BINARY function *(PR [#5972](https://github.com/tobymao/sqlglot/pull/5972) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
|
|
@@ -7618,3 +7767,5 @@ Changelog
|
|
|
7618
7767
|
[v27.18.0]: https://github.com/tobymao/sqlglot/compare/v27.17.0...v27.18.0
|
|
7619
7768
|
[v27.19.0]: https://github.com/tobymao/sqlglot/compare/v27.18.0...v27.19.0
|
|
7620
7769
|
[v27.20.0]: https://github.com/tobymao/sqlglot/compare/v27.19.0...v27.20.0
|
|
7770
|
+
[v27.21.0]: https://github.com/tobymao/sqlglot/compare/v27.20.0...v27.21.0
|
|
7771
|
+
[v27.22.0]: https://github.com/tobymao/sqlglot/compare/v27.21.0...v27.22.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlglot
|
|
3
|
-
Version: 27.
|
|
3
|
+
Version: 27.22.1
|
|
4
4
|
Summary: An easily customizable SQL parser and transpiler
|
|
5
5
|
Author-email: Toby Mao <toby.mao@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -33,7 +33,7 @@ Requires-Dist: typing_extensions; extra == "dev"
|
|
|
33
33
|
Requires-Dist: maturin<2.0,>=1.4; extra == "dev"
|
|
34
34
|
Requires-Dist: pyperf; extra == "dev"
|
|
35
35
|
Provides-Extra: rs
|
|
36
|
-
Requires-Dist: sqlglotrs==0.7.
|
|
36
|
+
Requires-Dist: sqlglotrs==0.7.1; extra == "rs"
|
|
37
37
|
Dynamic: license-file
|
|
38
38
|
Dynamic: provides-extra
|
|
39
39
|
|
|
@@ -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.22.1'
|
|
32
|
+
__version_tuple__ = version_tuple = (27, 22, 1)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g7ac01c2ae'
|
|
@@ -525,6 +525,13 @@ class Dialect(metaclass=_Dialect):
|
|
|
525
525
|
equivalent of CREATE SCHEMA is CREATE DATABASE.
|
|
526
526
|
"""
|
|
527
527
|
|
|
528
|
+
ALTER_TABLE_SUPPORTS_CASCADE = False
|
|
529
|
+
"""
|
|
530
|
+
Hive by default does not update the schema of existing partitions when a column is changed.
|
|
531
|
+
the CASCADE clause is used to indicate that the change should be propagated to all existing partitions.
|
|
532
|
+
the Spark dialect, while derived from Hive, does not support the CASCADE clause.
|
|
533
|
+
"""
|
|
534
|
+
|
|
528
535
|
# Whether ADD is present for each column added by ALTER TABLE
|
|
529
536
|
ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN = True
|
|
530
537
|
|
|
@@ -211,6 +211,7 @@ class Hive(Dialect):
|
|
|
211
211
|
SAFE_DIVISION = True
|
|
212
212
|
ARRAY_AGG_INCLUDES_NULLS = None
|
|
213
213
|
REGEXP_EXTRACT_DEFAULT_GROUP = 1
|
|
214
|
+
ALTER_TABLE_SUPPORTS_CASCADE = True
|
|
214
215
|
|
|
215
216
|
# https://spark.apache.org/docs/latest/sql-ref-identifier.html#description
|
|
216
217
|
NORMALIZATION_STRATEGY = NormalizationStrategy.CASE_INSENSITIVE
|
|
@@ -310,6 +311,10 @@ class Hive(Dialect):
|
|
|
310
311
|
VALUES_FOLLOWED_BY_PAREN = False
|
|
311
312
|
JOINS_HAVE_EQUAL_PRECEDENCE = True
|
|
312
313
|
ADD_JOIN_ON_TRUE = True
|
|
314
|
+
ALTER_TABLE_PARTITIONS = True
|
|
315
|
+
|
|
316
|
+
CHANGE_COLUMN_ALTER_SYNTAX = False
|
|
317
|
+
# Whether the dialect supports using ALTER COLUMN syntax with CHANGE COLUMN.
|
|
313
318
|
|
|
314
319
|
FUNCTIONS = {
|
|
315
320
|
**parser.Parser.FUNCTIONS,
|
|
@@ -378,6 +383,11 @@ class Hive(Dialect):
|
|
|
378
383
|
),
|
|
379
384
|
}
|
|
380
385
|
|
|
386
|
+
ALTER_PARSERS = {
|
|
387
|
+
**parser.Parser.ALTER_PARSERS,
|
|
388
|
+
"CHANGE": lambda self: self._parse_alter_table_change(),
|
|
389
|
+
}
|
|
390
|
+
|
|
381
391
|
def _parse_transform(self) -> t.Optional[exp.Transform | exp.QueryTransform]:
|
|
382
392
|
if not self._match(TokenType.L_PAREN, advance=False):
|
|
383
393
|
self._retreat(self._index - 1)
|
|
@@ -451,6 +461,35 @@ class Hive(Dialect):
|
|
|
451
461
|
|
|
452
462
|
return this
|
|
453
463
|
|
|
464
|
+
def _parse_alter_table_change(self) -> t.Optional[exp.Expression]:
|
|
465
|
+
self._match(TokenType.COLUMN)
|
|
466
|
+
this = self._parse_field(any_token=True)
|
|
467
|
+
|
|
468
|
+
if self.CHANGE_COLUMN_ALTER_SYNTAX and self._match_text_seq("TYPE"):
|
|
469
|
+
return self.expression(
|
|
470
|
+
exp.AlterColumn,
|
|
471
|
+
this=this,
|
|
472
|
+
dtype=self._parse_types(schema=True),
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
column_new = self._parse_field(any_token=True)
|
|
476
|
+
dtype = self._parse_types(schema=True)
|
|
477
|
+
|
|
478
|
+
comment = self._match(TokenType.COMMENT) and self._parse_string()
|
|
479
|
+
|
|
480
|
+
if not this or not column_new or not dtype:
|
|
481
|
+
self.raise_error(
|
|
482
|
+
"Expected 'CHANGE COLUMN' to be followed by 'column_name' 'column_name' 'data_type'"
|
|
483
|
+
)
|
|
484
|
+
|
|
485
|
+
return self.expression(
|
|
486
|
+
exp.AlterColumn,
|
|
487
|
+
this=this,
|
|
488
|
+
rename_to=column_new,
|
|
489
|
+
dtype=dtype,
|
|
490
|
+
comment=comment,
|
|
491
|
+
)
|
|
492
|
+
|
|
454
493
|
def _parse_partition_and_order(
|
|
455
494
|
self,
|
|
456
495
|
) -> t.Tuple[t.List[exp.Expression], t.Optional[exp.Expression]]:
|
|
@@ -500,6 +539,7 @@ class Hive(Dialect):
|
|
|
500
539
|
PAD_FILL_PATTERN_IS_REQUIRED = True
|
|
501
540
|
SUPPORTS_MEDIAN = False
|
|
502
541
|
ARRAY_SIZE_NAME = "SIZE"
|
|
542
|
+
ALTER_SET_TYPE = ""
|
|
503
543
|
|
|
504
544
|
EXPRESSIONS_WITHOUT_NESTED_CTES = {
|
|
505
545
|
exp.Insert,
|
|
@@ -757,6 +797,32 @@ class Hive(Dialect):
|
|
|
757
797
|
),
|
|
758
798
|
)
|
|
759
799
|
|
|
800
|
+
def altercolumn_sql(self, expression: exp.AlterColumn) -> str:
|
|
801
|
+
this = self.sql(expression, "this")
|
|
802
|
+
new_name = self.sql(expression, "rename_to") or this
|
|
803
|
+
dtype = self.sql(expression, "dtype")
|
|
804
|
+
comment = (
|
|
805
|
+
f" COMMENT {self.sql(expression, 'comment')}"
|
|
806
|
+
if self.sql(expression, "comment")
|
|
807
|
+
else ""
|
|
808
|
+
)
|
|
809
|
+
default = self.sql(expression, "default")
|
|
810
|
+
visible = expression.args.get("visible")
|
|
811
|
+
allow_null = expression.args.get("allow_null")
|
|
812
|
+
drop = expression.args.get("drop")
|
|
813
|
+
|
|
814
|
+
if any([default, drop, visible, allow_null, drop]):
|
|
815
|
+
self.unsupported("Unsupported CHANGE COLUMN syntax")
|
|
816
|
+
|
|
817
|
+
if not dtype:
|
|
818
|
+
self.unsupported("CHANGE COLUMN without a type is not supported")
|
|
819
|
+
|
|
820
|
+
return f"CHANGE COLUMN {this} {new_name} {dtype}{comment}"
|
|
821
|
+
|
|
822
|
+
def renamecolumn_sql(self, expression: exp.RenameColumn) -> str:
|
|
823
|
+
self.unsupported("Cannot rename columns without data type defined in Hive")
|
|
824
|
+
return ""
|
|
825
|
+
|
|
760
826
|
def alterset_sql(self, expression: exp.AlterSet) -> str:
|
|
761
827
|
exprs = self.expressions(expression, flat=True)
|
|
762
828
|
exprs = f" {exprs}" if exprs else ""
|
|
@@ -151,6 +151,8 @@ def _annotate_by_similar_args(
|
|
|
151
151
|
|
|
152
152
|
|
|
153
153
|
class Spark2(Hive):
|
|
154
|
+
ALTER_TABLE_SUPPORTS_CASCADE = False
|
|
155
|
+
|
|
154
156
|
ANNOTATORS = {
|
|
155
157
|
**Hive.ANNOTATORS,
|
|
156
158
|
exp.Substring: lambda self, e: self._annotate_by_args(e, "this"),
|
|
@@ -172,6 +174,7 @@ class Spark2(Hive):
|
|
|
172
174
|
|
|
173
175
|
class Parser(Hive.Parser):
|
|
174
176
|
TRIM_PATTERN_FIRST = True
|
|
177
|
+
CHANGE_COLUMN_ALTER_SYNTAX = True
|
|
175
178
|
|
|
176
179
|
FUNCTIONS = {
|
|
177
180
|
**Hive.Parser.FUNCTIONS,
|
|
@@ -248,6 +251,7 @@ class Spark2(Hive):
|
|
|
248
251
|
QUERY_HINTS = True
|
|
249
252
|
NVL2_SUPPORTED = True
|
|
250
253
|
CAN_IMPLEMENT_ARRAY_ANY = True
|
|
254
|
+
ALTER_SET_TYPE = "TYPE"
|
|
251
255
|
|
|
252
256
|
PROPERTIES_LOCATION = {
|
|
253
257
|
**Hive.Generator.PROPERTIES_LOCATION,
|
|
@@ -364,3 +368,16 @@ class Spark2(Hive):
|
|
|
364
368
|
return super().fileformatproperty_sql(expression)
|
|
365
369
|
|
|
366
370
|
return f"USING {expression.name.upper()}"
|
|
371
|
+
|
|
372
|
+
def altercolumn_sql(self, expression: exp.AlterColumn) -> str:
|
|
373
|
+
this = self.sql(expression, "this")
|
|
374
|
+
new_name = self.sql(expression, "rename_to") or this
|
|
375
|
+
comment = self.sql(expression, "comment")
|
|
376
|
+
if new_name == this:
|
|
377
|
+
if comment:
|
|
378
|
+
return f"ALTER COLUMN {this} COMMENT {comment}"
|
|
379
|
+
return super(Hive.Generator, self).altercolumn_sql(expression)
|
|
380
|
+
return f"RENAME COLUMN {this} TO {new_name}"
|
|
381
|
+
|
|
382
|
+
def renamecolumn_sql(self, expression: exp.RenameColumn) -> str:
|
|
383
|
+
return super(Hive.Generator, self).renamecolumn_sql(expression)
|
|
@@ -670,6 +670,12 @@ class TSQL(Dialect):
|
|
|
670
670
|
|
|
671
671
|
SET_OP_MODIFIERS = {"offset"}
|
|
672
672
|
|
|
673
|
+
ODBC_DATETIME_LITERALS = {
|
|
674
|
+
"d": exp.Date,
|
|
675
|
+
"t": exp.Time,
|
|
676
|
+
"ts": exp.Timestamp,
|
|
677
|
+
}
|
|
678
|
+
|
|
673
679
|
def _parse_alter_table_set(self) -> exp.AlterSet:
|
|
674
680
|
return self._parse_wrapped(super()._parse_alter_table_set)
|
|
675
681
|
|
|
@@ -902,6 +908,11 @@ class TSQL(Dialect):
|
|
|
902
908
|
|
|
903
909
|
return self.expression(exp.UniqueColumnConstraint, this=this)
|
|
904
910
|
|
|
911
|
+
def _parse_update(self) -> exp.Update:
|
|
912
|
+
expression = super()._parse_update()
|
|
913
|
+
expression.set("options", self._parse_options())
|
|
914
|
+
return expression
|
|
915
|
+
|
|
905
916
|
def _parse_partition(self) -> t.Optional[exp.Partition]:
|
|
906
917
|
if not self._match_text_seq("WITH", "(", "PARTITIONS"):
|
|
907
918
|
return None
|
|
@@ -1838,6 +1838,7 @@ class AlterColumn(Expression):
|
|
|
1838
1838
|
"comment": False,
|
|
1839
1839
|
"allow_null": False,
|
|
1840
1840
|
"visible": False,
|
|
1841
|
+
"rename_to": False,
|
|
1841
1842
|
}
|
|
1842
1843
|
|
|
1843
1844
|
|
|
@@ -3633,6 +3634,7 @@ class Update(DML):
|
|
|
3633
3634
|
"returning": False,
|
|
3634
3635
|
"order": False,
|
|
3635
3636
|
"limit": False,
|
|
3637
|
+
"options": False,
|
|
3636
3638
|
}
|
|
3637
3639
|
|
|
3638
3640
|
def table(
|
|
@@ -4956,6 +4958,7 @@ class Alter(Expression):
|
|
|
4956
4958
|
"cluster": False,
|
|
4957
4959
|
"not_valid": False,
|
|
4958
4960
|
"check": False,
|
|
4961
|
+
"cascade": False,
|
|
4959
4962
|
}
|
|
4960
4963
|
|
|
4961
4964
|
@property
|
|
@@ -6754,7 +6757,13 @@ class JSONExists(Func):
|
|
|
6754
6757
|
# https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/JSON_TABLE.html
|
|
6755
6758
|
# Note: parsing of JSON column definitions is currently incomplete.
|
|
6756
6759
|
class JSONColumnDef(Expression):
|
|
6757
|
-
arg_types = {
|
|
6760
|
+
arg_types = {
|
|
6761
|
+
"this": False,
|
|
6762
|
+
"kind": False,
|
|
6763
|
+
"path": False,
|
|
6764
|
+
"nested_schema": False,
|
|
6765
|
+
"ordinality": False,
|
|
6766
|
+
}
|
|
6758
6767
|
|
|
6759
6768
|
|
|
6760
6769
|
class JSONSchema(Expression):
|
|
@@ -2200,7 +2200,9 @@ class Generator(metaclass=_Generator):
|
|
|
2200
2200
|
expression_sql = f"{from_sql}{where_sql}{returning}"
|
|
2201
2201
|
else:
|
|
2202
2202
|
expression_sql = f"{returning}{from_sql}{where_sql}"
|
|
2203
|
-
|
|
2203
|
+
options = self.expressions(expression, key="options")
|
|
2204
|
+
options = f" OPTION({options})" if options else ""
|
|
2205
|
+
sql = f"UPDATE {this} SET {set_sql}{expression_sql}{order}{limit}{options}"
|
|
2204
2206
|
return self.prepend_ctes(expression, sql)
|
|
2205
2207
|
|
|
2206
2208
|
def values_sql(self, expression: exp.Values, values_as_table: bool = True) -> str:
|
|
@@ -3216,7 +3218,9 @@ class Generator(metaclass=_Generator):
|
|
|
3216
3218
|
this = self.sql(expression, "this")
|
|
3217
3219
|
kind = self.sql(expression, "kind")
|
|
3218
3220
|
kind = f" {kind}" if kind else ""
|
|
3219
|
-
|
|
3221
|
+
|
|
3222
|
+
ordinality = " FOR ORDINALITY" if expression.args.get("ordinality") else ""
|
|
3223
|
+
return f"{this}{kind}{path}{ordinality}"
|
|
3220
3224
|
|
|
3221
3225
|
def jsonschema_sql(self, expression: exp.JSONSchema) -> str:
|
|
3222
3226
|
return self.func("COLUMNS", *expression.expressions)
|
|
@@ -3621,10 +3625,15 @@ class Generator(metaclass=_Generator):
|
|
|
3621
3625
|
kind = self.sql(expression, "kind")
|
|
3622
3626
|
not_valid = " NOT VALID" if expression.args.get("not_valid") else ""
|
|
3623
3627
|
check = " WITH CHECK" if expression.args.get("check") else ""
|
|
3628
|
+
cascade = (
|
|
3629
|
+
" CASCADE"
|
|
3630
|
+
if expression.args.get("cascade") and self.dialect.ALTER_TABLE_SUPPORTS_CASCADE
|
|
3631
|
+
else ""
|
|
3632
|
+
)
|
|
3624
3633
|
this = self.sql(expression, "this")
|
|
3625
3634
|
this = f" {this}" if this else ""
|
|
3626
3635
|
|
|
3627
|
-
return f"ALTER {kind}{exists}{only}{this}{on_cluster}{check}{self.sep()}{actions_sql}{not_valid}{options}"
|
|
3636
|
+
return f"ALTER {kind}{exists}{only}{this}{on_cluster}{check}{self.sep()}{actions_sql}{not_valid}{options}{cascade}"
|
|
3628
3637
|
|
|
3629
3638
|
def altersession_sql(self, expression: exp.AlterSession) -> str:
|
|
3630
3639
|
items_sql = self.expressions(expression, flat=True)
|
|
@@ -19,10 +19,15 @@ def optimize_joins(expression):
|
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
21
|
for select in expression.find_all(exp.Select):
|
|
22
|
+
joins = select.args.get("joins", [])
|
|
23
|
+
|
|
24
|
+
if not _is_reorderable(joins):
|
|
25
|
+
continue
|
|
26
|
+
|
|
22
27
|
references = {}
|
|
23
28
|
cross_joins = []
|
|
24
29
|
|
|
25
|
-
for join in
|
|
30
|
+
for join in joins:
|
|
26
31
|
tables = other_table_names(join)
|
|
27
32
|
|
|
28
33
|
if tables:
|
|
@@ -59,11 +64,20 @@ def reorder_joins(expression):
|
|
|
59
64
|
"""
|
|
60
65
|
for from_ in expression.find_all(exp.From):
|
|
61
66
|
parent = from_.parent
|
|
62
|
-
joins =
|
|
63
|
-
|
|
67
|
+
joins = parent.args.get("joins", [])
|
|
68
|
+
|
|
69
|
+
if not _is_reorderable(joins):
|
|
70
|
+
continue
|
|
71
|
+
|
|
72
|
+
joins_by_name = {join.alias_or_name: join for join in joins}
|
|
73
|
+
dag = {name: other_table_names(join) for name, join in joins_by_name.items()}
|
|
64
74
|
parent.set(
|
|
65
75
|
"joins",
|
|
66
|
-
[
|
|
76
|
+
[
|
|
77
|
+
joins_by_name[name]
|
|
78
|
+
for name in tsort(dag)
|
|
79
|
+
if name != from_.alias_or_name and name in joins_by_name
|
|
80
|
+
],
|
|
67
81
|
)
|
|
68
82
|
return expression
|
|
69
83
|
|
|
@@ -90,3 +104,23 @@ def normalize(expression):
|
|
|
90
104
|
def other_table_names(join: exp.Join) -> t.Set[str]:
|
|
91
105
|
on = join.args.get("on")
|
|
92
106
|
return exp.column_table_names(on, join.alias_or_name) if on else set()
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _is_reorderable(joins: t.List[exp.Join]) -> bool:
|
|
110
|
+
"""
|
|
111
|
+
Checks if joins can be reordered without changing query semantics.
|
|
112
|
+
|
|
113
|
+
Joins with a side (LEFT, RIGHT, FULL) cannot be reordered easily,
|
|
114
|
+
the order affects which rows are included in the result.
|
|
115
|
+
|
|
116
|
+
Example:
|
|
117
|
+
>>> from sqlglot import parse_one, exp
|
|
118
|
+
>>> from sqlglot.optimizer.optimize_joins import _is_reorderable
|
|
119
|
+
>>> ast = parse_one("SELECT * FROM x JOIN y ON x.id = y.id JOIN z ON y.id = z.id")
|
|
120
|
+
>>> _is_reorderable(ast.find(exp.Select).args.get("joins", []))
|
|
121
|
+
True
|
|
122
|
+
>>> ast = parse_one("SELECT * FROM x LEFT JOIN y ON x.id = y.id JOIN z ON y.id = z.id")
|
|
123
|
+
>>> _is_reorderable(ast.find(exp.Select).args.get("joins", []))
|
|
124
|
+
False
|
|
125
|
+
"""
|
|
126
|
+
return not any(join.side for join in joins)
|