polyglot-sql 0.1.14__tar.gz → 0.2.0__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 (167) hide show
  1. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/Cargo.lock +5 -5
  2. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/Cargo.toml +7 -1
  3. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/PKG-INFO +1 -1
  4. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/Cargo.toml +1 -1
  5. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/builder.rs +27 -27
  6. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/bigquery.rs +20 -15
  7. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/clickhouse.rs +2 -0
  8. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/databricks.rs +19 -15
  9. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/datafusion.rs +2 -2
  10. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/duckdb.rs +167 -138
  11. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/exasol.rs +97 -12
  12. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/fabric.rs +6 -6
  13. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/hive.rs +3 -3
  14. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/mod.rs +2306 -953
  15. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/mysql.rs +16 -8
  16. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/oracle.rs +4 -2
  17. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/postgres.rs +18 -14
  18. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/presto.rs +14 -10
  19. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/snowflake.rs +101 -56
  20. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/spark.rs +16 -12
  21. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/sqlite.rs +12 -12
  22. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/teradata.rs +1 -1
  23. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/trino.rs +5 -3
  24. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/tsql.rs +16 -12
  25. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/diff.rs +4 -4
  26. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/expressions.rs +1283 -13
  27. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/generator.rs +992 -354
  28. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/lineage.rs +7 -7
  29. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/annotate_types.rs +6 -6
  30. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/canonicalize.rs +9 -3
  31. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/isolate_table_selects.rs +3 -2
  32. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/normalize_identifiers.rs +2 -2
  33. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/pushdown_projections.rs +2 -2
  34. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/qualify_columns.rs +17 -17
  35. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/simplify.rs +33 -28
  36. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/subquery.rs +2 -2
  37. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/parser.rs +1772 -1404
  38. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/tokens.rs +484 -391
  39. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/transforms.rs +115 -95
  40. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/traversal.rs +5 -5
  41. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/validation.rs +2 -2
  42. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/analyze_failures.rs +1 -1
  43. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/common/test_runner.rs +4 -0
  44. polyglot_sql-0.2.0/crates/polyglot-sql-python/docs/api.md +411 -0
  45. polyglot_sql-0.2.0/crates/polyglot-sql-python/docs/index.md +112 -0
  46. polyglot_sql-0.2.0/crates/polyglot-sql-python/src/expr.rs +724 -0
  47. polyglot_sql-0.2.0/crates/polyglot-sql-python/src/expr_types.rs +982 -0
  48. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/lib.rs +2 -2
  49. polyglot_sql-0.2.0/crates/polyglot-sql-python/src/parse.rs +45 -0
  50. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/tests/test_compat.py +4 -4
  51. polyglot_sql-0.2.0/crates/polyglot-sql-python/tests/test_expression.py +352 -0
  52. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/tests/test_optimize.py +2 -2
  53. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/tests/test_parse.py +25 -8
  54. polyglot_sql-0.2.0/python/polyglot_sql/__init__.py +1035 -0
  55. polyglot_sql-0.2.0/python/polyglot_sql/__init__.pyi +1591 -0
  56. polyglot_sql-0.1.14/crates/polyglot-sql-python/docs/api.md +0 -57
  57. polyglot_sql-0.1.14/crates/polyglot-sql-python/docs/index.md +0 -46
  58. polyglot_sql-0.1.14/crates/polyglot-sql-python/src/expr.rs +0 -166
  59. polyglot_sql-0.1.14/crates/polyglot-sql-python/src/parse.rs +0 -83
  60. polyglot_sql-0.1.14/crates/polyglot-sql-python/tests/test_expression.py +0 -73
  61. polyglot_sql-0.1.14/python/polyglot_sql/__init__.py +0 -59
  62. polyglot_sql-0.1.14/python/polyglot_sql/__init__.pyi +0 -164
  63. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/README.md +0 -0
  64. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/README.md +0 -0
  65. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/benches/in_list.rs +0 -0
  66. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/benches/parsing.rs +0 -0
  67. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/benches/rust_parsing.rs +0 -0
  68. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/benches/transpile.rs +0 -0
  69. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/examples/basic_usage.rs +0 -0
  70. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/examples/bench_json.rs +0 -0
  71. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/ast_transforms.rs +0 -0
  72. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/athena.rs +0 -0
  73. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/cockroachdb.rs +0 -0
  74. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/doris.rs +0 -0
  75. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/dremio.rs +0 -0
  76. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/drill.rs +0 -0
  77. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/druid.rs +0 -0
  78. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/dune.rs +0 -0
  79. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/generic.rs +0 -0
  80. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/materialize.rs +0 -0
  81. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/redshift.rs +0 -0
  82. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/risingwave.rs +0 -0
  83. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/singlestore.rs +0 -0
  84. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/solr.rs +0 -0
  85. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/starrocks.rs +0 -0
  86. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/tableau.rs +0 -0
  87. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/dialects/tidb.rs +0 -0
  88. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/error.rs +0 -0
  89. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/function_catalog.rs +0 -0
  90. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/function_registry.rs +0 -0
  91. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/helper.rs +0 -0
  92. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/lib.rs +0 -0
  93. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/eliminate_ctes.rs +0 -0
  94. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/eliminate_joins.rs +0 -0
  95. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/mod.rs +0 -0
  96. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/normalize.rs +0 -0
  97. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/optimize_joins.rs +0 -0
  98. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/optimizer.rs +0 -0
  99. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/pushdown_predicates.rs +0 -0
  100. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/optimizer/qualify_tables.rs +0 -0
  101. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/planner.rs +0 -0
  102. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/resolver.rs +0 -0
  103. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/schema.rs +0 -0
  104. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/scope.rs +0 -0
  105. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/time.rs +0 -0
  106. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/trie.rs +0 -0
  107. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/src/validation/tests.rs +0 -0
  108. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/common/known_failures.rs +0 -0
  109. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/common/mod.rs +0 -0
  110. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/common/test_data.rs +0 -0
  111. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/custom_clickhouse_coverage.rs +0 -0
  112. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/custom_clickhouse_parser.rs +0 -0
  113. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/custom_dialect.rs +0 -0
  114. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/custom_dialect_tests.rs +0 -0
  115. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/ddl.json +0 -0
  116. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/dml.json +0 -0
  117. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/functions.json +0 -0
  118. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/identity.json +0 -0
  119. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/operators.json +0 -0
  120. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/select.json +0 -0
  121. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/transpilation.json +0 -0
  122. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/custom_fixtures/datafusion/types.json +0 -0
  123. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/dialect_matrix.rs +0 -0
  124. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/error_handling.rs +0 -0
  125. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/identity_roundtrip.rs +0 -0
  126. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/sqlglot_compat.rs +0 -0
  127. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/sqlglot_dialect_identity.rs +0 -0
  128. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/sqlglot_identity.rs +0 -0
  129. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/sqlglot_identity_detailed.rs +0 -0
  130. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/sqlglot_parser.rs +0 -0
  131. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/sqlglot_pretty.rs +0 -0
  132. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/sqlglot_transpilation.rs +0 -0
  133. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql/tests/sqlglot_transpile.rs +0 -0
  134. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-function-catalogs/Cargo.toml +0 -0
  135. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-function-catalogs/README.md +0 -0
  136. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-function-catalogs/src/clickhouse.rs +0 -0
  137. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-function-catalogs/src/duckdb.rs +0 -0
  138. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-function-catalogs/src/lib.rs +0 -0
  139. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-function-catalogs/tools/clickhouse/extract_functions.py +0 -0
  140. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-function-catalogs/tools/duckdb/extract_functions.py +0 -0
  141. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/Cargo.toml +0 -0
  142. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/README.md +0 -0
  143. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/mkdocs.yml +0 -0
  144. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/annotate_types.rs +0 -0
  145. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/dialects.rs +0 -0
  146. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/diff.rs +0 -0
  147. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/errors.rs +0 -0
  148. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/format.rs +0 -0
  149. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/generate.rs +0 -0
  150. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/helpers.rs +0 -0
  151. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/lineage.rs +0 -0
  152. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/optimize.rs +0 -0
  153. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/tokenize.rs +0 -0
  154. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/transpile.rs +0 -0
  155. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/types.rs +0 -0
  156. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/src/validate.rs +0 -0
  157. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/tests/conftest.py +0 -0
  158. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/tests/test_dialects.py +0 -0
  159. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/tests/test_diff.py +0 -0
  160. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/tests/test_format.py +0 -0
  161. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/tests/test_generate.py +0 -0
  162. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/tests/test_lineage.py +0 -0
  163. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/tests/test_transpile.py +0 -0
  164. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/tests/test_validate.py +0 -0
  165. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/crates/polyglot-sql-python/uv.lock +0 -0
  166. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/pyproject.toml +0 -0
  167. {polyglot_sql-0.1.14 → polyglot_sql-0.2.0}/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.1.14"
590
+ version = "0.2.0"
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.1.14"
605
+ version = "0.2.0"
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.1.14"
615
+ version = "0.2.0"
616
616
 
617
617
  [[package]]
618
618
  name = "polyglot-sql-python"
619
- version = "0.1.14"
619
+ version = "0.2.0"
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.1.14"
630
+ version = "0.2.0"
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.1.14"
9
+ version = "0.2.0"
10
10
  edition = "2021"
11
11
  license = "MIT"
12
12
  authors = ["polyglot contributors"]
@@ -40,6 +40,12 @@ codegen-units = 1 # Better optimization
40
40
  panic = "abort" # Smaller binary
41
41
  strip = true # Strip symbols
42
42
 
43
+ [profile.bench]
44
+ inherits = "release"
45
+ opt-level = 3
46
+ lto = true
47
+ codegen-units = 1
48
+
43
49
  [profile.ffi_release]
44
50
  inherits = "release"
45
51
  panic = "unwind"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyglot-sql
3
- Version: 0.1.14
3
+ Version: 0.2.0
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.1.14", optional = true, default-features = false }
81
+ polyglot-sql-function-catalogs = { path = "../polyglot-sql-function-catalogs", version = "0.2.0", optional = true, default-features = false }
82
82
 
83
83
  [dev-dependencies]
84
84
  pretty_assertions = "1.4"
@@ -135,7 +135,7 @@ fn builder_table_ref(name: &str) -> TableRef {
135
135
  /// ```
136
136
  pub fn col(name: &str) -> Expr {
137
137
  if let Some((table, column)) = name.rsplit_once('.') {
138
- Expr(Expression::Column(Column {
138
+ Expr(Expression::boxed_column(Column {
139
139
  name: builder_identifier(column),
140
140
  table: Some(builder_identifier(table)),
141
141
  join_mark: false,
@@ -144,7 +144,7 @@ pub fn col(name: &str) -> Expr {
144
144
  inferred_type: None,
145
145
  }))
146
146
  } else {
147
- Expr(Expression::Column(Column {
147
+ Expr(Expression::boxed_column(Column {
148
148
  name: builder_identifier(name),
149
149
  table: None,
150
150
  join_mark: false,
@@ -206,7 +206,7 @@ pub fn boolean(value: bool) -> Expr {
206
206
  /// assert_eq!(t.to_sql(), "my_schema.users");
207
207
  /// ```
208
208
  pub fn table(name: &str) -> Expr {
209
- Expr(Expression::Table(builder_table_ref(name)))
209
+ Expr(Expression::Table(Box::new(builder_table_ref(name))))
210
210
  }
211
211
 
212
212
  /// Create a SQL function call expression.
@@ -782,7 +782,7 @@ where
782
782
  pub fn from(table_name: &str) -> SelectBuilder {
783
783
  let mut builder = SelectBuilder::new();
784
784
  builder.select.from = Some(From {
785
- expressions: vec![Expression::Table(builder_table_ref(table_name))],
785
+ expressions: vec![Expression::Table(Box::new(builder_table_ref(table_name)))],
786
786
  });
787
787
  builder
788
788
  }
@@ -1231,7 +1231,7 @@ impl SelectBuilder {
1231
1231
  /// Set the FROM clause to reference the given table by name.
1232
1232
  pub fn from(mut self, table_name: &str) -> Self {
1233
1233
  self.select.from = Some(From {
1234
- expressions: vec![Expression::Table(builder_table_ref(table_name))],
1234
+ expressions: vec![Expression::Table(Box::new(builder_table_ref(table_name)))],
1235
1235
  });
1236
1236
  self
1237
1237
  }
@@ -1251,7 +1251,7 @@ impl SelectBuilder {
1251
1251
  pub fn join(mut self, table_name: &str, on: Expr) -> Self {
1252
1252
  self.select.joins.push(Join {
1253
1253
  kind: JoinKind::Inner,
1254
- this: Expression::Table(builder_table_ref(table_name)),
1254
+ this: Expression::Table(Box::new(builder_table_ref(table_name))),
1255
1255
  on: Some(on.0),
1256
1256
  using: Vec::new(),
1257
1257
  use_inner_keyword: false,
@@ -1271,7 +1271,7 @@ impl SelectBuilder {
1271
1271
  pub fn left_join(mut self, table_name: &str, on: Expr) -> Self {
1272
1272
  self.select.joins.push(Join {
1273
1273
  kind: JoinKind::Left,
1274
- this: Expression::Table(builder_table_ref(table_name)),
1274
+ this: Expression::Table(Box::new(builder_table_ref(table_name))),
1275
1275
  on: Some(on.0),
1276
1276
  using: Vec::new(),
1277
1277
  use_inner_keyword: false,
@@ -1404,7 +1404,7 @@ impl SelectBuilder {
1404
1404
  /// Set the LIMIT clause to restrict the result set to `count` rows.
1405
1405
  pub fn limit(mut self, count: usize) -> Self {
1406
1406
  self.select.limit = Some(Limit {
1407
- this: Expression::Literal(Literal::Number(count.to_string())),
1407
+ this: Expression::Literal(Box::new(Literal::Number(count.to_string()))),
1408
1408
  percent: false,
1409
1409
  comments: Vec::new(),
1410
1410
  });
@@ -1414,7 +1414,7 @@ impl SelectBuilder {
1414
1414
  /// Set the OFFSET clause to skip the first `count` rows.
1415
1415
  pub fn offset(mut self, count: usize) -> Self {
1416
1416
  self.select.offset = Some(Offset {
1417
- this: Expression::Literal(Literal::Number(count.to_string())),
1417
+ this: Expression::Literal(Box::new(Literal::Number(count.to_string()))),
1418
1418
  rows: None,
1419
1419
  });
1420
1420
  self
@@ -1439,7 +1439,7 @@ impl SelectBuilder {
1439
1439
  pub fn right_join(mut self, table_name: &str, on: Expr) -> Self {
1440
1440
  self.select.joins.push(Join {
1441
1441
  kind: JoinKind::Right,
1442
- this: Expression::Table(builder_table_ref(table_name)),
1442
+ this: Expression::Table(Box::new(builder_table_ref(table_name))),
1443
1443
  on: Some(on.0),
1444
1444
  using: Vec::new(),
1445
1445
  use_inner_keyword: false,
@@ -1459,7 +1459,7 @@ impl SelectBuilder {
1459
1459
  pub fn cross_join(mut self, table_name: &str) -> Self {
1460
1460
  self.select.joins.push(Join {
1461
1461
  kind: JoinKind::Cross,
1462
- this: Expression::Table(builder_table_ref(table_name)),
1462
+ this: Expression::Table(Box::new(builder_table_ref(table_name))),
1463
1463
  on: None,
1464
1464
  using: Vec::new(),
1465
1465
  use_inner_keyword: false,
@@ -1785,7 +1785,7 @@ impl UpdateBuilder {
1785
1785
  /// This allows joining against other tables within the UPDATE statement.
1786
1786
  pub fn from(mut self, table_name: &str) -> Self {
1787
1787
  self.update.from_clause = Some(From {
1788
- expressions: vec![Expression::Table(builder_table_ref(table_name))],
1788
+ expressions: vec![Expression::Table(Box::new(builder_table_ref(table_name)))],
1789
1789
  });
1790
1790
  self
1791
1791
  }
@@ -2051,17 +2051,17 @@ impl SetOpBuilder {
2051
2051
 
2052
2052
  /// Restrict the combined set operation result to `count` rows.
2053
2053
  pub fn limit(mut self, count: usize) -> Self {
2054
- self.limit = Some(Box::new(Expression::Literal(Literal::Number(
2054
+ self.limit = Some(Box::new(Expression::Literal(Box::new(Literal::Number(
2055
2055
  count.to_string(),
2056
- ))));
2056
+ )))));
2057
2057
  self
2058
2058
  }
2059
2059
 
2060
2060
  /// Skip the first `count` rows from the combined set operation result.
2061
2061
  pub fn offset(mut self, count: usize) -> Self {
2062
- self.offset = Some(Box::new(Expression::Literal(Literal::Number(
2062
+ self.offset = Some(Box::new(Expression::Literal(Box::new(Literal::Number(
2063
2063
  count.to_string(),
2064
- ))));
2064
+ )))));
2065
2065
  self
2066
2066
  }
2067
2067
 
@@ -2328,42 +2328,42 @@ pub trait IntoLiteral {
2328
2328
  impl IntoLiteral for &str {
2329
2329
  /// Produce a SQL string literal (e.g. `'hello'`).
2330
2330
  fn into_literal(self) -> Expr {
2331
- Expr(Expression::Literal(Literal::String(self.to_string())))
2331
+ Expr(Expression::Literal(Box::new(Literal::String(self.to_string()))))
2332
2332
  }
2333
2333
  }
2334
2334
 
2335
2335
  impl IntoLiteral for String {
2336
2336
  /// Produce a SQL string literal from an owned string.
2337
2337
  fn into_literal(self) -> Expr {
2338
- Expr(Expression::Literal(Literal::String(self)))
2338
+ Expr(Expression::Literal(Box::new(Literal::String(self))))
2339
2339
  }
2340
2340
  }
2341
2341
 
2342
2342
  impl IntoLiteral for i64 {
2343
2343
  /// Produce a SQL numeric literal from a 64-bit integer.
2344
2344
  fn into_literal(self) -> Expr {
2345
- Expr(Expression::Literal(Literal::Number(self.to_string())))
2345
+ Expr(Expression::Literal(Box::new(Literal::Number(self.to_string()))))
2346
2346
  }
2347
2347
  }
2348
2348
 
2349
2349
  impl IntoLiteral for i32 {
2350
2350
  /// Produce a SQL numeric literal from a 32-bit integer.
2351
2351
  fn into_literal(self) -> Expr {
2352
- Expr(Expression::Literal(Literal::Number(self.to_string())))
2352
+ Expr(Expression::Literal(Box::new(Literal::Number(self.to_string()))))
2353
2353
  }
2354
2354
  }
2355
2355
 
2356
2356
  impl IntoLiteral for usize {
2357
2357
  /// Produce a SQL numeric literal from a `usize`.
2358
2358
  fn into_literal(self) -> Expr {
2359
- Expr(Expression::Literal(Literal::Number(self.to_string())))
2359
+ Expr(Expression::Literal(Box::new(Literal::Number(self.to_string()))))
2360
2360
  }
2361
2361
  }
2362
2362
 
2363
2363
  impl IntoLiteral for f64 {
2364
2364
  /// Produce a SQL numeric literal from a 64-bit float.
2365
2365
  fn into_literal(self) -> Expr {
2366
- Expr(Expression::Literal(Literal::Number(self.to_string())))
2366
+ Expr(Expression::Literal(Box::new(Literal::Number(self.to_string()))))
2367
2367
  }
2368
2368
  }
2369
2369
 
@@ -2412,7 +2412,7 @@ fn binary_op(left: Expression, right: Expression) -> BinaryOp {
2412
2412
  /// ```
2413
2413
  pub fn merge_into(target: &str) -> MergeBuilder {
2414
2414
  MergeBuilder {
2415
- target: Expression::Table(builder_table_ref(target)),
2415
+ target: Expression::Table(Box::new(builder_table_ref(target))),
2416
2416
  using: None,
2417
2417
  on: None,
2418
2418
  whens: Vec::new(),
@@ -2432,7 +2432,7 @@ pub struct MergeBuilder {
2432
2432
  impl MergeBuilder {
2433
2433
  /// Set the source table and ON join condition.
2434
2434
  pub fn using(mut self, source: &str, on: Expr) -> Self {
2435
- self.using = Some(Expression::Table(builder_table_ref(source)));
2435
+ self.using = Some(Expression::Table(Box::new(builder_table_ref(source))));
2436
2436
  self.on = Some(on.0);
2437
2437
  self
2438
2438
  }
@@ -2443,7 +2443,7 @@ impl MergeBuilder {
2443
2443
  .into_iter()
2444
2444
  .map(|(col_name, val)| {
2445
2445
  Expression::Eq(Box::new(BinaryOp {
2446
- left: Expression::Column(Column {
2446
+ left: Expression::boxed_column(Column {
2447
2447
  name: builder_identifier(col_name),
2448
2448
  table: None,
2449
2449
  join_mark: false,
@@ -2491,7 +2491,7 @@ impl MergeBuilder {
2491
2491
  .into_iter()
2492
2492
  .map(|(col_name, val)| {
2493
2493
  Expression::Eq(Box::new(BinaryOp {
2494
- left: Expression::Column(Column {
2494
+ left: Expression::boxed_column(Column {
2495
2495
  name: builder_identifier(col_name),
2496
2496
  table: None,
2497
2497
  join_mark: false,
@@ -2552,7 +2552,7 @@ impl MergeBuilder {
2552
2552
  let col_exprs: Vec<Expression> = columns
2553
2553
  .iter()
2554
2554
  .map(|c| {
2555
- Expression::Column(Column {
2555
+ Expression::boxed_column(Column {
2556
2556
  name: builder_identifier(c),
2557
2557
  table: None,
2558
2558
  join_mark: false,
@@ -523,8 +523,9 @@ impl DialectImpl for BigQueryDialect {
523
523
  Expression::Split(f) => {
524
524
  // Check if delimiter is empty or a placeholder - add default comma
525
525
  let delimiter = match &f.delimiter {
526
- Expression::Literal(Literal::String(s)) if s.is_empty() => {
527
- Expression::Literal(Literal::String(",".to_string()))
526
+ Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(s) if s.is_empty()) => {
527
+ let Literal::String(_) = lit.as_ref() else { unreachable!() };
528
+ Expression::Literal(Box::new(Literal::String(",".to_string())))
528
529
  }
529
530
  _ => f.delimiter,
530
531
  };
@@ -598,13 +599,13 @@ impl DialectImpl for BigQueryDialect {
598
599
  if let Some(ref mut group_by) = select.group_by {
599
600
  for grouped in group_by.expressions.iter_mut() {
600
601
  // Skip numeric indices (already aliased)
601
- if matches!(grouped, Expression::Literal(Literal::Number(_))) {
602
+ if matches!(grouped, Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_))) {
602
603
  continue;
603
604
  }
604
605
  // Check if this GROUP BY expression matches a SELECT alias
605
606
  for (expr, alias_ident) in &aliases {
606
607
  if grouped == expr {
607
- *grouped = Expression::Column(Column {
608
+ *grouped = Expression::boxed_column(Column {
608
609
  name: alias_ident.clone(),
609
610
  table: None,
610
611
  join_mark: false,
@@ -642,7 +643,7 @@ impl DialectImpl for BigQueryDialect {
642
643
  trailing_comments: Vec::new(),
643
644
  inferred_type: None,
644
645
  }));
645
- let col_ref = Expression::Column(Column {
646
+ let col_ref = Expression::boxed_column(Column {
646
647
  name: Identifier::new("_col"),
647
648
  table: None,
648
649
  join_mark: false,
@@ -661,7 +662,7 @@ impl DialectImpl for BigQueryDialect {
661
662
  })),
662
663
  };
663
664
  let inner_select = Expression::Select(Box::new(Select {
664
- expressions: vec![Expression::Literal(Literal::Number("1".to_string()))],
665
+ expressions: vec![Expression::Literal(Box::new(Literal::Number("1".to_string())))],
665
666
  from: Some(From {
666
667
  expressions: vec![aliased_unnest],
667
668
  }),
@@ -716,15 +717,16 @@ impl DialectImpl for BigQueryDialect {
716
717
  // JSONExtract with variant_extract (Snowflake colon syntax) -> JSON_EXTRACT
717
718
  Expression::JSONExtract(e) if e.variant_extract.is_some() => {
718
719
  let path = match *e.expression {
719
- Expression::Literal(Literal::String(s)) => {
720
+ Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
721
+ let Literal::String(s) = lit.as_ref() else { unreachable!() };
720
722
  let normalized = if s.starts_with('$') {
721
- s
723
+ s.clone()
722
724
  } else if s.starts_with('[') {
723
725
  format!("${}", s)
724
726
  } else {
725
727
  format!("$.{}", s)
726
728
  };
727
- Expression::Literal(Literal::String(normalized))
729
+ Expression::Literal(Box::new(Literal::String(normalized)))
728
730
  }
729
731
  other => other,
730
732
  };
@@ -1191,7 +1193,7 @@ impl BigQueryDialect {
1191
1193
  // SPLIT(foo) -> SPLIT(foo, ',')
1192
1194
  "SPLIT" if f.args.len() == 1 => {
1193
1195
  let mut args = f.args;
1194
- args.push(Expression::Literal(Literal::String(",".to_string())));
1196
+ args.push(Expression::Literal(Box::new(Literal::String(",".to_string()))));
1195
1197
  Ok(Expression::Split(Box::new(SplitFunc {
1196
1198
  this: args.remove(0),
1197
1199
  delimiter: args.remove(0),
@@ -1296,7 +1298,8 @@ impl BigQueryDialect {
1296
1298
  let this = args.remove(0);
1297
1299
  let path = args.remove(0);
1298
1300
  let json_path = match &path {
1299
- Expression::Literal(Literal::String(s)) => {
1301
+ Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
1302
+ let Literal::String(s) = lit.as_ref() else { unreachable!() };
1300
1303
  let normalized = if s.starts_with('$') {
1301
1304
  s.clone()
1302
1305
  } else if s.starts_with('[') {
@@ -1304,7 +1307,7 @@ impl BigQueryDialect {
1304
1307
  } else {
1305
1308
  format!("$.{}", s)
1306
1309
  };
1307
- Expression::Literal(Literal::String(normalized))
1310
+ Expression::Literal(Box::new(Literal::String(normalized)))
1308
1311
  }
1309
1312
  _ => path,
1310
1313
  };
@@ -1378,9 +1381,11 @@ impl BigQueryDialect {
1378
1381
  .map(|(i, arg)| {
1379
1382
  // Only transform the first argument (the format string)
1380
1383
  if i == 0 {
1381
- if let Expression::Literal(Literal::String(s)) = arg {
1382
- let normalized = self.normalize_time_format(&s);
1383
- return Expression::Literal(Literal::String(normalized));
1384
+ if let Expression::Literal(ref lit) = arg {
1385
+ if let Literal::String(s) = lit.as_ref() {
1386
+ let normalized = self.normalize_time_format(&s);
1387
+ return Expression::Literal(Box::new(Literal::String(normalized)));
1388
+ }
1384
1389
  }
1385
1390
  }
1386
1391
  arg
@@ -40,6 +40,8 @@ impl DialectImpl for ClickHouseDialect {
40
40
  // ClickHouse supports 0xDEADBEEF hex integer literals
41
41
  config.hex_number_strings = true;
42
42
  config.hex_string_is_integer_type = true;
43
+ // ClickHouse allows underscores as digit separators in numeric literals
44
+ config.numbers_can_be_underscore_separated = true;
43
45
  config
44
46
  }
45
47
 
@@ -149,10 +149,11 @@ impl DialectImpl for DatabricksDialect {
149
149
  Expression::DateSub(f) => {
150
150
  // Convert string literals to numbers (interval values are often stored as strings)
151
151
  let val = match f.interval {
152
- Expression::Literal(crate::expressions::Literal::String(s))
153
- if s.parse::<i64>().is_ok() =>
152
+ Expression::Literal(lit) if matches!(lit.as_ref(), crate::expressions::Literal::String(s) if s.parse::<i64>().is_ok())
153
+ =>
154
154
  {
155
- Expression::Literal(crate::expressions::Literal::Number(s))
155
+ let crate::expressions::Literal::String(s) = lit.as_ref() else { unreachable!() };
156
+ Expression::Literal(Box::new(crate::expressions::Literal::Number(s.clone())))
156
157
  }
157
158
  other => other,
158
159
  };
@@ -431,9 +432,8 @@ impl DatabricksDialect {
431
432
  if f.args.len() == 2 {
432
433
  let is_simple_number = matches!(
433
434
  &f.args[1],
434
- Expression::Literal(crate::expressions::Literal::Number(_))
435
- | Expression::Neg(_)
436
- );
435
+ Expression::Literal(lit) if matches!(lit.as_ref(), crate::expressions::Literal::Number(_))
436
+ ) || matches!(&f.args[1], Expression::Neg(_));
437
437
  if is_simple_number {
438
438
  // Keep as DATE_ADD(date, num_days)
439
439
  Ok(Expression::Function(Box::new(Function::new(
@@ -515,7 +515,8 @@ impl DatabricksDialect {
515
515
 
516
516
  // Extract and strip the $. prefix from the path
517
517
  let path_expr = match &path_arg {
518
- Expression::Literal(crate::expressions::Literal::String(s)) => {
518
+ Expression::Literal(lit) if matches!(lit.as_ref(), crate::expressions::Literal::String(_)) => {
519
+ let crate::expressions::Literal::String(s) = lit.as_ref() else { unreachable!() };
519
520
  // Strip leading '$.' if present
520
521
  let stripped = if s.starts_with("$.") {
521
522
  &s[2..]
@@ -524,9 +525,9 @@ impl DatabricksDialect {
524
525
  } else {
525
526
  s.as_str()
526
527
  };
527
- Expression::Literal(crate::expressions::Literal::String(
528
+ Expression::Literal(Box::new(crate::expressions::Literal::String(
528
529
  stripped.to_string(),
529
- ))
530
+ )))
530
531
  }
531
532
  _ => path_arg,
532
533
  };
@@ -817,10 +818,11 @@ impl DatabricksDialect {
817
818
  // Check if the inner expression is a typed literal
818
819
  match &c.this {
819
820
  // TIMESTAMP 'value'::TYPE -> CAST(CAST('value' AS TYPE) AS TIMESTAMP)
820
- Expression::Literal(Literal::Timestamp(value)) => {
821
+ Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Timestamp(_)) => {
822
+ let Literal::Timestamp(value) = lit.as_ref() else { unreachable!() };
821
823
  // Create inner cast: CAST('value' AS target_type)
822
824
  let inner_cast = Expression::Cast(Box::new(Cast {
823
- this: Expression::Literal(Literal::String(value.clone())),
825
+ this: Expression::Literal(Box::new(Literal::String(value.clone()))),
824
826
  to: c.to,
825
827
  trailing_comments: Vec::new(),
826
828
  double_colon_syntax: false,
@@ -843,9 +845,10 @@ impl DatabricksDialect {
843
845
  })))
844
846
  }
845
847
  // DATE 'value'::TYPE -> CAST(CAST('value' AS TYPE) AS DATE)
846
- Expression::Literal(Literal::Date(value)) => {
848
+ Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Date(_)) => {
849
+ let Literal::Date(value) = lit.as_ref() else { unreachable!() };
847
850
  let inner_cast = Expression::Cast(Box::new(Cast {
848
- this: Expression::Literal(Literal::String(value.clone())),
851
+ this: Expression::Literal(Box::new(Literal::String(value.clone()))),
849
852
  to: c.to,
850
853
  trailing_comments: Vec::new(),
851
854
  double_colon_syntax: false,
@@ -864,9 +867,10 @@ impl DatabricksDialect {
864
867
  })))
865
868
  }
866
869
  // TIME 'value'::TYPE -> CAST(CAST('value' AS TYPE) AS TIME)
867
- Expression::Literal(Literal::Time(value)) => {
870
+ Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Time(_)) => {
871
+ let Literal::Time(value) = lit.as_ref() else { unreachable!() };
868
872
  let inner_cast = Expression::Cast(Box::new(Cast {
869
- this: Expression::Literal(Literal::String(value.clone())),
873
+ this: Expression::Literal(Box::new(Literal::String(value.clone()))),
870
874
  to: c.to,
871
875
  trailing_comments: Vec::new(),
872
876
  double_colon_syntax: false,
@@ -113,9 +113,9 @@ impl DataFusionDialect {
113
113
  // SQUARE(x) → POWER(x, 2)
114
114
  "SQUARE" => {
115
115
  let mut args = f.args;
116
- args.push(Expression::Literal(crate::expressions::Literal::Number(
116
+ args.push(Expression::Literal(Box::new(crate::expressions::Literal::Number(
117
117
  "2".to_string(),
118
- )));
118
+ ))));
119
119
  Ok(Expression::Function(Box::new(Function::new(
120
120
  "power".to_string(),
121
121
  args,