polyglot-sql-chio 0.13.1__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.1 → polyglot_sql_chio-0.13.2}/Cargo.lock +6 -6
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/Cargo.toml +1 -1
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/PKG-INFO +1 -1
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/Cargo.toml +2 -2
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/README.md +4 -4
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/annotate_types.rs +100 -3
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +17 -11
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/set_operation_types.rs +16 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/parser.rs +46 -12
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/resolver.rs +1 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/scope.rs +5 -3
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/validation/expressions.rs +7 -1
- polyglot_sql_chio-0.13.2/crates/polyglot-sql/src/validation/snowflake_setops.rs +637 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/validation/tests.rs +452 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/validation.rs +140 -12
- 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.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/README.md +1 -1
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/README.md +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/allocation_hotspots.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/ast_traversal.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/in_list.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/lineage.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/parsing.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/performance_hotspots.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/benches/transpile.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/examples/bench_json.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/examples/validate_batch.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/ast_children.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/ast_json.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/ast_mutation.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/ast_transforms.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/binding.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/builder/mod.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/builder/plan.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/bigquery.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/clickhouse.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/databricks.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/datafusion.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/duckdb.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/exasol.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/fabric.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/hive.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/mod.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/mysql.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/aggregates.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/collections.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/json.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/mod.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/operators.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/postgres_interval.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/scalar.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/statements.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/temporal.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/normalization/types.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/oracle.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/postgres.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/presto.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/snowflake.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/spark.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/sqlite.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/teradata.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/trino.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/dialects/tsql.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/diff.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/error.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/expressions.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/format_tokens.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/function_catalog.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/function_registry.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/generator.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/guard.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/helper.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/lib.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/lineage.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/openlineage.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/canonicalize.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/mod.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/simplify.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/optimizer/subquery.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/planner.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/query_analysis/column_uses.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/query_analysis.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/schema.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/set_operation.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/time.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/tokens.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/transforms.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/traversal.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/trie.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/validation/coercion.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/validation/semantics.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/src/validation/signatures.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/analyze_failures.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/clickhouse_regression.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/common/known_failures.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/common/mod.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/common/test_runner.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/create_view_security_comment_regression.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/data_type_api.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/deep_nesting_regression.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/dialect_matrix.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/error_handling.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/fabric_regression.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/fabric_tpch_regression.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/fixtures/snowflake_semantic_truth.json +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/oracle_data_types_regression.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/postgres_explain_options.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/postgres_regexp_clickhouse.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/postgres_sqlite_regression.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/qualify_tables.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/query_analysis.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/query_analysis_regression.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/snowflake_regression_test.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_compat.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/tpch_transpile_stack.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/transform_regression.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql/tests/tsql_regression.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-ast-derive/Cargo.toml +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-ast-derive/src/lib.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/src/types.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/Cargo.toml +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/README.md +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/docs/api.md +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/docs/index.md +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/mkdocs.yml +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/builders.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/dialects.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/diff.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/errors.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/expr.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/expr_types.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/format.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/generate.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/helpers.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/lib.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/lineage.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/openlineage.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/optimize.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/parse.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/query_analysis.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/transforms.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/transpile.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/types.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/src/validate.rs +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/conftest.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_builders.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_compat.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_expression.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_format.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_lineage.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_optimize.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_parse.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_query_analysis.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_transforms.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/crates/polyglot-sql-python/uv.lock +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/pyproject.toml +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/python/polyglot_sql/__init__.py +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/python/polyglot_sql/__init__.pyi +0 -0
- {polyglot_sql_chio-0.13.1 → polyglot_sql_chio-0.13.2}/python/polyglot_sql/analysis_types.py +0 -0
- {polyglot_sql_chio-0.13.1 → 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
|
}
|
|
@@ -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
|
}
|
|
@@ -2838,6 +2919,16 @@ mod tests {
|
|
|
2838
2919
|
actual.is_none_or(|t| *t == DataType::Unknown),
|
|
2839
2920
|
"{dialect:?}: {actual:?}"
|
|
2840
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
|
+
),
|
|
2841
2932
|
Teradata if left == "INT" => assert!(
|
|
2842
2933
|
matches!(actual, Some(DataType::Int { .. })),
|
|
2843
2934
|
"{dialect:?}: {actual:?}"
|
|
@@ -3740,7 +3831,7 @@ mod tests {
|
|
|
3740
3831
|
#[test]
|
|
3741
3832
|
fn test_regexp_extract_all_rule_is_duckdb_specific() {
|
|
3742
3833
|
// Other dialects have different overloads, notably BigQuery BYTES.
|
|
3743
|
-
//
|
|
3834
|
+
// No DuckDB-specific return rule may leak into another dialect.
|
|
3744
3835
|
for dialect in [
|
|
3745
3836
|
None,
|
|
3746
3837
|
Some(DialectType::Generic),
|
|
@@ -3753,7 +3844,13 @@ mod tests {
|
|
|
3753
3844
|
Expression::Literal(Box::new(Literal::ByteString("a1".to_string()))),
|
|
3754
3845
|
] {
|
|
3755
3846
|
let mut annotator = TypeAnnotator::new(None, dialect);
|
|
3756
|
-
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
|
+
};
|
|
3757
3854
|
let function = Expression::Function(Box::new(Function::new(
|
|
3758
3855
|
"REGEXP_EXTRACT_ALL",
|
|
3759
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()),
|
|
@@ -354,6 +354,22 @@ fn combine(
|
|
|
354
354
|
if depth > 64 || matches!(left, Unknown) || matches!(right, Unknown) {
|
|
355
355
|
return Unknown;
|
|
356
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
|
+
}
|
|
357
373
|
match (left, right) {
|
|
358
374
|
(Null, Null) => match family(dialect) {
|
|
359
375
|
Family::Postgres => Known(DataType::Text),
|
|
@@ -10588,6 +10588,10 @@ impl Parser {
|
|
|
10588
10588
|
strict,
|
|
10589
10589
|
on_columns,
|
|
10590
10590
|
}));
|
|
10591
|
+
// INTERSECT binds more tightly than UNION and EXCEPT on Snowflake.
|
|
10592
|
+
if self.config.dialect == Some(crate::dialects::DialectType::Snowflake) {
|
|
10593
|
+
result = Self::snowflake_intersect_precedence(result);
|
|
10594
|
+
}
|
|
10591
10595
|
found_set_op = true;
|
|
10592
10596
|
} else if self.check_set_operation_start(TokenType::Except) {
|
|
10593
10597
|
self.skip();
|
|
@@ -10647,6 +10651,42 @@ impl Parser {
|
|
|
10647
10651
|
Ok(result)
|
|
10648
10652
|
}
|
|
10649
10653
|
|
|
10654
|
+
fn snowflake_intersect_precedence(expression: Expression) -> Expression {
|
|
10655
|
+
let Expression::Intersect(mut intersect) = expression else {
|
|
10656
|
+
return expression;
|
|
10657
|
+
};
|
|
10658
|
+
match std::mem::replace(&mut intersect.left, Expression::null()) {
|
|
10659
|
+
Expression::Annotated(mut annotated) => {
|
|
10660
|
+
intersect.left = std::mem::replace(&mut annotated.this, Expression::null());
|
|
10661
|
+
annotated.this =
|
|
10662
|
+
Self::snowflake_intersect_precedence(Expression::Intersect(intersect));
|
|
10663
|
+
Expression::Annotated(annotated)
|
|
10664
|
+
}
|
|
10665
|
+
Expression::Union(mut outer) => {
|
|
10666
|
+
intersect.left = std::mem::replace(&mut outer.right, Expression::null());
|
|
10667
|
+
outer.order_by = intersect.order_by.take();
|
|
10668
|
+
outer.limit = intersect.limit.take();
|
|
10669
|
+
outer.offset = intersect.offset.take();
|
|
10670
|
+
outer.right =
|
|
10671
|
+
Self::snowflake_intersect_precedence(Expression::Intersect(intersect));
|
|
10672
|
+
Expression::Union(outer)
|
|
10673
|
+
}
|
|
10674
|
+
Expression::Except(mut outer) => {
|
|
10675
|
+
intersect.left = std::mem::replace(&mut outer.right, Expression::null());
|
|
10676
|
+
outer.order_by = intersect.order_by.take();
|
|
10677
|
+
outer.limit = intersect.limit.take();
|
|
10678
|
+
outer.offset = intersect.offset.take();
|
|
10679
|
+
outer.right =
|
|
10680
|
+
Self::snowflake_intersect_precedence(Expression::Intersect(intersect));
|
|
10681
|
+
Expression::Except(outer)
|
|
10682
|
+
}
|
|
10683
|
+
left => {
|
|
10684
|
+
intersect.left = left;
|
|
10685
|
+
Expression::Intersect(intersect)
|
|
10686
|
+
}
|
|
10687
|
+
}
|
|
10688
|
+
}
|
|
10689
|
+
|
|
10650
10690
|
/// Canonicalize a VALUES set-operation branch as a SELECT from a derived table.
|
|
10651
10691
|
/// This keeps VALUES branches addressable by later alias-pushdown transforms and
|
|
10652
10692
|
/// matches SQLGlot's set-operation AST shape.
|
|
@@ -37450,18 +37490,12 @@ impl Parser {
|
|
|
37450
37490
|
}
|
|
37451
37491
|
}
|
|
37452
37492
|
self.expect(TokenType::RParen)?;
|
|
37453
|
-
//
|
|
37454
|
-
|
|
37455
|
-
|
|
37456
|
-
args,
|
|
37457
|
-
|
|
37458
|
-
|
|
37459
|
-
use_bracket_syntax: false,
|
|
37460
|
-
no_parens: false,
|
|
37461
|
-
quoted: false,
|
|
37462
|
-
span: None,
|
|
37463
|
-
inferred_type: None,
|
|
37464
|
-
})));
|
|
37493
|
+
// Multi-argument COUNT is still an aggregate (Snowflake).
|
|
37494
|
+
if self.config.dialect == Some(crate::dialects::DialectType::Snowflake) {
|
|
37495
|
+
let filter = self.parse_filter_clause()?;
|
|
37496
|
+
return Ok(Self::make_simple_aggregate(name, args, false, filter));
|
|
37497
|
+
}
|
|
37498
|
+
return Ok(Self::make_unquoted_function(name, args));
|
|
37465
37499
|
}
|
|
37466
37500
|
(Some(first_expr), false, false)
|
|
37467
37501
|
};
|
|
@@ -397,6 +397,7 @@ impl<'a> Resolver<'a> {
|
|
|
397
397
|
/// Get the alias or name for a select expression
|
|
398
398
|
fn get_expression_alias(&self, expr: &Expression) -> Option<String> {
|
|
399
399
|
match expr {
|
|
400
|
+
Expression::Annotated(annotated) => self.get_expression_alias(&annotated.this),
|
|
400
401
|
Expression::Alias(alias) => Some(alias.alias.name.clone()),
|
|
401
402
|
Expression::Column(col) => Some(col.name.name.clone()),
|
|
402
403
|
Expression::Star(_) => Some("*".to_string()),
|
|
@@ -933,9 +933,11 @@ fn add_table_to_scope(expr: &Expression, scope: &mut Scope) {
|
|
|
933
933
|
scope.derived_table_scopes.push(derived_scope);
|
|
934
934
|
}
|
|
935
935
|
Expression::Lateral(lateral) => {
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
936
|
+
let name = lateral
|
|
937
|
+
.alias
|
|
938
|
+
.clone()
|
|
939
|
+
.unwrap_or_else(|| scope.next_virtual_source_name());
|
|
940
|
+
scope.add_virtual_source(name, expr.clone());
|
|
939
941
|
}
|
|
940
942
|
Expression::LateralView(lateral_view) => {
|
|
941
943
|
add_lateral_view_to_scope(lateral_view, scope);
|
|
@@ -332,7 +332,13 @@ pub(super) fn check(
|
|
|
332
332
|
false,
|
|
333
333
|
validation_codes::E_INVALID_CAST,
|
|
334
334
|
validation_codes::W_LOSSY_CAST,
|
|
335
|
-
format!(
|
|
335
|
+
format!(
|
|
336
|
+
"Unknown cast target type '{}'",
|
|
337
|
+
match &expr.to {
|
|
338
|
+
DataType::Custom { name } => name.as_str(),
|
|
339
|
+
_ => unreachable!(),
|
|
340
|
+
}
|
|
341
|
+
),
|
|
336
342
|
));
|
|
337
343
|
}
|
|
338
344
|
}
|