polyglot-sql 0.14.2__tar.gz → 0.14.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.14.2 → polyglot_sql-0.14.3}/Cargo.lock +7 -7
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/Cargo.toml +1 -1
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/PKG-INFO +1 -1
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/Cargo.toml +2 -2
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/README.md +4 -4
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/binding.rs +13 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/lineage.rs +42 -169
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/annotate_types.rs +10 -13
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +10 -57
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/query_analysis/column_uses.rs +139 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/query_analysis.rs +34 -2
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/resolver.rs +5 -16
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/schema.rs +55 -41
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/scope.rs +21 -4
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/validation/tests.rs +109 -1
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/validation.rs +171 -203
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/query_analysis.rs +273 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-function-catalogs/README.md +1 -1
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/python/polyglot_sql/analysis_types.py +1 -1
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/README.md +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/benches/allocation_hotspots.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/benches/ast_traversal.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/benches/common/mod.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/benches/in_list.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/benches/lineage.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/benches/parsing.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/benches/performance_hotspots.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/benches/transpile.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/examples/bench_json.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/examples/performance_review.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/ast_children.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/ast_json.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/ast_mutation.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/ast_transforms.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/builder/mod.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/builder/plan.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/bigquery.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/clickhouse.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/databricks.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/datafusion.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/duckdb.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/exasol.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/fabric.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/hana.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/hive.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/mod.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/mysql.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/normalization/aggregates.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/normalization/collections.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/normalization/duckdb.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/normalization/hana.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/normalization/json.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/normalization/mod.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/normalization/operators.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/normalization/postgres_interval.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/normalization/scalar.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/normalization/statements.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/normalization/temporal.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/normalization/types.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/normalization/vertica.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/oracle.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/postgres.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/presto.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/snowflake.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/spark.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/sqlite.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/teradata.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/trino.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/tsql.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/dialects/vertica.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/diff.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/error.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/expressions/explain.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/expressions.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/format_tokens.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/function_catalog.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/function_registry.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/generator/explain.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/generator/pipes.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/generator/routines.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/generator.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/guard.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/helper.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/lib.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/openlineage.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/canonicalize.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/mod.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/set_operation_types.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/simplify.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/subquery.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/parser/explain.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/parser/pipes.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/parser/routines.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/parser.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/planner.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/set_operation.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/time.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/tokens.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/transforms.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/traversal.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/trie.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/validation/semantics.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/analyze_failures.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/clickhouse_regression.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/common/known_failures.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/common/mod.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/common/test_runner.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/common/upstream_semantic_exceptions.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/create_view_security_comment_regression.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/hana/ddl.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/hana/dml.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/hana/functions.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/hana/identity.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/hana/select.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/hana/types.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/vertica/identity.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/vertica/transpilation.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/custom_fixtures/vertica/types.json +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/data_type_api.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/deep_nesting_regression.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/deserialize_payloads.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/dialect_matrix.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/duckdb_decimal_precision.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/duckdb_integer_division.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/duckdb_json_arrow_context.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/duckdb_order_by_all.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/duckdb_regex_operators.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/duckdb_unreserved_relation_aliases.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/error_handling.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/fabric_regression.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/fabric_tpch_regression.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/fixture_update_regression.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/is_predicate_precedence.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/mod_precedence.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/numeric_exponent_boundaries.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/oracle_data_types_regression.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/oracle_flashback.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/postgres_explain_options.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/postgres_regexp_clickhouse.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/postgres_sqlite_regression.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/query_analysis_regression.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/quoted_relation_columns.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/snowflake_regression_test.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/sqlglot_compat.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/tpch_transpile_stack.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/transform_regression.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/tsql_regression.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/tests/unicode_token_ranges.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-ast-derive/Cargo.toml +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-ast-derive/src/lib.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/Cargo.toml +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/README.md +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/docs/api.md +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/docs/index.md +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/mkdocs.yml +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/builders.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/dialects.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/diff.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/errors.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/expr.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/expr_types.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/format.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/generate.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/helpers.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/lib.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/lineage.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/openlineage.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/optimize.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/parse.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/query_analysis.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/shared_expression.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/transforms.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/transpile.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/types.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/src/validate.rs +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/conftest.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_builders.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_compat.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_duckdb_datafusion_execution.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_duckdb_regex_execution.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_expression.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_format.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_lineage.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_optimize.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_parse.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_query_analysis.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_shared_expression.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_transforms.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql-python/uv.lock +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/pyproject.toml +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/python/polyglot_sql/__init__.py +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/python/polyglot_sql/__init__.pyi +0 -0
- {polyglot_sql-0.14.2 → polyglot_sql-0.14.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.14.
|
|
608
|
+
version = "0.14.3"
|
|
609
609
|
dependencies = [
|
|
610
610
|
"criterion",
|
|
611
611
|
"once_cell",
|
|
@@ -623,7 +623,7 @@ dependencies = [
|
|
|
623
623
|
|
|
624
624
|
[[package]]
|
|
625
625
|
name = "polyglot-sql-ast-derive"
|
|
626
|
-
version = "0.14.
|
|
626
|
+
version = "0.14.3"
|
|
627
627
|
dependencies = [
|
|
628
628
|
"proc-macro2",
|
|
629
629
|
"quote",
|
|
@@ -632,7 +632,7 @@ dependencies = [
|
|
|
632
632
|
|
|
633
633
|
[[package]]
|
|
634
634
|
name = "polyglot-sql-ffi"
|
|
635
|
-
version = "0.14.
|
|
635
|
+
version = "0.14.3"
|
|
636
636
|
dependencies = [
|
|
637
637
|
"cbindgen",
|
|
638
638
|
"polyglot-sql",
|
|
@@ -642,11 +642,11 @@ dependencies = [
|
|
|
642
642
|
|
|
643
643
|
[[package]]
|
|
644
644
|
name = "polyglot-sql-function-catalogs"
|
|
645
|
-
version = "0.14.
|
|
645
|
+
version = "0.14.3"
|
|
646
646
|
|
|
647
647
|
[[package]]
|
|
648
648
|
name = "polyglot-sql-python"
|
|
649
|
-
version = "0.14.
|
|
649
|
+
version = "0.14.3"
|
|
650
650
|
dependencies = [
|
|
651
651
|
"polyglot-sql",
|
|
652
652
|
"pyo3",
|
|
@@ -657,7 +657,7 @@ dependencies = [
|
|
|
657
657
|
|
|
658
658
|
[[package]]
|
|
659
659
|
name = "polyglot-sql-wasi"
|
|
660
|
-
version = "0.14.
|
|
660
|
+
version = "0.14.3"
|
|
661
661
|
dependencies = [
|
|
662
662
|
"polyglot-sql",
|
|
663
663
|
"serde",
|
|
@@ -666,7 +666,7 @@ dependencies = [
|
|
|
666
666
|
|
|
667
667
|
[[package]]
|
|
668
668
|
name = "polyglot-sql-wasm"
|
|
669
|
-
version = "0.14.
|
|
669
|
+
version = "0.14.3"
|
|
670
670
|
dependencies = [
|
|
671
671
|
"console_error_panic_hook",
|
|
672
672
|
"js-sys",
|
|
@@ -103,14 +103,14 @@ function-catalog-all-dialects = [
|
|
|
103
103
|
]
|
|
104
104
|
|
|
105
105
|
[dependencies]
|
|
106
|
-
polyglot-sql-ast-derive = { path = "../polyglot-sql-ast-derive", version = "0.14.
|
|
106
|
+
polyglot-sql-ast-derive = { path = "../polyglot-sql-ast-derive", version = "0.14.3" }
|
|
107
107
|
serde = { workspace = true }
|
|
108
108
|
serde_json = { workspace = true }
|
|
109
109
|
thiserror = { workspace = true }
|
|
110
110
|
unicode-segmentation = { workspace = true }
|
|
111
111
|
stacker = { version = "0.1", optional = true }
|
|
112
112
|
ts-rs = { version = "12.0", features = ["serde-compat"], optional = true }
|
|
113
|
-
polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.14.
|
|
113
|
+
polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.14.3", optional = true, default-features = false }
|
|
114
114
|
|
|
115
115
|
[dev-dependencies]
|
|
116
116
|
pretty_assertions = "1.4"
|
|
@@ -25,12 +25,12 @@ By default, `polyglot-sql` enables the full public API. Parser-only consumers ca
|
|
|
25
25
|
disable default features and opt into only the dialect parsers they need:
|
|
26
26
|
|
|
27
27
|
```toml
|
|
28
|
-
polyglot-sql = { version = "0.14.
|
|
28
|
+
polyglot-sql = { version = "0.14.3", default-features = false }
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
```toml
|
|
32
32
|
polyglot-sql = {
|
|
33
|
-
version = "0.14.
|
|
33
|
+
version = "0.14.3",
|
|
34
34
|
default-features = false,
|
|
35
35
|
features = ["dialect-clickhouse"],
|
|
36
36
|
}
|
|
@@ -44,14 +44,14 @@ Examples:
|
|
|
44
44
|
```toml
|
|
45
45
|
# Parse and generate SQL for one dialect.
|
|
46
46
|
polyglot-sql = {
|
|
47
|
-
version = "0.14.
|
|
47
|
+
version = "0.14.3",
|
|
48
48
|
default-features = false,
|
|
49
49
|
features = ["generate", "dialect-clickhouse"],
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
# Cross-dialect transpilation.
|
|
53
53
|
polyglot-sql = {
|
|
54
|
-
version = "0.14.
|
|
54
|
+
version = "0.14.3",
|
|
55
55
|
default-features = false,
|
|
56
56
|
features = ["transpile", "dialect-clickhouse", "dialect-postgresql"],
|
|
57
57
|
}
|
|
@@ -82,6 +82,19 @@ pub(crate) fn identifier_name(identifier: &crate::expressions::Identifier) -> St
|
|
|
82
82
|
identifier.to_type_field_name()
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/// Render a table path for schema lookup, retaining identifier boundaries and quoting.
|
|
86
|
+
pub(crate) fn schema_table_name(table: &crate::expressions::TableRef) -> String {
|
|
87
|
+
let mut parts = Vec::new();
|
|
88
|
+
if let Some(catalog) = &table.catalog {
|
|
89
|
+
parts.push(identifier_name(catalog));
|
|
90
|
+
}
|
|
91
|
+
if let Some(schema) = &table.schema {
|
|
92
|
+
parts.push(identifier_name(schema));
|
|
93
|
+
}
|
|
94
|
+
parts.push(identifier_name(&table.name));
|
|
95
|
+
parts.join(".")
|
|
96
|
+
}
|
|
97
|
+
|
|
85
98
|
/// Boolean contexts are inline AST fields as well as standalone nodes. Keep
|
|
86
99
|
/// their discovery shared so DML does not silently miss the SELECT checks.
|
|
87
100
|
pub(crate) fn predicates(expression: &Expression) -> Vec<(&'static str, &Expression)> {
|
|
@@ -2740,7 +2740,7 @@ fn attach_virtual_source_dependencies(
|
|
|
2740
2740
|
depth + 1,
|
|
2741
2741
|
);
|
|
2742
2742
|
} else {
|
|
2743
|
-
let non_virtual_sources =
|
|
2743
|
+
let non_virtual_sources = preceding_non_virtual_sources(scope, source_alias);
|
|
2744
2744
|
if non_virtual_sources.len() == 1 {
|
|
2745
2745
|
resolve_qualified_column(
|
|
2746
2746
|
node,
|
|
@@ -2759,45 +2759,43 @@ fn attach_virtual_source_dependencies(
|
|
|
2759
2759
|
}
|
|
2760
2760
|
}
|
|
2761
2761
|
|
|
2762
|
-
fn
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
.alias
|
|
2768
|
-
.as_ref()
|
|
2769
|
-
.map(|a| a.name.clone())
|
|
2770
|
-
.unwrap_or_else(|| table.name.name.clone()),
|
|
2771
|
-
),
|
|
2772
|
-
Expression::Subquery(subquery) => {
|
|
2773
|
-
subquery.alias.as_ref().map(|alias| alias.name.clone())
|
|
2774
|
-
}
|
|
2775
|
-
Expression::Unnest(unnest) => unnest.alias.as_ref().map(|alias| alias.name.clone()),
|
|
2776
|
-
Expression::Alias(alias) if matches!(&alias.this, Expression::Unnest(_)) => {
|
|
2777
|
-
Some(alias.alias.name.clone())
|
|
2778
|
-
}
|
|
2779
|
-
Expression::Alias(alias) if is_query_like_relation(&alias.this) => {
|
|
2780
|
-
Some(alias.alias.name.clone())
|
|
2781
|
-
}
|
|
2782
|
-
Expression::Lateral(lateral) => lateral.alias.clone(),
|
|
2783
|
-
Expression::LateralView(lateral_view) => lateral_view
|
|
2784
|
-
.table_alias
|
|
2762
|
+
pub(crate) fn relation_source_name(expr: &Expression) -> Option<String> {
|
|
2763
|
+
match expr {
|
|
2764
|
+
Expression::Table(table) => Some(
|
|
2765
|
+
table
|
|
2766
|
+
.alias
|
|
2785
2767
|
.as_ref()
|
|
2786
|
-
.
|
|
2787
|
-
.
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
))
|
|
2796
|
-
Expression::Paren(paren) => source_name(&paren.this),
|
|
2797
|
-
_ => None,
|
|
2768
|
+
.map(|a| a.name.clone())
|
|
2769
|
+
.unwrap_or_else(|| table.name.name.clone()),
|
|
2770
|
+
),
|
|
2771
|
+
Expression::Subquery(subquery) => subquery.alias.as_ref().map(|alias| alias.name.clone()),
|
|
2772
|
+
Expression::Unnest(unnest) => unnest.alias.as_ref().map(|alias| alias.name.clone()),
|
|
2773
|
+
Expression::Alias(alias) if matches!(&alias.this, Expression::Unnest(_)) => {
|
|
2774
|
+
Some(alias.alias.name.clone())
|
|
2775
|
+
}
|
|
2776
|
+
Expression::Alias(alias) if is_query_like_relation(&alias.this) => {
|
|
2777
|
+
Some(alias.alias.name.clone())
|
|
2798
2778
|
}
|
|
2779
|
+
Expression::Lateral(lateral) => lateral.alias.clone(),
|
|
2780
|
+
Expression::LateralView(lateral_view) => lateral_view
|
|
2781
|
+
.table_alias
|
|
2782
|
+
.as_ref()
|
|
2783
|
+
.or_else(|| lateral_view.column_aliases.first())
|
|
2784
|
+
.map(|alias| alias.name.clone()),
|
|
2785
|
+
Expression::Pivot(pivot) => Some(pivot_lineage_source_name(
|
|
2786
|
+
&pivot.this,
|
|
2787
|
+
pivot.alias.as_ref().map(|alias| alias.name.as_str()),
|
|
2788
|
+
)),
|
|
2789
|
+
Expression::Unpivot(unpivot) => Some(pivot_lineage_source_name(
|
|
2790
|
+
&unpivot.this,
|
|
2791
|
+
unpivot.alias.as_ref().map(|alias| alias.name.as_str()),
|
|
2792
|
+
)),
|
|
2793
|
+
Expression::Paren(paren) => relation_source_name(&paren.this),
|
|
2794
|
+
_ => None,
|
|
2799
2795
|
}
|
|
2796
|
+
}
|
|
2800
2797
|
|
|
2798
|
+
fn source_names_from_from_join(scope: &Scope) -> Vec<String> {
|
|
2801
2799
|
let effective_expr = match &scope.expression {
|
|
2802
2800
|
Expression::Cte(cte) => &cte.this,
|
|
2803
2801
|
expr => expr,
|
|
@@ -2809,7 +2807,7 @@ fn source_names_from_from_join(scope: &Scope) -> Vec<String> {
|
|
|
2809
2807
|
if let Expression::Select(select) = effective_expr {
|
|
2810
2808
|
if let Some(from) = &select.from {
|
|
2811
2809
|
for expr in &from.expressions {
|
|
2812
|
-
if let Some(name) =
|
|
2810
|
+
if let Some(name) = relation_source_name(expr) {
|
|
2813
2811
|
if !name.is_empty() && seen.insert(name.clone()) {
|
|
2814
2812
|
names.push(name);
|
|
2815
2813
|
}
|
|
@@ -2820,7 +2818,7 @@ fn source_names_from_from_join(scope: &Scope) -> Vec<String> {
|
|
|
2820
2818
|
if is_semi_or_anti_join_kind(join.kind) {
|
|
2821
2819
|
continue;
|
|
2822
2820
|
}
|
|
2823
|
-
if let Some(name) =
|
|
2821
|
+
if let Some(name) = relation_source_name(&join.this) {
|
|
2824
2822
|
if !name.is_empty() && seen.insert(name.clone()) {
|
|
2825
2823
|
names.push(name);
|
|
2826
2824
|
}
|
|
@@ -2828,7 +2826,7 @@ fn source_names_from_from_join(scope: &Scope) -> Vec<String> {
|
|
|
2828
2826
|
}
|
|
2829
2827
|
for lateral_view in &select.lateral_views {
|
|
2830
2828
|
if let Some(name) =
|
|
2831
|
-
|
|
2829
|
+
relation_source_name(&Expression::LateralView(Box::new(lateral_view.clone())))
|
|
2832
2830
|
{
|
|
2833
2831
|
if !name.is_empty() && seen.insert(name.clone()) {
|
|
2834
2832
|
names.push(name);
|
|
@@ -2881,9 +2879,10 @@ fn expressions_equivalent_after_wrappers(left: &Expression, right: &Expression)
|
|
|
2881
2879
|
left == right || effective_scope_expression(left) == effective_scope_expression(right)
|
|
2882
2880
|
}
|
|
2883
2881
|
|
|
2884
|
-
fn
|
|
2882
|
+
fn preceding_non_virtual_sources(scope: &Scope, source_alias: &str) -> Vec<String> {
|
|
2885
2883
|
source_names_from_from_join(scope)
|
|
2886
2884
|
.into_iter()
|
|
2885
|
+
.take_while(|name| name != source_alias)
|
|
2887
2886
|
.filter(|name| {
|
|
2888
2887
|
!matches!(
|
|
2889
2888
|
scope.sources.get(name).map(|source| source.kind),
|
|
@@ -3959,65 +3958,16 @@ fn collect_column_refs(
|
|
|
3959
3958
|
}
|
|
3960
3959
|
}
|
|
3961
3960
|
|
|
3962
|
-
//
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
| Expression::Min(f)
|
|
3966
|
-
| Expression::Max(f)
|
|
3967
|
-
| Expression::ArrayAgg(f)
|
|
3968
|
-
| Expression::CountIf(f)
|
|
3969
|
-
| Expression::Stddev(f)
|
|
3970
|
-
| Expression::StddevPop(f)
|
|
3971
|
-
| Expression::StddevSamp(f)
|
|
3972
|
-
| Expression::Variance(f)
|
|
3973
|
-
| Expression::VarPop(f)
|
|
3974
|
-
| Expression::VarSamp(f)
|
|
3975
|
-
| Expression::Median(f)
|
|
3976
|
-
| Expression::Mode(f)
|
|
3977
|
-
| Expression::First(f)
|
|
3978
|
-
| Expression::Last(f)
|
|
3979
|
-
| Expression::AnyValue(f)
|
|
3980
|
-
| Expression::ApproxDistinct(f)
|
|
3981
|
-
| Expression::ApproxCountDistinct(f)
|
|
3982
|
-
| Expression::LogicalAnd(f)
|
|
3983
|
-
| Expression::LogicalOr(f)
|
|
3984
|
-
| Expression::Skewness(f)
|
|
3985
|
-
| Expression::ArrayConcatAgg(f)
|
|
3986
|
-
| Expression::ArrayUniqueAgg(f)
|
|
3987
|
-
| Expression::BoolXorAgg(f)
|
|
3988
|
-
| Expression::BitwiseAndAgg(f)
|
|
3989
|
-
| Expression::BitwiseOrAgg(f)
|
|
3990
|
-
| Expression::BitwiseXorAgg(f) => {
|
|
3991
|
-
stack.push(&f.this);
|
|
3992
|
-
if let Some(ref filter) = f.filter {
|
|
3993
|
-
stack.push(filter);
|
|
3994
|
-
}
|
|
3995
|
-
if let Some((ref expr, _)) = f.having_max {
|
|
3996
|
-
stack.push(expr);
|
|
3997
|
-
}
|
|
3998
|
-
if let Some(ref limit) = f.limit {
|
|
3999
|
-
stack.push(limit);
|
|
4000
|
-
}
|
|
3961
|
+
// Ordering, filters, and other aggregate operands can all affect the value.
|
|
3962
|
+
aggregate if crate::traversal::is_aggregate(aggregate) => {
|
|
3963
|
+
crate::ast_children::for_each_child(aggregate, |_, child| stack.push(child));
|
|
4001
3964
|
}
|
|
4002
3965
|
|
|
4003
|
-
// === Generic Function / AggregateFunction: args ===
|
|
4004
3966
|
Expression::Function(func) => {
|
|
4005
3967
|
for arg in &func.args {
|
|
4006
3968
|
stack.push(arg);
|
|
4007
3969
|
}
|
|
4008
3970
|
}
|
|
4009
|
-
Expression::AggregateFunction(func) => {
|
|
4010
|
-
for arg in &func.args {
|
|
4011
|
-
stack.push(arg);
|
|
4012
|
-
}
|
|
4013
|
-
if let Some(ref filter) = func.filter {
|
|
4014
|
-
stack.push(filter);
|
|
4015
|
-
}
|
|
4016
|
-
if let Some(ref limit) = func.limit {
|
|
4017
|
-
stack.push(limit);
|
|
4018
|
-
}
|
|
4019
|
-
}
|
|
4020
|
-
|
|
4021
3971
|
// === WindowFunction: this (skip Over for lineage purposes) ===
|
|
4022
3972
|
Expression::WindowFunction(wf) => {
|
|
4023
3973
|
stack.push(&wf.this);
|
|
@@ -4242,51 +4192,6 @@ fn collect_column_refs(
|
|
|
4242
4192
|
stack.push(e);
|
|
4243
4193
|
}
|
|
4244
4194
|
}
|
|
4245
|
-
Expression::Count(f) => {
|
|
4246
|
-
if let Some(ref this) = f.this {
|
|
4247
|
-
stack.push(this);
|
|
4248
|
-
}
|
|
4249
|
-
if let Some(ref filter) = f.filter {
|
|
4250
|
-
stack.push(filter);
|
|
4251
|
-
}
|
|
4252
|
-
}
|
|
4253
|
-
Expression::GroupConcat(f) => {
|
|
4254
|
-
stack.push(&f.this);
|
|
4255
|
-
if let Some(ref sep) = f.separator {
|
|
4256
|
-
stack.push(sep);
|
|
4257
|
-
}
|
|
4258
|
-
if let Some(ref filter) = f.filter {
|
|
4259
|
-
stack.push(filter);
|
|
4260
|
-
}
|
|
4261
|
-
}
|
|
4262
|
-
Expression::StringAgg(f) => {
|
|
4263
|
-
stack.push(&f.this);
|
|
4264
|
-
if let Some(ref sep) = f.separator {
|
|
4265
|
-
stack.push(sep);
|
|
4266
|
-
}
|
|
4267
|
-
if let Some(ref filter) = f.filter {
|
|
4268
|
-
stack.push(filter);
|
|
4269
|
-
}
|
|
4270
|
-
if let Some(ref limit) = f.limit {
|
|
4271
|
-
stack.push(limit);
|
|
4272
|
-
}
|
|
4273
|
-
}
|
|
4274
|
-
Expression::ListAgg(f) => {
|
|
4275
|
-
stack.push(&f.this);
|
|
4276
|
-
if let Some(ref sep) = f.separator {
|
|
4277
|
-
stack.push(sep);
|
|
4278
|
-
}
|
|
4279
|
-
if let Some(ref filter) = f.filter {
|
|
4280
|
-
stack.push(filter);
|
|
4281
|
-
}
|
|
4282
|
-
}
|
|
4283
|
-
Expression::SumIf(f) => {
|
|
4284
|
-
stack.push(&f.this);
|
|
4285
|
-
stack.push(&f.condition);
|
|
4286
|
-
if let Some(ref filter) = f.filter {
|
|
4287
|
-
stack.push(filter);
|
|
4288
|
-
}
|
|
4289
|
-
}
|
|
4290
4195
|
Expression::DateAdd(f) | Expression::DateSub(f) => {
|
|
4291
4196
|
stack.push(&f.this);
|
|
4292
4197
|
stack.push(&f.interval);
|
|
@@ -4443,25 +4348,6 @@ fn collect_column_refs(
|
|
|
4443
4348
|
stack.push(style);
|
|
4444
4349
|
}
|
|
4445
4350
|
}
|
|
4446
|
-
Expression::ApproxPercentile(f) => {
|
|
4447
|
-
stack.push(&f.this);
|
|
4448
|
-
stack.push(&f.percentile);
|
|
4449
|
-
if let Some(ref acc) = f.accuracy {
|
|
4450
|
-
stack.push(acc);
|
|
4451
|
-
}
|
|
4452
|
-
if let Some(ref filter) = f.filter {
|
|
4453
|
-
stack.push(filter);
|
|
4454
|
-
}
|
|
4455
|
-
}
|
|
4456
|
-
Expression::Percentile(f)
|
|
4457
|
-
| Expression::PercentileCont(f)
|
|
4458
|
-
| Expression::PercentileDisc(f) => {
|
|
4459
|
-
stack.push(&f.this);
|
|
4460
|
-
stack.push(&f.percentile);
|
|
4461
|
-
if let Some(ref filter) = f.filter {
|
|
4462
|
-
stack.push(filter);
|
|
4463
|
-
}
|
|
4464
|
-
}
|
|
4465
4351
|
Expression::WithinGroup(f) => {
|
|
4466
4352
|
stack.push(&f.this);
|
|
4467
4353
|
for e in &f.order_by {
|
|
@@ -4606,19 +4492,6 @@ fn collect_column_refs(
|
|
|
4606
4492
|
stack.push(&f.this);
|
|
4607
4493
|
stack.push(&f.transform);
|
|
4608
4494
|
}
|
|
4609
|
-
Expression::JsonArrayAgg(f) => {
|
|
4610
|
-
stack.push(&f.this);
|
|
4611
|
-
if let Some(ref filter) = f.filter {
|
|
4612
|
-
stack.push(filter);
|
|
4613
|
-
}
|
|
4614
|
-
}
|
|
4615
|
-
Expression::JsonObjectAgg(f) => {
|
|
4616
|
-
stack.push(&f.key);
|
|
4617
|
-
stack.push(&f.value);
|
|
4618
|
-
if let Some(ref filter) = f.filter {
|
|
4619
|
-
stack.push(filter);
|
|
4620
|
-
}
|
|
4621
|
-
}
|
|
4622
4495
|
Expression::NTile(f) => {
|
|
4623
4496
|
if let Some(ref n) = f.num_buckets {
|
|
4624
4497
|
stack.push(n);
|
{polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/annotate_types.rs
RENAMED
|
@@ -2237,24 +2237,21 @@ impl Schema for ScopedSchema<'_> {
|
|
|
2237
2237
|
|
|
2238
2238
|
type OutputColumns = Vec<(String, DataType)>;
|
|
2239
2239
|
|
|
2240
|
-
fn table_name(table: &crate::expressions::TableRef) -> String {
|
|
2241
|
-
let mut parts = Vec::new();
|
|
2242
|
-
if let Some(catalog) = &table.catalog {
|
|
2243
|
-
parts.push(crate::binding::identifier_name(catalog));
|
|
2244
|
-
}
|
|
2245
|
-
if let Some(schema) = &table.schema {
|
|
2246
|
-
parts.push(crate::binding::identifier_name(schema));
|
|
2247
|
-
}
|
|
2248
|
-
parts.push(crate::binding::identifier_name(&table.name));
|
|
2249
|
-
parts.join(".")
|
|
2250
|
-
}
|
|
2251
|
-
|
|
2252
2240
|
fn table_columns(schema: &dyn Schema, table: &str) -> OutputColumns {
|
|
2253
2241
|
schema
|
|
2254
2242
|
.column_names(table)
|
|
2255
2243
|
.unwrap_or_default()
|
|
2256
2244
|
.into_iter()
|
|
2257
2245
|
.map(|column| {
|
|
2246
|
+
// A mapping returns canonical column names. Quote a case-sensitive
|
|
2247
|
+
// name when carrying it into a new scope so it is not folded again.
|
|
2248
|
+
let column = if !crate::binding::schema_identifier(&column).quoted
|
|
2249
|
+
&& normalize_name(&column, schema.dialect(), false, true) != column
|
|
2250
|
+
{
|
|
2251
|
+
crate::binding::identifier_name(&crate::expressions::Identifier::quoted(column))
|
|
2252
|
+
} else {
|
|
2253
|
+
column
|
|
2254
|
+
};
|
|
2258
2255
|
let data_type = schema
|
|
2259
2256
|
.get_column_type(table, &column)
|
|
2260
2257
|
.unwrap_or(DataType::Unknown);
|
|
@@ -2414,7 +2411,7 @@ fn annotate_relation_source(
|
|
|
2414
2411
|
) {
|
|
2415
2412
|
match expression {
|
|
2416
2413
|
Expression::Table(table) => {
|
|
2417
|
-
let source_table =
|
|
2414
|
+
let source_table = crate::binding::schema_table_name(table);
|
|
2418
2415
|
let mut columns = table_columns(schema, &source_table);
|
|
2419
2416
|
columns = apply_column_aliases(columns, &table.column_aliases);
|
|
2420
2417
|
let visible_name = table.alias.as_ref().unwrap_or(&table.name);
|
{polyglot_sql-0.14.2 → polyglot_sql-0.14.3}/crates/polyglot-sql/src/optimizer/qualify_columns.rs
RENAMED
|
@@ -1049,7 +1049,6 @@ fn expand_stars(
|
|
|
1049
1049
|
) -> QualifyColumnsResult<()> {
|
|
1050
1050
|
let mut new_selections: Vec<Expression> = Vec::new();
|
|
1051
1051
|
let mut has_star = false;
|
|
1052
|
-
let mut coalesced_columns: HashSet<String> = HashSet::new();
|
|
1053
1052
|
|
|
1054
1053
|
// Use ordered source names (not unordered HashMap keys)
|
|
1055
1054
|
let ordered_sources = get_ordered_source_names(select);
|
|
@@ -1071,30 +1070,6 @@ fn expand_stars(
|
|
|
1071
1070
|
return Ok(());
|
|
1072
1071
|
}
|
|
1073
1072
|
for col_name in &columns {
|
|
1074
|
-
let normalized = normalize_column_name(col_name, resolver.dialect);
|
|
1075
|
-
if star.excludes(col_name, resolver.dialect)
|
|
1076
|
-
|| coalesced_columns.contains(&normalized)
|
|
1077
|
-
{
|
|
1078
|
-
continue;
|
|
1079
|
-
}
|
|
1080
|
-
if let Some(tables) = column_tables.get(&normalized) {
|
|
1081
|
-
if tables.contains(table_name) {
|
|
1082
|
-
coalesced_columns.insert(normalized);
|
|
1083
|
-
let coalesce = make_coalesce(col_name, tables);
|
|
1084
|
-
if let Some(expanded) =
|
|
1085
|
-
star.expand_column(col_name, coalesce, resolver.dialect)
|
|
1086
|
-
{
|
|
1087
|
-
new_selections.push(match expanded {
|
|
1088
|
-
Expression::Alias(_) => expanded,
|
|
1089
|
-
_ => Expression::Alias(Box::new(Alias::new(
|
|
1090
|
-
expanded,
|
|
1091
|
-
Identifier::new(col_name),
|
|
1092
|
-
))),
|
|
1093
|
-
});
|
|
1094
|
-
}
|
|
1095
|
-
continue;
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
1073
|
new_selections.extend(star.expand_column(
|
|
1099
1074
|
col_name,
|
|
1100
1075
|
create_qualified_column(col_name, Some(table_name)),
|
|
@@ -1103,6 +1078,7 @@ fn expand_stars(
|
|
|
1103
1078
|
}
|
|
1104
1079
|
}
|
|
1105
1080
|
} else {
|
|
1081
|
+
let mut coalesced_columns = HashSet::new();
|
|
1106
1082
|
for source_name in &ordered_sources {
|
|
1107
1083
|
if let Ok(columns) = resolver.get_source_columns(source_name) {
|
|
1108
1084
|
if columns.contains(&"*".to_string()) || columns.is_empty() {
|
|
@@ -1157,27 +1133,6 @@ fn expand_stars(
|
|
|
1157
1133
|
return Ok(());
|
|
1158
1134
|
}
|
|
1159
1135
|
for col_name in &columns {
|
|
1160
|
-
let normalized = normalize_column_name(col_name, resolver.dialect);
|
|
1161
|
-
if coalesced_columns.contains(&normalized) {
|
|
1162
|
-
continue;
|
|
1163
|
-
}
|
|
1164
|
-
if let Some(tables) = column_tables.get(&normalized) {
|
|
1165
|
-
if tables.contains(table_name) {
|
|
1166
|
-
coalesced_columns.insert(normalized);
|
|
1167
|
-
let coalesce = make_coalesce(col_name, tables);
|
|
1168
|
-
new_selections.push(Expression::Alias(Box::new(Alias {
|
|
1169
|
-
this: coalesce,
|
|
1170
|
-
alias: Identifier::new(col_name),
|
|
1171
|
-
column_aliases: vec![],
|
|
1172
|
-
alias_explicit_as: false,
|
|
1173
|
-
alias_keyword: None,
|
|
1174
|
-
pre_alias_comments: vec![],
|
|
1175
|
-
trailing_comments: vec![],
|
|
1176
|
-
inferred_type: None,
|
|
1177
|
-
})));
|
|
1178
|
-
continue;
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
1136
|
new_selections
|
|
1182
1137
|
.push(create_qualified_column(col_name, Some(table_name)));
|
|
1183
1138
|
}
|
|
@@ -1212,14 +1167,15 @@ fn qualify_outputs_select(select: &mut Select) -> QualifyColumnsResult<()> {
|
|
|
1212
1167
|
let mut new_selections: Vec<Expression> = Vec::new();
|
|
1213
1168
|
|
|
1214
1169
|
for (i, expr) in select.expressions.iter().enumerate() {
|
|
1215
|
-
|
|
1170
|
+
let mut output = expr;
|
|
1171
|
+
while let Expression::Annotated(annotated) = output {
|
|
1172
|
+
output = &annotated.this;
|
|
1173
|
+
}
|
|
1174
|
+
match output {
|
|
1216
1175
|
Expression::Alias(_) => new_selections.push(expr.clone()),
|
|
1217
|
-
Expression::Column(col) => {
|
|
1218
|
-
new_selections.push(create_alias(expr.clone(), &col.name.name));
|
|
1219
|
-
}
|
|
1220
1176
|
Expression::Star(_) => new_selections.push(expr.clone()),
|
|
1221
1177
|
_ => {
|
|
1222
|
-
let alias_name = get_output_name(
|
|
1178
|
+
let alias_name = get_output_name(output).unwrap_or_else(|| format!("_col_{}", i));
|
|
1223
1179
|
new_selections.push(create_alias(expr.clone(), &alias_name));
|
|
1224
1180
|
}
|
|
1225
1181
|
}
|
|
@@ -3802,12 +3758,9 @@ mod tests {
|
|
|
3802
3758
|
qualify_columns(expr, &schema, &QualifyColumnsOptions::new()).expect("qualify");
|
|
3803
3759
|
let sql = gen(&result);
|
|
3804
3760
|
|
|
3805
|
-
//
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
"USING column from x.* should become COALESCE: {sql}"
|
|
3809
|
-
);
|
|
3810
|
-
assert!(sql.contains("x.a"), "non-USING column a: {sql}");
|
|
3761
|
+
// The pinned SQLGlot qualify_columns.sql fixture coalesces x.b here.
|
|
3762
|
+
// A qualified star projects only columns of the named relation (#547).
|
|
3763
|
+
assert!(sql.starts_with("SELECT x.a AS a, x.b AS b FROM"), "{sql}");
|
|
3811
3764
|
}
|
|
3812
3765
|
|
|
3813
3766
|
#[test]
|