polyglot-sql-chio 0.12.2__tar.gz → 0.12.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_chio-0.12.2 → polyglot_sql_chio-0.12.3}/Cargo.lock +6 -6
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/Cargo.toml +1 -1
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/PKG-INFO +2 -5
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/Cargo.toml +2 -2
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/README.md +4 -4
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/lineage.rs +71 -16
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/resolver.rs +33 -23
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/query_analysis.rs +116 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-function-catalogs/README.md +1 -1
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/Cargo.toml +1 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/pyproject.toml +1 -4
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/README.md +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/allocation_hotspots.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/ast_traversal.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/in_list.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/lineage.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/parsing.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/performance_hotspots.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/transpile.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/examples/bench_json.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/ast_children.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/ast_json.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/ast_mutation.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/ast_transforms.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/binding.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/builder/mod.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/builder/plan.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/bigquery.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/clickhouse.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/databricks.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/datafusion.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/duckdb.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/exasol.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/fabric.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/hive.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/mod.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/mysql.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/normalization/aggregates.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/normalization/collections.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/normalization/json.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/normalization/mod.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/normalization/operators.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/normalization/postgres_interval.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/normalization/scalar.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/normalization/statements.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/normalization/temporal.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/normalization/types.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/oracle.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/postgres.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/presto.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/snowflake.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/spark.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/sqlite.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/teradata.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/trino.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/tsql.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/diff.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/error.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/expressions.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/format_tokens.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/function_catalog.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/function_registry.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/generator.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/guard.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/helper.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/lib.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/openlineage.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/annotate_types.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/canonicalize.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/mod.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/set_operation_types.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/simplify.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/optimizer/subquery.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/parser.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/planner.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/query_analysis/column_uses.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/query_analysis.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/schema.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/scope.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/set_operation.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/time.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/tokens.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/transforms.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/traversal.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/trie.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/validation/semantics.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/validation/tests.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/validation.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/analyze_failures.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/clickhouse_regression.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/common/known_failures.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/common/mod.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/common/test_runner.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/create_view_security_comment_regression.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/data_type_api.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/deep_nesting_regression.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/dialect_matrix.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/error_handling.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/fabric_regression.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/fabric_tpch_regression.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/oracle_data_types_regression.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/postgres_explain_options.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/postgres_regexp_clickhouse.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/postgres_sqlite_regression.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/qualify_tables.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/query_analysis_regression.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/snowflake_regression_test.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/sqlglot_compat.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/tpch_transpile_stack.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/transform_regression.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/tsql_regression.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-ast-derive/Cargo.toml +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-ast-derive/src/lib.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/README.md +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/docs/api.md +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/docs/index.md +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/mkdocs.yml +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/builders.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/dialects.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/diff.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/errors.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/expr.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/expr_types.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/format.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/generate.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/helpers.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/lib.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/lineage.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/openlineage.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/optimize.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/parse.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/query_analysis.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/transforms.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/transpile.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/types.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/src/validate.rs +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/conftest.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_builders.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_compat.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_expression.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_format.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_lineage.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_optimize.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_parse.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_query_analysis.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_transforms.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql-python/uv.lock +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/python/polyglot_sql/__init__.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/python/polyglot_sql/__init__.pyi +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/python/polyglot_sql/analysis_types.py +0 -0
- {polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.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.12.
|
|
608
|
+
version = "0.12.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.12.
|
|
626
|
+
version = "0.12.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.12.
|
|
635
|
+
version = "0.12.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.12.
|
|
645
|
+
version = "0.12.3"
|
|
646
646
|
|
|
647
647
|
[[package]]
|
|
648
648
|
name = "polyglot-sql-python"
|
|
649
|
-
version = "0.12.
|
|
649
|
+
version = "0.12.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-wasm"
|
|
660
|
-
version = "0.12.
|
|
660
|
+
version = "0.12.3"
|
|
661
661
|
dependencies = [
|
|
662
662
|
"console_error_panic_hook",
|
|
663
663
|
"js-sys",
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: polyglot-sql-chio
|
|
3
|
-
Version: 0.12.
|
|
3
|
+
Version: 0.12.3
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
7
7
|
Classifier: Programming Language :: Rust
|
|
8
8
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
13
10
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
11
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
12
|
Classifier: Topic :: Database
|
|
@@ -18,7 +15,7 @@ Summary: Rust-powered SQL transpiler for more than 30 SQL dialects. Parse, gener
|
|
|
18
15
|
Keywords: sql,transpiler,parser,dialect,database
|
|
19
16
|
Home-Page: https://github.com/tobilg/polyglot
|
|
20
17
|
License: MIT
|
|
21
|
-
Requires-Python: >=3.
|
|
18
|
+
Requires-Python: >=3.12
|
|
22
19
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
23
20
|
Project-URL: Documentation, https://polyglot.gh.tobilg.com
|
|
24
21
|
Project-URL: Homepage, https://github.com/chio-labs/polyglot
|
|
@@ -100,14 +100,14 @@ function-catalog-all-dialects = [
|
|
|
100
100
|
]
|
|
101
101
|
|
|
102
102
|
[dependencies]
|
|
103
|
-
polyglot-sql-ast-derive = { path = "../polyglot-sql-ast-derive", version = "0.12.
|
|
103
|
+
polyglot-sql-ast-derive = { path = "../polyglot-sql-ast-derive", version = "0.12.3" }
|
|
104
104
|
serde = { workspace = true }
|
|
105
105
|
serde_json = { workspace = true }
|
|
106
106
|
thiserror = { workspace = true }
|
|
107
107
|
unicode-segmentation = { workspace = true }
|
|
108
108
|
stacker = { version = "0.1", optional = true }
|
|
109
109
|
ts-rs = { version = "12.0", features = ["serde-compat"], optional = true }
|
|
110
|
-
polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.12.
|
|
110
|
+
polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.12.3", optional = true, default-features = false }
|
|
111
111
|
|
|
112
112
|
[dev-dependencies]
|
|
113
113
|
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.12.
|
|
28
|
+
polyglot-sql = { version = "0.12.3", default-features = false }
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
```toml
|
|
32
32
|
polyglot-sql = {
|
|
33
|
-
version = "0.12.
|
|
33
|
+
version = "0.12.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.12.
|
|
47
|
+
version = "0.12.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.12.
|
|
54
|
+
version = "0.12.3",
|
|
55
55
|
default-features = false,
|
|
56
56
|
features = ["transpile", "dialect-clickhouse", "dialect-postgresql"],
|
|
57
57
|
}
|
|
@@ -714,13 +714,7 @@ fn expand_star_from_sources(
|
|
|
714
714
|
let qual_normalized = normalize_cte_name(qual);
|
|
715
715
|
for src in sources {
|
|
716
716
|
if src.normalized == qual_normalized || src.alias.to_lowercase() == qual_normalized {
|
|
717
|
-
|
|
718
|
-
if let Some(cols) = resolved_ctes.get(&src.normalized) {
|
|
719
|
-
expanded.extend(cols.iter().map(|c| (src.alias.clone(), c.clone())));
|
|
720
|
-
return Some(expanded);
|
|
721
|
-
}
|
|
722
|
-
// Fall back to schema
|
|
723
|
-
if let Some(cols) = lookup_schema_columns(schema, &src.fq_name) {
|
|
717
|
+
if let Some(cols) = source_output_columns(src, resolved_ctes, schema) {
|
|
724
718
|
expanded.extend(cols.into_iter().map(|c| (src.alias.clone(), c)));
|
|
725
719
|
return Some(expanded);
|
|
726
720
|
}
|
|
@@ -735,15 +729,9 @@ fn expand_star_from_sources(
|
|
|
735
729
|
// This matches sqlglot's behavior (raises SqlglotError when schema is missing).
|
|
736
730
|
let mut any_expanded = false;
|
|
737
731
|
for src in sources {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
} else if let Some(cols) = lookup_schema_columns(schema, &src.fq_name) {
|
|
742
|
-
expanded.extend(cols.into_iter().map(|c| (src.alias.clone(), c)));
|
|
743
|
-
any_expanded = true;
|
|
744
|
-
} else {
|
|
745
|
-
return None;
|
|
746
|
-
}
|
|
732
|
+
let cols = source_output_columns(src, resolved_ctes, schema)?;
|
|
733
|
+
expanded.extend(cols.into_iter().map(|c| (src.alias.clone(), c)));
|
|
734
|
+
any_expanded = true;
|
|
747
735
|
}
|
|
748
736
|
if any_expanded {
|
|
749
737
|
Some(expanded)
|
|
@@ -753,6 +741,57 @@ fn expand_star_from_sources(
|
|
|
753
741
|
}
|
|
754
742
|
}
|
|
755
743
|
|
|
744
|
+
/// Output columns of a FROM/JOIN source, preferring resolved CTEs over the schema.
|
|
745
|
+
fn source_output_columns(
|
|
746
|
+
src: &SourceInfo,
|
|
747
|
+
resolved_ctes: &HashMap<String, Vec<String>>,
|
|
748
|
+
schema: Option<&dyn Schema>,
|
|
749
|
+
) -> Option<Vec<String>> {
|
|
750
|
+
match &src.relation {
|
|
751
|
+
SourceRelation::Plain => resolved_ctes
|
|
752
|
+
.get(&src.normalized)
|
|
753
|
+
.cloned()
|
|
754
|
+
.or_else(|| lookup_schema_columns(schema, &src.fq_name)),
|
|
755
|
+
SourceRelation::Pivot(pivot) if !pivot.unpivot => {
|
|
756
|
+
let input = pivot_input_columns(&pivot.this, resolved_ctes, schema)?;
|
|
757
|
+
let output = pivot_output_columns(pivot, &input, None);
|
|
758
|
+
(!output.is_empty()).then(|| output.into_iter().map(|(post, _)| post).collect())
|
|
759
|
+
}
|
|
760
|
+
SourceRelation::Unpivot(unpivot) => {
|
|
761
|
+
let input = pivot_input_columns(&unpivot.this, resolved_ctes, schema)?;
|
|
762
|
+
let output = crate::resolver::unpivot_output_columns(unpivot, input, None);
|
|
763
|
+
(!output.is_empty()).then_some(output)
|
|
764
|
+
}
|
|
765
|
+
SourceRelation::Pivot(_) => None,
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
fn pivot_input_columns(
|
|
770
|
+
input: &Expression,
|
|
771
|
+
resolved_ctes: &HashMap<String, Vec<String>>,
|
|
772
|
+
schema: Option<&dyn Schema>,
|
|
773
|
+
) -> Option<Vec<String>> {
|
|
774
|
+
match input {
|
|
775
|
+
Expression::Table(table) => {
|
|
776
|
+
let cte_columns = (table.schema.is_none() && table.catalog.is_none())
|
|
777
|
+
.then(|| resolved_ctes.get(&normalize_cte_name(&table.name)).cloned())
|
|
778
|
+
.flatten();
|
|
779
|
+
cte_columns.or_else(|| {
|
|
780
|
+
let fq_name = [&table.catalog, &table.schema]
|
|
781
|
+
.into_iter()
|
|
782
|
+
.flatten()
|
|
783
|
+
.map(|part| part.name.as_str())
|
|
784
|
+
.chain(std::iter::once(table.name.name.as_str()))
|
|
785
|
+
.collect::<Vec<_>>()
|
|
786
|
+
.join(".");
|
|
787
|
+
lookup_schema_columns(schema, &fq_name)
|
|
788
|
+
})
|
|
789
|
+
}
|
|
790
|
+
Expression::Paren(paren) => pivot_input_columns(&paren.this, resolved_ctes, schema),
|
|
791
|
+
_ => None,
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
|
|
756
795
|
/// Look up column names for a table from the schema.
|
|
757
796
|
fn lookup_schema_columns(schema: Option<&dyn Schema>, fq_name: &str) -> Option<Vec<String>> {
|
|
758
797
|
let schema = schema?;
|
|
@@ -802,6 +841,16 @@ struct SourceInfo {
|
|
|
802
841
|
normalized: String,
|
|
803
842
|
/// Fully-qualified table name for schema lookup (e.g., "db.schema.table").
|
|
804
843
|
fq_name: String,
|
|
844
|
+
/// Relation shape that determines how this source's output columns are derived.
|
|
845
|
+
relation: SourceRelation,
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/// PIVOT and UNPIVOT change their input's columns, so their output cannot be
|
|
849
|
+
/// read from the CTE or table that happens to share the source name.
|
|
850
|
+
enum SourceRelation {
|
|
851
|
+
Plain,
|
|
852
|
+
Pivot(Box<crate::expressions::Pivot>),
|
|
853
|
+
Unpivot(Box<crate::expressions::Unpivot>),
|
|
805
854
|
}
|
|
806
855
|
|
|
807
856
|
/// Extract source info (alias, normalized CTE name, fully-qualified name) from a
|
|
@@ -816,6 +865,7 @@ fn get_select_sources(select: &Select) -> Vec<SourceInfo> {
|
|
|
816
865
|
quoted: alias.quoted,
|
|
817
866
|
normalized: normalize_cte_name(alias),
|
|
818
867
|
fq_name: alias.name.clone(),
|
|
868
|
+
relation: SourceRelation::Plain,
|
|
819
869
|
}
|
|
820
870
|
}
|
|
821
871
|
|
|
@@ -825,6 +875,7 @@ fn get_select_sources(select: &Select) -> Vec<SourceInfo> {
|
|
|
825
875
|
quoted: false,
|
|
826
876
|
normalized: alias.to_lowercase(),
|
|
827
877
|
fq_name: alias.to_string(),
|
|
878
|
+
relation: SourceRelation::Plain,
|
|
828
879
|
}
|
|
829
880
|
}
|
|
830
881
|
|
|
@@ -850,6 +901,7 @@ fn get_select_sources(select: &Select) -> Vec<SourceInfo> {
|
|
|
850
901
|
quoted: t.name.quoted,
|
|
851
902
|
normalized,
|
|
852
903
|
fq_name,
|
|
904
|
+
relation: SourceRelation::Plain,
|
|
853
905
|
})
|
|
854
906
|
}
|
|
855
907
|
Expression::Subquery(s) => {
|
|
@@ -862,6 +914,7 @@ fn get_select_sources(select: &Select) -> Vec<SourceInfo> {
|
|
|
862
914
|
quoted: alias_identifier.quoted,
|
|
863
915
|
normalized,
|
|
864
916
|
fq_name,
|
|
917
|
+
relation: SourceRelation::Plain,
|
|
865
918
|
})
|
|
866
919
|
}
|
|
867
920
|
Expression::Unnest(u) => u.alias.as_ref().map(virtual_source_info),
|
|
@@ -887,6 +940,7 @@ fn get_select_sources(select: &Select) -> Vec<SourceInfo> {
|
|
|
887
940
|
quoted: false,
|
|
888
941
|
normalized: alias.to_lowercase(),
|
|
889
942
|
fq_name: alias,
|
|
943
|
+
relation: SourceRelation::Pivot(pivot.clone()),
|
|
890
944
|
})
|
|
891
945
|
}
|
|
892
946
|
Expression::Unpivot(unpivot) => {
|
|
@@ -899,6 +953,7 @@ fn get_select_sources(select: &Select) -> Vec<SourceInfo> {
|
|
|
899
953
|
quoted: false,
|
|
900
954
|
normalized: alias.to_lowercase(),
|
|
901
955
|
fq_name: alias,
|
|
956
|
+
relation: SourceRelation::Unpivot(unpivot.clone()),
|
|
902
957
|
})
|
|
903
958
|
}
|
|
904
959
|
Expression::Paren(p) => extract_source(&p.this),
|
|
@@ -387,29 +387,7 @@ impl<'a> Resolver<'a> {
|
|
|
387
387
|
|
|
388
388
|
fn get_unpivot_output_columns(&self, unpivot: &crate::expressions::Unpivot) -> Vec<String> {
|
|
389
389
|
let pre_columns = self.get_source_output_columns(&unpivot.this);
|
|
390
|
-
|
|
391
|
-
return Vec::new();
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
let input_columns: HashSet<String> = unpivot
|
|
395
|
-
.columns
|
|
396
|
-
.iter()
|
|
397
|
-
.flat_map(expression_column_names)
|
|
398
|
-
.map(|column| normalize_column_name(&column, self.dialect))
|
|
399
|
-
.collect();
|
|
400
|
-
let mut columns: Vec<String> = pre_columns
|
|
401
|
-
.into_iter()
|
|
402
|
-
.filter(|column| !input_columns.contains(&normalize_column_name(column, self.dialect)))
|
|
403
|
-
.collect();
|
|
404
|
-
columns.push(unpivot.name_column.name.clone());
|
|
405
|
-
columns.push(unpivot.value_column.name.clone());
|
|
406
|
-
columns.extend(
|
|
407
|
-
unpivot
|
|
408
|
-
.extra_value_columns
|
|
409
|
-
.iter()
|
|
410
|
-
.map(|column| column.name.clone()),
|
|
411
|
-
);
|
|
412
|
-
apply_alias_columns(columns, &unpivot.alias_columns)
|
|
390
|
+
unpivot_output_columns(unpivot, pre_columns, self.dialect)
|
|
413
391
|
}
|
|
414
392
|
|
|
415
393
|
fn get_source_output_columns(&self, source: &Expression) -> Vec<String> {
|
|
@@ -657,6 +635,38 @@ fn normalize_column_name(name: &str, dialect: Option<DialectType>) -> String {
|
|
|
657
635
|
normalize_name(name, dialect, false, true)
|
|
658
636
|
}
|
|
659
637
|
|
|
638
|
+
/// UNPIVOT output: unconsumed input columns, then name and value columns.
|
|
639
|
+
/// Returns no columns when the input columns are unknown.
|
|
640
|
+
pub(crate) fn unpivot_output_columns(
|
|
641
|
+
unpivot: &crate::expressions::Unpivot,
|
|
642
|
+
pre_columns: Vec<String>,
|
|
643
|
+
dialect: Option<DialectType>,
|
|
644
|
+
) -> Vec<String> {
|
|
645
|
+
if pre_columns.is_empty() || pre_columns.iter().any(|column| column == "*") {
|
|
646
|
+
return Vec::new();
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
let input_columns: HashSet<String> = unpivot
|
|
650
|
+
.columns
|
|
651
|
+
.iter()
|
|
652
|
+
.flat_map(expression_column_names)
|
|
653
|
+
.map(|column| normalize_column_name(&column, dialect))
|
|
654
|
+
.collect();
|
|
655
|
+
let mut columns: Vec<String> = pre_columns
|
|
656
|
+
.into_iter()
|
|
657
|
+
.filter(|column| !input_columns.contains(&normalize_column_name(column, dialect)))
|
|
658
|
+
.collect();
|
|
659
|
+
columns.push(unpivot.name_column.name.clone());
|
|
660
|
+
columns.push(unpivot.value_column.name.clone());
|
|
661
|
+
columns.extend(
|
|
662
|
+
unpivot
|
|
663
|
+
.extra_value_columns
|
|
664
|
+
.iter()
|
|
665
|
+
.map(|column| column.name.clone()),
|
|
666
|
+
);
|
|
667
|
+
apply_alias_columns(columns, &unpivot.alias_columns)
|
|
668
|
+
}
|
|
669
|
+
|
|
660
670
|
fn apply_alias_columns(mut columns: Vec<String>, alias_columns: &[Identifier]) -> Vec<String> {
|
|
661
671
|
for (idx, alias) in alias_columns.iter().enumerate() {
|
|
662
672
|
if let Some(column) = columns.get_mut(idx) {
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/tests/query_analysis.rs
RENAMED
|
@@ -3499,3 +3499,119 @@ fn analyze_query_resolves_snowflake_dynamic_pivot_over_cte_without_recursion() {
|
|
|
3499
3499
|
|
|
3500
3500
|
assert!(!analysis.projections.is_empty());
|
|
3501
3501
|
}
|
|
3502
|
+
|
|
3503
|
+
struct ReshapedStarCase {
|
|
3504
|
+
name: &'static str,
|
|
3505
|
+
sql: &'static str,
|
|
3506
|
+
with_schema: bool,
|
|
3507
|
+
expected_columns: &'static [&'static str],
|
|
3508
|
+
expected_upstream: Option<&'static [&'static [(&'static str, &'static str)]]>,
|
|
3509
|
+
}
|
|
3510
|
+
|
|
3511
|
+
const PIVOTED_UPSTREAM: &[&[(&str, &str)]] = &[
|
|
3512
|
+
&[("staged_orders", "customer_id")],
|
|
3513
|
+
&[("staged_orders", "amount")],
|
|
3514
|
+
&[("staged_orders", "amount")],
|
|
3515
|
+
];
|
|
3516
|
+
|
|
3517
|
+
#[test]
|
|
3518
|
+
fn star_over_pivot_and_unpivot_reports_reshaped_columns_in_every_mode() {
|
|
3519
|
+
let schema: ValidationSchema = serde_json::from_value(json!({
|
|
3520
|
+
"tables": [
|
|
3521
|
+
{"name": "staged_orders", "columns": [
|
|
3522
|
+
{"name": "customer_id", "type": "INT"},
|
|
3523
|
+
{"name": "category", "type": "VARCHAR"},
|
|
3524
|
+
{"name": "amount", "type": "INT"}
|
|
3525
|
+
]},
|
|
3526
|
+
{"name": "wide_orders", "columns": [
|
|
3527
|
+
{"name": "customer_id", "type": "INT"},
|
|
3528
|
+
{"name": "books", "type": "INT"},
|
|
3529
|
+
{"name": "games", "type": "INT"}
|
|
3530
|
+
]}
|
|
3531
|
+
]
|
|
3532
|
+
}))
|
|
3533
|
+
.unwrap();
|
|
3534
|
+
let ctes = "WITH pivot_input AS (SELECT customer_id, category, amount FROM staged_orders), \
|
|
3535
|
+
wide_input AS (SELECT customer_id, books, games FROM wide_orders) ";
|
|
3536
|
+
let cases = [
|
|
3537
|
+
ReshapedStarCase {
|
|
3538
|
+
name: "pivot over cte",
|
|
3539
|
+
sql: "SELECT * FROM pivot_input PIVOT (MAX(amount) FOR category IN ('books', 'games'))",
|
|
3540
|
+
with_schema: true,
|
|
3541
|
+
expected_columns: &["customer_id", "books", "games"],
|
|
3542
|
+
expected_upstream: Some(PIVOTED_UPSTREAM),
|
|
3543
|
+
},
|
|
3544
|
+
ReshapedStarCase {
|
|
3545
|
+
name: "pivot over cte without schema",
|
|
3546
|
+
sql: "SELECT * FROM pivot_input PIVOT (MAX(amount) FOR category IN ('books', 'games'))",
|
|
3547
|
+
with_schema: false,
|
|
3548
|
+
expected_columns: &["customer_id", "books", "games"],
|
|
3549
|
+
expected_upstream: Some(PIVOTED_UPSTREAM),
|
|
3550
|
+
},
|
|
3551
|
+
ReshapedStarCase {
|
|
3552
|
+
name: "pivot over table",
|
|
3553
|
+
sql:
|
|
3554
|
+
"SELECT * FROM staged_orders PIVOT (MAX(amount) FOR category IN ('books', 'games'))",
|
|
3555
|
+
with_schema: true,
|
|
3556
|
+
expected_columns: &["customer_id", "books", "games"],
|
|
3557
|
+
expected_upstream: Some(PIVOTED_UPSTREAM),
|
|
3558
|
+
},
|
|
3559
|
+
ReshapedStarCase {
|
|
3560
|
+
name: "qualified star over aliased pivot",
|
|
3561
|
+
sql: "SELECT pv.* FROM pivot_input \
|
|
3562
|
+
PIVOT (MAX(amount) FOR category IN ('books', 'games')) AS pv",
|
|
3563
|
+
with_schema: true,
|
|
3564
|
+
expected_columns: &["customer_id", "books", "games"],
|
|
3565
|
+
expected_upstream: Some(PIVOTED_UPSTREAM),
|
|
3566
|
+
},
|
|
3567
|
+
ReshapedStarCase {
|
|
3568
|
+
name: "unpivot over cte",
|
|
3569
|
+
sql: "SELECT * FROM wide_input UNPIVOT (amount FOR category IN (books, games))",
|
|
3570
|
+
with_schema: true,
|
|
3571
|
+
expected_columns: &["customer_id", "category", "amount"],
|
|
3572
|
+
expected_upstream: None,
|
|
3573
|
+
},
|
|
3574
|
+
];
|
|
3575
|
+
for case in cases {
|
|
3576
|
+
let sql = format!("{ctes}{}", case.sql);
|
|
3577
|
+
let options = AnalyzeQueryOptions {
|
|
3578
|
+
dialect: DialectType::DuckDB,
|
|
3579
|
+
schema: case.with_schema.then(|| schema.clone()),
|
|
3580
|
+
..Default::default()
|
|
3581
|
+
};
|
|
3582
|
+
for (mode, analysis) in [
|
|
3583
|
+
("default", analyze_query(&sql, options.clone()).unwrap()),
|
|
3584
|
+
(
|
|
3585
|
+
"project",
|
|
3586
|
+
analyze_query_for_project_projections(&sql, options.clone()).unwrap(),
|
|
3587
|
+
),
|
|
3588
|
+
] {
|
|
3589
|
+
let columns: Vec<_> = analysis
|
|
3590
|
+
.projections
|
|
3591
|
+
.iter()
|
|
3592
|
+
.map(|projection| projection.name.as_deref().unwrap_or_default())
|
|
3593
|
+
.collect();
|
|
3594
|
+
assert_eq!(columns, case.expected_columns, "{} ({mode})", case.name);
|
|
3595
|
+
let Some(expected_upstream) = case.expected_upstream else {
|
|
3596
|
+
continue;
|
|
3597
|
+
};
|
|
3598
|
+
let upstream: Vec<Vec<_>> = analysis
|
|
3599
|
+
.projections
|
|
3600
|
+
.iter()
|
|
3601
|
+
.map(|projection| {
|
|
3602
|
+
projection
|
|
3603
|
+
.upstream
|
|
3604
|
+
.iter()
|
|
3605
|
+
.map(|column| {
|
|
3606
|
+
(
|
|
3607
|
+
column.table.as_deref().unwrap_or_default(),
|
|
3608
|
+
column.column.as_str(),
|
|
3609
|
+
)
|
|
3610
|
+
})
|
|
3611
|
+
.collect()
|
|
3612
|
+
})
|
|
3613
|
+
.collect();
|
|
3614
|
+
assert_eq!(upstream, expected_upstream, "{} ({mode})", case.name);
|
|
3615
|
+
}
|
|
3616
|
+
}
|
|
3617
|
+
}
|
|
@@ -25,7 +25,7 @@ With `polyglot-sql` compile-time wiring (recommended):
|
|
|
25
25
|
|
|
26
26
|
```toml
|
|
27
27
|
[dependencies]
|
|
28
|
-
polyglot-sql = { version = "0.12.
|
|
28
|
+
polyglot-sql = { version = "0.12.3", features = ["function-catalog-clickhouse"] }
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
Then run schema validation with type checks:
|
|
@@ -19,6 +19,7 @@ default = []
|
|
|
19
19
|
function-catalog-clickhouse = ["polyglot-sql/function-catalog-clickhouse"]
|
|
20
20
|
function-catalog-duckdb = ["polyglot-sql/function-catalog-duckdb"]
|
|
21
21
|
function-catalog-all-dialects = ["polyglot-sql/function-catalog-all-dialects"]
|
|
22
|
+
abi3 = ["pyo3/abi3-py312"]
|
|
22
23
|
|
|
23
24
|
[dependencies]
|
|
24
25
|
polyglot-sql = { path = "../polyglot-sql" }
|
|
@@ -8,7 +8,7 @@ dynamic = ["version"]
|
|
|
8
8
|
description = "Rust-powered SQL transpiler for more than 30 SQL dialects. Parse, generate, transpile, format, and validate SQL."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
11
|
-
requires-python = ">=3.
|
|
11
|
+
requires-python = ">=3.12"
|
|
12
12
|
keywords = ["sql", "transpiler", "parser", "dialect", "database"]
|
|
13
13
|
classifiers = [
|
|
14
14
|
"Development Status :: 4 - Beta",
|
|
@@ -17,9 +17,6 @@ classifiers = [
|
|
|
17
17
|
"Programming Language :: Rust",
|
|
18
18
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
19
19
|
"Programming Language :: Python :: 3",
|
|
20
|
-
"Programming Language :: Python :: 3.9",
|
|
21
|
-
"Programming Language :: Python :: 3.10",
|
|
22
|
-
"Programming Language :: Python :: 3.11",
|
|
23
20
|
"Programming Language :: Python :: 3.12",
|
|
24
21
|
"Programming Language :: Python :: 3.13",
|
|
25
22
|
"Topic :: Database",
|
|
File without changes
|
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/ast_traversal.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/in_list.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/lineage.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/parsing.rs
RENAMED
|
File without changes
|
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/rust_parsing.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/benches/transpile.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/examples/basic_usage.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/examples/bench_json.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/ast_children.rs
RENAMED
|
File without changes
|
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/ast_mutation.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/ast_transforms.rs
RENAMED
|
File without changes
|
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/builder/mod.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/builder/plan.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/athena.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/bigquery.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/clickhouse.rs
RENAMED
|
File without changes
|
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/databricks.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/datafusion.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/doris.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/dremio.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/drill.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/druid.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/duckdb.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/dune.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/exasol.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/fabric.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/generic.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/hive.rs
RENAMED
|
File without changes
|
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/mod.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/mysql.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/oracle.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/postgres.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/presto.rs
RENAMED
|
File without changes
|
{polyglot_sql_chio-0.12.2 → polyglot_sql_chio-0.12.3}/crates/polyglot-sql/src/dialects/redshift.rs
RENAMED
|
File without changes
|