polyglot-sql-chio 0.13.0__tar.gz → 0.13.2__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.13.0 → polyglot_sql_chio-0.13.2}/Cargo.lock +6 -6
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/Cargo.toml +1 -1
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/PKG-INFO +1 -1
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/Cargo.toml +2 -2
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/README.md +4 -4
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/builder/mod.rs +3 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/mod.rs +3 -1
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/aggregates.rs +1 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/expressions.rs +17 -1
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/generator.rs +22 -2
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/annotate_types.rs +131 -22
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +17 -11
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/set_operation_types.rs +29 -2
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/parser.rs +62 -21
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/resolver.rs +27 -8
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/scope.rs +5 -3
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/set_operation.rs +67 -1
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/validation/expressions.rs +7 -1
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/validation/semantics.rs +9 -1
- polyglot_sql_chio-0.13.2/crates/polyglot-sql/src/validation/snowflake_setops.rs +637 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/validation/tests.rs +633 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/validation.rs +364 -80
- polyglot_sql_chio-0.13.2/crates/polyglot-sql/tests/fixtures/snowflake_set_operation_chains.json +8 -0
- polyglot_sql_chio-0.13.2/crates/polyglot-sql/tests/fixtures/snowflake_set_operation_matrix.txt +14 -0
- polyglot_sql_chio-0.13.2/crates/polyglot-sql/tests/fixtures/snowflake_set_operation_results.txt +88 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/snowflake_regression_test.rs +33 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/README.md +1 -1
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_format.py +17 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/README.md +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/allocation_hotspots.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/ast_traversal.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/in_list.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/lineage.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/parsing.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/performance_hotspots.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/transpile.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/examples/bench_json.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/examples/validate_batch.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/ast_children.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/ast_json.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/ast_mutation.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/ast_transforms.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/binding.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/builder/plan.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/bigquery.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/clickhouse.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/databricks.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/datafusion.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/duckdb.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/exasol.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/fabric.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/hive.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/mysql.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/collections.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/json.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/mod.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/operators.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/postgres_interval.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/scalar.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/statements.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/temporal.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/types.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/oracle.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/postgres.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/presto.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/snowflake.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/spark.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/sqlite.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/teradata.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/trino.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/tsql.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/diff.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/error.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/format_tokens.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/function_catalog.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/function_registry.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/guard.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/helper.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/lib.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/lineage.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/openlineage.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/canonicalize.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/mod.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/simplify.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/subquery.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/planner.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/query_analysis/column_uses.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/query_analysis.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/schema.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/time.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/tokens.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/transforms.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/traversal.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/trie.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/validation/coercion.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/validation/signatures.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/analyze_failures.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/clickhouse_regression.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/common/known_failures.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/common/mod.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/common/test_runner.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/create_view_security_comment_regression.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/data_type_api.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/deep_nesting_regression.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/dialect_matrix.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/error_handling.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/fabric_regression.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/fabric_tpch_regression.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/fixtures/snowflake_semantic_truth.json +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/oracle_data_types_regression.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/postgres_explain_options.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/postgres_regexp_clickhouse.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/postgres_sqlite_regression.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/qualify_tables.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/query_analysis.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/query_analysis_regression.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_compat.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/tpch_transpile_stack.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/transform_regression.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/tsql_regression.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-ast-derive/Cargo.toml +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-ast-derive/src/lib.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/src/types.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/Cargo.toml +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/README.md +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/docs/api.md +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/docs/index.md +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/mkdocs.yml +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/builders.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/dialects.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/diff.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/errors.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/expr.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/expr_types.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/format.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/generate.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/helpers.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/lib.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/lineage.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/openlineage.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/optimize.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/parse.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/query_analysis.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/transforms.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/transpile.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/types.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/validate.rs +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/conftest.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_builders.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_compat.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_expression.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_lineage.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_optimize.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_parse.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_query_analysis.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_transforms.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/uv.lock +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/pyproject.toml +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/python/polyglot_sql/__init__.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/python/polyglot_sql/__init__.pyi +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/python/polyglot_sql/analysis_types.py +0 -0
- {polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/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.13.
|
|
608
|
+
version = "0.13.2"
|
|
609
609
|
dependencies = [
|
|
610
610
|
"criterion",
|
|
611
611
|
"once_cell",
|
|
@@ -624,7 +624,7 @@ dependencies = [
|
|
|
624
624
|
|
|
625
625
|
[[package]]
|
|
626
626
|
name = "polyglot-sql-ast-derive"
|
|
627
|
-
version = "0.13.
|
|
627
|
+
version = "0.13.2"
|
|
628
628
|
dependencies = [
|
|
629
629
|
"proc-macro2",
|
|
630
630
|
"quote",
|
|
@@ -633,7 +633,7 @@ dependencies = [
|
|
|
633
633
|
|
|
634
634
|
[[package]]
|
|
635
635
|
name = "polyglot-sql-ffi"
|
|
636
|
-
version = "0.13.
|
|
636
|
+
version = "0.13.2"
|
|
637
637
|
dependencies = [
|
|
638
638
|
"cbindgen",
|
|
639
639
|
"polyglot-sql",
|
|
@@ -643,11 +643,11 @@ dependencies = [
|
|
|
643
643
|
|
|
644
644
|
[[package]]
|
|
645
645
|
name = "polyglot-sql-function-catalogs"
|
|
646
|
-
version = "0.13.
|
|
646
|
+
version = "0.13.2"
|
|
647
647
|
|
|
648
648
|
[[package]]
|
|
649
649
|
name = "polyglot-sql-python"
|
|
650
|
-
version = "0.13.
|
|
650
|
+
version = "0.13.2"
|
|
651
651
|
dependencies = [
|
|
652
652
|
"polyglot-sql",
|
|
653
653
|
"pyo3",
|
|
@@ -658,7 +658,7 @@ dependencies = [
|
|
|
658
658
|
|
|
659
659
|
[[package]]
|
|
660
660
|
name = "polyglot-sql-wasm"
|
|
661
|
-
version = "0.13.
|
|
661
|
+
version = "0.13.2"
|
|
662
662
|
dependencies = [
|
|
663
663
|
"console_error_panic_hook",
|
|
664
664
|
"js-sys",
|
|
@@ -101,14 +101,14 @@ function-catalog-all-dialects = [
|
|
|
101
101
|
|
|
102
102
|
[dependencies]
|
|
103
103
|
regex = { version = "1", optional = true }
|
|
104
|
-
polyglot-sql-ast-derive = { path = "../polyglot-sql-ast-derive", version = "0.13.
|
|
104
|
+
polyglot-sql-ast-derive = { path = "../polyglot-sql-ast-derive", version = "0.13.2" }
|
|
105
105
|
serde = { workspace = true }
|
|
106
106
|
serde_json = { workspace = true }
|
|
107
107
|
thiserror = { workspace = true }
|
|
108
108
|
unicode-segmentation = { workspace = true }
|
|
109
109
|
stacker = { version = "0.1", optional = true }
|
|
110
110
|
ts-rs = { version = "12.0", features = ["serde-compat"], optional = true }
|
|
111
|
-
polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.13.
|
|
111
|
+
polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.13.2", optional = true, default-features = false }
|
|
112
112
|
|
|
113
113
|
[dev-dependencies]
|
|
114
114
|
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.13.
|
|
28
|
+
polyglot-sql = { version = "0.13.2", default-features = false }
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
```toml
|
|
32
32
|
polyglot-sql = {
|
|
33
|
-
version = "0.13.
|
|
33
|
+
version = "0.13.2",
|
|
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.13.
|
|
47
|
+
version = "0.13.2",
|
|
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.13.
|
|
54
|
+
version = "0.13.2",
|
|
55
55
|
default-features = false,
|
|
56
56
|
features = ["transpile", "dialect-clickhouse", "dialect-postgresql"],
|
|
57
57
|
}
|
{polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/builder/mod.rs
RENAMED
|
@@ -416,6 +416,7 @@ pub fn condition(sql: &str) -> Expr {
|
|
|
416
416
|
/// Create a `COUNT(expr)` expression.
|
|
417
417
|
pub fn count(expr: Expr) -> Expr {
|
|
418
418
|
Expr(Expression::Count(Box::new(CountFunc {
|
|
419
|
+
span: None,
|
|
419
420
|
this: Some(expr.0),
|
|
420
421
|
star: false,
|
|
421
422
|
distinct: false,
|
|
@@ -429,6 +430,7 @@ pub fn count(expr: Expr) -> Expr {
|
|
|
429
430
|
/// Create a `COUNT(*)` expression.
|
|
430
431
|
pub fn count_star() -> Expr {
|
|
431
432
|
Expr(Expression::Count(Box::new(CountFunc {
|
|
433
|
+
span: None,
|
|
432
434
|
this: None,
|
|
433
435
|
star: true,
|
|
434
436
|
distinct: false,
|
|
@@ -442,6 +444,7 @@ pub fn count_star() -> Expr {
|
|
|
442
444
|
/// Create a `COUNT(DISTINCT expr)` expression.
|
|
443
445
|
pub fn count_distinct(expr: Expr) -> Expr {
|
|
444
446
|
Expr(Expression::Count(Box::new(CountFunc {
|
|
447
|
+
span: None,
|
|
445
448
|
this: Some(expr.0),
|
|
446
449
|
star: false,
|
|
447
450
|
distinct: true,
|
{polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/mod.rs
RENAMED
|
@@ -3065,7 +3065,9 @@ impl Dialect {
|
|
|
3065
3065
|
pub fn generate_pretty(&self, expr: &Expression) -> Result<String> {
|
|
3066
3066
|
let mut config = self.get_config_for_expr(expr);
|
|
3067
3067
|
config.pretty = true;
|
|
3068
|
-
let mut generator = Generator::with_config(config)
|
|
3068
|
+
let mut generator = Generator::with_config(config)
|
|
3069
|
+
.with_preserved_null_ordering()
|
|
3070
|
+
.with_preserved_variant_paths();
|
|
3069
3071
|
generator.generate(expr)
|
|
3070
3072
|
}
|
|
3071
3073
|
|
{polyglot_sql_chio-0.13.0 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/expressions.rs
RENAMED
|
@@ -6745,9 +6745,13 @@ pub struct AggFunc {
|
|
|
6745
6745
|
}
|
|
6746
6746
|
|
|
6747
6747
|
/// COUNT function with optional star
|
|
6748
|
-
#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone,
|
|
6748
|
+
#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, Serialize, Deserialize)]
|
|
6749
6749
|
#[cfg_attr(feature = "bindings", derive(TS))]
|
|
6750
6750
|
pub struct CountFunc {
|
|
6751
|
+
/// Source range of the call; metadata, not expression identity.
|
|
6752
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
6753
|
+
#[ast(skip)]
|
|
6754
|
+
pub span: Option<Span>,
|
|
6751
6755
|
pub this: Option<Expression>,
|
|
6752
6756
|
pub star: bool,
|
|
6753
6757
|
pub distinct: bool,
|
|
@@ -6764,6 +6768,18 @@ pub struct CountFunc {
|
|
|
6764
6768
|
pub inferred_type: Option<DataType>,
|
|
6765
6769
|
}
|
|
6766
6770
|
|
|
6771
|
+
impl PartialEq for CountFunc {
|
|
6772
|
+
fn eq(&self, other: &Self) -> bool {
|
|
6773
|
+
self.this == other.this
|
|
6774
|
+
&& self.star == other.star
|
|
6775
|
+
&& self.distinct == other.distinct
|
|
6776
|
+
&& self.filter == other.filter
|
|
6777
|
+
&& self.ignore_nulls == other.ignore_nulls
|
|
6778
|
+
&& self.original_name == other.original_name
|
|
6779
|
+
&& self.inferred_type == other.inferred_type
|
|
6780
|
+
}
|
|
6781
|
+
}
|
|
6782
|
+
|
|
6767
6783
|
/// GROUP_CONCAT function (MySQL style)
|
|
6768
6784
|
#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
6769
6785
|
#[cfg_attr(feature = "bindings", derive(TS))]
|
|
@@ -46,6 +46,7 @@ use serde::{Deserialize, Serialize};
|
|
|
46
46
|
pub struct Generator {
|
|
47
47
|
/// Formatting preserves the parsed null-ordering clauses instead of normalizing them.
|
|
48
48
|
preserve_null_ordering: bool,
|
|
49
|
+
preserve_variant_paths: bool,
|
|
49
50
|
config: Arc<GeneratorConfig>,
|
|
50
51
|
output: String,
|
|
51
52
|
unsupported_messages: Vec<String>,
|
|
@@ -2201,6 +2202,7 @@ impl Generator {
|
|
|
2201
2202
|
pub(crate) fn with_arc_config(config: Arc<GeneratorConfig>) -> Self {
|
|
2202
2203
|
Self {
|
|
2203
2204
|
preserve_null_ordering: false,
|
|
2205
|
+
preserve_variant_paths: false,
|
|
2204
2206
|
config,
|
|
2205
2207
|
output: String::new(),
|
|
2206
2208
|
unsupported_messages: Vec::new(),
|
|
@@ -2217,9 +2219,15 @@ impl Generator {
|
|
|
2217
2219
|
self
|
|
2218
2220
|
}
|
|
2219
2221
|
|
|
2222
|
+
pub(crate) fn with_preserved_variant_paths(mut self) -> Self {
|
|
2223
|
+
self.preserve_variant_paths = true;
|
|
2224
|
+
self
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2220
2227
|
fn child_generator(&self) -> Self {
|
|
2221
2228
|
let mut generator = Self::with_arc_config(self.config.clone());
|
|
2222
2229
|
generator.preserve_null_ordering = self.preserve_null_ordering;
|
|
2230
|
+
generator.preserve_variant_paths = self.preserve_variant_paths;
|
|
2223
2231
|
generator
|
|
2224
2232
|
}
|
|
2225
2233
|
|
|
@@ -27993,6 +28001,7 @@ impl Generator {
|
|
|
27993
28001
|
};
|
|
27994
28002
|
let mut gen = Generator::with_config(config);
|
|
27995
28003
|
gen.preserve_null_ordering = self.preserve_null_ordering;
|
|
28004
|
+
gen.preserve_variant_paths = self.preserve_variant_paths;
|
|
27996
28005
|
gen.generate_expression(expr)?;
|
|
27997
28006
|
Ok(gen.output)
|
|
27998
28007
|
}
|
|
@@ -33291,12 +33300,23 @@ impl Generator {
|
|
|
33291
33300
|
// Otherwise output JSON_EXTRACT(this, expression)
|
|
33292
33301
|
if e.variant_extract.is_some() {
|
|
33293
33302
|
use crate::dialects::DialectType;
|
|
33294
|
-
if matches!(self.config.dialect, Some(DialectType::Databricks))
|
|
33303
|
+
if matches!(self.config.dialect, Some(DialectType::Databricks))
|
|
33304
|
+
|| (self.preserve_variant_paths
|
|
33305
|
+
&& self.config.dialect == Some(DialectType::Snowflake))
|
|
33306
|
+
{
|
|
33295
33307
|
// Databricks: output col:path syntax (e.g., c1:price, c1:price.foo, c1:price.bar[1])
|
|
33296
33308
|
// Keys that are not safe identifiers (contain hyphens, spaces, etc.) must use
|
|
33297
33309
|
// bracket notation: c:["x-y"] instead of c:x-y
|
|
33298
33310
|
self.generate_expression(&e.this)?;
|
|
33299
|
-
self.write(
|
|
33311
|
+
self.write(
|
|
33312
|
+
if self.preserve_variant_paths
|
|
33313
|
+
&& matches!(e.this.as_ref(), Expression::Subscript(_))
|
|
33314
|
+
{
|
|
33315
|
+
"."
|
|
33316
|
+
} else {
|
|
33317
|
+
":"
|
|
33318
|
+
},
|
|
33319
|
+
);
|
|
33300
33320
|
match e.expression.as_ref() {
|
|
33301
33321
|
Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
|
|
33302
33322
|
let Literal::String(s) = lit.as_ref() else {
|
|
@@ -403,6 +403,33 @@ impl<'a> TypeAnnotator<'a> {
|
|
|
403
403
|
|
|
404
404
|
/// Annotate types for an expression tree
|
|
405
405
|
pub fn annotate(&mut self, expr: &Expression) -> Option<DataType> {
|
|
406
|
+
if self._dialect == Some(DialectType::Snowflake) {
|
|
407
|
+
match expr {
|
|
408
|
+
Expression::CurrentTimestamp(_) | Expression::CurrentTimestampLTZ(_) => {
|
|
409
|
+
return Some(DataType::Custom {
|
|
410
|
+
name: "TIMESTAMPLTZ".into(),
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
Expression::TimestampTzFromParts(_) => {
|
|
414
|
+
return Some(DataType::Timestamp {
|
|
415
|
+
precision: None,
|
|
416
|
+
timezone: true,
|
|
417
|
+
})
|
|
418
|
+
}
|
|
419
|
+
Expression::TimestampFromParts(_) | Expression::ToTimestamp(_) => {
|
|
420
|
+
return Some(DataType::Timestamp {
|
|
421
|
+
precision: None,
|
|
422
|
+
timezone: false,
|
|
423
|
+
})
|
|
424
|
+
}
|
|
425
|
+
_ => {}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
if self._dialect == Some(DialectType::Snowflake)
|
|
429
|
+
&& matches!(expr, Expression::ParseJson(_) | Expression::ParseJSON(_))
|
|
430
|
+
{
|
|
431
|
+
return Some(DataType::Json);
|
|
432
|
+
}
|
|
406
433
|
match expr {
|
|
407
434
|
// Literals
|
|
408
435
|
Expression::Literal(lit) => Self::annotate_literal(lit),
|
|
@@ -1421,6 +1448,56 @@ impl<'a> TypeAnnotator<'a> {
|
|
|
1421
1448
|
}
|
|
1422
1449
|
let func_name = func.name.to_uppercase();
|
|
1423
1450
|
|
|
1451
|
+
if self._dialect == Some(DialectType::Snowflake) && !func.quoted {
|
|
1452
|
+
match func_name.as_str() {
|
|
1453
|
+
"CURRENT_TIMESTAMP" | "GETDATE" | "LOCALTIMESTAMP" | "SYSTIMESTAMP" => {
|
|
1454
|
+
return Some(DataType::Custom {
|
|
1455
|
+
name: "TIMESTAMPLTZ".into(),
|
|
1456
|
+
})
|
|
1457
|
+
}
|
|
1458
|
+
"PARSE_JSON" | "TRY_PARSE_JSON" | "TO_VARIANT" => return Some(DataType::Json),
|
|
1459
|
+
"ARRAY_CONSTRUCT" | "ARRAY_CONSTRUCT_COMPACT" => {
|
|
1460
|
+
return Some(DataType::Array {
|
|
1461
|
+
element_type: Box::new(DataType::Json),
|
|
1462
|
+
dimension: None,
|
|
1463
|
+
})
|
|
1464
|
+
}
|
|
1465
|
+
"TO_TIMESTAMP"
|
|
1466
|
+
| "TO_TIMESTAMP_NTZ"
|
|
1467
|
+
| "TO_TIMESTAMP_LTZ"
|
|
1468
|
+
| "TO_TIMESTAMP_TZ"
|
|
1469
|
+
| "TRY_TO_TIMESTAMP"
|
|
1470
|
+
| "TRY_TO_TIMESTAMP_NTZ"
|
|
1471
|
+
| "TRY_TO_TIMESTAMP_LTZ"
|
|
1472
|
+
| "TRY_TO_TIMESTAMP_TZ"
|
|
1473
|
+
| "TIMESTAMP_FROM_PARTS"
|
|
1474
|
+
| "TIMESTAMP_NTZ_FROM_PARTS"
|
|
1475
|
+
| "TIMESTAMP_LTZ_FROM_PARTS"
|
|
1476
|
+
| "TIMESTAMP_TZ_FROM_PARTS" => {
|
|
1477
|
+
if func_name.contains("_NTZ") || func_name.contains("_LTZ") {
|
|
1478
|
+
return Some(DataType::Custom {
|
|
1479
|
+
name: if func_name.contains("_LTZ") {
|
|
1480
|
+
"TIMESTAMPLTZ"
|
|
1481
|
+
} else {
|
|
1482
|
+
"TIMESTAMPNTZ"
|
|
1483
|
+
}
|
|
1484
|
+
.to_string(),
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
return Some(DataType::Timestamp {
|
|
1488
|
+
precision: None,
|
|
1489
|
+
timezone: func_name.contains("_TZ"),
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
"DATE_FROM_PARTS" | "DATEFROMPARTS" | "TO_DATE" | "TRY_TO_DATE" => {
|
|
1493
|
+
return Some(DataType::Date)
|
|
1494
|
+
}
|
|
1495
|
+
"DAYOFWEEKISO" | "WEEKISO" | "WEEKOFYEAR" | "YEAROFWEEK" | "YEAROFWEEKISO"
|
|
1496
|
+
| "DAYOFYEAR" => return Some(DataType::BigInt { length: None }),
|
|
1497
|
+
_ => {}
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1424
1501
|
if self._dialect == Some(DialectType::PostgreSQL) && !func.quoted {
|
|
1425
1502
|
match func_name.as_str() {
|
|
1426
1503
|
"SUM" => return func.args.first().and_then(|arg| self.annotate_sum(arg)),
|
|
@@ -1512,7 +1589,11 @@ impl<'a> TypeAnnotator<'a> {
|
|
|
1512
1589
|
};
|
|
1513
1590
|
}
|
|
1514
1591
|
self.used_unknown_function_fallback = true;
|
|
1515
|
-
|
|
1592
|
+
if self._dialect == Some(DialectType::Snowflake) {
|
|
1593
|
+
Some(DataType::Unknown)
|
|
1594
|
+
} else {
|
|
1595
|
+
func.args.first().and_then(|arg| self.annotate(arg))
|
|
1596
|
+
}
|
|
1516
1597
|
}
|
|
1517
1598
|
}
|
|
1518
1599
|
}
|
|
@@ -2672,6 +2753,16 @@ fn annotate_scoped_expression_with_outer(
|
|
|
2672
2753
|
parent: Option<&dyn Schema>,
|
|
2673
2754
|
dialect: Option<DialectType>,
|
|
2674
2755
|
outer: Option<&dyn Schema>,
|
|
2756
|
+
) -> OutputColumns {
|
|
2757
|
+
annotate_scoped_outputs(expression, parent, dialect, outer, true)
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
fn annotate_scoped_outputs(
|
|
2761
|
+
expression: &mut Expression,
|
|
2762
|
+
parent: Option<&dyn Schema>,
|
|
2763
|
+
dialect: Option<DialectType>,
|
|
2764
|
+
outer: Option<&dyn Schema>,
|
|
2765
|
+
resolve_outputs: bool,
|
|
2675
2766
|
) -> OutputColumns {
|
|
2676
2767
|
match expression {
|
|
2677
2768
|
Expression::Select(select) => annotate_select(select, parent, dialect, outer),
|
|
@@ -2692,33 +2783,35 @@ fn annotate_scoped_expression_with_outer(
|
|
|
2692
2783
|
Expression::Union(union) => {
|
|
2693
2784
|
let mut schema = ScopedSchema::new(parent, dialect);
|
|
2694
2785
|
annotate_with(&mut union.with, &mut schema, dialect, outer);
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2786
|
+
annotate_scoped_outputs(&mut union.left, Some(&schema), dialect, outer, false);
|
|
2787
|
+
annotate_scoped_outputs(&mut union.right, Some(&schema), dialect, outer, false);
|
|
2788
|
+
if resolve_outputs {
|
|
2789
|
+
super::set_operation_types::query_columns(expression, dialect)
|
|
2790
|
+
} else {
|
|
2791
|
+
Vec::new()
|
|
2792
|
+
}
|
|
2698
2793
|
}
|
|
2699
2794
|
Expression::Intersect(intersect) => {
|
|
2700
2795
|
let mut schema = ScopedSchema::new(parent, dialect);
|
|
2701
2796
|
annotate_with(&mut intersect.with, &mut schema, dialect, outer);
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
dialect
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
&mut intersect.right,
|
|
2710
|
-
Some(&schema),
|
|
2711
|
-
dialect,
|
|
2712
|
-
outer,
|
|
2713
|
-
);
|
|
2714
|
-
super::set_operation_types::query_columns(expression, dialect)
|
|
2797
|
+
annotate_scoped_outputs(&mut intersect.left, Some(&schema), dialect, outer, false);
|
|
2798
|
+
annotate_scoped_outputs(&mut intersect.right, Some(&schema), dialect, outer, false);
|
|
2799
|
+
if resolve_outputs {
|
|
2800
|
+
super::set_operation_types::query_columns(expression, dialect)
|
|
2801
|
+
} else {
|
|
2802
|
+
Vec::new()
|
|
2803
|
+
}
|
|
2715
2804
|
}
|
|
2716
2805
|
Expression::Except(except) => {
|
|
2717
2806
|
let mut schema = ScopedSchema::new(parent, dialect);
|
|
2718
2807
|
annotate_with(&mut except.with, &mut schema, dialect, outer);
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2808
|
+
annotate_scoped_outputs(&mut except.left, Some(&schema), dialect, outer, false);
|
|
2809
|
+
annotate_scoped_outputs(&mut except.right, Some(&schema), dialect, outer, false);
|
|
2810
|
+
if resolve_outputs {
|
|
2811
|
+
super::set_operation_types::query_columns(expression, dialect)
|
|
2812
|
+
} else {
|
|
2813
|
+
Vec::new()
|
|
2814
|
+
}
|
|
2722
2815
|
}
|
|
2723
2816
|
_ => {
|
|
2724
2817
|
if let Some(mut selected) = crate::binding::dml_scope(expression) {
|
|
@@ -2826,6 +2919,16 @@ mod tests {
|
|
|
2826
2919
|
actual.is_none_or(|t| *t == DataType::Unknown),
|
|
2827
2920
|
"{dialect:?}: {actual:?}"
|
|
2828
2921
|
),
|
|
2922
|
+
Snowflake => assert!(
|
|
2923
|
+
matches!(
|
|
2924
|
+
actual,
|
|
2925
|
+
Some(DataType::Decimal {
|
|
2926
|
+
precision: Some(38),
|
|
2927
|
+
scale: Some(0)
|
|
2928
|
+
})
|
|
2929
|
+
),
|
|
2930
|
+
"{dialect:?}: {actual:?}"
|
|
2931
|
+
),
|
|
2829
2932
|
Teradata if left == "INT" => assert!(
|
|
2830
2933
|
matches!(actual, Some(DataType::Int { .. })),
|
|
2831
2934
|
"{dialect:?}: {actual:?}"
|
|
@@ -3728,7 +3831,7 @@ mod tests {
|
|
|
3728
3831
|
#[test]
|
|
3729
3832
|
fn test_regexp_extract_all_rule_is_duckdb_specific() {
|
|
3730
3833
|
// Other dialects have different overloads, notably BigQuery BYTES.
|
|
3731
|
-
//
|
|
3834
|
+
// No DuckDB-specific return rule may leak into another dialect.
|
|
3732
3835
|
for dialect in [
|
|
3733
3836
|
None,
|
|
3734
3837
|
Some(DialectType::Generic),
|
|
@@ -3741,7 +3844,13 @@ mod tests {
|
|
|
3741
3844
|
Expression::Literal(Box::new(Literal::ByteString("a1".to_string()))),
|
|
3742
3845
|
] {
|
|
3743
3846
|
let mut annotator = TypeAnnotator::new(None, dialect);
|
|
3744
|
-
let expected =
|
|
3847
|
+
let expected = if dialect == Some(DialectType::Snowflake) {
|
|
3848
|
+
// An unmodelled warehouse function must not acquire its
|
|
3849
|
+
// input type and propagate that guess into CASE/CTE outputs.
|
|
3850
|
+
Some(DataType::Unknown)
|
|
3851
|
+
} else {
|
|
3852
|
+
annotator.annotate(&input)
|
|
3853
|
+
};
|
|
3745
3854
|
let function = Expression::Function(Box::new(Function::new(
|
|
3746
3855
|
"REGEXP_EXTRACT_ALL",
|
|
3747
3856
|
vec![input, make_string_literal("[0-9]+")],
|
|
@@ -1198,23 +1198,28 @@ pub fn qualify_outputs(scope: &Scope) -> QualifyColumnsResult<()> {
|
|
|
1198
1198
|
}
|
|
1199
1199
|
|
|
1200
1200
|
fn qualify_outputs_select(select: &mut Select) -> QualifyColumnsResult<()> {
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
for (i, expr) in select.expressions.iter().enumerate() {
|
|
1201
|
+
fn qualify_output(expr: &Expression, i: usize) -> Expression {
|
|
1204
1202
|
match expr {
|
|
1205
|
-
Expression::
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1203
|
+
Expression::Annotated(annotated) => {
|
|
1204
|
+
let mut annotated = annotated.clone();
|
|
1205
|
+
annotated.this = qualify_output(&annotated.this, i);
|
|
1206
|
+
Expression::Annotated(annotated)
|
|
1207
|
+
}
|
|
1208
|
+
Expression::Alias(_) => expr.clone(),
|
|
1209
|
+
Expression::Column(col) => create_alias(expr.clone(), &col.name.name),
|
|
1210
|
+
Expression::Star(_) => expr.clone(),
|
|
1210
1211
|
_ => {
|
|
1211
1212
|
let alias_name = get_output_name(expr).unwrap_or_else(|| format!("_col_{}", i));
|
|
1212
|
-
|
|
1213
|
+
create_alias(expr.clone(), &alias_name)
|
|
1213
1214
|
}
|
|
1214
1215
|
}
|
|
1215
1216
|
}
|
|
1216
|
-
|
|
1217
|
-
|
|
1217
|
+
select.expressions = select
|
|
1218
|
+
.expressions
|
|
1219
|
+
.iter()
|
|
1220
|
+
.enumerate()
|
|
1221
|
+
.map(|(i, expr)| qualify_output(expr, i))
|
|
1222
|
+
.collect();
|
|
1218
1223
|
Ok(())
|
|
1219
1224
|
}
|
|
1220
1225
|
|
|
@@ -3071,6 +3076,7 @@ fn create_alias(expr: Expression, alias_name: &str) -> Expression {
|
|
|
3071
3076
|
/// Get the output name for an expression
|
|
3072
3077
|
fn get_output_name(expr: &Expression) -> Option<String> {
|
|
3073
3078
|
match expr {
|
|
3079
|
+
Expression::Annotated(annotated) => get_output_name(&annotated.this),
|
|
3074
3080
|
Expression::Column(col) => Some(col.name.name.clone()),
|
|
3075
3081
|
Expression::Alias(alias) => Some(alias.alias.name.clone()),
|
|
3076
3082
|
Expression::Identifier(id) => Some(id.name.clone()),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
use crate::dialects::DialectType;
|
|
6
6
|
use crate::expressions::{DataType, Expression, Literal, OracleDataType, StructField};
|
|
7
|
-
use crate::set_operation::
|
|
7
|
+
use crate::set_operation::set_operation_layout_from_identifiers;
|
|
8
8
|
use std::collections::HashMap;
|
|
9
9
|
|
|
10
10
|
#[derive(Clone, Debug)]
|
|
@@ -111,7 +111,18 @@ impl OutputResolver {
|
|
|
111
111
|
) -> Vec<QueryOutput> {
|
|
112
112
|
let left = self.resolve_inner(left, depth + 1);
|
|
113
113
|
let right = self.resolve_inner(right, depth + 1);
|
|
114
|
-
let
|
|
114
|
+
let identifiers = |outputs: &[QueryOutput]| {
|
|
115
|
+
outputs
|
|
116
|
+
.iter()
|
|
117
|
+
.map(|output| crate::binding::schema_identifier(&output.name))
|
|
118
|
+
.collect::<Vec<_>>()
|
|
119
|
+
};
|
|
120
|
+
let layout = set_operation_layout_from_identifiers(
|
|
121
|
+
query,
|
|
122
|
+
Some(self.dialect),
|
|
123
|
+
&identifiers(&left),
|
|
124
|
+
&identifiers(&right),
|
|
125
|
+
);
|
|
115
126
|
let pairs = match layout {
|
|
116
127
|
Ok(Some(layout)) => layout
|
|
117
128
|
.outputs
|
|
@@ -343,6 +354,22 @@ fn combine(
|
|
|
343
354
|
if depth > 64 || matches!(left, Unknown) || matches!(right, Unknown) {
|
|
344
355
|
return Unknown;
|
|
345
356
|
}
|
|
357
|
+
if dialect == DialectType::Snowflake {
|
|
358
|
+
if matches!((left, right), (Null, Null)) {
|
|
359
|
+
return Null;
|
|
360
|
+
}
|
|
361
|
+
let data_type = |value: &OutputType| match value {
|
|
362
|
+
Known(ty) => Some(ty.clone()),
|
|
363
|
+
StringLiteral(_) => Some(text_type(dialect)),
|
|
364
|
+
_ => None,
|
|
365
|
+
};
|
|
366
|
+
return crate::validation::snowflake_setops::result_type(
|
|
367
|
+
data_type(left).as_ref(),
|
|
368
|
+
data_type(right).as_ref(),
|
|
369
|
+
)
|
|
370
|
+
.map(Known)
|
|
371
|
+
.unwrap_or(Unknown);
|
|
372
|
+
}
|
|
346
373
|
match (left, right) {
|
|
347
374
|
(Null, Null) => match family(dialect) {
|
|
348
375
|
Family::Postgres => Known(DataType::Text),
|