polyglot-sql 0.5.1__tar.gz → 0.5.3__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.
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/Cargo.lock +5 -5
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/Cargo.toml +1 -1
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/PKG-INFO +49 -4
- {polyglot_sql-0.5.1/crates/polyglot-sql-python → polyglot_sql-0.5.3}/README.md +48 -3
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/Cargo.toml +1 -1
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/README.md +60 -5
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/generator.rs +19 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/lib.rs +3 -3
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/lineage.rs +22 -2
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +43 -7
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/parser.rs +28 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/query_analysis.rs +604 -9
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/scope.rs +5 -1
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/traversal.rs +15 -2
- polyglot_sql-0.5.3/crates/polyglot-sql/tests/query_analysis.rs +515 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/tsql_regression.rs +47 -1
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3/crates/polyglot-sql-python}/README.md +48 -3
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/docs/index.md +55 -3
- polyglot_sql-0.5.3/crates/polyglot-sql-python/tests/test_query_analysis.py +97 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/python/polyglot_sql/__init__.pyi +6 -1
- polyglot_sql-0.5.1/crates/polyglot-sql/tests/query_analysis.rs +0 -143
- polyglot_sql-0.5.1/crates/polyglot-sql-python/tests/test_query_analysis.py +0 -45
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/benches/in_list.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/benches/parsing.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/benches/transpile.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/examples/bench_json.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/ast_transforms.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/builder.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/bigquery.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/clickhouse.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/databricks.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/datafusion.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/duckdb.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/exasol.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/fabric.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/hive.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/mod.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/mysql.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/oracle.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/postgres.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/presto.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/snowflake.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/spark.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/sqlite.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/teradata.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/trino.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/dialects/tsql.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/diff.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/error.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/expressions.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/function_catalog.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/function_registry.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/helper.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/openlineage.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/annotate_types.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/canonicalize.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/mod.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/simplify.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/subquery.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/planner.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/resolver.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/schema.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/time.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/tokens.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/transforms.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/trie.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/validation/tests.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/validation.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/analyze_failures.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/clickhouse_regression.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/common/known_failures.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/common/mod.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/common/test_runner.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/data_type_api.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/deep_nesting_regression.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/dialect_matrix.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/error_handling.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/fabric_regression.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/fabric_tpch_regression.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/issue201_regression_test.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/issue210_regression_test.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/issue226_regression_test.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/issue227_strict_unsupported.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/postgres_sqlite_regression.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/snowflake_regression_test.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/sqlglot_compat.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/tpch_transpile_stack.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/tests/transform_regression.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-function-catalogs/README.md +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/Cargo.toml +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/docs/api.md +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/mkdocs.yml +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/dialects.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/diff.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/errors.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/expr.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/expr_types.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/format.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/generate.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/helpers.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/lib.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/lineage.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/openlineage.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/optimize.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/parse.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/query_analysis.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/transforms.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/transpile.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/types.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/src/validate.rs +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/tests/conftest.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/tests/test_compat.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/tests/test_expression.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/tests/test_format.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/tests/test_lineage.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/tests/test_optimize.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/tests/test_parse.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/tests/test_transforms.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql-python/uv.lock +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/pyproject.toml +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/python/polyglot_sql/__init__.py +0 -0
- {polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/python/polyglot_sql/py.typed +0 -0
|
@@ -605,7 +605,7 @@ dependencies = [
|
|
|
605
605
|
|
|
606
606
|
[[package]]
|
|
607
607
|
name = "polyglot-sql"
|
|
608
|
-
version = "0.5.
|
|
608
|
+
version = "0.5.3"
|
|
609
609
|
dependencies = [
|
|
610
610
|
"criterion",
|
|
611
611
|
"once_cell",
|
|
@@ -621,7 +621,7 @@ dependencies = [
|
|
|
621
621
|
|
|
622
622
|
[[package]]
|
|
623
623
|
name = "polyglot-sql-ffi"
|
|
624
|
-
version = "0.5.
|
|
624
|
+
version = "0.5.3"
|
|
625
625
|
dependencies = [
|
|
626
626
|
"cbindgen",
|
|
627
627
|
"polyglot-sql",
|
|
@@ -631,11 +631,11 @@ dependencies = [
|
|
|
631
631
|
|
|
632
632
|
[[package]]
|
|
633
633
|
name = "polyglot-sql-function-catalogs"
|
|
634
|
-
version = "0.5.
|
|
634
|
+
version = "0.5.3"
|
|
635
635
|
|
|
636
636
|
[[package]]
|
|
637
637
|
name = "polyglot-sql-python"
|
|
638
|
-
version = "0.5.
|
|
638
|
+
version = "0.5.3"
|
|
639
639
|
dependencies = [
|
|
640
640
|
"polyglot-sql",
|
|
641
641
|
"pyo3",
|
|
@@ -646,7 +646,7 @@ dependencies = [
|
|
|
646
646
|
|
|
647
647
|
[[package]]
|
|
648
648
|
name = "polyglot-sql-wasm"
|
|
649
|
-
version = "0.5.
|
|
649
|
+
version = "0.5.3"
|
|
650
650
|
dependencies = [
|
|
651
651
|
"console_error_panic_hook",
|
|
652
652
|
"js-sys",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: polyglot-sql
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.3
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -125,22 +125,67 @@ emission are intentionally out of scope.
|
|
|
125
125
|
|
|
126
126
|
```python
|
|
127
127
|
analysis = polyglot_sql.analyze_query(
|
|
128
|
-
"
|
|
128
|
+
"WITH base AS (SELECT id, amount FROM orders) SELECT * FROM base",
|
|
129
129
|
{
|
|
130
130
|
"dialect": "generic",
|
|
131
131
|
"schema": {
|
|
132
132
|
"tables": [
|
|
133
133
|
{
|
|
134
134
|
"name": "orders",
|
|
135
|
-
"columns": [
|
|
135
|
+
"columns": [
|
|
136
|
+
{"name": "id", "type": "INT", "nullable": False},
|
|
137
|
+
{"name": "amount", "type": "DECIMAL(10,2)", "nullable": True},
|
|
138
|
+
],
|
|
136
139
|
}
|
|
137
140
|
]
|
|
138
141
|
},
|
|
139
142
|
},
|
|
140
143
|
)
|
|
141
|
-
print(analysis["
|
|
144
|
+
print(analysis["cteFacts"][0]["bodySql"]) # "SELECT id, amount FROM orders"
|
|
145
|
+
print(analysis["starProjections"][0]["expandedColumns"]) # ["id", "amount"]
|
|
146
|
+
print(analysis["projections"][0]["nullability"]) # "non_null"
|
|
147
|
+
print(analysis["baseTables"][0]["name"]) # "orders"
|
|
142
148
|
```
|
|
143
149
|
|
|
150
|
+
`analysis["relations"]` reports sources visible in the analyzed scope.
|
|
151
|
+
`analysis["baseTables"]` reports deduplicated physical table dependencies across
|
|
152
|
+
nested CTEs, derived tables, subqueries, and set-operation branches. Validation
|
|
153
|
+
uses broad type families, while query analysis preserves parseable detailed
|
|
154
|
+
schema type strings for projection `typeHint` values. `analysis["cteFacts"]`
|
|
155
|
+
reports top-level CTE definitions, `analysis["starProjections"]` records the
|
|
156
|
+
original star projections and schema-expanded columns, and each projection has
|
|
157
|
+
conservative `nullability`: `"non_null"`, `"nullable"`, or `"unknown"`.
|
|
158
|
+
|
|
159
|
+
Validation schema dictionaries use:
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
schema = {
|
|
163
|
+
"strict": True,
|
|
164
|
+
"tables": [
|
|
165
|
+
{
|
|
166
|
+
"name": "orders",
|
|
167
|
+
"schema": "analytics",
|
|
168
|
+
"aliases": ["o"],
|
|
169
|
+
"primaryKey": ["id"],
|
|
170
|
+
"uniqueKeys": [["external_id"]],
|
|
171
|
+
"foreignKeys": [
|
|
172
|
+
{
|
|
173
|
+
"columns": ["customer_id"],
|
|
174
|
+
"references": {"table": "customers", "columns": ["id"]},
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"columns": [
|
|
178
|
+
{"name": "id", "type": "INT", "nullable": False, "primaryKey": True},
|
|
179
|
+
{"name": "amount", "type": "DECIMAL(10,2)", "nullable": True},
|
|
180
|
+
],
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Use the `type` key for column types. `dataType` / `data_type` are not accepted
|
|
187
|
+
aliases in this payload.
|
|
188
|
+
|
|
144
189
|
## API Reference
|
|
145
190
|
|
|
146
191
|
All functions are exported from `polyglot_sql`.
|
|
@@ -98,22 +98,67 @@ emission are intentionally out of scope.
|
|
|
98
98
|
|
|
99
99
|
```python
|
|
100
100
|
analysis = polyglot_sql.analyze_query(
|
|
101
|
-
"
|
|
101
|
+
"WITH base AS (SELECT id, amount FROM orders) SELECT * FROM base",
|
|
102
102
|
{
|
|
103
103
|
"dialect": "generic",
|
|
104
104
|
"schema": {
|
|
105
105
|
"tables": [
|
|
106
106
|
{
|
|
107
107
|
"name": "orders",
|
|
108
|
-
"columns": [
|
|
108
|
+
"columns": [
|
|
109
|
+
{"name": "id", "type": "INT", "nullable": False},
|
|
110
|
+
{"name": "amount", "type": "DECIMAL(10,2)", "nullable": True},
|
|
111
|
+
],
|
|
109
112
|
}
|
|
110
113
|
]
|
|
111
114
|
},
|
|
112
115
|
},
|
|
113
116
|
)
|
|
114
|
-
print(analysis["
|
|
117
|
+
print(analysis["cteFacts"][0]["bodySql"]) # "SELECT id, amount FROM orders"
|
|
118
|
+
print(analysis["starProjections"][0]["expandedColumns"]) # ["id", "amount"]
|
|
119
|
+
print(analysis["projections"][0]["nullability"]) # "non_null"
|
|
120
|
+
print(analysis["baseTables"][0]["name"]) # "orders"
|
|
115
121
|
```
|
|
116
122
|
|
|
123
|
+
`analysis["relations"]` reports sources visible in the analyzed scope.
|
|
124
|
+
`analysis["baseTables"]` reports deduplicated physical table dependencies across
|
|
125
|
+
nested CTEs, derived tables, subqueries, and set-operation branches. Validation
|
|
126
|
+
uses broad type families, while query analysis preserves parseable detailed
|
|
127
|
+
schema type strings for projection `typeHint` values. `analysis["cteFacts"]`
|
|
128
|
+
reports top-level CTE definitions, `analysis["starProjections"]` records the
|
|
129
|
+
original star projections and schema-expanded columns, and each projection has
|
|
130
|
+
conservative `nullability`: `"non_null"`, `"nullable"`, or `"unknown"`.
|
|
131
|
+
|
|
132
|
+
Validation schema dictionaries use:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
schema = {
|
|
136
|
+
"strict": True,
|
|
137
|
+
"tables": [
|
|
138
|
+
{
|
|
139
|
+
"name": "orders",
|
|
140
|
+
"schema": "analytics",
|
|
141
|
+
"aliases": ["o"],
|
|
142
|
+
"primaryKey": ["id"],
|
|
143
|
+
"uniqueKeys": [["external_id"]],
|
|
144
|
+
"foreignKeys": [
|
|
145
|
+
{
|
|
146
|
+
"columns": ["customer_id"],
|
|
147
|
+
"references": {"table": "customers", "columns": ["id"]},
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
"columns": [
|
|
151
|
+
{"name": "id", "type": "INT", "nullable": False, "primaryKey": True},
|
|
152
|
+
{"name": "amount", "type": "DECIMAL(10,2)", "nullable": True},
|
|
153
|
+
],
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Use the `type` key for column types. `dataType` / `data_type` are not accepted
|
|
160
|
+
aliases in this payload.
|
|
161
|
+
|
|
117
162
|
## API Reference
|
|
118
163
|
|
|
119
164
|
All functions are exported from `polyglot_sql`.
|
|
@@ -106,7 +106,7 @@ thiserror = { workspace = true }
|
|
|
106
106
|
unicode-segmentation = { workspace = true }
|
|
107
107
|
stacker = { version = "0.1", optional = true }
|
|
108
108
|
ts-rs = { version = "12.0", features = ["serde-compat"], optional = true }
|
|
109
|
-
polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.5.
|
|
109
|
+
polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.5.3", optional = true, default-features = false }
|
|
110
110
|
|
|
111
111
|
[dev-dependencies]
|
|
112
112
|
pretty_assertions = "1.4"
|
|
@@ -313,23 +313,78 @@ Schema-aware validation emits stable codes such as:
|
|
|
313
313
|
### Compact Query Analysis
|
|
314
314
|
|
|
315
315
|
Use `analyze_query` when you need high-level facts without consuming the full AST
|
|
316
|
-
or full lineage graph
|
|
316
|
+
or full lineage graph. `relations` reports sources visible in the analyzed
|
|
317
|
+
scope, while `base_tables` reports deduplicated physical table dependencies
|
|
318
|
+
across CTEs, derived tables, subqueries, and set-operation branches. When a
|
|
319
|
+
`ValidationSchema` is supplied, detailed type strings such as `DECIMAL(10,2)`
|
|
320
|
+
are preserved in projection `type_hint` values when parseable.
|
|
321
|
+
`cte_facts` reports top-level CTE names, declared columns, original CTE body SQL,
|
|
322
|
+
and CTE output columns. `star_projections` reports the original top-level star
|
|
323
|
+
projection index, optional table qualifier, and schema-expanded columns when
|
|
324
|
+
known. Each projection also includes conservative `nullability`:
|
|
325
|
+
`non_null`, `nullable`, or `unknown`.
|
|
317
326
|
|
|
318
327
|
```rust
|
|
319
|
-
use polyglot_sql::{
|
|
328
|
+
use polyglot_sql::{
|
|
329
|
+
analyze_query, AnalyzeQueryOptions, DialectType, ProjectionNullability, QueryShape,
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
let schema: polyglot_sql::ValidationSchema = serde_json::from_value(serde_json::json!({
|
|
333
|
+
"tables": [{
|
|
334
|
+
"name": "orders",
|
|
335
|
+
"columns": [
|
|
336
|
+
{"name": "id", "type": "INT", "nullable": false},
|
|
337
|
+
{"name": "amount", "type": "DECIMAL(10,2)", "nullable": true}
|
|
338
|
+
]
|
|
339
|
+
}]
|
|
340
|
+
})).unwrap();
|
|
320
341
|
|
|
321
342
|
let analysis = analyze_query(
|
|
322
|
-
"
|
|
343
|
+
"WITH base AS (SELECT id, amount FROM orders) SELECT * FROM base",
|
|
323
344
|
AnalyzeQueryOptions {
|
|
324
345
|
dialect: DialectType::Generic,
|
|
325
|
-
schema:
|
|
346
|
+
schema: Some(schema),
|
|
326
347
|
},
|
|
327
348
|
).unwrap();
|
|
328
349
|
|
|
329
350
|
assert_eq!(analysis.shape, QueryShape::Select);
|
|
330
|
-
assert_eq!(analysis.
|
|
351
|
+
assert_eq!(analysis.cte_facts[0].name, "base");
|
|
352
|
+
assert_eq!(analysis.cte_facts[0].body_sql, "SELECT id, amount FROM orders");
|
|
353
|
+
assert_eq!(analysis.star_projections[0].expanded_columns, vec!["id", "amount"]);
|
|
354
|
+
assert_eq!(analysis.projections[0].nullability, ProjectionNullability::NonNull);
|
|
355
|
+
assert_eq!(analysis.base_tables[0].name, "orders");
|
|
331
356
|
```
|
|
332
357
|
|
|
358
|
+
External JSON schemas use this shape:
|
|
359
|
+
|
|
360
|
+
```json
|
|
361
|
+
{
|
|
362
|
+
"strict": true,
|
|
363
|
+
"tables": [
|
|
364
|
+
{
|
|
365
|
+
"name": "orders",
|
|
366
|
+
"schema": "analytics",
|
|
367
|
+
"aliases": ["o"],
|
|
368
|
+
"primaryKey": ["id"],
|
|
369
|
+
"uniqueKeys": [["external_id"]],
|
|
370
|
+
"foreignKeys": [
|
|
371
|
+
{
|
|
372
|
+
"columns": ["customer_id"],
|
|
373
|
+
"references": { "table": "customers", "columns": ["id"] }
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
"columns": [
|
|
377
|
+
{ "name": "id", "type": "INT", "nullable": false, "primaryKey": true },
|
|
378
|
+
{ "name": "amount", "type": "DECIMAL(10,2)", "nullable": true }
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Use the `type` key for column types in JSON. `dataType` / `data_type` are not
|
|
386
|
+
accepted aliases.
|
|
387
|
+
|
|
333
388
|
### Tokenize
|
|
334
389
|
|
|
335
390
|
Access the raw token stream with full source position spans. Each token carries a `Span` with byte offsets and line/column numbers.
|
|
@@ -12189,6 +12189,7 @@ impl Generator {
|
|
|
12189
12189
|
let is_character_set = name_str == Some("CHARACTER SET");
|
|
12190
12190
|
let is_names = name_str == Some("NAMES");
|
|
12191
12191
|
let is_collate = name_str == Some("COLLATE");
|
|
12192
|
+
let is_identity_insert = name_str == Some("IDENTITY_INSERT");
|
|
12192
12193
|
let is_value_only =
|
|
12193
12194
|
matches!(&item.value, Expression::Identifier(id) if id.name.is_empty());
|
|
12194
12195
|
|
|
@@ -12216,6 +12217,11 @@ impl Generator {
|
|
|
12216
12217
|
self.write_keyword("COLLATE");
|
|
12217
12218
|
self.write_space();
|
|
12218
12219
|
self.generate_set_value(&item.value)?;
|
|
12220
|
+
} else if is_identity_insert {
|
|
12221
|
+
// T-SQL: SET IDENTITY_INSERT <table> ON|OFF
|
|
12222
|
+
self.write_keyword("IDENTITY_INSERT");
|
|
12223
|
+
self.write_space();
|
|
12224
|
+
self.generate_identity_insert_value(&item.value)?;
|
|
12219
12225
|
} else if has_variable_kind {
|
|
12220
12226
|
// Output: SET [VARIABLE] <name> = <value>
|
|
12221
12227
|
// VARIABLE keyword already written above if dialect requires it
|
|
@@ -12253,6 +12259,19 @@ impl Generator {
|
|
|
12253
12259
|
Ok(())
|
|
12254
12260
|
}
|
|
12255
12261
|
|
|
12262
|
+
fn generate_identity_insert_value(&mut self, value: &Expression) -> Result<()> {
|
|
12263
|
+
if let Expression::Tuple(tuple) = value {
|
|
12264
|
+
if tuple.expressions.len() == 2 {
|
|
12265
|
+
self.generate_expression(&tuple.expressions[0])?;
|
|
12266
|
+
self.write_space();
|
|
12267
|
+
self.generate_set_value(&tuple.expressions[1])?;
|
|
12268
|
+
return Ok(());
|
|
12269
|
+
}
|
|
12270
|
+
}
|
|
12271
|
+
|
|
12272
|
+
self.generate_set_value(value)
|
|
12273
|
+
}
|
|
12274
|
+
|
|
12256
12275
|
/// Generate a SET statement value, writing keyword values (DEFAULT, ON, OFF)
|
|
12257
12276
|
/// directly to avoid reserved keyword quoting.
|
|
12258
12277
|
fn generate_set_value(&mut self, value: &Expression) -> Result<()> {
|
|
@@ -93,9 +93,9 @@ pub use optimizer::{
|
|
|
93
93
|
pub use parser::Parser;
|
|
94
94
|
#[cfg(all(feature = "semantic", feature = "generate"))]
|
|
95
95
|
pub use query_analysis::{
|
|
96
|
-
analyze_query, AnalyzeQueryOptions, ColumnReferenceFact,
|
|
97
|
-
|
|
98
|
-
TransformKind,
|
|
96
|
+
analyze_query, AnalyzeQueryOptions, ColumnReferenceFact, CteFact, ProjectionFact,
|
|
97
|
+
ProjectionNullability, QueryAnalysis, QueryShape, ReferenceConfidence, RelationFact,
|
|
98
|
+
SetOperationBranchFact, SetOperationFact, StarProjectionFact, TransformKind,
|
|
99
99
|
};
|
|
100
100
|
#[cfg(feature = "semantic")]
|
|
101
101
|
pub use resolver::{is_column_ambiguous, resolve_column, Resolver, ResolverError, ResolverResult};
|
|
@@ -772,12 +772,32 @@ fn to_node_inner(
|
|
|
772
772
|
apply_scope_context(&mut node, scope, source_name, reference_node_name);
|
|
773
773
|
|
|
774
774
|
// 5. Star handling — add downstream for each source
|
|
775
|
-
if
|
|
775
|
+
if let Expression::Star(star) = &select_expr {
|
|
776
|
+
let star_table = star
|
|
777
|
+
.table
|
|
778
|
+
.as_ref()
|
|
779
|
+
.map(|identifier| identifier.name.as_str());
|
|
776
780
|
for (name, source_info) in &scope.sources {
|
|
781
|
+
if let Some(star_table) = star_table {
|
|
782
|
+
let table_matches = name.eq_ignore_ascii_case(star_table)
|
|
783
|
+
|| source_info
|
|
784
|
+
.alias
|
|
785
|
+
.as_deref()
|
|
786
|
+
.is_some_and(|alias| alias.eq_ignore_ascii_case(star_table))
|
|
787
|
+
|| matches!(
|
|
788
|
+
&source_info.expression,
|
|
789
|
+
Expression::Table(table_ref)
|
|
790
|
+
if table_name_from_table_ref(table_ref).eq_ignore_ascii_case(star_table)
|
|
791
|
+
);
|
|
792
|
+
if !table_matches {
|
|
793
|
+
continue;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
777
797
|
let mut child = LineageNode::new(
|
|
778
798
|
format!("{}.*", name),
|
|
779
799
|
Expression::Star(crate::expressions::Star {
|
|
780
|
-
table:
|
|
800
|
+
table: star.table.clone(),
|
|
781
801
|
except: None,
|
|
782
802
|
replace: None,
|
|
783
803
|
rename: None,
|
{polyglot_sql-0.5.1 → polyglot_sql-0.5.3}/crates/polyglot-sql/src/optimizer/qualify_columns.rs
RENAMED
|
@@ -653,21 +653,23 @@ fn expand_stars(
|
|
|
653
653
|
|
|
654
654
|
for expr in &select.expressions {
|
|
655
655
|
match expr {
|
|
656
|
-
Expression::Star(
|
|
656
|
+
Expression::Star(star) => {
|
|
657
657
|
has_star = true;
|
|
658
|
-
|
|
659
|
-
|
|
658
|
+
if let Some(table) = &star.table {
|
|
659
|
+
let table_name = &table.name;
|
|
660
|
+
if !ordered_sources.contains(table_name) {
|
|
661
|
+
return Err(QualifyColumnsError::UnknownTable(table_name.clone()));
|
|
662
|
+
}
|
|
663
|
+
if let Ok(columns) = resolver.get_source_columns(table_name) {
|
|
660
664
|
if columns.contains(&"*".to_string()) || columns.is_empty() {
|
|
661
665
|
return Ok(());
|
|
662
666
|
}
|
|
663
667
|
for col_name in &columns {
|
|
664
668
|
if coalesced_columns.contains(col_name) {
|
|
665
|
-
// Already emitted as COALESCE, skip
|
|
666
669
|
continue;
|
|
667
670
|
}
|
|
668
671
|
if let Some(tables) = column_tables.get(col_name) {
|
|
669
|
-
if tables.contains(
|
|
670
|
-
// Emit COALESCE and mark as coalesced
|
|
672
|
+
if tables.contains(table_name) {
|
|
671
673
|
coalesced_columns.insert(col_name.clone());
|
|
672
674
|
let coalesce = make_coalesce(col_name, tables);
|
|
673
675
|
new_selections.push(Expression::Alias(Box::new(Alias {
|
|
@@ -684,7 +686,41 @@ fn expand_stars(
|
|
|
684
686
|
}
|
|
685
687
|
}
|
|
686
688
|
new_selections
|
|
687
|
-
.push(create_qualified_column(col_name, Some(
|
|
689
|
+
.push(create_qualified_column(col_name, Some(table_name)));
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
} else {
|
|
693
|
+
for source_name in &ordered_sources {
|
|
694
|
+
if let Ok(columns) = resolver.get_source_columns(source_name) {
|
|
695
|
+
if columns.contains(&"*".to_string()) || columns.is_empty() {
|
|
696
|
+
return Ok(());
|
|
697
|
+
}
|
|
698
|
+
for col_name in &columns {
|
|
699
|
+
if coalesced_columns.contains(col_name) {
|
|
700
|
+
// Already emitted as COALESCE, skip
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
if let Some(tables) = column_tables.get(col_name) {
|
|
704
|
+
if tables.contains(source_name) {
|
|
705
|
+
// Emit COALESCE and mark as coalesced
|
|
706
|
+
coalesced_columns.insert(col_name.clone());
|
|
707
|
+
let coalesce = make_coalesce(col_name, tables);
|
|
708
|
+
new_selections.push(Expression::Alias(Box::new(Alias {
|
|
709
|
+
this: coalesce,
|
|
710
|
+
alias: Identifier::new(col_name),
|
|
711
|
+
column_aliases: vec![],
|
|
712
|
+
alias_explicit_as: false,
|
|
713
|
+
alias_keyword: None,
|
|
714
|
+
pre_alias_comments: vec![],
|
|
715
|
+
trailing_comments: vec![],
|
|
716
|
+
inferred_type: None,
|
|
717
|
+
})));
|
|
718
|
+
continue;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
new_selections
|
|
722
|
+
.push(create_qualified_column(col_name, Some(source_name)));
|
|
723
|
+
}
|
|
688
724
|
}
|
|
689
725
|
}
|
|
690
726
|
}
|
|
@@ -24377,6 +24377,34 @@ impl Parser {
|
|
|
24377
24377
|
return self.fallback_to_command(statement_start);
|
|
24378
24378
|
}
|
|
24379
24379
|
|
|
24380
|
+
// T-SQL: SET IDENTITY_INSERT schema.table ON|OFF.
|
|
24381
|
+
if matches!(
|
|
24382
|
+
self.config.dialect,
|
|
24383
|
+
Some(crate::dialects::DialectType::TSQL)
|
|
24384
|
+
) && self.match_identifier("IDENTITY_INSERT")
|
|
24385
|
+
{
|
|
24386
|
+
let table = self.parse_table_ref()?;
|
|
24387
|
+
let state = if self.check(TokenType::On) || self.check_keyword_text("OFF") {
|
|
24388
|
+
self.advance().text.to_uppercase()
|
|
24389
|
+
} else {
|
|
24390
|
+
return Err(self.parse_error("Expected ON or OFF after SET IDENTITY_INSERT table"));
|
|
24391
|
+
};
|
|
24392
|
+
|
|
24393
|
+
items.push(SetItem {
|
|
24394
|
+
name: Expression::Identifier(Identifier::new("IDENTITY_INSERT")),
|
|
24395
|
+
value: Expression::Tuple(Box::new(crate::expressions::Tuple {
|
|
24396
|
+
expressions: vec![
|
|
24397
|
+
Expression::Table(Box::new(table)),
|
|
24398
|
+
Expression::Identifier(Identifier::new(state)),
|
|
24399
|
+
],
|
|
24400
|
+
})),
|
|
24401
|
+
kind: None,
|
|
24402
|
+
no_equals: true,
|
|
24403
|
+
});
|
|
24404
|
+
|
|
24405
|
+
return Ok(Expression::SetStatement(Box::new(SetStatement { items })));
|
|
24406
|
+
}
|
|
24407
|
+
|
|
24380
24408
|
// ClickHouse: SET DEFAULT ROLE ... TO user - parse as command
|
|
24381
24409
|
if matches!(
|
|
24382
24410
|
self.config.dialect,
|