polyglot-sql 0.7.0__tar.gz → 0.8.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.7.0 → polyglot_sql-0.8.1}/Cargo.lock +6 -6
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/Cargo.toml +1 -1
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/PKG-INFO +8 -1
- {polyglot_sql-0.7.0/crates/polyglot-sql-python → polyglot_sql-0.8.1}/README.md +7 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/Cargo.toml +2 -2
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/README.md +11 -4
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/mod.rs +274 -18
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/normalization/mod.rs +3 -3
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/normalization/scalar.rs +10 -5
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/tsql.rs +215 -28
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/generator.rs +102 -2
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/lib.rs +3 -3
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/lineage.rs +104 -5
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/openlineage.rs +152 -16
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/parser.rs +8 -1
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/query_analysis.rs +33 -3
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/tokens.rs +18 -3
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/transforms.rs +337 -15
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/fabric_regression.rs +225 -2
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/query_analysis.rs +31 -1
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/tsql_regression.rs +245 -10
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1/crates/polyglot-sql-python}/README.md +7 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/test_lineage.py +10 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/benches/allocation_hotspots.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/benches/ast_traversal.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/benches/in_list.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/benches/lineage.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/benches/parsing.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/benches/performance_hotspots.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/benches/transpile.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/examples/bench_json.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/ast_children.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/ast_json.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/ast_transforms.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/builder.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/bigquery.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/clickhouse.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/databricks.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/datafusion.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/duckdb.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/exasol.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/fabric.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/hive.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/mysql.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/normalization/aggregates.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/normalization/collections.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/normalization/json.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/normalization/operators.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/normalization/postgres_interval.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/normalization/statements.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/normalization/temporal.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/normalization/types.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/oracle.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/postgres.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/presto.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/snowflake.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/spark.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/sqlite.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/teradata.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/trino.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/diff.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/error.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/expressions.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/format_tokens.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/function_catalog.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/function_registry.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/guard.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/helper.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/annotate_types.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/canonicalize.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/mod.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/simplify.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/optimizer/subquery.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/planner.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/resolver.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/schema.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/scope.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/time.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/traversal.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/trie.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/validation/tests.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/validation.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/analyze_failures.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/clickhouse_regression.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/common/known_failures.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/common/mod.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/common/test_runner.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/create_view_security_comment_regression.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/data_type_api.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/deep_nesting_regression.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/dialect_matrix.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/error_handling.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/fabric_tpch_regression.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/oracle_data_types_regression.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/postgres_explain_options.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/postgres_regexp_clickhouse.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/postgres_sqlite_regression.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/query_analysis_regression.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/snowflake_regression_test.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/sqlglot_compat.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/tpch_transpile_stack.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/tests/transform_regression.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-ast-derive/Cargo.toml +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-ast-derive/src/lib.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-function-catalogs/README.md +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/Cargo.toml +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/docs/api.md +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/docs/index.md +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/mkdocs.yml +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/dialects.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/diff.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/errors.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/expr.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/expr_types.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/format.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/generate.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/helpers.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/lib.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/lineage.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/openlineage.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/optimize.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/parse.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/query_analysis.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/transforms.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/transpile.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/types.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/src/validate.rs +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/conftest.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/test_compat.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/test_expression.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/test_format.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/test_optimize.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/test_parse.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/test_query_analysis.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/test_transforms.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql-python/uv.lock +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/pyproject.toml +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/python/polyglot_sql/__init__.py +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/python/polyglot_sql/__init__.pyi +0 -0
- {polyglot_sql-0.7.0 → polyglot_sql-0.8.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.
|
|
608
|
+
version = "0.8.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.
|
|
626
|
+
version = "0.8.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.
|
|
635
|
+
version = "0.8.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.
|
|
645
|
+
version = "0.8.1"
|
|
646
646
|
|
|
647
647
|
[[package]]
|
|
648
648
|
name = "polyglot-sql-python"
|
|
649
|
-
version = "0.
|
|
649
|
+
version = "0.8.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.
|
|
660
|
+
version = "0.8.1"
|
|
661
661
|
dependencies = [
|
|
662
662
|
"console_error_panic_hook",
|
|
663
663
|
"js-sys",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: polyglot-sql
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.1
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -177,6 +177,13 @@ Function-like projections may include `transformFunction` with the function
|
|
|
177
177
|
name, literal arguments, and column arguments, for example for
|
|
178
178
|
`DATE_TRUNC('month', created_at)`.
|
|
179
179
|
|
|
180
|
+
Each `analysis["setOperations"][...]["branches"]` entry includes a `role` of
|
|
181
|
+
`"value"` or `"filter"`. Lineage results attach optional `set_branch` metadata
|
|
182
|
+
to immediate set-operation branch roots with the `operator`, original
|
|
183
|
+
zero-based `ordinal`, and `all` flag; omitted branches do not renumber the
|
|
184
|
+
surviving nodes. In OpenLineage output, `EXCEPT` and `INTERSECT` right-hand
|
|
185
|
+
inputs are emitted as indirect `FILTER` dependencies.
|
|
186
|
+
|
|
180
187
|
Validation schema dictionaries use:
|
|
181
188
|
|
|
182
189
|
```python
|
|
@@ -150,6 +150,13 @@ Function-like projections may include `transformFunction` with the function
|
|
|
150
150
|
name, literal arguments, and column arguments, for example for
|
|
151
151
|
`DATE_TRUNC('month', created_at)`.
|
|
152
152
|
|
|
153
|
+
Each `analysis["setOperations"][...]["branches"]` entry includes a `role` of
|
|
154
|
+
`"value"` or `"filter"`. Lineage results attach optional `set_branch` metadata
|
|
155
|
+
to immediate set-operation branch roots with the `operator`, original
|
|
156
|
+
zero-based `ordinal`, and `all` flag; omitted branches do not renumber the
|
|
157
|
+
surviving nodes. In OpenLineage output, `EXCEPT` and `INTERSECT` right-hand
|
|
158
|
+
inputs are emitted as indirect `FILTER` dependencies.
|
|
159
|
+
|
|
153
160
|
Validation schema dictionaries use:
|
|
154
161
|
|
|
155
162
|
```python
|
|
@@ -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.
|
|
103
|
+
polyglot-sql-ast-derive = { path = "../polyglot-sql-ast-derive", version = "0.8.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.
|
|
110
|
+
polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.8.1", optional = true, default-features = false }
|
|
111
111
|
|
|
112
112
|
[dev-dependencies]
|
|
113
113
|
pretty_assertions = "1.4"
|
|
@@ -25,12 +25,12 @@ By default, `polyglot-sql` enables the full public API. Parser-only consumers ca
|
|
|
25
25
|
disable default features and opt into only the dialect parsers they need:
|
|
26
26
|
|
|
27
27
|
```toml
|
|
28
|
-
polyglot-sql = { version = "0.
|
|
28
|
+
polyglot-sql = { version = "0.8.1", default-features = false }
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
```toml
|
|
32
32
|
polyglot-sql = {
|
|
33
|
-
version = "0.
|
|
33
|
+
version = "0.8.0",
|
|
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.
|
|
47
|
+
version = "0.8.0",
|
|
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.
|
|
54
|
+
version = "0.8.0",
|
|
55
55
|
default-features = false,
|
|
56
56
|
features = ["transpile", "dialect-clickhouse", "dialect-postgresql"],
|
|
57
57
|
}
|
|
@@ -332,6 +332,13 @@ and CTE output columns. `star_projections` reports the original top-level star
|
|
|
332
332
|
projection index, optional table qualifier, and schema-expanded columns when
|
|
333
333
|
known. Each projection also includes conservative `nullability`:
|
|
334
334
|
`non_null`, `nullable`, or `unknown`.
|
|
335
|
+
Each `set_operations` branch includes a semantic `role`: both `UNION` branches
|
|
336
|
+
are `value`, while the right branch of `EXCEPT` and `INTERSECT` is `filter`.
|
|
337
|
+
|
|
338
|
+
Lineage nodes at immediate set-operation branch roots expose optional
|
|
339
|
+
`set_branch` metadata with the operator, original zero-based branch ordinal,
|
|
340
|
+
and `ALL` flag. The ordinal remains stable when another branch cannot be
|
|
341
|
+
resolved.
|
|
335
342
|
|
|
336
343
|
```rust
|
|
337
344
|
use polyglot_sql::{
|
|
@@ -4244,6 +4244,15 @@ impl Dialect {
|
|
|
4244
4244
|
}
|
|
4245
4245
|
|
|
4246
4246
|
let mut diagnostics = Vec::new();
|
|
4247
|
+
if matches!(source, DialectType::PostgreSQL | DialectType::CockroachDB)
|
|
4248
|
+
&& matches!(target, DialectType::TSQL | DialectType::Fabric)
|
|
4249
|
+
&& Self::tsql_apply_has_invalid_outer_aggregate(expr)
|
|
4250
|
+
{
|
|
4251
|
+
Self::push_unsupported_diagnostic(
|
|
4252
|
+
&mut diagnostics,
|
|
4253
|
+
"APPLY aggregate expressions that combine an outer reference with another column reference",
|
|
4254
|
+
);
|
|
4255
|
+
}
|
|
4247
4256
|
let structural_grouping_tuples =
|
|
4248
4257
|
if matches!(source, DialectType::PostgreSQL | DialectType::CockroachDB)
|
|
4249
4258
|
&& matches!(target, DialectType::TSQL | DialectType::Fabric)
|
|
@@ -5091,22 +5100,8 @@ impl Dialect {
|
|
|
5091
5100
|
}
|
|
5092
5101
|
}
|
|
5093
5102
|
|
|
5094
|
-
fn
|
|
5095
|
-
|
|
5096
|
-
match expr {
|
|
5097
|
-
Expression::Star(star) => star.table.is_some(),
|
|
5098
|
-
// A star projected by an embedded query is not an argument of
|
|
5099
|
-
// the surrounding aggregate (for example, inside EXISTS).
|
|
5100
|
-
Expression::Select(_)
|
|
5101
|
-
| Expression::Subquery(_)
|
|
5102
|
-
| Expression::Union(_)
|
|
5103
|
-
| Expression::Intersect(_)
|
|
5104
|
-
| Expression::Except(_) => false,
|
|
5105
|
-
_ => expr.children().into_iter().any(contains_qualified_star),
|
|
5106
|
-
}
|
|
5107
|
-
}
|
|
5108
|
-
|
|
5109
|
-
let is_aggregate = matches!(
|
|
5103
|
+
fn node_is_aggregate_function(expr: &Expression) -> bool {
|
|
5104
|
+
matches!(
|
|
5110
5105
|
expr,
|
|
5111
5106
|
Expression::AggregateFunction(_)
|
|
5112
5107
|
| Expression::Count(_)
|
|
@@ -5162,9 +5157,218 @@ impl Dialect {
|
|
|
5162
5157
|
| Expression::HashAgg(_)
|
|
5163
5158
|
| Expression::ObjectAgg(_)
|
|
5164
5159
|
| Expression::AIAgg(_)
|
|
5165
|
-
)
|
|
5160
|
+
)
|
|
5161
|
+
}
|
|
5162
|
+
|
|
5163
|
+
fn node_has_qualified_whole_row_aggregate_argument(expr: &Expression) -> bool {
|
|
5164
|
+
fn contains_qualified_star(expr: &Expression) -> bool {
|
|
5165
|
+
match expr {
|
|
5166
|
+
Expression::Star(star) => star.table.is_some(),
|
|
5167
|
+
// A star projected by an embedded query is not an argument of
|
|
5168
|
+
// the surrounding aggregate (for example, inside EXISTS).
|
|
5169
|
+
Expression::Select(_)
|
|
5170
|
+
| Expression::Subquery(_)
|
|
5171
|
+
| Expression::Union(_)
|
|
5172
|
+
| Expression::Intersect(_)
|
|
5173
|
+
| Expression::Except(_) => false,
|
|
5174
|
+
_ => expr.children().into_iter().any(contains_qualified_star),
|
|
5175
|
+
}
|
|
5176
|
+
}
|
|
5177
|
+
|
|
5178
|
+
Self::node_is_aggregate_function(expr)
|
|
5179
|
+
&& expr.children().into_iter().any(contains_qualified_star)
|
|
5180
|
+
}
|
|
5181
|
+
|
|
5182
|
+
fn tsql_apply_has_invalid_outer_aggregate(expr: &Expression) -> bool {
|
|
5183
|
+
// SQL Server error 8124: if an aggregate expression contains an outer
|
|
5184
|
+
// reference, that reference must be the only column used by the expression.
|
|
5185
|
+
fn collect_source_names(expr: &Expression, names: &mut HashSet<String>) {
|
|
5186
|
+
let mut insert = |name: &Identifier| {
|
|
5187
|
+
if !name.name.is_empty() {
|
|
5188
|
+
names.insert(name.name.to_ascii_lowercase());
|
|
5189
|
+
}
|
|
5190
|
+
};
|
|
5191
|
+
|
|
5192
|
+
match expr {
|
|
5193
|
+
Expression::Table(table) => {
|
|
5194
|
+
insert(table.alias.as_ref().unwrap_or(&table.name));
|
|
5195
|
+
}
|
|
5196
|
+
Expression::Subquery(subquery) => {
|
|
5197
|
+
if let Some(alias) = &subquery.alias {
|
|
5198
|
+
insert(alias);
|
|
5199
|
+
}
|
|
5200
|
+
}
|
|
5201
|
+
Expression::Alias(alias) => insert(&alias.alias),
|
|
5202
|
+
Expression::JoinedTable(joined) => {
|
|
5203
|
+
if let Some(alias) = &joined.alias {
|
|
5204
|
+
insert(alias);
|
|
5205
|
+
} else {
|
|
5206
|
+
collect_source_names(&joined.left, names);
|
|
5207
|
+
for join in &joined.joins {
|
|
5208
|
+
collect_source_names(&join.this, names);
|
|
5209
|
+
}
|
|
5210
|
+
}
|
|
5211
|
+
}
|
|
5212
|
+
Expression::Paren(paren) => collect_source_names(&paren.this, names),
|
|
5213
|
+
Expression::Pivot(pivot) => {
|
|
5214
|
+
if let Some(alias) = &pivot.alias {
|
|
5215
|
+
insert(alias);
|
|
5216
|
+
} else {
|
|
5217
|
+
collect_source_names(&pivot.this, names);
|
|
5218
|
+
}
|
|
5219
|
+
}
|
|
5220
|
+
Expression::Unpivot(unpivot) => {
|
|
5221
|
+
if let Some(alias) = &unpivot.alias {
|
|
5222
|
+
insert(alias);
|
|
5223
|
+
} else {
|
|
5224
|
+
collect_source_names(&unpivot.this, names);
|
|
5225
|
+
}
|
|
5226
|
+
}
|
|
5227
|
+
_ => {}
|
|
5228
|
+
}
|
|
5229
|
+
}
|
|
5230
|
+
|
|
5231
|
+
fn collect_columns<'a>(
|
|
5232
|
+
expr: &'a Expression,
|
|
5233
|
+
columns: &mut Vec<&'a crate::expressions::Column>,
|
|
5234
|
+
) {
|
|
5235
|
+
match expr {
|
|
5236
|
+
Expression::Column(column) => columns.push(column),
|
|
5237
|
+
// Query expressions introduce a new name-resolution scope. Their
|
|
5238
|
+
// columns are checked when their own SELECT node is visited.
|
|
5239
|
+
Expression::Select(_)
|
|
5240
|
+
| Expression::Subquery(_)
|
|
5241
|
+
| Expression::Union(_)
|
|
5242
|
+
| Expression::Intersect(_)
|
|
5243
|
+
| Expression::Except(_) => {}
|
|
5244
|
+
_ => {
|
|
5245
|
+
for child in expr.children() {
|
|
5246
|
+
collect_columns(child, columns);
|
|
5247
|
+
}
|
|
5248
|
+
}
|
|
5249
|
+
}
|
|
5250
|
+
}
|
|
5251
|
+
|
|
5252
|
+
fn same_column(
|
|
5253
|
+
left: &crate::expressions::Column,
|
|
5254
|
+
right: &crate::expressions::Column,
|
|
5255
|
+
) -> bool {
|
|
5256
|
+
let same_identifier =
|
|
5257
|
+
|left: &Identifier, right: &Identifier| left.name.eq_ignore_ascii_case(&right.name);
|
|
5258
|
+
|
|
5259
|
+
same_identifier(&left.name, &right.name)
|
|
5260
|
+
&& match (&left.table, &right.table) {
|
|
5261
|
+
(Some(left), Some(right)) => same_identifier(left, right),
|
|
5262
|
+
(None, None) => true,
|
|
5263
|
+
_ => false,
|
|
5264
|
+
}
|
|
5265
|
+
}
|
|
5166
5266
|
|
|
5167
|
-
|
|
5267
|
+
fn aggregate_is_invalid(expr: &Expression, local_sources: &HashSet<String>) -> bool {
|
|
5268
|
+
let mut columns = Vec::new();
|
|
5269
|
+
collect_columns(expr, &mut columns);
|
|
5270
|
+
|
|
5271
|
+
let outer_column = columns.iter().copied().find(|column| match &column.table {
|
|
5272
|
+
Some(table) => !local_sources.contains(&table.name.to_ascii_lowercase()),
|
|
5273
|
+
// Without a local source, an unqualified reference in a lateral
|
|
5274
|
+
// query can only resolve against an outer scope.
|
|
5275
|
+
None => local_sources.is_empty(),
|
|
5276
|
+
});
|
|
5277
|
+
|
|
5278
|
+
outer_column
|
|
5279
|
+
.is_some_and(|outer| columns.iter().any(|column| !same_column(outer, column)))
|
|
5280
|
+
}
|
|
5281
|
+
|
|
5282
|
+
fn expression_has_invalid_aggregate(
|
|
5283
|
+
expr: &Expression,
|
|
5284
|
+
local_sources: &HashSet<String>,
|
|
5285
|
+
) -> bool {
|
|
5286
|
+
if Dialect::node_is_aggregate_function(expr)
|
|
5287
|
+
&& aggregate_is_invalid(expr, local_sources)
|
|
5288
|
+
{
|
|
5289
|
+
return true;
|
|
5290
|
+
}
|
|
5291
|
+
|
|
5292
|
+
match expr {
|
|
5293
|
+
Expression::Select(_)
|
|
5294
|
+
| Expression::Subquery(_)
|
|
5295
|
+
| Expression::Union(_)
|
|
5296
|
+
| Expression::Intersect(_)
|
|
5297
|
+
| Expression::Except(_) => false,
|
|
5298
|
+
_ => expr
|
|
5299
|
+
.children()
|
|
5300
|
+
.into_iter()
|
|
5301
|
+
.any(|child| expression_has_invalid_aggregate(child, local_sources)),
|
|
5302
|
+
}
|
|
5303
|
+
}
|
|
5304
|
+
|
|
5305
|
+
fn select_has_invalid_aggregate(select: &Select) -> bool {
|
|
5306
|
+
let mut local_sources = HashSet::new();
|
|
5307
|
+
if let Some(from) = &select.from {
|
|
5308
|
+
for source in &from.expressions {
|
|
5309
|
+
collect_source_names(source, &mut local_sources);
|
|
5310
|
+
}
|
|
5311
|
+
}
|
|
5312
|
+
for join in &select.joins {
|
|
5313
|
+
collect_source_names(&join.this, &mut local_sources);
|
|
5314
|
+
}
|
|
5315
|
+
|
|
5316
|
+
let invalid =
|
|
5317
|
+
|expr: &Expression| expression_has_invalid_aggregate(expr, &local_sources);
|
|
5318
|
+
|
|
5319
|
+
select.expressions.iter().any(invalid)
|
|
5320
|
+
|| select.prewhere.as_ref().is_some_and(invalid)
|
|
5321
|
+
|| select
|
|
5322
|
+
.where_clause
|
|
5323
|
+
.as_ref()
|
|
5324
|
+
.is_some_and(|where_clause| invalid(&where_clause.this))
|
|
5325
|
+
|| select
|
|
5326
|
+
.group_by
|
|
5327
|
+
.as_ref()
|
|
5328
|
+
.is_some_and(|group_by| group_by.expressions.iter().any(invalid))
|
|
5329
|
+
|| select
|
|
5330
|
+
.having
|
|
5331
|
+
.as_ref()
|
|
5332
|
+
.is_some_and(|having| invalid(&having.this))
|
|
5333
|
+
|| select
|
|
5334
|
+
.qualify
|
|
5335
|
+
.as_ref()
|
|
5336
|
+
.is_some_and(|qualify| invalid(&qualify.this))
|
|
5337
|
+
|| select.order_by.as_ref().is_some_and(|order_by| {
|
|
5338
|
+
order_by
|
|
5339
|
+
.expressions
|
|
5340
|
+
.iter()
|
|
5341
|
+
.any(|ordered| invalid(&ordered.this))
|
|
5342
|
+
})
|
|
5343
|
+
}
|
|
5344
|
+
|
|
5345
|
+
fn apply_rhs_is_invalid(rhs: &Expression) -> bool {
|
|
5346
|
+
rhs.dfs().any(|node| match node {
|
|
5347
|
+
Expression::Select(select) => select_has_invalid_aggregate(select),
|
|
5348
|
+
_ => false,
|
|
5349
|
+
})
|
|
5350
|
+
}
|
|
5351
|
+
|
|
5352
|
+
fn joins_have_invalid_aggregate(joins: &[Join]) -> bool {
|
|
5353
|
+
joins.iter().any(|join| {
|
|
5354
|
+
matches!(
|
|
5355
|
+
join.kind,
|
|
5356
|
+
crate::expressions::JoinKind::CrossApply
|
|
5357
|
+
| crate::expressions::JoinKind::OuterApply
|
|
5358
|
+
) && apply_rhs_is_invalid(&join.this)
|
|
5359
|
+
})
|
|
5360
|
+
}
|
|
5361
|
+
|
|
5362
|
+
expr.dfs().any(|node| match node {
|
|
5363
|
+
Expression::Select(select) => joins_have_invalid_aggregate(&select.joins),
|
|
5364
|
+
Expression::JoinedTable(joined) => joins_have_invalid_aggregate(&joined.joins),
|
|
5365
|
+
Expression::Update(update) => {
|
|
5366
|
+
joins_have_invalid_aggregate(&update.table_joins)
|
|
5367
|
+
|| joins_have_invalid_aggregate(&update.from_joins)
|
|
5368
|
+
}
|
|
5369
|
+
Expression::Delete(delete) => joins_have_invalid_aggregate(&delete.joins),
|
|
5370
|
+
_ => false,
|
|
5371
|
+
})
|
|
5168
5372
|
}
|
|
5169
5373
|
|
|
5170
5374
|
fn target_supports_remaining_unnest(target: DialectType) -> bool {
|
|
@@ -5992,6 +6196,18 @@ impl Dialect {
|
|
|
5992
6196
|
Some("AGE")
|
|
5993
6197
|
} else if name.eq_ignore_ascii_case("ERF") {
|
|
5994
6198
|
Some("ERF")
|
|
6199
|
+
} else if name.eq_ignore_ascii_case("SINH") {
|
|
6200
|
+
Some("SINH")
|
|
6201
|
+
} else if name.eq_ignore_ascii_case("COSH") {
|
|
6202
|
+
Some("COSH")
|
|
6203
|
+
} else if name.eq_ignore_ascii_case("TANH") {
|
|
6204
|
+
Some("TANH")
|
|
6205
|
+
} else if name.eq_ignore_ascii_case("ASINH") {
|
|
6206
|
+
Some("ASINH")
|
|
6207
|
+
} else if name.eq_ignore_ascii_case("ACOSH") {
|
|
6208
|
+
Some("ACOSH")
|
|
6209
|
+
} else if name.eq_ignore_ascii_case("ATANH") {
|
|
6210
|
+
Some("ATANH")
|
|
5995
6211
|
} else if name.eq_ignore_ascii_case("GCD") {
|
|
5996
6212
|
Some("GCD")
|
|
5997
6213
|
} else if name.eq_ignore_ascii_case("LCM") {
|
|
@@ -7903,6 +8119,7 @@ impl Dialect {
|
|
|
7903
8119
|
}
|
|
7904
8120
|
|
|
7905
8121
|
fn conditional_aggregate_value_for_tsql(filter: Expression, value: Expression) -> Expression {
|
|
8122
|
+
let filter = crate::transforms::ensure_bool_condition(filter);
|
|
7906
8123
|
Expression::Case(Box::new(crate::expressions::Case {
|
|
7907
8124
|
operand: None,
|
|
7908
8125
|
whens: vec![(filter, value)],
|
|
@@ -9077,6 +9294,23 @@ impl Dialect {
|
|
|
9077
9294
|
fn wrap_tsql_values_set_operand(expr: Expression) -> Expression {
|
|
9078
9295
|
match expr {
|
|
9079
9296
|
Expression::Values(values) => Self::tsql_values_as_select(*values),
|
|
9297
|
+
Expression::Select(mut select)
|
|
9298
|
+
if Self::is_parser_wrapped_values_set_operand(&select) =>
|
|
9299
|
+
{
|
|
9300
|
+
let mut from = select.from.take().expect("checked as present");
|
|
9301
|
+
let Expression::Values(values) = from
|
|
9302
|
+
.expressions
|
|
9303
|
+
.pop()
|
|
9304
|
+
.expect("checked as a single VALUES source")
|
|
9305
|
+
else {
|
|
9306
|
+
unreachable!("checked as a VALUES source");
|
|
9307
|
+
};
|
|
9308
|
+
Self::tsql_values_as_select(*values)
|
|
9309
|
+
}
|
|
9310
|
+
Expression::Annotated(mut annotated) => {
|
|
9311
|
+
annotated.this = Self::wrap_tsql_values_set_operand(annotated.this);
|
|
9312
|
+
Expression::Annotated(annotated)
|
|
9313
|
+
}
|
|
9080
9314
|
Expression::Union(mut union) => {
|
|
9081
9315
|
let left = std::mem::replace(&mut union.left, Expression::Null(Null));
|
|
9082
9316
|
let right = std::mem::replace(&mut union.right, Expression::Null(Null));
|
|
@@ -9102,6 +9336,28 @@ impl Dialect {
|
|
|
9102
9336
|
}
|
|
9103
9337
|
}
|
|
9104
9338
|
|
|
9339
|
+
#[cfg(feature = "transpile")]
|
|
9340
|
+
fn is_parser_wrapped_values_set_operand(select: &Select) -> bool {
|
|
9341
|
+
let Some(from) = &select.from else {
|
|
9342
|
+
return false;
|
|
9343
|
+
};
|
|
9344
|
+
let [Expression::Values(values)] = from.expressions.as_slice() else {
|
|
9345
|
+
return false;
|
|
9346
|
+
};
|
|
9347
|
+
if !values
|
|
9348
|
+
.alias
|
|
9349
|
+
.as_ref()
|
|
9350
|
+
.is_some_and(|alias| alias.name == "_values")
|
|
9351
|
+
{
|
|
9352
|
+
return false;
|
|
9353
|
+
}
|
|
9354
|
+
|
|
9355
|
+
let mut parser_wrapper = Select::new();
|
|
9356
|
+
parser_wrapper.expressions = vec![Expression::star()];
|
|
9357
|
+
parser_wrapper.from = Some(from.clone());
|
|
9358
|
+
select == &parser_wrapper
|
|
9359
|
+
}
|
|
9360
|
+
|
|
9105
9361
|
#[cfg(feature = "transpile")]
|
|
9106
9362
|
fn tsql_values_as_select(mut values: crate::expressions::Values) -> Expression {
|
|
9107
9363
|
let column_aliases = if values.column_aliases.is_empty() {
|
{polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/normalization/mod.rs
RENAMED
|
@@ -1918,13 +1918,13 @@ pub(super) fn normalize(
|
|
|
1918
1918
|
&& matches!(source, DialectType::PostgreSQL)
|
|
1919
1919
|
&& matches!(target, DialectType::TSQL | DialectType::Fabric) =>
|
|
1920
1920
|
{
|
|
1921
|
-
Action::Scalar(scalar::Action::
|
|
1921
|
+
Action::Scalar(scalar::Action::PostgresConcatToTsql)
|
|
1922
1922
|
}
|
|
1923
|
-
"CONCAT_WS" if f.args.len()
|
|
1923
|
+
"CONCAT_WS" if f.args.len() >= 2
|
|
1924
1924
|
&& matches!(source, DialectType::PostgreSQL)
|
|
1925
1925
|
&& matches!(target, DialectType::TSQL | DialectType::Fabric) =>
|
|
1926
1926
|
{
|
|
1927
|
-
Action::Scalar(scalar::Action::
|
|
1927
|
+
Action::Scalar(scalar::Action::PostgresConcatToTsql)
|
|
1928
1928
|
}
|
|
1929
1929
|
"ARBITRARY" | "AGGREGATE"
|
|
1930
1930
|
| "REGEXP_MATCHES" | "REGEXP_FULL_MATCH"
|
{polyglot_sql-0.7.0 → polyglot_sql-0.8.1}/crates/polyglot-sql/src/dialects/normalization/scalar.rs
RENAMED
|
@@ -77,7 +77,7 @@ pub(super) enum Action {
|
|
|
77
77
|
StrPositionExpand,
|
|
78
78
|
CurrentUserSparkParens,
|
|
79
79
|
ConcatCoalesceWrap,
|
|
80
|
-
|
|
80
|
+
PostgresConcatToTsql,
|
|
81
81
|
CbrtToPower,
|
|
82
82
|
MinMaxToLeastGreatest,
|
|
83
83
|
Nvl2Expand,
|
|
@@ -11536,7 +11536,7 @@ pub(super) fn rewrite(
|
|
|
11536
11536
|
}
|
|
11537
11537
|
}
|
|
11538
11538
|
|
|
11539
|
-
Action::
|
|
11539
|
+
Action::PostgresConcatToTsql => {
|
|
11540
11540
|
let mut function = if let Expression::Function(f) = e {
|
|
11541
11541
|
*f
|
|
11542
11542
|
} else {
|
|
@@ -11548,9 +11548,14 @@ pub(super) fn rewrite(
|
|
|
11548
11548
|
Ok(Expression::Function(Box::new(function)))
|
|
11549
11549
|
} else {
|
|
11550
11550
|
let separator = function.args.remove(0);
|
|
11551
|
-
|
|
11552
|
-
function.
|
|
11553
|
-
|
|
11551
|
+
|
|
11552
|
+
if function.args.len() == 1 {
|
|
11553
|
+
function.name = "CONCAT".to_string();
|
|
11554
|
+
function.args.push(Expression::string(""));
|
|
11555
|
+
} else {
|
|
11556
|
+
function.args.insert(0, separator.clone());
|
|
11557
|
+
}
|
|
11558
|
+
|
|
11554
11559
|
let concat = Expression::Function(Box::new(function));
|
|
11555
11560
|
|
|
11556
11561
|
if matches!(separator, Expression::Literal(_)) {
|