polyglot-sql 0.8.1__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.
Files changed (209) hide show
  1. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/Cargo.lock +6 -6
  2. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/Cargo.toml +1 -1
  3. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/PKG-INFO +33 -1
  4. {polyglot_sql-0.8.1/crates/polyglot-sql-python → polyglot_sql-0.9.1}/README.md +32 -0
  5. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/Cargo.toml +2 -2
  6. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/README.md +1 -1
  7. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/ast_transforms.rs +86 -112
  8. polyglot_sql-0.9.1/crates/polyglot-sql/src/builder/engine.rs +825 -0
  9. polyglot_sql-0.8.1/crates/polyglot-sql/src/builder.rs → polyglot_sql-0.9.1/crates/polyglot-sql/src/builder/mod.rs +578 -644
  10. polyglot_sql-0.9.1/crates/polyglot-sql/src/builder/plan.rs +1482 -0
  11. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/bigquery.rs +27 -0
  12. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/mod.rs +304 -72
  13. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/aggregates.rs +112 -1
  14. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/json.rs +63 -0
  15. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/mod.rs +91 -16
  16. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/operators.rs +437 -0
  17. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/scalar.rs +416 -11
  18. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/temporal.rs +76 -0
  19. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/types.rs +15 -10
  20. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/snowflake.rs +96 -2
  21. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/expressions.rs +4 -4
  22. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/generator.rs +109 -17
  23. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/lib.rs +13 -0
  24. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/lineage.rs +389 -16
  25. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/openlineage.rs +2 -57
  26. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/annotate_types.rs +106 -0
  27. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/mod.rs +26 -0
  28. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +347 -42
  29. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +29 -1
  30. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/parser.rs +229 -38
  31. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/planner.rs +12 -85
  32. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/query_analysis.rs +167 -30
  33. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/resolver.rs +68 -0
  34. polyglot_sql-0.9.1/crates/polyglot-sql/src/set_operation.rs +475 -0
  35. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/traversal.rs +70 -0
  36. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/common/known_failures.rs +19 -0
  37. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/dialect_matrix.rs +878 -1
  38. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/fabric_regression.rs +56 -0
  39. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/query_analysis.rs +189 -0
  40. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/snowflake_regression_test.rs +117 -1
  41. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_compat.rs +23 -0
  42. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/tsql_regression.rs +56 -0
  43. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1/crates/polyglot-sql-python}/README.md +32 -0
  44. polyglot_sql-0.9.1/crates/polyglot-sql-python/src/builders.rs +642 -0
  45. polyglot_sql-0.9.1/crates/polyglot-sql-python/src/expr.rs +1568 -0
  46. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/lib.rs +2 -0
  47. polyglot_sql-0.9.1/crates/polyglot-sql-python/tests/test_builders.py +132 -0
  48. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_lineage.py +19 -0
  49. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/python/polyglot_sql/__init__.py +208 -0
  50. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/python/polyglot_sql/__init__.pyi +132 -0
  51. polyglot_sql-0.8.1/crates/polyglot-sql-python/src/expr.rs +0 -728
  52. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/allocation_hotspots.rs +0 -0
  53. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/ast_traversal.rs +0 -0
  54. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/in_list.rs +0 -0
  55. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/lineage.rs +0 -0
  56. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/parsing.rs +0 -0
  57. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/performance_hotspots.rs +0 -0
  58. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
  59. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/benches/transpile.rs +0 -0
  60. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
  61. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/examples/bench_json.rs +0 -0
  62. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/ast_children.rs +0 -0
  63. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/ast_json.rs +0 -0
  64. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
  65. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/clickhouse.rs +0 -0
  66. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
  67. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/databricks.rs +0 -0
  68. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/datafusion.rs +0 -0
  69. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
  70. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
  71. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
  72. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
  73. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/duckdb.rs +0 -0
  74. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
  75. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/exasol.rs +0 -0
  76. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/fabric.rs +0 -0
  77. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
  78. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/hive.rs +0 -0
  79. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
  80. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/mysql.rs +0 -0
  81. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/collections.rs +0 -0
  82. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/postgres_interval.rs +0 -0
  83. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/normalization/statements.rs +0 -0
  84. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/oracle.rs +0 -0
  85. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/postgres.rs +0 -0
  86. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/presto.rs +0 -0
  87. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
  88. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
  89. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
  90. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
  91. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/spark.rs +0 -0
  92. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/sqlite.rs +0 -0
  93. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
  94. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
  95. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/teradata.rs +0 -0
  96. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
  97. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/trino.rs +0 -0
  98. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/dialects/tsql.rs +0 -0
  99. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/diff.rs +0 -0
  100. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/error.rs +0 -0
  101. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/format_tokens.rs +0 -0
  102. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/function_catalog.rs +0 -0
  103. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/function_registry.rs +0 -0
  104. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/guard.rs +0 -0
  105. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/helper.rs +0 -0
  106. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/canonicalize.rs +0 -0
  107. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
  108. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
  109. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +0 -0
  110. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
  111. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +0 -0
  112. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
  113. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
  114. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
  115. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +0 -0
  116. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/simplify.rs +0 -0
  117. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/optimizer/subquery.rs +0 -0
  118. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/schema.rs +0 -0
  119. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/scope.rs +0 -0
  120. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/time.rs +0 -0
  121. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/tokens.rs +0 -0
  122. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/transforms.rs +0 -0
  123. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/trie.rs +0 -0
  124. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/validation/tests.rs +0 -0
  125. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/src/validation.rs +0 -0
  126. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/analyze_failures.rs +0 -0
  127. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/clickhouse_regression.rs +0 -0
  128. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/common/mod.rs +0 -0
  129. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
  130. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/common/test_runner.rs +0 -0
  131. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/create_view_security_comment_regression.rs +0 -0
  132. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
  133. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
  134. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
  135. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
  136. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
  137. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
  138. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
  139. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
  140. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
  141. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
  142. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
  143. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
  144. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/data_type_api.rs +0 -0
  145. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/deep_nesting_regression.rs +0 -0
  146. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/error_handling.rs +0 -0
  147. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/fabric_tpch_regression.rs +0 -0
  148. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
  149. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/oracle_data_types_regression.rs +0 -0
  150. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/postgres_explain_options.rs +0 -0
  151. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/postgres_regexp_clickhouse.rs +0 -0
  152. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/postgres_sqlite_regression.rs +0 -0
  153. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/query_analysis_regression.rs +0 -0
  154. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
  155. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
  156. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
  157. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
  158. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
  159. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
  160. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
  161. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/tpch_transpile_stack.rs +0 -0
  162. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql/tests/transform_regression.rs +0 -0
  163. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-ast-derive/Cargo.toml +0 -0
  164. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-ast-derive/src/lib.rs +0 -0
  165. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
  166. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/README.md +0 -0
  167. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
  168. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
  169. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
  170. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
  171. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
  172. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/Cargo.toml +0 -0
  173. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/docs/api.md +0 -0
  174. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/docs/index.md +0 -0
  175. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/mkdocs.yml +0 -0
  176. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
  177. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/dialects.rs +0 -0
  178. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/diff.rs +0 -0
  179. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/errors.rs +0 -0
  180. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/expr_types.rs +0 -0
  181. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/format.rs +0 -0
  182. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/generate.rs +0 -0
  183. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/helpers.rs +0 -0
  184. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/lineage.rs +0 -0
  185. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/openlineage.rs +0 -0
  186. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/optimize.rs +0 -0
  187. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/parse.rs +0 -0
  188. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/query_analysis.rs +0 -0
  189. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
  190. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/transforms.rs +0 -0
  191. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/transpile.rs +0 -0
  192. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/types.rs +0 -0
  193. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/src/validate.rs +0 -0
  194. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/conftest.py +0 -0
  195. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_compat.py +0 -0
  196. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
  197. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
  198. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_expression.py +0 -0
  199. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_format.py +0 -0
  200. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
  201. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_optimize.py +0 -0
  202. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_parse.py +0 -0
  203. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_query_analysis.py +0 -0
  204. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_transforms.py +0 -0
  205. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
  206. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
  207. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/crates/polyglot-sql-python/uv.lock +0 -0
  208. {polyglot_sql-0.8.1 → polyglot_sql-0.9.1}/pyproject.toml +0 -0
  209. {polyglot_sql-0.8.1 → 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.8.1"
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.8.1"
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.8.1"
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.8.1"
645
+ version = "0.9.1"
646
646
 
647
647
  [[package]]
648
648
  name = "polyglot-sql-python"
649
- version = "0.8.1"
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.8.1"
660
+ version = "0.9.1"
661
661
  dependencies = [
662
662
  "console_error_panic_hook",
663
663
  "js-sys",
@@ -6,7 +6,7 @@ exclude = [
6
6
  ]
7
7
 
8
8
  [workspace.package]
9
- version = "0.8.1"
9
+ version = "0.9.1"
10
10
  edition = "2021"
11
11
  license = "MIT"
12
12
  authors = ["polyglot contributors"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyglot-sql
3
- Version: 0.8.1
3
+ Version: 0.9.1
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -68,6 +68,38 @@ polyglot_sql.parse_one("VARCHAR(255)", dialect="duckdb", into=polyglot_sql.DataT
68
68
  polyglot_sql.format_sql("SELECT a,b FROM t WHERE x=1", dialect="postgres")
69
69
  ```
70
70
 
71
+ ### SQLGlot-Compatible Builders
72
+
73
+ The common SQLGlot builder surface is available directly from
74
+ `polyglot_sql`. Builders return normal Polyglot expression objects and are
75
+ immutable: each chained call returns a new expression.
76
+
77
+ ```python
78
+ query = (
79
+ polyglot_sql.select("customer_id", "COUNT(*) AS orders")
80
+ .from_("orders")
81
+ .where("status = 'complete'")
82
+ .group_by("customer_id")
83
+ .order_by("orders DESC")
84
+ .limit(10)
85
+ )
86
+
87
+ query.sql("postgres")
88
+ # "SELECT customer_id, COUNT(*) AS orders FROM orders WHERE status = 'complete' GROUP BY customer_id ORDER BY orders DESC LIMIT 10"
89
+
90
+ active = polyglot_sql.column("status").eq("active")
91
+ active.sql()
92
+ # "status = 'active'"
93
+ ```
94
+
95
+ The shared builder feature set also includes named aggregate/string/math/date
96
+ helpers, all join and set-operation variants, named windows, lateral views,
97
+ hints, row locks, CTAS, `CASE`, `INSERT`, `UPDATE`, `DELETE`, and conditional
98
+ `MERGE` actions. Repeated clauses append by default; pass `append=False` to
99
+ replace one. Advanced parser options, mutable `copy=False` behavior, and the
100
+ complete SQLGlot expression catalog are not included. Polyglot expressions
101
+ remain the native AST type; SQLGlot is not a runtime dependency.
102
+
71
103
  ```python
72
104
  ast = polyglot_sql.parse_one("SELECT id FROM a UNION ALL SELECT id FROM b")
73
105
  order_expr = polyglot_sql.parse_one("SELECT id").args["expressions"][0]
@@ -41,6 +41,38 @@ polyglot_sql.parse_one("VARCHAR(255)", dialect="duckdb", into=polyglot_sql.DataT
41
41
  polyglot_sql.format_sql("SELECT a,b FROM t WHERE x=1", dialect="postgres")
42
42
  ```
43
43
 
44
+ ### SQLGlot-Compatible Builders
45
+
46
+ The common SQLGlot builder surface is available directly from
47
+ `polyglot_sql`. Builders return normal Polyglot expression objects and are
48
+ immutable: each chained call returns a new expression.
49
+
50
+ ```python
51
+ query = (
52
+ polyglot_sql.select("customer_id", "COUNT(*) AS orders")
53
+ .from_("orders")
54
+ .where("status = 'complete'")
55
+ .group_by("customer_id")
56
+ .order_by("orders DESC")
57
+ .limit(10)
58
+ )
59
+
60
+ query.sql("postgres")
61
+ # "SELECT customer_id, COUNT(*) AS orders FROM orders WHERE status = 'complete' GROUP BY customer_id ORDER BY orders DESC LIMIT 10"
62
+
63
+ active = polyglot_sql.column("status").eq("active")
64
+ active.sql()
65
+ # "status = 'active'"
66
+ ```
67
+
68
+ The shared builder feature set also includes named aggregate/string/math/date
69
+ helpers, all join and set-operation variants, named windows, lateral views,
70
+ hints, row locks, CTAS, `CASE`, `INSERT`, `UPDATE`, `DELETE`, and conditional
71
+ `MERGE` actions. Repeated clauses append by default; pass `append=False` to
72
+ replace one. Advanced parser options, mutable `copy=False` behavior, and the
73
+ complete SQLGlot expression catalog are not included. Polyglot expressions
74
+ remain the native AST type; SQLGlot is not a runtime dependency.
75
+
44
76
  ```python
45
77
  ast = polyglot_sql.parse_one("SELECT id FROM a UNION ALL SELECT id FROM b")
46
78
  order_expr = polyglot_sql.parse_one("SELECT id").args["expressions"][0]
@@ -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.8.1" }
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.8.1", optional = true, default-features = false }
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.8.1", default-features = false }
28
+ polyglot-sql = { version = "0.9.1", default-features = false }
29
29
  ```
30
30
 
31
31
  ```toml
@@ -9,8 +9,9 @@
9
9
 
10
10
  use std::collections::{HashMap, HashSet};
11
11
 
12
+ use crate::builder::engine;
12
13
  use crate::expressions::*;
13
- use crate::traversal::ExpressionWalk;
14
+ use crate::traversal::{is_aggregate, ExpressionWalk};
14
15
 
15
16
  /// Apply a bottom-up transformation to every node in the tree.
16
17
  /// Wraps `crate::traversal::transform` with a simpler signature for this module.
@@ -28,12 +29,9 @@ fn xform<F: Fn(Expression) -> Expression>(expr: Expression, fun: F) -> Expressio
28
29
  /// If `expr` is a `Select`, the given `columns` are appended to its expression list.
29
30
  /// Non-SELECT expressions are returned unchanged.
30
31
  pub fn add_select_columns(expr: Expression, columns: Vec<Expression>) -> Expression {
31
- if let Expression::Select(mut sel) = expr {
32
- sel.expressions.extend(columns);
33
- Expression::Select(sel)
34
- } else {
35
- expr
36
- }
32
+ let mut expression = expr;
33
+ let _ = engine::append_select(&mut expression, columns, true);
34
+ expression
37
35
  }
38
36
 
39
37
  /// Remove columns from the SELECT list where `predicate` returns `true`.
@@ -51,12 +49,9 @@ pub fn remove_select_columns<F: Fn(&Expression) -> bool>(
51
49
 
52
50
  /// Set or remove the DISTINCT flag on a SELECT.
53
51
  pub fn set_distinct(expr: Expression, distinct: bool) -> Expression {
54
- if let Expression::Select(mut sel) = expr {
55
- sel.distinct = distinct;
56
- Expression::Select(sel)
57
- } else {
58
- expr
59
- }
52
+ let mut expression = expr;
53
+ let _ = engine::apply_distinct(&mut expression, distinct);
54
+ expression
60
55
  }
61
56
 
62
57
  // ---------------------------------------------------------------------------
@@ -69,6 +64,14 @@ pub fn set_distinct(expr: Expression, distinct: bool) -> Expression {
69
64
  /// existing one using AND (default) or OR (when `use_or` is `true`).
70
65
  /// If there is no WHERE clause, one is created.
71
66
  pub fn add_where(expr: Expression, condition: Expression, use_or: bool) -> Expression {
67
+ if !use_or {
68
+ if !matches!(expr, Expression::Select(_)) {
69
+ return expr;
70
+ }
71
+ let mut expression = expr;
72
+ let _ = engine::apply_where(&mut expression, condition, true);
73
+ return expression;
74
+ }
72
75
  if let Expression::Select(mut sel) = expr {
73
76
  sel.where_clause = Some(match sel.where_clause.take() {
74
77
  Some(existing) => {
@@ -108,29 +111,9 @@ pub fn set_limit(expr: Expression, limit: usize) -> Expression {
108
111
 
109
112
  /// Set the LIMIT on a SELECT or set operation using an expression.
110
113
  pub fn set_limit_expr(expr: Expression, limit: Expression) -> Expression {
111
- match expr {
112
- Expression::Select(mut sel) => {
113
- sel.limit = Some(Limit {
114
- this: limit,
115
- percent: false,
116
- comments: Vec::new(),
117
- });
118
- Expression::Select(sel)
119
- }
120
- Expression::Union(mut union) => {
121
- union.limit = Some(Box::new(limit));
122
- Expression::Union(union)
123
- }
124
- Expression::Intersect(mut intersect) => {
125
- intersect.limit = Some(Box::new(limit));
126
- Expression::Intersect(intersect)
127
- }
128
- Expression::Except(mut except) => {
129
- except.limit = Some(Box::new(limit));
130
- Expression::Except(except)
131
- }
132
- other => other,
133
- }
114
+ let mut expression = expr;
115
+ let _ = engine::apply_limit(&mut expression, limit);
116
+ expression
134
117
  }
135
118
 
136
119
  /// Set the OFFSET on a SELECT or set operation.
@@ -140,28 +123,9 @@ pub fn set_offset(expr: Expression, offset: usize) -> Expression {
140
123
 
141
124
  /// Set the OFFSET on a SELECT or set operation using an expression.
142
125
  pub fn set_offset_expr(expr: Expression, offset: Expression) -> Expression {
143
- match expr {
144
- Expression::Select(mut sel) => {
145
- sel.offset = Some(Offset {
146
- this: offset,
147
- rows: None,
148
- });
149
- Expression::Select(sel)
150
- }
151
- Expression::Union(mut union) => {
152
- union.offset = Some(Box::new(offset));
153
- Expression::Union(union)
154
- }
155
- Expression::Intersect(mut intersect) => {
156
- intersect.offset = Some(Box::new(offset));
157
- Expression::Intersect(intersect)
158
- }
159
- Expression::Except(mut except) => {
160
- except.offset = Some(Box::new(offset));
161
- Expression::Except(except)
162
- }
163
- other => other,
164
- }
126
+ let mut expression = expr;
127
+ let _ = engine::apply_offset(&mut expression, offset);
128
+ expression
165
129
  }
166
130
 
167
131
  /// Set the ORDER BY clause on a SELECT or set operation.
@@ -169,38 +133,10 @@ pub fn set_offset_expr(expr: Expression, offset: Expression) -> Expression {
169
133
  /// Bare expressions are normalized to ascending order expressions. Existing
170
134
  /// `Ordered` expressions preserve their direction and null-ordering metadata.
171
135
  pub fn set_order_by(expr: Expression, expressions: Vec<Expression>) -> Expression {
172
- let order_by = OrderBy {
173
- expressions: expressions.into_iter().map(normalize_ordered).collect(),
174
- siblings: false,
175
- comments: Vec::new(),
176
- };
177
-
178
- match expr {
179
- Expression::Select(mut sel) => {
180
- sel.order_by = Some(order_by);
181
- Expression::Select(sel)
182
- }
183
- Expression::Union(mut union) => {
184
- union.order_by = Some(order_by);
185
- Expression::Union(union)
186
- }
187
- Expression::Intersect(mut intersect) => {
188
- intersect.order_by = Some(order_by);
189
- Expression::Intersect(intersect)
190
- }
191
- Expression::Except(mut except) => {
192
- except.order_by = Some(order_by);
193
- Expression::Except(except)
194
- }
195
- other => other,
196
- }
197
- }
198
-
199
- fn normalize_ordered(expression: Expression) -> Ordered {
200
- match expression {
201
- Expression::Ordered(ordered) => *ordered,
202
- other => Ordered::asc(other),
203
- }
136
+ let mut expression = expr;
137
+ let values = expressions.into_iter().map(engine::ordered).collect();
138
+ let _ = engine::apply_order_by(&mut expression, values, false);
139
+ expression
204
140
  }
205
141
 
206
142
  /// Remove both LIMIT and OFFSET from a SELECT.
@@ -400,6 +336,26 @@ pub fn get_output_column_names(expr: &Expression) -> Vec<String> {
400
336
  output_column_names_from_query(expr)
401
337
  }
402
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
+
403
359
  fn output_column_names_from_query(expr: &Expression) -> Vec<String> {
404
360
  match expr {
405
361
  Expression::Select(select) => select_output_column_names(select),
@@ -604,22 +560,7 @@ pub fn get_subqueries(expr: &Expression) -> Vec<&Expression> {
604
560
  /// Includes typed aggregates (`Count`, `Sum`, `Avg`, `Min`, `Max`, etc.)
605
561
  /// and generic `AggregateFunction` nodes.
606
562
  pub fn get_aggregate_functions(expr: &Expression) -> Vec<&Expression> {
607
- expr.find_all(|e| {
608
- matches!(
609
- e,
610
- Expression::AggregateFunction(_)
611
- | Expression::Count(_)
612
- | Expression::Sum(_)
613
- | Expression::Avg(_)
614
- | Expression::Min(_)
615
- | Expression::Max(_)
616
- | Expression::ApproxDistinct(_)
617
- | Expression::ArrayAgg(_)
618
- | Expression::GroupConcat(_)
619
- | Expression::StringAgg(_)
620
- | Expression::ListAgg(_)
621
- )
622
- })
563
+ expr.find_all(is_aggregate)
623
564
  }
624
565
 
625
566
  /// Collect all window function nodes in the expression tree.
@@ -759,6 +700,37 @@ mod tests {
759
700
  assert_eq!(names, vec!["c1".to_string(), "c2".to_string()]);
760
701
  }
761
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
+
762
734
  #[test]
763
735
  fn test_get_column_names_union_still_returns_all_references() {
764
736
  let expr =
@@ -915,12 +887,14 @@ mod tests {
915
887
 
916
888
  #[test]
917
889
  fn test_get_aggregate_functions() {
918
- let expr = parse_one("SELECT COUNT(*), SUM(x) FROM t");
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();
919
895
  let aggs = get_aggregate_functions(&expr);
920
- assert!(
921
- aggs.len() >= 2,
922
- "Expected at least 2 aggregates, got {}",
923
- aggs.len()
924
- );
896
+ let aggregate_types: Vec<_> = aggs.iter().map(|agg| agg.variant_name()).collect();
897
+
898
+ assert_eq!(aggregate_types, vec!["count_if", "median", "first"]);
925
899
  }
926
900
  }