polyglot-sql 0.3.0__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/Cargo.lock +5 -5
  2. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/Cargo.toml +1 -1
  3. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/PKG-INFO +1 -1
  4. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/Cargo.toml +1 -1
  5. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/ast_transforms.rs +12 -0
  6. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/builder.rs +2 -0
  7. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/bigquery.rs +1 -3
  8. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/duckdb.rs +3 -3
  9. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/mod.rs +95 -42
  10. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/sqlite.rs +1 -3
  11. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/expressions.rs +14 -0
  12. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/generator.rs +50 -1
  13. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/lib.rs +42 -11
  14. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/lineage.rs +978 -7
  15. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +44 -0
  16. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/parser.rs +826 -87
  17. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/traversal.rs +8 -0
  18. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/README.md +0 -0
  19. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/README.md +0 -0
  20. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/benches/in_list.rs +0 -0
  21. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/benches/parsing.rs +0 -0
  22. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
  23. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/benches/transpile.rs +0 -0
  24. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
  25. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/examples/bench_json.rs +0 -0
  26. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
  27. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/clickhouse.rs +0 -0
  28. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
  29. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/databricks.rs +0 -0
  30. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/datafusion.rs +0 -0
  31. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
  32. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
  33. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
  34. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
  35. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
  36. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/exasol.rs +0 -0
  37. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/fabric.rs +0 -0
  38. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
  39. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/hive.rs +0 -0
  40. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
  41. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/mysql.rs +0 -0
  42. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/oracle.rs +0 -0
  43. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/postgres.rs +0 -0
  44. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/presto.rs +0 -0
  45. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
  46. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
  47. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
  48. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/snowflake.rs +0 -0
  49. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
  50. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/spark.rs +0 -0
  51. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
  52. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
  53. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/teradata.rs +0 -0
  54. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
  55. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/trino.rs +0 -0
  56. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/dialects/tsql.rs +0 -0
  57. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/diff.rs +0 -0
  58. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/error.rs +0 -0
  59. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/function_catalog.rs +0 -0
  60. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/function_registry.rs +0 -0
  61. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/helper.rs +0 -0
  62. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/annotate_types.rs +0 -0
  63. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/canonicalize.rs +0 -0
  64. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
  65. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
  66. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +0 -0
  67. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/mod.rs +0 -0
  68. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
  69. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +0 -0
  70. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
  71. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
  72. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
  73. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +0 -0
  74. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +0 -0
  75. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/simplify.rs +0 -0
  76. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/optimizer/subquery.rs +0 -0
  77. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/planner.rs +0 -0
  78. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/resolver.rs +0 -0
  79. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/schema.rs +0 -0
  80. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/scope.rs +0 -0
  81. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/time.rs +0 -0
  82. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/tokens.rs +0 -0
  83. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/transforms.rs +0 -0
  84. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/trie.rs +0 -0
  85. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/validation/tests.rs +0 -0
  86. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/src/validation.rs +0 -0
  87. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/analyze_failures.rs +0 -0
  88. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/common/known_failures.rs +0 -0
  89. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/common/mod.rs +0 -0
  90. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
  91. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/common/test_runner.rs +0 -0
  92. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
  93. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
  94. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
  95. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
  96. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
  97. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
  98. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
  99. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
  100. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
  101. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
  102. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
  103. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
  104. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/dialect_matrix.rs +0 -0
  105. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/error_handling.rs +0 -0
  106. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
  107. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/sqlglot_compat.rs +0 -0
  108. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
  109. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
  110. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
  111. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
  112. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
  113. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
  114. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
  115. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
  116. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-function-catalogs/README.md +0 -0
  117. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
  118. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
  119. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
  120. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
  121. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
  122. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/Cargo.toml +0 -0
  123. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/README.md +0 -0
  124. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/docs/api.md +0 -0
  125. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/docs/index.md +0 -0
  126. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/mkdocs.yml +0 -0
  127. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
  128. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/dialects.rs +0 -0
  129. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/diff.rs +0 -0
  130. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/errors.rs +0 -0
  131. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/expr.rs +0 -0
  132. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/expr_types.rs +0 -0
  133. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/format.rs +0 -0
  134. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/generate.rs +0 -0
  135. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/helpers.rs +0 -0
  136. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/lib.rs +0 -0
  137. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/lineage.rs +0 -0
  138. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/optimize.rs +0 -0
  139. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/parse.rs +0 -0
  140. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
  141. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/transpile.rs +0 -0
  142. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/types.rs +0 -0
  143. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/src/validate.rs +0 -0
  144. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/tests/conftest.py +0 -0
  145. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/tests/test_compat.py +0 -0
  146. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
  147. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
  148. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/tests/test_expression.py +0 -0
  149. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/tests/test_format.py +0 -0
  150. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
  151. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/tests/test_lineage.py +0 -0
  152. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/tests/test_optimize.py +0 -0
  153. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/tests/test_parse.py +0 -0
  154. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
  155. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
  156. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/crates/polyglot-sql-python/uv.lock +0 -0
  157. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/pyproject.toml +0 -0
  158. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/python/polyglot_sql/__init__.py +0 -0
  159. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/python/polyglot_sql/__init__.pyi +0 -0
  160. {polyglot_sql-0.3.0 → polyglot_sql-0.3.2}/python/polyglot_sql/py.typed +0 -0
@@ -587,7 +587,7 @@ dependencies = [
587
587
 
588
588
  [[package]]
589
589
  name = "polyglot-sql"
590
- version = "0.3.0"
590
+ version = "0.3.2"
591
591
  dependencies = [
592
592
  "criterion",
593
593
  "once_cell",
@@ -602,7 +602,7 @@ dependencies = [
602
602
 
603
603
  [[package]]
604
604
  name = "polyglot-sql-ffi"
605
- version = "0.3.0"
605
+ version = "0.3.2"
606
606
  dependencies = [
607
607
  "cbindgen",
608
608
  "polyglot-sql",
@@ -612,11 +612,11 @@ dependencies = [
612
612
 
613
613
  [[package]]
614
614
  name = "polyglot-sql-function-catalogs"
615
- version = "0.3.0"
615
+ version = "0.3.2"
616
616
 
617
617
  [[package]]
618
618
  name = "polyglot-sql-python"
619
- version = "0.3.0"
619
+ version = "0.3.2"
620
620
  dependencies = [
621
621
  "polyglot-sql",
622
622
  "pyo3",
@@ -627,7 +627,7 @@ dependencies = [
627
627
 
628
628
  [[package]]
629
629
  name = "polyglot-sql-wasm"
630
- version = "0.3.0"
630
+ version = "0.3.2"
631
631
  dependencies = [
632
632
  "console_error_panic_hook",
633
633
  "js-sys",
@@ -6,7 +6,7 @@ exclude = [
6
6
  ]
7
7
 
8
8
  [workspace.package]
9
- version = "0.3.0"
9
+ version = "0.3.2"
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.3.0
3
+ Version: 0.3.2
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -78,7 +78,7 @@ serde_json = { workspace = true }
78
78
  thiserror = { workspace = true }
79
79
  unicode-segmentation = { workspace = true }
80
80
  ts-rs = { version = "12.0", features = ["serde-compat"], optional = true }
81
- polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.3.0", optional = true, default-features = false }
81
+ polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.3.2", optional = true, default-features = false }
82
82
 
83
83
  [dev-dependencies]
84
84
  pretty_assertions = "1.4"
@@ -422,6 +422,18 @@ pub fn get_table_names(expr: &Expression) -> Vec<String> {
422
422
  }
423
423
  }
424
424
  }
425
+ Expression::Cache(cache) => {
426
+ let name = cache.table.name.clone();
427
+ if !name.is_empty() && !cte_aliases.contains(&name) {
428
+ names.push(name);
429
+ }
430
+ }
431
+ Expression::Uncache(uncache) => {
432
+ let name = uncache.table.name.clone();
433
+ if !name.is_empty() && !cte_aliases.contains(&name) {
434
+ names.push(name);
435
+ }
436
+ }
425
437
  _ => {}
426
438
  }
427
439
  }
@@ -1618,6 +1618,8 @@ impl SelectBuilder {
1618
1618
  using_template: None,
1619
1619
  rollup: None,
1620
1620
  uuid: None,
1621
+ with_partition_columns: vec![],
1622
+ with_connection: None,
1621
1623
  }))
1622
1624
  }
1623
1625
 
@@ -1142,9 +1142,7 @@ impl BigQueryDialect {
1142
1142
  let unit_name = match &unit_expr {
1143
1143
  Expression::Identifier(id) => id.name.to_uppercase(),
1144
1144
  Expression::Var(v) => v.this.to_uppercase(),
1145
- Expression::Column(col) if col.table.is_none() => {
1146
- col.name.name.to_uppercase()
1147
- }
1145
+ Expression::Column(col) if col.table.is_none() => col.name.name.to_uppercase(),
1148
1146
  _ => "DAY".to_string(),
1149
1147
  };
1150
1148
  let unit = match unit_name.as_str() {
@@ -13,9 +13,9 @@ use super::{DialectImpl, DialectType};
13
13
  use crate::error::Result;
14
14
  use crate::expressions::{
15
15
  AggFunc, Alias, BinaryOp, Case, Cast, CeilFunc, Column, DataType, Expression, Function,
16
- Identifier, Interval, IntervalUnit, IntervalUnitSpec, IsNull, JSONPath,
17
- JSONPathKey, JSONPathRoot, JSONPathSubscript, JsonExtractFunc, Literal, Null, Paren, Struct,
18
- Subquery, SubstringFunc, UnaryFunc, UnaryOp, VarArgFunc, WindowFunction,
16
+ Identifier, Interval, IntervalUnit, IntervalUnitSpec, IsNull, JSONPath, JSONPathKey,
17
+ JSONPathRoot, JSONPathSubscript, JsonExtractFunc, Literal, Null, Paren, Struct, Subquery,
18
+ SubstringFunc, UnaryFunc, UnaryOp, VarArgFunc, WindowFunction,
19
19
  };
20
20
  use crate::generator::GeneratorConfig;
21
21
  use crate::tokens::TokenizerConfig;
@@ -543,6 +543,33 @@ where
543
543
  {
544
544
  use crate::expressions::BinaryOp;
545
545
 
546
+ // Helper macro to recurse into AggFunc-based expressions (this, filter, order_by, having_max, limit).
547
+ macro_rules! recurse_agg {
548
+ ($variant:ident, $f:expr) => {{
549
+ let mut f = $f;
550
+ f.this = transform_recursive(f.this, transform_fn)?;
551
+ if let Some(filter) = f.filter.take() {
552
+ f.filter = Some(transform_recursive(filter, transform_fn)?);
553
+ }
554
+ for ord in &mut f.order_by {
555
+ ord.this = transform_recursive(
556
+ std::mem::replace(&mut ord.this, Expression::Null(crate::expressions::Null)),
557
+ transform_fn,
558
+ )?;
559
+ }
560
+ if let Some((ref mut expr, _)) = f.having_max {
561
+ *expr = Box::new(transform_recursive(
562
+ std::mem::replace(expr.as_mut(), Expression::Null(crate::expressions::Null)),
563
+ transform_fn,
564
+ )?);
565
+ }
566
+ if let Some(limit) = f.limit.take() {
567
+ f.limit = Some(Box::new(transform_recursive(*limit, transform_fn)?));
568
+ }
569
+ Expression::$variant(f)
570
+ }};
571
+ }
572
+
546
573
  // Helper macro to transform binary ops with Box<BinaryOp>
547
574
  macro_rules! transform_binary {
548
575
  ($variant:ident, $op:expr) => {{
@@ -954,14 +981,9 @@ where
954
981
  f.this = transform_recursive(f.this, transform_fn)?;
955
982
  Expression::Date(f)
956
983
  }
957
- Expression::Stddev(mut f) => {
958
- f.this = transform_recursive(f.this, transform_fn)?;
959
- Expression::Stddev(f)
960
- }
961
- Expression::Variance(mut f) => {
962
- f.this = transform_recursive(f.this, transform_fn)?;
963
- Expression::Variance(f)
964
- }
984
+ Expression::Stddev(f) => recurse_agg!(Stddev, f),
985
+ Expression::StddevSamp(f) => recurse_agg!(StddevSamp, f),
986
+ Expression::Variance(f) => recurse_agg!(Variance, f),
965
987
 
966
988
  // ===== BinaryFunc-based expressions =====
967
989
  Expression::ModFunc(mut f) => {
@@ -1586,19 +1608,45 @@ where
1586
1608
  Expression::Filter(f)
1587
1609
  }
1588
1610
 
1589
- // BitwiseOrAgg/BitwiseAndAgg/BitwiseXorAgg: recurse into the aggregate argument
1590
- Expression::BitwiseOrAgg(mut f) => {
1591
- f.this = transform_recursive(f.this, transform_fn)?;
1592
- Expression::BitwiseOrAgg(f)
1593
- }
1594
- Expression::BitwiseAndAgg(mut f) => {
1595
- f.this = transform_recursive(f.this, transform_fn)?;
1596
- Expression::BitwiseAndAgg(f)
1597
- }
1598
- Expression::BitwiseXorAgg(mut f) => {
1599
- f.this = transform_recursive(f.this, transform_fn)?;
1600
- Expression::BitwiseXorAgg(f)
1611
+ // Aggregate functions (AggFunc-based): recurse into the aggregate argument,
1612
+ // filter, order_by, having_max, and limit.
1613
+ // Stddev, StddevSamp, Variance, and ArrayAgg are handled earlier in this match.
1614
+ Expression::Sum(f) => recurse_agg!(Sum, f),
1615
+ Expression::Avg(f) => recurse_agg!(Avg, f),
1616
+ Expression::Min(f) => recurse_agg!(Min, f),
1617
+ Expression::Max(f) => recurse_agg!(Max, f),
1618
+ Expression::CountIf(f) => recurse_agg!(CountIf, f),
1619
+ Expression::StddevPop(f) => recurse_agg!(StddevPop, f),
1620
+ Expression::VarPop(f) => recurse_agg!(VarPop, f),
1621
+ Expression::VarSamp(f) => recurse_agg!(VarSamp, f),
1622
+ Expression::Median(f) => recurse_agg!(Median, f),
1623
+ Expression::Mode(f) => recurse_agg!(Mode, f),
1624
+ Expression::First(f) => recurse_agg!(First, f),
1625
+ Expression::Last(f) => recurse_agg!(Last, f),
1626
+ Expression::AnyValue(f) => recurse_agg!(AnyValue, f),
1627
+ Expression::ApproxDistinct(f) => recurse_agg!(ApproxDistinct, f),
1628
+ Expression::ApproxCountDistinct(f) => recurse_agg!(ApproxCountDistinct, f),
1629
+ Expression::LogicalAnd(f) => recurse_agg!(LogicalAnd, f),
1630
+ Expression::LogicalOr(f) => recurse_agg!(LogicalOr, f),
1631
+ Expression::Skewness(f) => recurse_agg!(Skewness, f),
1632
+ Expression::ArrayConcatAgg(f) => recurse_agg!(ArrayConcatAgg, f),
1633
+ Expression::ArrayUniqueAgg(f) => recurse_agg!(ArrayUniqueAgg, f),
1634
+ Expression::BoolXorAgg(f) => recurse_agg!(BoolXorAgg, f),
1635
+ Expression::BitwiseOrAgg(f) => recurse_agg!(BitwiseOrAgg, f),
1636
+ Expression::BitwiseAndAgg(f) => recurse_agg!(BitwiseAndAgg, f),
1637
+ Expression::BitwiseXorAgg(f) => recurse_agg!(BitwiseXorAgg, f),
1638
+
1639
+ // Count has its own struct with an Option<Expression> `this` field
1640
+ Expression::Count(mut c) => {
1641
+ if let Some(this) = c.this.take() {
1642
+ c.this = Some(transform_recursive(this, transform_fn)?);
1643
+ }
1644
+ if let Some(filter) = c.filter.take() {
1645
+ c.filter = Some(transform_recursive(filter, transform_fn)?);
1646
+ }
1647
+ Expression::Count(c)
1601
1648
  }
1649
+
1602
1650
  Expression::PipeOperator(mut pipe) => {
1603
1651
  pipe.this = transform_recursive(pipe.this, transform_fn)?;
1604
1652
  pipe.expression = transform_recursive(pipe.expression, transform_fn)?;
@@ -4061,7 +4109,7 @@ impl Dialect {
4061
4109
  DuckDBTryCastJsonToTryJsonParse, // DuckDB TRY_CAST(x AS JSON) -> TRY(JSON_PARSE(x)) for Trino/Presto/Athena
4062
4110
  DuckDBJsonFuncToJsonParse, // DuckDB json(x) -> JSON_PARSE(x) for Trino/Presto/Athena
4063
4111
  DuckDBJsonValidToIsJson, // DuckDB json_valid(x) -> x IS JSON for Trino/Presto/Athena
4064
- ArraySyntaxConvert, // ARRAY[x] -> ARRAY(x) for Spark, [x] for BigQuery/DuckDB
4112
+ ArraySyntaxConvert, // ARRAY[x] -> ARRAY(x) for Spark, [x] for BigQuery/DuckDB
4065
4113
  AtTimeZoneConvert, // AT TIME ZONE -> AT_TIMEZONE (Presto) / FROM_UTC_TIMESTAMP (Spark)
4066
4114
  DayOfWeekConvert, // DAY_OF_WEEK -> dialect-specific
4067
4115
  MaxByMinByConvert, // MAX_BY/MIN_BY -> argMax/argMin for ClickHouse
@@ -20018,20 +20066,27 @@ impl Dialect {
20018
20066
  // DuckDB supports TRUNC(x, decimals) — preserve both args
20019
20067
  let mut args = f.args;
20020
20068
  // Snowflake fractions_supported: wrap non-INT decimals in CAST(... AS INT)
20021
- if args.len() == 2 && matches!(source, DialectType::Snowflake) {
20069
+ if args.len() == 2
20070
+ && matches!(source, DialectType::Snowflake)
20071
+ {
20022
20072
  let decimals = args.remove(1);
20023
20073
  let is_int = matches!(&decimals, Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)))
20024
20074
  || matches!(&decimals, Expression::Cast(c) if matches!(c.to, DataType::Int { .. } | DataType::SmallInt { .. } | DataType::BigInt { .. } | DataType::TinyInt { .. }));
20025
20075
  let wrapped = if !is_int {
20026
- Expression::Cast(Box::new(crate::expressions::Cast {
20027
- this: decimals,
20028
- to: DataType::Int { length: None, integer_spelling: false },
20029
- double_colon_syntax: false,
20030
- trailing_comments: Vec::new(),
20031
- format: None,
20032
- default: None,
20033
- inferred_type: None,
20034
- }))
20076
+ Expression::Cast(Box::new(
20077
+ crate::expressions::Cast {
20078
+ this: decimals,
20079
+ to: DataType::Int {
20080
+ length: None,
20081
+ integer_spelling: false,
20082
+ },
20083
+ double_colon_syntax: false,
20084
+ trailing_comments: Vec::new(),
20085
+ format: None,
20086
+ default: None,
20087
+ inferred_type: None,
20088
+ },
20089
+ ))
20035
20090
  } else {
20036
20091
  decimals
20037
20092
  };
@@ -22182,14 +22237,12 @@ impl Dialect {
22182
22237
  // DuckDB json_valid(x) -> x IS JSON (SQL:2016 predicate) for Trino/Presto/Athena
22183
22238
  if let Expression::Function(mut f) = e {
22184
22239
  let arg = f.args.remove(0);
22185
- Ok(Expression::IsJson(Box::new(
22186
- crate::expressions::IsJson {
22187
- this: arg,
22188
- json_type: None,
22189
- unique_keys: None,
22190
- negated: false,
22191
- },
22192
- )))
22240
+ Ok(Expression::IsJson(Box::new(crate::expressions::IsJson {
22241
+ this: arg,
22242
+ json_type: None,
22243
+ unique_keys: None,
22244
+ negated: false,
22245
+ })))
22193
22246
  } else {
22194
22247
  Ok(e)
22195
22248
  }
@@ -29880,6 +29933,8 @@ impl Dialect {
29880
29933
  using_template: None,
29881
29934
  rollup: None,
29882
29935
  uuid: None,
29936
+ with_partition_columns: Vec::new(),
29937
+ with_connection: None,
29883
29938
  };
29884
29939
  return Expression::CreateTable(Box::new(ct));
29885
29940
  }
@@ -35948,9 +36003,7 @@ mod tests {
35948
36003
  #[test]
35949
36004
  fn test_pg_hash_bitwise_xor() {
35950
36005
  let dialect = Dialect::get(DialectType::PostgreSQL);
35951
- let result = dialect
35952
- .transpile("x # y", DialectType::PostgreSQL)
35953
- .unwrap();
36006
+ let result = dialect.transpile("x # y", DialectType::PostgreSQL).unwrap();
35954
36007
  assert_eq!(result[0], "x # y");
35955
36008
  }
35956
36009
 
@@ -355,9 +355,7 @@ impl SQLiteDialect {
355
355
  }
356
356
  Expression::Identifier(id) => id.name.to_lowercase(),
357
357
  Expression::Var(v) => v.this.to_lowercase(),
358
- Expression::Column(col) if col.table.is_none() => {
359
- col.name.name.to_lowercase()
360
- }
358
+ Expression::Column(col) if col.table.is_none() => col.name.name.to_lowercase(),
361
359
  _ => "day".to_string(),
362
360
  };
363
361
 
@@ -7344,6 +7344,15 @@ pub struct CreateTable {
7344
7344
  /// ClickHouse: UUID 'xxx' clause after table name
7345
7345
  #[serde(default, skip_serializing_if = "Option::is_none")]
7346
7346
  pub uuid: Option<String>,
7347
+ /// WITH PARTITION COLUMNS (col_name col_type, ...) — currently used by BigQuery
7348
+ /// for hive-partitioned external tables. Not dialect-prefixed since the syntax
7349
+ /// could appear in other engines.
7350
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
7351
+ pub with_partition_columns: Vec<ColumnDef>,
7352
+ /// WITH CONNECTION `project.region.connection` — currently used by BigQuery
7353
+ /// for external tables that reference a Cloud Resource connection.
7354
+ #[serde(default, skip_serializing_if = "Option::is_none")]
7355
+ pub with_connection: Option<TableRef>,
7347
7356
  }
7348
7357
 
7349
7358
  /// Teradata index specification for CREATE TABLE
@@ -7411,6 +7420,8 @@ impl CreateTable {
7411
7420
  using_template: None,
7412
7421
  rollup: None,
7413
7422
  uuid: None,
7423
+ with_partition_columns: Vec::new(),
7424
+ with_connection: None,
7414
7425
  }
7415
7426
  }
7416
7427
  }
@@ -10592,6 +10603,9 @@ pub struct MultitableInserts {
10592
10603
  /// Leading comments before the statement
10593
10604
  #[serde(default)]
10594
10605
  pub leading_comments: Vec<String>,
10606
+ /// OVERWRITE modifier (Snowflake: INSERT OVERWRITE ALL)
10607
+ #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10608
+ pub overwrite: bool,
10595
10609
  }
10596
10610
 
10597
10611
  /// OnConflict
@@ -7947,6 +7947,51 @@ impl Generator {
7947
7947
  self.generate_expression(&on_prop.this)?;
7948
7948
  }
7949
7949
 
7950
+ // BigQuery: WITH PARTITION COLUMNS (col_name col_type, ...)
7951
+ if !ct.with_partition_columns.is_empty() {
7952
+ if self.config.pretty {
7953
+ self.write_newline();
7954
+ } else {
7955
+ self.write_space();
7956
+ }
7957
+ self.write_keyword("WITH PARTITION COLUMNS");
7958
+ self.write(" (");
7959
+ if self.config.pretty {
7960
+ self.write_newline();
7961
+ self.indent_level += 1;
7962
+ for (i, col) in ct.with_partition_columns.iter().enumerate() {
7963
+ if i > 0 {
7964
+ self.write(",");
7965
+ self.write_newline();
7966
+ }
7967
+ self.write_indent();
7968
+ self.generate_column_def(col)?;
7969
+ }
7970
+ self.indent_level -= 1;
7971
+ self.write_newline();
7972
+ } else {
7973
+ for (i, col) in ct.with_partition_columns.iter().enumerate() {
7974
+ if i > 0 {
7975
+ self.write(", ");
7976
+ }
7977
+ self.generate_column_def(col)?;
7978
+ }
7979
+ }
7980
+ self.write(")");
7981
+ }
7982
+
7983
+ // BigQuery: WITH CONNECTION `project.region.connection`
7984
+ if let Some(ref conn) = ct.with_connection {
7985
+ if self.config.pretty {
7986
+ self.write_newline();
7987
+ } else {
7988
+ self.write_space();
7989
+ }
7990
+ self.write_keyword("WITH CONNECTION");
7991
+ self.write_space();
7992
+ self.generate_table(conn)?;
7993
+ }
7994
+
7950
7995
  // Output SchemaCommentProperty BEFORE WITH properties (Presto/Hive/Spark style)
7951
7996
  // For ClickHouse, SchemaCommentProperty goes after AS SELECT, handled later
7952
7997
  if !is_clickhouse {
@@ -31093,8 +31138,12 @@ impl Generator {
31093
31138
  self.write_space();
31094
31139
  }
31095
31140
  }
31096
- // Python: INSERT kind expressions source
31141
+ // Python: INSERT [OVERWRITE] kind expressions source
31097
31142
  self.write_keyword("INSERT");
31143
+ if e.overwrite {
31144
+ self.write_space();
31145
+ self.write_keyword("OVERWRITE");
31146
+ }
31098
31147
  self.write_space();
31099
31148
  self.write(&e.kind);
31100
31149
  if self.config.pretty {
@@ -846,17 +846,48 @@ mod format_tests {
846
846
  #[test]
847
847
  fn transpile_matches_dialect_method() {
848
848
  let cases: &[(DialectType, DialectType, &str, &str, &str)] = &[
849
- (DialectType::DuckDB, DialectType::Trino, "duckdb", "trino",
850
- "SELECT to_timestamp(col) FROM t"),
851
- (DialectType::DuckDB, DialectType::Trino, "duckdb", "trino",
852
- "SELECT CAST(col AS JSON) FROM t"),
853
- (DialectType::DuckDB, DialectType::Trino, "duckdb", "trino",
854
- "SELECT json_valid(col) FROM t"),
855
- (DialectType::Snowflake, DialectType::DuckDB, "snowflake", "duckdb",
856
- "SELECT DATEDIFF(day, a, b) FROM t"),
857
- (DialectType::BigQuery, DialectType::DuckDB, "bigquery", "duckdb",
858
- "SELECT DATE_DIFF(a, b, DAY) FROM t"),
859
- (DialectType::Generic, DialectType::Generic, "generic", "generic", "SELECT 1"),
849
+ (
850
+ DialectType::DuckDB,
851
+ DialectType::Trino,
852
+ "duckdb",
853
+ "trino",
854
+ "SELECT to_timestamp(col) FROM t",
855
+ ),
856
+ (
857
+ DialectType::DuckDB,
858
+ DialectType::Trino,
859
+ "duckdb",
860
+ "trino",
861
+ "SELECT CAST(col AS JSON) FROM t",
862
+ ),
863
+ (
864
+ DialectType::DuckDB,
865
+ DialectType::Trino,
866
+ "duckdb",
867
+ "trino",
868
+ "SELECT json_valid(col) FROM t",
869
+ ),
870
+ (
871
+ DialectType::Snowflake,
872
+ DialectType::DuckDB,
873
+ "snowflake",
874
+ "duckdb",
875
+ "SELECT DATEDIFF(day, a, b) FROM t",
876
+ ),
877
+ (
878
+ DialectType::BigQuery,
879
+ DialectType::DuckDB,
880
+ "bigquery",
881
+ "duckdb",
882
+ "SELECT DATE_DIFF(a, b, DAY) FROM t",
883
+ ),
884
+ (
885
+ DialectType::Generic,
886
+ DialectType::Generic,
887
+ "generic",
888
+ "generic",
889
+ "SELECT 1",
890
+ ),
860
891
  ];
861
892
  for (read, write, read_name, write_name, sql) in cases {
862
893
  let via_lib = transpile(sql, *read, *write).expect("lib::transpile failed");