polyglot-sql 0.9.0__tar.gz → 0.9.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/Cargo.lock +6 -6
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/Cargo.toml +1 -1
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/PKG-INFO +1 -1
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/Cargo.toml +2 -2
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/README.md +1 -1
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/ast_transforms.rs +61 -23
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/mod.rs +23 -58
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/expressions.rs +4 -4
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/generator.rs +50 -10
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/lib.rs +13 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/lineage.rs +389 -16
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/openlineage.rs +2 -57
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/annotate_types.rs +106 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/mod.rs +26 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +347 -42
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +29 -1
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/parser.rs +120 -28
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/planner.rs +12 -85
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/query_analysis.rs +167 -30
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/resolver.rs +68 -0
- polyglot_sql-0.9.1/crates/polyglot-sql/src/set_operation.rs +475 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/traversal.rs +70 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/fabric_regression.rs +56 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/query_analysis.rs +189 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/tsql_regression.rs +56 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_lineage.py +19 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/README.md +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/allocation_hotspots.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/ast_traversal.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/in_list.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/lineage.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/parsing.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/performance_hotspots.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/transpile.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/examples/bench_json.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/ast_children.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/ast_json.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/builder/engine.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/builder/mod.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/builder/plan.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/bigquery.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/clickhouse.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/databricks.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/datafusion.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/duckdb.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/exasol.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/fabric.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/hive.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/mysql.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/aggregates.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/collections.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/json.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/mod.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/operators.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/postgres_interval.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/scalar.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/statements.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/temporal.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/types.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/oracle.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/postgres.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/presto.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/snowflake.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/spark.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/sqlite.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/teradata.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/trino.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/tsql.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/diff.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/error.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/format_tokens.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/function_catalog.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/function_registry.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/guard.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/helper.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/canonicalize.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/simplify.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/subquery.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/schema.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/scope.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/time.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/tokens.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/transforms.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/trie.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/validation/tests.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/validation.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/analyze_failures.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/clickhouse_regression.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/common/known_failures.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/common/mod.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/common/test_runner.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/create_view_security_comment_regression.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/data_type_api.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/deep_nesting_regression.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/dialect_matrix.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/error_handling.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/fabric_tpch_regression.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/oracle_data_types_regression.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/postgres_explain_options.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/postgres_regexp_clickhouse.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/postgres_sqlite_regression.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/query_analysis_regression.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/snowflake_regression_test.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_compat.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/tpch_transpile_stack.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/transform_regression.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-ast-derive/Cargo.toml +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-ast-derive/src/lib.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/README.md +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/Cargo.toml +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/README.md +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/docs/api.md +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/docs/index.md +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/mkdocs.yml +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/builders.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/dialects.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/diff.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/errors.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/expr.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/expr_types.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/format.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/generate.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/helpers.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/lib.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/lineage.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/openlineage.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/optimize.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/parse.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/query_analysis.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/transforms.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/transpile.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/types.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/validate.rs +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/conftest.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_builders.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_compat.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_expression.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_format.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_optimize.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_parse.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_query_analysis.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_transforms.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/uv.lock +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/pyproject.toml +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/python/polyglot_sql/__init__.py +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/python/polyglot_sql/__init__.pyi +0 -0
- {polyglot_sql-0.9.0 → polyglot_sql-0.9.1}/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.9.
|
|
608
|
+
version = "0.9.1"
|
|
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.9.
|
|
626
|
+
version = "0.9.1"
|
|
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.9.
|
|
635
|
+
version = "0.9.1"
|
|
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.9.
|
|
645
|
+
version = "0.9.1"
|
|
646
646
|
|
|
647
647
|
[[package]]
|
|
648
648
|
name = "polyglot-sql-python"
|
|
649
|
-
version = "0.9.
|
|
649
|
+
version = "0.9.1"
|
|
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.9.
|
|
660
|
+
version = "0.9.1"
|
|
661
661
|
dependencies = [
|
|
662
662
|
"console_error_panic_hook",
|
|
663
663
|
"js-sys",
|
|
@@ -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.9.
|
|
103
|
+
polyglot-sql-ast-derive = { path = "../polyglot-sql-ast-derive", version = "0.9.1" }
|
|
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.9.
|
|
110
|
+
polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.9.1", optional = true, default-features = false }
|
|
111
111
|
|
|
112
112
|
[dev-dependencies]
|
|
113
113
|
pretty_assertions = "1.4"
|
|
@@ -25,7 +25,7 @@ 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.9.
|
|
28
|
+
polyglot-sql = { version = "0.9.1", default-features = false }
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
```toml
|
|
@@ -11,7 +11,7 @@ use std::collections::{HashMap, HashSet};
|
|
|
11
11
|
|
|
12
12
|
use crate::builder::engine;
|
|
13
13
|
use crate::expressions::*;
|
|
14
|
-
use crate::traversal::ExpressionWalk;
|
|
14
|
+
use crate::traversal::{is_aggregate, ExpressionWalk};
|
|
15
15
|
|
|
16
16
|
/// Apply a bottom-up transformation to every node in the tree.
|
|
17
17
|
/// Wraps `crate::traversal::transform` with a simpler signature for this module.
|
|
@@ -336,6 +336,26 @@ pub fn get_output_column_names(expr: &Expression) -> Vec<String> {
|
|
|
336
336
|
output_column_names_from_query(expr)
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
+
/// Collect projected output column names using dialect-specific set-operation
|
|
340
|
+
/// alignment rules.
|
|
341
|
+
///
|
|
342
|
+
/// This differs from [`get_output_column_names`] only for name-aligned set
|
|
343
|
+
/// operations. When an output shape is not statically knowable (for example an
|
|
344
|
+
/// unresolved wildcard), it preserves the existing leftmost-branch behavior.
|
|
345
|
+
pub fn get_output_column_names_for_dialect(
|
|
346
|
+
expr: &Expression,
|
|
347
|
+
dialect: Option<crate::dialects::DialectType>,
|
|
348
|
+
) -> Vec<String> {
|
|
349
|
+
crate::set_operation::query_output_identifiers(expr, dialect)
|
|
350
|
+
.map(|identifiers| {
|
|
351
|
+
identifiers
|
|
352
|
+
.into_iter()
|
|
353
|
+
.map(|identifier| identifier.name)
|
|
354
|
+
.collect()
|
|
355
|
+
})
|
|
356
|
+
.unwrap_or_else(|_| output_column_names_from_query(expr))
|
|
357
|
+
}
|
|
358
|
+
|
|
339
359
|
fn output_column_names_from_query(expr: &Expression) -> Vec<String> {
|
|
340
360
|
match expr {
|
|
341
361
|
Expression::Select(select) => select_output_column_names(select),
|
|
@@ -540,22 +560,7 @@ pub fn get_subqueries(expr: &Expression) -> Vec<&Expression> {
|
|
|
540
560
|
/// Includes typed aggregates (`Count`, `Sum`, `Avg`, `Min`, `Max`, etc.)
|
|
541
561
|
/// and generic `AggregateFunction` nodes.
|
|
542
562
|
pub fn get_aggregate_functions(expr: &Expression) -> Vec<&Expression> {
|
|
543
|
-
expr.find_all(
|
|
544
|
-
matches!(
|
|
545
|
-
e,
|
|
546
|
-
Expression::AggregateFunction(_)
|
|
547
|
-
| Expression::Count(_)
|
|
548
|
-
| Expression::Sum(_)
|
|
549
|
-
| Expression::Avg(_)
|
|
550
|
-
| Expression::Min(_)
|
|
551
|
-
| Expression::Max(_)
|
|
552
|
-
| Expression::ApproxDistinct(_)
|
|
553
|
-
| Expression::ArrayAgg(_)
|
|
554
|
-
| Expression::GroupConcat(_)
|
|
555
|
-
| Expression::StringAgg(_)
|
|
556
|
-
| Expression::ListAgg(_)
|
|
557
|
-
)
|
|
558
|
-
})
|
|
563
|
+
expr.find_all(is_aggregate)
|
|
559
564
|
}
|
|
560
565
|
|
|
561
566
|
/// Collect all window function nodes in the expression tree.
|
|
@@ -695,6 +700,37 @@ mod tests {
|
|
|
695
700
|
assert_eq!(names, vec!["c1".to_string(), "c2".to_string()]);
|
|
696
701
|
}
|
|
697
702
|
|
|
703
|
+
#[test]
|
|
704
|
+
fn test_get_output_column_names_uses_dialect_by_name_layout() {
|
|
705
|
+
for dialect in [
|
|
706
|
+
crate::dialects::DialectType::DuckDB,
|
|
707
|
+
crate::dialects::DialectType::Snowflake,
|
|
708
|
+
] {
|
|
709
|
+
let expr = crate::parse_one(
|
|
710
|
+
"SELECT 1 AS left_value UNION ALL BY NAME SELECT 2 AS right_value",
|
|
711
|
+
dialect,
|
|
712
|
+
)
|
|
713
|
+
.expect("parse");
|
|
714
|
+
assert_eq!(
|
|
715
|
+
get_output_column_names_for_dialect(&expr, Some(dialect)),
|
|
716
|
+
vec!["left_value", "right_value"]
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
let expr = crate::parse_one(
|
|
721
|
+
"SELECT 1 AS a, 2 AS b UNION ALL BY NAME SELECT 3 AS b, 4 AS a",
|
|
722
|
+
crate::dialects::DialectType::BigQuery,
|
|
723
|
+
)
|
|
724
|
+
.expect("parse");
|
|
725
|
+
assert_eq!(
|
|
726
|
+
get_output_column_names_for_dialect(
|
|
727
|
+
&expr,
|
|
728
|
+
Some(crate::dialects::DialectType::BigQuery),
|
|
729
|
+
),
|
|
730
|
+
vec!["a", "b"]
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
|
|
698
734
|
#[test]
|
|
699
735
|
fn test_get_column_names_union_still_returns_all_references() {
|
|
700
736
|
let expr =
|
|
@@ -851,12 +887,14 @@ mod tests {
|
|
|
851
887
|
|
|
852
888
|
#[test]
|
|
853
889
|
fn test_get_aggregate_functions() {
|
|
854
|
-
let expr = parse_one(
|
|
890
|
+
let expr = crate::parse_one(
|
|
891
|
+
"SELECT COUNT_IF(numeric_value > 0), MEDIAN(numeric_value), FIRST(numeric_value) FROM source_table",
|
|
892
|
+
crate::dialects::DialectType::DuckDB,
|
|
893
|
+
)
|
|
894
|
+
.unwrap();
|
|
855
895
|
let aggs = get_aggregate_functions(&expr);
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
aggs.len()
|
|
860
|
-
);
|
|
896
|
+
let aggregate_types: Vec<_> = aggs.iter().map(|agg| agg.variant_name()).collect();
|
|
897
|
+
|
|
898
|
+
assert_eq!(aggregate_types, vec!["count_if", "median", "first"]);
|
|
861
899
|
}
|
|
862
900
|
}
|
|
@@ -188,7 +188,7 @@ use crate::parser::Parser;
|
|
|
188
188
|
use crate::tokens::TokenType;
|
|
189
189
|
use crate::tokens::{Token, Tokenizer, TokenizerConfig};
|
|
190
190
|
#[cfg(feature = "transpile")]
|
|
191
|
-
use crate::traversal::ExpressionWalk;
|
|
191
|
+
use crate::traversal::{is_aggregate, ExpressionWalk};
|
|
192
192
|
use serde::{Deserialize, Serialize};
|
|
193
193
|
use std::collections::HashMap;
|
|
194
194
|
#[cfg(feature = "transpile")]
|
|
@@ -4561,6 +4561,12 @@ impl Dialect {
|
|
|
4561
4561
|
"qualified whole-row aggregate arguments",
|
|
4562
4562
|
);
|
|
4563
4563
|
}
|
|
4564
|
+
if Self::node_has_subquery_in_aggregate_argument(node) {
|
|
4565
|
+
Self::push_unsupported_diagnostic(
|
|
4566
|
+
&mut diagnostics,
|
|
4567
|
+
"aggregate arguments containing subqueries",
|
|
4568
|
+
);
|
|
4569
|
+
}
|
|
4564
4570
|
}
|
|
4565
4571
|
|
|
4566
4572
|
if !Self::target_supports_distinct_on(target) && Self::node_has_distinct_on(node) {
|
|
@@ -5368,63 +5374,7 @@ impl Dialect {
|
|
|
5368
5374
|
}
|
|
5369
5375
|
|
|
5370
5376
|
fn node_is_aggregate_function(expr: &Expression) -> bool {
|
|
5371
|
-
|
|
5372
|
-
expr,
|
|
5373
|
-
Expression::AggregateFunction(_)
|
|
5374
|
-
| Expression::Count(_)
|
|
5375
|
-
| Expression::Sum(_)
|
|
5376
|
-
| Expression::Avg(_)
|
|
5377
|
-
| Expression::Min(_)
|
|
5378
|
-
| Expression::Max(_)
|
|
5379
|
-
| Expression::GroupConcat(_)
|
|
5380
|
-
| Expression::StringAgg(_)
|
|
5381
|
-
| Expression::ListAgg(_)
|
|
5382
|
-
| Expression::ArrayAgg(_)
|
|
5383
|
-
| Expression::CountIf(_)
|
|
5384
|
-
| Expression::SumIf(_)
|
|
5385
|
-
| Expression::Stddev(_)
|
|
5386
|
-
| Expression::StddevPop(_)
|
|
5387
|
-
| Expression::StddevSamp(_)
|
|
5388
|
-
| Expression::Variance(_)
|
|
5389
|
-
| Expression::VarPop(_)
|
|
5390
|
-
| Expression::VarSamp(_)
|
|
5391
|
-
| Expression::Median(_)
|
|
5392
|
-
| Expression::Mode(_)
|
|
5393
|
-
| Expression::First(_)
|
|
5394
|
-
| Expression::Last(_)
|
|
5395
|
-
| Expression::AnyValue(_)
|
|
5396
|
-
| Expression::ApproxDistinct(_)
|
|
5397
|
-
| Expression::ApproxCountDistinct(_)
|
|
5398
|
-
| Expression::ApproxPercentile(_)
|
|
5399
|
-
| Expression::Percentile(_)
|
|
5400
|
-
| Expression::LogicalAnd(_)
|
|
5401
|
-
| Expression::LogicalOr(_)
|
|
5402
|
-
| Expression::Skewness(_)
|
|
5403
|
-
| Expression::BitwiseCount(_)
|
|
5404
|
-
| Expression::BitwiseAndAgg(_)
|
|
5405
|
-
| Expression::BitwiseOrAgg(_)
|
|
5406
|
-
| Expression::BitwiseXorAgg(_)
|
|
5407
|
-
| Expression::ArrayConcatAgg(_)
|
|
5408
|
-
| Expression::ArrayUniqueAgg(_)
|
|
5409
|
-
| Expression::BoolXorAgg(_)
|
|
5410
|
-
| Expression::JsonArrayAgg(_)
|
|
5411
|
-
| Expression::JsonObjectAgg(_)
|
|
5412
|
-
| Expression::ParameterizedAgg(_)
|
|
5413
|
-
| Expression::ArgMax(_)
|
|
5414
|
-
| Expression::ArgMin(_)
|
|
5415
|
-
| Expression::ApproxTopK(_)
|
|
5416
|
-
| Expression::ApproxTopKAccumulate(_)
|
|
5417
|
-
| Expression::ApproxTopKCombine(_)
|
|
5418
|
-
| Expression::ApproxTopKEstimate(_)
|
|
5419
|
-
| Expression::ApproxTopSum(_)
|
|
5420
|
-
| Expression::ApproxQuantiles(_)
|
|
5421
|
-
| Expression::AnonymousAggFunc(_)
|
|
5422
|
-
| Expression::CombinedAggFunc(_)
|
|
5423
|
-
| Expression::CombinedParameterizedAgg(_)
|
|
5424
|
-
| Expression::HashAgg(_)
|
|
5425
|
-
| Expression::ObjectAgg(_)
|
|
5426
|
-
| Expression::AIAgg(_)
|
|
5427
|
-
)
|
|
5377
|
+
is_aggregate(expr)
|
|
5428
5378
|
}
|
|
5429
5379
|
|
|
5430
5380
|
fn node_has_qualified_whole_row_aggregate_argument(expr: &Expression) -> bool {
|
|
@@ -5446,6 +5396,21 @@ impl Dialect {
|
|
|
5446
5396
|
&& expr.children().into_iter().any(contains_qualified_star)
|
|
5447
5397
|
}
|
|
5448
5398
|
|
|
5399
|
+
fn node_has_subquery_in_aggregate_argument(expr: &Expression) -> bool {
|
|
5400
|
+
fn contains_query(expr: &Expression) -> bool {
|
|
5401
|
+
matches!(
|
|
5402
|
+
expr,
|
|
5403
|
+
Expression::Select(_)
|
|
5404
|
+
| Expression::Subquery(_)
|
|
5405
|
+
| Expression::Union(_)
|
|
5406
|
+
| Expression::Intersect(_)
|
|
5407
|
+
| Expression::Except(_)
|
|
5408
|
+
) || expr.children().into_iter().any(contains_query)
|
|
5409
|
+
}
|
|
5410
|
+
|
|
5411
|
+
Self::node_is_aggregate_function(expr) && expr.children().into_iter().any(contains_query)
|
|
5412
|
+
}
|
|
5413
|
+
|
|
5449
5414
|
fn tsql_apply_has_invalid_outer_aggregate(expr: &Expression) -> bool {
|
|
5450
5415
|
// SQL Server error 8124: if an aggregate expression contains an outer
|
|
5451
5416
|
// reference, that reference must be the only column used by the expression.
|
|
@@ -3791,7 +3791,7 @@ impl Default for Select {
|
|
|
3791
3791
|
///
|
|
3792
3792
|
/// When `all` is true, duplicate rows are preserved (UNION ALL).
|
|
3793
3793
|
/// ORDER BY, LIMIT, and OFFSET can be applied to the combined result.
|
|
3794
|
-
/// Supports DuckDB
|
|
3794
|
+
/// Supports DuckDB/Snowflake BY NAME and BigQuery BY NAME/CORRESPONDING modifiers.
|
|
3795
3795
|
#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
3796
3796
|
#[cfg_attr(feature = "bindings", derive(TS))]
|
|
3797
3797
|
pub struct Union {
|
|
@@ -3821,7 +3821,7 @@ pub struct Union {
|
|
|
3821
3821
|
/// CLUSTER BY clause (Hive/Spark)
|
|
3822
3822
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
3823
3823
|
pub cluster_by: Option<ClusterBy>,
|
|
3824
|
-
/// DuckDB BY NAME modifier
|
|
3824
|
+
/// DuckDB, Snowflake, and BigQuery BY NAME modifier
|
|
3825
3825
|
#[serde(default)]
|
|
3826
3826
|
pub by_name: bool,
|
|
3827
3827
|
/// BigQuery: Set operation side (LEFT, RIGHT, FULL)
|
|
@@ -3890,7 +3890,7 @@ pub struct Intersect {
|
|
|
3890
3890
|
/// CLUSTER BY clause (Hive/Spark)
|
|
3891
3891
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
3892
3892
|
pub cluster_by: Option<ClusterBy>,
|
|
3893
|
-
/// DuckDB BY NAME modifier
|
|
3893
|
+
/// DuckDB, Snowflake, and BigQuery BY NAME modifier
|
|
3894
3894
|
#[serde(default)]
|
|
3895
3895
|
pub by_name: bool,
|
|
3896
3896
|
/// BigQuery: Set operation side (LEFT, RIGHT, FULL)
|
|
@@ -3957,7 +3957,7 @@ pub struct Except {
|
|
|
3957
3957
|
/// CLUSTER BY clause (Hive/Spark)
|
|
3958
3958
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
3959
3959
|
pub cluster_by: Option<ClusterBy>,
|
|
3960
|
-
/// DuckDB BY NAME modifier
|
|
3960
|
+
/// DuckDB, Snowflake, and BigQuery BY NAME modifier
|
|
3961
3961
|
#[serde(default)]
|
|
3962
3962
|
pub by_name: bool,
|
|
3963
3963
|
/// BigQuery: Set operation side (LEFT, RIGHT, FULL)
|
|
@@ -7183,7 +7183,7 @@ impl Generator {
|
|
|
7183
7183
|
}
|
|
7184
7184
|
|
|
7185
7185
|
// BigQuery: CORRESPONDING/STRICT CORRESPONDING -> BY NAME, BY (cols) -> ON (cols)
|
|
7186
|
-
// DuckDB: BY NAME
|
|
7186
|
+
// DuckDB/Snowflake: BY NAME
|
|
7187
7187
|
if union.corresponding || union.by_name {
|
|
7188
7188
|
self.write_space();
|
|
7189
7189
|
self.write_keyword("BY NAME");
|
|
@@ -7357,7 +7357,7 @@ impl Generator {
|
|
|
7357
7357
|
}
|
|
7358
7358
|
|
|
7359
7359
|
// BigQuery: CORRESPONDING/STRICT CORRESPONDING -> BY NAME, BY (cols) -> ON (cols)
|
|
7360
|
-
// DuckDB: BY NAME
|
|
7360
|
+
// DuckDB/Snowflake: BY NAME
|
|
7361
7361
|
if intersect.corresponding || intersect.by_name {
|
|
7362
7362
|
self.write_space();
|
|
7363
7363
|
self.write_keyword("BY NAME");
|
|
@@ -7565,7 +7565,7 @@ impl Generator {
|
|
|
7565
7565
|
}
|
|
7566
7566
|
|
|
7567
7567
|
// BigQuery: CORRESPONDING/STRICT CORRESPONDING -> BY NAME, BY (cols) -> ON (cols)
|
|
7568
|
-
// DuckDB: BY NAME
|
|
7568
|
+
// DuckDB/Snowflake: BY NAME
|
|
7569
7569
|
if except.corresponding || except.by_name {
|
|
7570
7570
|
self.write_space();
|
|
7571
7571
|
self.write_keyword("BY NAME");
|
|
@@ -37817,6 +37817,48 @@ impl Generator {
|
|
|
37817
37817
|
}
|
|
37818
37818
|
}
|
|
37819
37819
|
|
|
37820
|
+
fn postgres_tsql_literal_string(expr: &Expression) -> Option<Cow<'_, str>> {
|
|
37821
|
+
match expr {
|
|
37822
|
+
Expression::Literal(literal) => match literal.as_ref() {
|
|
37823
|
+
Literal::String(value) => Some(Cow::Borrowed(value)),
|
|
37824
|
+
_ => None,
|
|
37825
|
+
},
|
|
37826
|
+
Expression::Cast(cast) | Expression::TryCast(cast) | Expression::SafeCast(cast)
|
|
37827
|
+
if Self::is_string_data_type(&cast.to) =>
|
|
37828
|
+
{
|
|
37829
|
+
let value = Self::postgres_tsql_literal_string(&cast.this)?;
|
|
37830
|
+
match &cast.to {
|
|
37831
|
+
DataType::Char { length } => Some(Self::postgres_string_cast_literal(
|
|
37832
|
+
value,
|
|
37833
|
+
length.unwrap_or(1),
|
|
37834
|
+
)),
|
|
37835
|
+
DataType::VarChar {
|
|
37836
|
+
length: Some(length),
|
|
37837
|
+
..
|
|
37838
|
+
}
|
|
37839
|
+
| DataType::String {
|
|
37840
|
+
length: Some(length),
|
|
37841
|
+
} => Some(Self::postgres_string_cast_literal(value, *length)),
|
|
37842
|
+
DataType::TextWithLength { length } => {
|
|
37843
|
+
Some(Self::postgres_string_cast_literal(value, *length))
|
|
37844
|
+
}
|
|
37845
|
+
_ => Some(value),
|
|
37846
|
+
}
|
|
37847
|
+
}
|
|
37848
|
+
_ => None,
|
|
37849
|
+
}
|
|
37850
|
+
}
|
|
37851
|
+
|
|
37852
|
+
fn postgres_string_cast_literal(value: Cow<'_, str>, length: u32) -> Cow<'_, str> {
|
|
37853
|
+
let length = length as usize;
|
|
37854
|
+
let value_length = value.chars().count();
|
|
37855
|
+
if value_length > length {
|
|
37856
|
+
Cow::Owned(value.chars().take(length).collect())
|
|
37857
|
+
} else {
|
|
37858
|
+
value
|
|
37859
|
+
}
|
|
37860
|
+
}
|
|
37861
|
+
|
|
37820
37862
|
fn postgres_year_is_outside_tsql_range(value: &str, format: &str) -> bool {
|
|
37821
37863
|
fn component_is_outside(component: &str, forced_negative: bool) -> bool {
|
|
37822
37864
|
let component = component.trim().trim_end_matches(',');
|
|
@@ -37898,13 +37940,11 @@ impl Generator {
|
|
|
37898
37940
|
if target_type == "DATE"
|
|
37899
37941
|
&& matches!(self.config.source_dialect, Some(DialectType::PostgreSQL))
|
|
37900
37942
|
{
|
|
37901
|
-
if let
|
|
37902
|
-
if
|
|
37903
|
-
|
|
37904
|
-
|
|
37905
|
-
|
|
37906
|
-
)?;
|
|
37907
|
-
}
|
|
37943
|
+
if let Some(value) = Self::postgres_tsql_literal_string(this) {
|
|
37944
|
+
if Self::postgres_year_is_outside_tsql_range(&value, format) {
|
|
37945
|
+
self.unsupported(
|
|
37946
|
+
"PostgreSQL TO_DATE literal is outside the T-SQL/Fabric DATE range 0001-01-01 through 9999-12-31",
|
|
37947
|
+
)?;
|
|
37908
37948
|
}
|
|
37909
37949
|
}
|
|
37910
37950
|
}
|
|
@@ -50,6 +50,7 @@ pub mod resolver;
|
|
|
50
50
|
pub mod schema;
|
|
51
51
|
#[cfg(feature = "semantic")]
|
|
52
52
|
pub mod scope;
|
|
53
|
+
mod set_operation;
|
|
53
54
|
#[cfg(feature = "time")]
|
|
54
55
|
pub mod time;
|
|
55
56
|
pub mod tokens;
|
|
@@ -991,6 +992,18 @@ mod validation_tests {
|
|
|
991
992
|
assert!(result.errors.iter().any(|error| error.code == "W001"));
|
|
992
993
|
assert!(result.errors.iter().any(|error| error.code == "W002"));
|
|
993
994
|
assert!(result.errors.iter().any(|error| error.code == "W004"));
|
|
995
|
+
|
|
996
|
+
let median_result = validate_with_options(
|
|
997
|
+
"SELECT category, MEDIAN(price) FROM products",
|
|
998
|
+
DialectType::DuckDB,
|
|
999
|
+
&options,
|
|
1000
|
+
);
|
|
1001
|
+
|
|
1002
|
+
assert!(median_result.valid, "Warnings must not invalidate SQL");
|
|
1003
|
+
assert!(median_result
|
|
1004
|
+
.errors
|
|
1005
|
+
.iter()
|
|
1006
|
+
.any(|error| error.code == "W002"));
|
|
994
1007
|
}
|
|
995
1008
|
|
|
996
1009
|
#[test]
|