sqlglot 27.8.0__tar.gz → 27.9.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 (227) hide show
  1. {sqlglot-27.8.0 → sqlglot-27.9.0}/CHANGELOG.md +69 -0
  2. {sqlglot-27.8.0 → sqlglot-27.9.0}/CONTRIBUTING.md +4 -0
  3. {sqlglot-27.8.0 → sqlglot-27.9.0}/PKG-INFO +41 -1
  4. {sqlglot-27.8.0 → sqlglot-27.9.0}/README.md +39 -0
  5. {sqlglot-27.8.0 → sqlglot-27.9.0}/pyproject.toml +1 -0
  6. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/_version.py +3 -3
  7. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/bigquery.py +112 -6
  8. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/clickhouse.py +11 -0
  9. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/dialect.py +2 -0
  10. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/doris.py +77 -9
  11. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/dremio.py +75 -15
  12. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/duckdb.py +13 -3
  13. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/exasol.py +23 -0
  14. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/mysql.py +0 -33
  15. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/redshift.py +1 -0
  16. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/singlestore.py +165 -19
  17. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/tsql.py +2 -0
  18. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/expressions.py +115 -4
  19. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/generator.py +92 -26
  20. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/qualify_columns.py +1 -1
  21. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/parser.py +43 -16
  22. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot.egg-info/PKG-INFO +41 -1
  23. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_bigquery.py +73 -23
  24. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_clickhouse.py +41 -0
  25. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_dialect.py +46 -0
  26. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_doris.py +21 -0
  27. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_dremio.py +15 -16
  28. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_duckdb.py +37 -1
  29. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_exasol.py +14 -0
  30. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_hive.py +13 -0
  31. sqlglot-27.9.0/tests/dialects/test_singlestore.py +414 -0
  32. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_spark.py +1 -1
  33. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_tsql.py +16 -2
  34. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/annotate_functions.sql +90 -0
  35. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/qualify_columns.sql +4 -0
  36. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_parser.py +13 -0
  37. sqlglot-27.8.0/tests/dialects/test_singlestore.py +0 -195
  38. {sqlglot-27.8.0 → sqlglot-27.9.0}/.gitignore +0 -0
  39. {sqlglot-27.8.0 → sqlglot-27.9.0}/.gitpod.yml +0 -0
  40. {sqlglot-27.8.0 → sqlglot-27.9.0}/.pre-commit-config.yaml +0 -0
  41. {sqlglot-27.8.0 → sqlglot-27.9.0}/LICENSE +0 -0
  42. {sqlglot-27.8.0 → sqlglot-27.9.0}/MANIFEST.in +0 -0
  43. {sqlglot-27.8.0 → sqlglot-27.9.0}/Makefile +0 -0
  44. {sqlglot-27.8.0 → sqlglot-27.9.0}/setup.cfg +0 -0
  45. {sqlglot-27.8.0 → sqlglot-27.9.0}/setup.py +0 -0
  46. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/__init__.py +0 -0
  47. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/__main__.py +0 -0
  48. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/_typing.py +0 -0
  49. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/__init__.py +1 -1
  50. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/athena.py +0 -0
  51. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/databricks.py +0 -0
  52. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/drill.py +0 -0
  53. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/druid.py +0 -0
  54. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/dune.py +0 -0
  55. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/fabric.py +0 -0
  56. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/hive.py +0 -0
  57. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/materialize.py +0 -0
  58. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/oracle.py +0 -0
  59. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/postgres.py +0 -0
  60. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/presto.py +0 -0
  61. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/prql.py +0 -0
  62. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/risingwave.py +0 -0
  63. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/snowflake.py +0 -0
  64. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/spark.py +0 -0
  65. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/spark2.py +0 -0
  66. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/sqlite.py +0 -0
  67. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/starrocks.py +0 -0
  68. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/tableau.py +0 -0
  69. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/teradata.py +0 -0
  70. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/dialects/trino.py +0 -0
  71. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/diff.py +0 -0
  72. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/errors.py +0 -0
  73. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/executor/__init__.py +0 -0
  74. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/executor/context.py +0 -0
  75. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/executor/env.py +0 -0
  76. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/executor/python.py +0 -0
  77. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/executor/table.py +0 -0
  78. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/helper.py +0 -0
  79. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/jsonpath.py +0 -0
  80. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/lineage.py +0 -0
  81. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/__init__.py +0 -0
  82. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/annotate_types.py +0 -0
  83. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/canonicalize.py +0 -0
  84. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/eliminate_ctes.py +0 -0
  85. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/eliminate_joins.py +0 -0
  86. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/eliminate_subqueries.py +0 -0
  87. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/isolate_table_selects.py +0 -0
  88. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/merge_subqueries.py +0 -0
  89. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/normalize.py +0 -0
  90. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/normalize_identifiers.py +0 -0
  91. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/optimize_joins.py +0 -0
  92. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/optimizer.py +0 -0
  93. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/pushdown_predicates.py +0 -0
  94. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/pushdown_projections.py +0 -0
  95. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/qualify.py +0 -0
  96. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/qualify_tables.py +0 -0
  97. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/scope.py +0 -0
  98. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/simplify.py +0 -0
  99. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/optimizer/unnest_subqueries.py +0 -0
  100. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/planner.py +0 -0
  101. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/py.typed +0 -0
  102. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/schema.py +0 -0
  103. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/serde.py +0 -0
  104. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/time.py +0 -0
  105. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/tokens.py +0 -0
  106. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/transforms.py +0 -0
  107. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot/trie.py +0 -0
  108. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot.egg-info/SOURCES.txt +0 -0
  109. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot.egg-info/dependency_links.txt +0 -0
  110. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot.egg-info/requires.txt +0 -0
  111. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot.egg-info/top_level.txt +0 -0
  112. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglot.png +0 -0
  113. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglotrs/Cargo.lock +0 -0
  114. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglotrs/Cargo.toml +0 -0
  115. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglotrs/benches/dialect_settings.json +0 -0
  116. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglotrs/benches/long.rs +0 -0
  117. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglotrs/benches/token_type_settings.json +0 -0
  118. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglotrs/benches/tokenizer_dialect_settings.json +0 -0
  119. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglotrs/benches/tokenizer_settings.json +0 -0
  120. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglotrs/pyproject.toml +0 -0
  121. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglotrs/src/lib.rs +0 -0
  122. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglotrs/src/settings.rs +0 -0
  123. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglotrs/src/token.rs +0 -0
  124. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglotrs/src/tokenizer.rs +0 -0
  125. {sqlglot-27.8.0 → sqlglot-27.9.0}/sqlglotrs/src/trie.rs +0 -0
  126. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/__init__.py +0 -0
  127. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/__init__.py +0 -0
  128. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_athena.py +0 -0
  129. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_databricks.py +0 -0
  130. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_drill.py +0 -0
  131. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_druid.py +0 -0
  132. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_dune.py +0 -0
  133. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_fabric.py +0 -0
  134. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_materialize.py +0 -0
  135. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_mysql.py +0 -0
  136. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_oracle.py +0 -0
  137. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_pipe_syntax.py +0 -0
  138. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_postgres.py +0 -0
  139. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_presto.py +0 -0
  140. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_prql.py +0 -0
  141. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_redshift.py +0 -0
  142. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_risingwave.py +0 -0
  143. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_snowflake.py +0 -0
  144. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_sqlite.py +0 -0
  145. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_starrocks.py +0 -0
  146. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_tableau.py +0 -0
  147. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_teradata.py +0 -0
  148. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/dialects/test_trino.py +0 -0
  149. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/identity.sql +0 -0
  150. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/jsonpath/LICENSE +0 -0
  151. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/jsonpath/cts.json +0 -0
  152. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/annotate_types.sql +0 -0
  153. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/canonicalize.sql +0 -0
  154. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/eliminate_ctes.sql +0 -0
  155. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/eliminate_joins.sql +0 -0
  156. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/eliminate_subqueries.sql +0 -0
  157. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/isolate_table_selects.sql +0 -0
  158. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/merge_subqueries.sql +0 -0
  159. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/normalize.sql +0 -0
  160. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/normalize_identifiers.sql +0 -0
  161. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/optimize_joins.sql +0 -0
  162. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/optimizer.sql +0 -0
  163. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/pushdown_cte_alias_columns.sql +0 -0
  164. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/pushdown_predicates.sql +0 -0
  165. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/pushdown_projections.sql +0 -0
  166. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/qualify_columns__invalid.sql +0 -0
  167. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/qualify_columns__with_invisible.sql +0 -0
  168. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/qualify_columns_ddl.sql +0 -0
  169. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/qualify_tables.sql +0 -0
  170. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/quote_identifiers.sql +0 -0
  171. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/simplify.sql +0 -0
  172. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/call_center.csv.gz +0 -0
  173. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/catalog_page.csv.gz +0 -0
  174. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/catalog_returns.csv.gz +0 -0
  175. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/catalog_sales.csv.gz +0 -0
  176. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/customer.csv.gz +0 -0
  177. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/customer_address.csv.gz +0 -0
  178. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/customer_demographics.csv.gz +0 -0
  179. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/date_dim.csv.gz +0 -0
  180. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/household_demographics.csv.gz +0 -0
  181. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/income_band.csv.gz +0 -0
  182. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/inventory.csv.gz +0 -0
  183. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/item.csv.gz +0 -0
  184. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/promotion.csv.gz +0 -0
  185. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/reason.csv.gz +0 -0
  186. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/ship_mode.csv.gz +0 -0
  187. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/store.csv.gz +0 -0
  188. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/store_returns.csv.gz +0 -0
  189. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/store_sales.csv.gz +0 -0
  190. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/time_dim.csv.gz +0 -0
  191. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/tpc-ds.sql +0 -0
  192. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/warehouse.csv.gz +0 -0
  193. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/web_page.csv.gz +0 -0
  194. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/web_returns.csv.gz +0 -0
  195. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/web_sales.csv.gz +0 -0
  196. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-ds/web_site.csv.gz +0 -0
  197. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-h/customer.csv.gz +0 -0
  198. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-h/lineitem.csv.gz +0 -0
  199. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-h/nation.csv.gz +0 -0
  200. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-h/orders.csv.gz +0 -0
  201. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-h/part.csv.gz +0 -0
  202. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-h/partsupp.csv.gz +0 -0
  203. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-h/region.csv.gz +0 -0
  204. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-h/supplier.csv.gz +0 -0
  205. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/tpc-h/tpc-h.sql +0 -0
  206. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/optimizer/unnest_subqueries.sql +0 -0
  207. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/partial.sql +0 -0
  208. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/fixtures/pretty.sql +0 -0
  209. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/gen_fixtures.py +0 -0
  210. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/helpers.py +0 -0
  211. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_build.py +0 -0
  212. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_dialect_imports.py +0 -0
  213. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_diff.py +0 -0
  214. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_docs.py +0 -0
  215. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_executor.py +0 -0
  216. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_expressions.py +0 -0
  217. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_generator.py +0 -0
  218. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_helper.py +0 -0
  219. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_jsonpath.py +0 -0
  220. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_lineage.py +0 -0
  221. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_optimizer.py +0 -0
  222. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_schema.py +0 -0
  223. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_serde.py +0 -0
  224. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_time.py +0 -0
  225. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_tokens.py +0 -0
  226. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_transforms.py +0 -0
  227. {sqlglot-27.8.0 → sqlglot-27.9.0}/tests/test_transpile.py +0 -0
@@ -1,6 +1,74 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## [v27.8.0] - 2025-08-19
5
+ ### :boom: BREAKING CHANGES
6
+ - due to [`2a33339`](https://github.com/tobymao/sqlglot/commit/2a333395cde71936df911488afcff92cae735e11) - annotate type for bigquery REPLACE *(PR [#5572](https://github.com/tobymao/sqlglot/pull/5572) by [@geooo109](https://github.com/geooo109))*:
7
+
8
+ annotate type for bigquery REPLACE (#5572)
9
+
10
+ - due to [`1e6f813`](https://github.com/tobymao/sqlglot/commit/1e6f81343de641e588f1a05ce7dc01bed72bd849) - annotate type for bigquery REGEXP_EXTRACT_ALL *(PR [#5573](https://github.com/tobymao/sqlglot/pull/5573) by [@geooo109](https://github.com/geooo109))*:
11
+
12
+ annotate type for bigquery REGEXP_EXTRACT_ALL (#5573)
13
+
14
+ - due to [`d0d62ed`](https://github.com/tobymao/sqlglot/commit/d0d62ede6320b3fd0eee04b7073f5708676dc58c) - support `TO_CHAR` with numeric inputs *(PR [#5570](https://github.com/tobymao/sqlglot/pull/5570) by [@jasonthomassql](https://github.com/jasonthomassql))*:
15
+
16
+ support `TO_CHAR` with numeric inputs (#5570)
17
+
18
+ - due to [`7928985`](https://github.com/tobymao/sqlglot/commit/7928985a655c3d0244bc9175a37f502b19a5c5f0) - allow dashes in JSONPath keys *(PR [#5574](https://github.com/tobymao/sqlglot/pull/5574) by [@georgesittas](https://github.com/georgesittas))*:
19
+
20
+ allow dashes in JSONPath keys (#5574)
21
+
22
+ - due to [`eb09e6e`](https://github.com/tobymao/sqlglot/commit/eb09e6e32491a05846488de7b72b1dca0e0a2669) - parse and annotate type for bigquery TRANSLATE *(PR [#5575](https://github.com/tobymao/sqlglot/pull/5575) by [@geooo109](https://github.com/geooo109))*:
23
+
24
+ parse and annotate type for bigquery TRANSLATE (#5575)
25
+
26
+ - due to [`f9a522b`](https://github.com/tobymao/sqlglot/commit/f9a522b26cd5d643b8b18fa64d70f2a3f0ff2d2c) - parse and annotate type for bigquery SOUNDEX *(PR [#5576](https://github.com/tobymao/sqlglot/pull/5576) by [@geooo109](https://github.com/geooo109))*:
27
+
28
+ parse and annotate type for bigquery SOUNDEX (#5576)
29
+
30
+ - due to [`51da41b`](https://github.com/tobymao/sqlglot/commit/51da41b90ce421b154e45add28353ac044640a1c) - annotate type for bigquery MD5 *(PR [#5577](https://github.com/tobymao/sqlglot/pull/5577) by [@geooo109](https://github.com/geooo109))*:
31
+
32
+ annotate type for bigquery MD5 (#5577)
33
+
34
+ - due to [`bcf302f`](https://github.com/tobymao/sqlglot/commit/bcf302ff6ad2d0adfc29f708a8b53b5c0e547619) - annotate type for bigquery MIN/MAX BY *(PR [#5579](https://github.com/tobymao/sqlglot/pull/5579) by [@geooo109](https://github.com/geooo109))*:
35
+
36
+ annotate type for bigquery MIN/MAX BY (#5579)
37
+
38
+ - due to [`c501d9e`](https://github.com/tobymao/sqlglot/commit/c501d9e6f58e4880e4d23f21f53f72dcb5fdaa8c) - parse and annotate type for bigquery GROUPING *(PR [#5581](https://github.com/tobymao/sqlglot/pull/5581) by [@geooo109](https://github.com/geooo109))*:
39
+
40
+ parse and annotate type for bigquery GROUPING (#5581)
41
+
42
+
43
+ ### :sparkles: New Features
44
+ - [`2a33339`](https://github.com/tobymao/sqlglot/commit/2a333395cde71936df911488afcff92cae735e11) - **optimizer**: annotate type for bigquery REPLACE *(PR [#5572](https://github.com/tobymao/sqlglot/pull/5572) by [@geooo109](https://github.com/geooo109))*
45
+ - [`1e6f813`](https://github.com/tobymao/sqlglot/commit/1e6f81343de641e588f1a05ce7dc01bed72bd849) - **optimizer**: annotate type for bigquery REGEXP_EXTRACT_ALL *(PR [#5573](https://github.com/tobymao/sqlglot/pull/5573) by [@geooo109](https://github.com/geooo109))*
46
+ - [`eb09e6e`](https://github.com/tobymao/sqlglot/commit/eb09e6e32491a05846488de7b72b1dca0e0a2669) - **optimizer**: parse and annotate type for bigquery TRANSLATE *(PR [#5575](https://github.com/tobymao/sqlglot/pull/5575) by [@geooo109](https://github.com/geooo109))*
47
+ - [`f9a522b`](https://github.com/tobymao/sqlglot/commit/f9a522b26cd5d643b8b18fa64d70f2a3f0ff2d2c) - **optimizer**: parse and annotate type for bigquery SOUNDEX *(PR [#5576](https://github.com/tobymao/sqlglot/pull/5576) by [@geooo109](https://github.com/geooo109))*
48
+ - [`51da41b`](https://github.com/tobymao/sqlglot/commit/51da41b90ce421b154e45add28353ac044640a1c) - **optimizer**: annotate type for bigquery MD5 *(PR [#5577](https://github.com/tobymao/sqlglot/pull/5577) by [@geooo109](https://github.com/geooo109))*
49
+ - [`bcf302f`](https://github.com/tobymao/sqlglot/commit/bcf302ff6ad2d0adfc29f708a8b53b5c0e547619) - **optimizer**: annotate type for bigquery MIN/MAX BY *(PR [#5579](https://github.com/tobymao/sqlglot/pull/5579) by [@geooo109](https://github.com/geooo109))*
50
+ - [`c501d9e`](https://github.com/tobymao/sqlglot/commit/c501d9e6f58e4880e4d23f21f53f72dcb5fdaa8c) - **optimizer**: parse and annotate type for bigquery GROUPING *(PR [#5581](https://github.com/tobymao/sqlglot/pull/5581) by [@geooo109](https://github.com/geooo109))*
51
+ - [`8612825`](https://github.com/tobymao/sqlglot/commit/86128253f911b733d45b073356e3b8ddf261c22b) - **spark**: generate date/time ops as interval binary ops *(commit by [@georgesittas](https://github.com/georgesittas))*
52
+ - [`8fda774`](https://github.com/tobymao/sqlglot/commit/8fda774b7a9b0c66948349dfe030d3c122ff6eee) - **singlestore**: Added parsing and generation of JSON_EXTRACT *(PR [#5555](https://github.com/tobymao/sqlglot/pull/5555) by [@AdalbertMemSQL](https://github.com/AdalbertMemSQL))*
53
+ - [`82cc954`](https://github.com/tobymao/sqlglot/commit/82cc9549a875211a400e5c4e818b05ca48a0a9f4) - **exasol**: map div function to IntDiv in exasol dialect *(PR [#5593](https://github.com/tobymao/sqlglot/pull/5593) by [@nnamdi16](https://github.com/nnamdi16))*
54
+ - [`eb0fe68`](https://github.com/tobymao/sqlglot/commit/eb0fe68d6b5977053c871badf2f5c1895b3e1c66) - **trino**: add JSON_VALUE function support with RETURNING clause *(PR [#5590](https://github.com/tobymao/sqlglot/pull/5590) by [@rev-rwasilewski](https://github.com/rev-rwasilewski))*
55
+ - [`9e95c11`](https://github.com/tobymao/sqlglot/commit/9e95c115ea0304d9ccb4cb0be8389f5ff5f2a952) - **exasol**: mapped weekofyear to week in Exasol dialect *(PR [#5594](https://github.com/tobymao/sqlglot/pull/5594) by [@nnamdi16](https://github.com/nnamdi16))*
56
+ - [`8f013c3`](https://github.com/tobymao/sqlglot/commit/8f013c37a412ca5978889c1e47b0c6f7add0715d) - **singlestore**: Fixed parsing of DATE function *(PR [#5601](https://github.com/tobymao/sqlglot/pull/5601) by [@AdalbertMemSQL](https://github.com/AdalbertMemSQL))*
57
+ - [`a4a299a`](https://github.com/tobymao/sqlglot/commit/a4a299acbaf4461f0c2b470bc4e9e9590515eda7) - transpile `TO_CHAR` from Dremio to Databricks *(PR [#5598](https://github.com/tobymao/sqlglot/pull/5598) by [@jasonthomassql](https://github.com/jasonthomassql))*
58
+ - [`093f35c`](https://github.com/tobymao/sqlglot/commit/093f35c201c3c22c3a14c6f8de26c06246bdf19c) - **dremio**: handle `DATE_FORMAT`, `TO_DATE`, and `TO_TIMESTAMP` *(PR [#5597](https://github.com/tobymao/sqlglot/pull/5597) by [@jasonthomassql](https://github.com/jasonthomassql))*
59
+
60
+ ### :bug: Bug Fixes
61
+ - [`d0d62ed`](https://github.com/tobymao/sqlglot/commit/d0d62ede6320b3fd0eee04b7073f5708676dc58c) - **dremio**: support `TO_CHAR` with numeric inputs *(PR [#5570](https://github.com/tobymao/sqlglot/pull/5570) by [@jasonthomassql](https://github.com/jasonthomassql))*
62
+ - [`7928985`](https://github.com/tobymao/sqlglot/commit/7928985a655c3d0244bc9175a37f502b19a5c5f0) - **bigquery**: allow dashes in JSONPath keys *(PR [#5574](https://github.com/tobymao/sqlglot/pull/5574) by [@georgesittas](https://github.com/georgesittas))*
63
+ - [`866042d`](https://github.com/tobymao/sqlglot/commit/866042d0268da0cebce042c0868878c0fb39c3d1) - Remove TokenType.APPLY from table alias tokens *(PR [#5592](https://github.com/tobymao/sqlglot/pull/5592) by [@VaggelisD](https://github.com/VaggelisD))*
64
+ - :arrow_lower_right: *fixes issue [#5591](https://github.com/tobymao/sqlglot/issues/5591) opened by [@saadbelgi](https://github.com/saadbelgi)*
65
+ - [`b485f66`](https://github.com/tobymao/sqlglot/commit/b485f6666fa8625b7da45ef832b5d666fbb707ea) - **dremio**: improve `TO_CHAR` transpilability *(PR [#5580](https://github.com/tobymao/sqlglot/pull/5580) by [@jasonthomassql](https://github.com/jasonthomassql))*
66
+ - [`81874e9`](https://github.com/tobymao/sqlglot/commit/81874e9c3aafcc2cf8fb443f65146c5b3598b9b3) - handle unknown types in `unit_to_str` *(commit by [@georgesittas](https://github.com/georgesittas))*
67
+
68
+ ### :wrench: Chores
69
+ - [`173e442`](https://github.com/tobymao/sqlglot/commit/173e4425b692728abffa8542324690823f984303) - refactor JSON_VALUE handling for MySQL and Trino *(commit by [@georgesittas](https://github.com/georgesittas))*
70
+
71
+
4
72
  ## [v27.7.0] - 2025-08-13
5
73
  ### :boom: BREAKING CHANGES
6
74
  - due to [`938f4b6`](https://github.com/tobymao/sqlglot/commit/938f4b6ebc1c0d26bd3c1400883978c79a435189) - annotate type for LAST_DAY *(PR [#5528](https://github.com/tobymao/sqlglot/pull/5528) by [@geooo109](https://github.com/geooo109))*:
@@ -6535,3 +6603,4 @@ Changelog
6535
6603
  [v27.5.1]: https://github.com/tobymao/sqlglot/compare/v27.5.0...v27.5.1
6536
6604
  [v27.6.0]: https://github.com/tobymao/sqlglot/compare/v27.5.1...v27.6.0
6537
6605
  [v27.7.0]: https://github.com/tobymao/sqlglot/compare/v27.6.0...v27.7.0
6606
+ [v27.8.0]: https://github.com/tobymao/sqlglot/compare/v27.7.0...v27.8.0
@@ -39,6 +39,10 @@ to share any relevant context and increase its chances of getting merged.
39
39
 
40
40
  Note: make sure to follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) guidelines when creating a PR.
41
41
 
42
+ ## IMPORTANT: Keep PRs minimal in scope
43
+
44
+ Each pull request should focus on a single, well-defined change. Avoid bundling multiple unrelated fixes or features in one PR. This makes code review faster and more effective, increases the likelihood of acceptance, and helps maintain a clean git history.
45
+
42
46
  ## Report bugs using GitHub's [issues](https://github.com/tobymao/sqlglot/issues)
43
47
 
44
48
  We use GitHub issues to track public bugs. Report a bug by opening a new issue.
@@ -1,8 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlglot
3
- Version: 27.8.0
3
+ Version: 27.9.0
4
4
  Summary: An easily customizable SQL parser and transpiler
5
5
  Author-email: Toby Mao <toby.mao@gmail.com>
6
+ License-Expression: MIT
6
7
  Project-URL: Homepage, https://sqlglot.com/
7
8
  Project-URL: Documentation, https://sqlglot.com/sqlglot.html
8
9
  Project-URL: Repository, https://github.com/tobymao/sqlglot
@@ -72,6 +73,7 @@ Contributions are very welcome in SQLGlot; read the [contribution guide](https:/
72
73
  * [Run Tests and Lint](#run-tests-and-lint)
73
74
  * [Benchmarks](#benchmarks)
74
75
  * [Optional Dependencies](#optional-dependencies)
76
+ * [Supported Dialects](#supported-dialects)
75
77
 
76
78
  ## Install
77
79
 
@@ -584,3 +586,41 @@ SQLGlot uses [dateutil](https://github.com/dateutil/dateutil) to simplify litera
584
586
  ```sql
585
587
  x + interval '1' month
586
588
  ```
589
+
590
+ ## Supported Dialects
591
+
592
+ | Dialect | Support Level |
593
+ |---------|---------------|
594
+ | Athena | Official |
595
+ | BigQuery | Official |
596
+ | ClickHouse | Official |
597
+ | Databricks | Official |
598
+ | Doris | Community |
599
+ | Dremio | Community |
600
+ | Drill | Community |
601
+ | Druid | Community |
602
+ | DuckDB | Official |
603
+ | Exasol | Community |
604
+ | Fabric | Community |
605
+ | Hive | Official |
606
+ | Materialize | Community |
607
+ | MySQL | Official |
608
+ | Oracle | Official |
609
+ | Postgres | Official |
610
+ | Presto | Official |
611
+ | PRQL | Community |
612
+ | Redshift | Official |
613
+ | RisingWave | Community |
614
+ | SingleStore | Community |
615
+ | Snowflake | Official |
616
+ | Spark | Official |
617
+ | SQLite | Official |
618
+ | StarRocks | Official |
619
+ | Tableau | Official |
620
+ | Teradata | Community |
621
+ | Trino | Official |
622
+ | TSQL | Official |
623
+
624
+ **Official Dialects** are maintained by the core SQLGlot team with higher priority for bug fixes and feature additions.
625
+
626
+ **Community Dialects** are developed and maintained primarily through community contributions. These are fully functional but may receive lower priority for issue resolution compared to officially supported dialects. We welcome and encourage community contributions to improve these dialects.
@@ -34,6 +34,7 @@ Contributions are very welcome in SQLGlot; read the [contribution guide](https:/
34
34
  * [Run Tests and Lint](#run-tests-and-lint)
35
35
  * [Benchmarks](#benchmarks)
36
36
  * [Optional Dependencies](#optional-dependencies)
37
+ * [Supported Dialects](#supported-dialects)
37
38
 
38
39
  ## Install
39
40
 
@@ -546,3 +547,41 @@ SQLGlot uses [dateutil](https://github.com/dateutil/dateutil) to simplify litera
546
547
  ```sql
547
548
  x + interval '1' month
548
549
  ```
550
+
551
+ ## Supported Dialects
552
+
553
+ | Dialect | Support Level |
554
+ |---------|---------------|
555
+ | Athena | Official |
556
+ | BigQuery | Official |
557
+ | ClickHouse | Official |
558
+ | Databricks | Official |
559
+ | Doris | Community |
560
+ | Dremio | Community |
561
+ | Drill | Community |
562
+ | Druid | Community |
563
+ | DuckDB | Official |
564
+ | Exasol | Community |
565
+ | Fabric | Community |
566
+ | Hive | Official |
567
+ | Materialize | Community |
568
+ | MySQL | Official |
569
+ | Oracle | Official |
570
+ | Postgres | Official |
571
+ | Presto | Official |
572
+ | PRQL | Community |
573
+ | Redshift | Official |
574
+ | RisingWave | Community |
575
+ | SingleStore | Community |
576
+ | Snowflake | Official |
577
+ | Spark | Official |
578
+ | SQLite | Official |
579
+ | StarRocks | Official |
580
+ | Tableau | Official |
581
+ | Teradata | Community |
582
+ | Trino | Official |
583
+ | TSQL | Official |
584
+
585
+ **Official Dialects** are maintained by the core SQLGlot team with higher priority for bug fixes and feature additions.
586
+
587
+ **Community Dialects** are developed and maintained primarily through community contributions. These are fully functional but may receive lower priority for issue resolution compared to officially supported dialects. We welcome and encourage community contributions to improve these dialects.
@@ -4,6 +4,7 @@ dynamic = ["version", "optional-dependencies"]
4
4
  description = "An easily customizable SQL parser and transpiler"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Toby Mao", email = "toby.mao@gmail.com" }]
7
+ license = "MIT"
7
8
  license-files = ["LICENSE"]
8
9
  requires-python = ">= 3.9"
9
10
  classifiers = [
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '27.8.0'
32
- __version_tuple__ = version_tuple = (27, 8, 0)
31
+ __version__ = version = '27.9.0'
32
+ __version_tuple__ = version_tuple = (27, 9, 0)
33
33
 
34
- __commit_id__ = commit_id = 'g093f35c20'
34
+ __commit_id__ = commit_id = 'ge4e08e8c9'
@@ -295,6 +295,22 @@ def _annotate_math_functions(self: TypeAnnotator, expression: E) -> E:
295
295
  return expression
296
296
 
297
297
 
298
+ def _annotate_by_args_approx_top(self: TypeAnnotator, expression: exp.ApproxTopK) -> exp.ApproxTopK:
299
+ self._annotate_args(expression)
300
+
301
+ struct_type = exp.DataType(
302
+ this=exp.DataType.Type.STRUCT,
303
+ expressions=[expression.this.type, exp.DataType(this=exp.DataType.Type.BIGINT)],
304
+ nested=True,
305
+ )
306
+ self._set_type(
307
+ expression,
308
+ exp.DataType(this=exp.DataType.Type.ARRAY, expressions=[struct_type], nested=True),
309
+ )
310
+
311
+ return expression
312
+
313
+
298
314
  @unsupported_args("ins_cost", "del_cost", "sub_cost")
299
315
  def _levenshtein_sql(self: BigQuery.Generator, expression: exp.Levenshtein) -> str:
300
316
  max_dist = expression.args.get("max_dist")
@@ -473,17 +489,24 @@ class BigQuery(Dialect):
473
489
  exp.Substring,
474
490
  )
475
491
  },
492
+ exp.ApproxTopSum: lambda self, e: _annotate_by_args_approx_top(self, e),
493
+ exp.ApproxTopK: lambda self, e: _annotate_by_args_approx_top(self, e),
494
+ exp.ApproxQuantiles: lambda self, e: self._annotate_by_args(e, "this", array=True),
476
495
  exp.ArgMax: lambda self, e: self._annotate_by_args(e, "this"),
477
496
  exp.ArgMin: lambda self, e: self._annotate_by_args(e, "this"),
478
497
  exp.Array: _annotate_array,
479
498
  exp.ArrayConcat: lambda self, e: self._annotate_by_args(e, "this", "expressions"),
480
499
  exp.Ascii: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
500
+ exp.JSONBool: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BOOLEAN),
481
501
  exp.BitwiseAndAgg: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
482
502
  exp.BitwiseOrAgg: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
483
503
  exp.BitwiseXorAgg: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
484
504
  exp.BitwiseCountAgg: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
485
505
  exp.ByteLength: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
486
506
  exp.ByteString: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BINARY),
507
+ exp.CodePointsToBytes: lambda self, e: self._annotate_with_type(
508
+ e, exp.DataType.Type.BINARY
509
+ ),
487
510
  exp.CodePointsToString: lambda self, e: self._annotate_with_type(
488
511
  e, exp.DataType.Type.VARCHAR
489
512
  ),
@@ -493,6 +516,9 @@ class BigQuery(Dialect):
493
516
  exp.CovarSamp: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
494
517
  exp.DateFromUnixDate: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DATE),
495
518
  exp.DateTrunc: lambda self, e: self._annotate_by_args(e, "this"),
519
+ exp.FarmFingerprint: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
520
+ exp.Unhex: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BINARY),
521
+ exp.Float64: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DOUBLE),
496
522
  exp.GenerateTimestampArray: lambda self, e: self._annotate_with_type(
497
523
  e, exp.DataType.build("ARRAY<TIMESTAMP>", dialect="bigquery")
498
524
  ),
@@ -506,12 +532,20 @@ class BigQuery(Dialect):
506
532
  ),
507
533
  exp.JSONType: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.VARCHAR),
508
534
  exp.Lag: lambda self, e: self._annotate_by_args(e, "this", "default"),
535
+ exp.LowerHex: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.VARCHAR),
509
536
  exp.MD5Digest: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BINARY),
510
537
  exp.ParseTime: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.TIME),
511
538
  exp.ParseDatetime: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DATETIME),
539
+ exp.ParseBignumeric: lambda self, e: self._annotate_with_type(
540
+ e, exp.DataType.Type.BIGDECIMAL
541
+ ),
542
+ exp.ParseNumeric: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.DECIMAL),
512
543
  exp.RegexpExtractAll: lambda self, e: self._annotate_by_args(e, "this", array=True),
513
544
  exp.Replace: lambda self, e: self._annotate_by_args(e, "this"),
514
545
  exp.Reverse: lambda self, e: self._annotate_by_args(e, "this"),
546
+ exp.SafeConvertBytesToString: lambda self, e: self._annotate_with_type(
547
+ e, exp.DataType.Type.VARCHAR
548
+ ),
515
549
  exp.Soundex: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.VARCHAR),
516
550
  exp.SHA: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BINARY),
517
551
  exp.SHA2: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BINARY),
@@ -522,8 +556,11 @@ class BigQuery(Dialect):
522
556
  ),
523
557
  exp.TimestampTrunc: lambda self, e: self._annotate_by_args(e, "this"),
524
558
  exp.TimeFromParts: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.TIME),
525
- exp.TsOrDsToTime: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.TIME),
526
559
  exp.TimeTrunc: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.TIME),
560
+ exp.ToCodePoints: lambda self, e: self._annotate_with_type(
561
+ e, exp.DataType.build("ARRAY<BIGINT>", dialect="bigquery")
562
+ ),
563
+ exp.TsOrDsToTime: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.TIME),
527
564
  exp.Translate: lambda self, e: self._annotate_by_args(e, "this"),
528
565
  exp.Unicode: lambda self, e: self._annotate_with_type(e, exp.DataType.Type.BIGINT),
529
566
  }
@@ -596,10 +633,13 @@ class BigQuery(Dialect):
596
633
  "EXPORT": TokenType.EXPORT,
597
634
  "FLOAT64": TokenType.DOUBLE,
598
635
  "FOR SYSTEM_TIME": TokenType.TIMESTAMP_SNAPSHOT,
636
+ "LOOP": TokenType.COMMAND,
599
637
  "MODEL": TokenType.MODEL,
600
638
  "NOT DETERMINISTIC": TokenType.VOLATILE,
601
639
  "RECORD": TokenType.STRUCT,
640
+ "REPEAT": TokenType.COMMAND,
602
641
  "TIMESTAMP": TokenType.TIMESTAMPTZ,
642
+ "WHILE": TokenType.COMMAND,
603
643
  }
604
644
  KEYWORDS.pop("DIV")
605
645
  KEYWORDS.pop("VALUES")
@@ -623,6 +663,8 @@ class BigQuery(Dialect):
623
663
 
624
664
  FUNCTIONS = {
625
665
  **parser.Parser.FUNCTIONS,
666
+ "APPROX_TOP_COUNT": exp.ApproxTopK.from_arg_list,
667
+ "BOOL": exp.JSONBool.from_arg_list,
626
668
  "CONTAINS_SUBSTR": _build_contains_substring,
627
669
  "DATE": _build_date,
628
670
  "DATE_ADD": build_date_delta_with_interval(exp.DateAdd),
@@ -689,6 +731,7 @@ class BigQuery(Dialect):
689
731
  "FORMAT_DATETIME": _build_format_time(exp.TsOrDsToDatetime),
690
732
  "FORMAT_TIMESTAMP": _build_format_time(exp.TsOrDsToTimestamp),
691
733
  "FORMAT_TIME": _build_format_time(exp.TsOrDsToTime),
734
+ "FROM_HEX": exp.Unhex.from_arg_list,
692
735
  "WEEK": lambda args: exp.WeekStart(this=exp.var(seq_get(args, 0))),
693
736
  }
694
737
 
@@ -699,7 +742,10 @@ class BigQuery(Dialect):
699
742
  exp.JSONArray, expressions=self._parse_csv(self._parse_bitwise)
700
743
  ),
701
744
  "MAKE_INTERVAL": lambda self: self._parse_make_interval(),
745
+ "PREDICT": lambda self: self._parse_predict(),
702
746
  "FEATURES_AT_TIME": lambda self: self._parse_features_at_time(),
747
+ "GENERATE_EMBEDDING": lambda self: self._parse_generate_embedding(),
748
+ "VECTOR_SEARCH": lambda self: self._parse_vector_search(),
703
749
  }
704
750
  FUNCTION_PARSERS.pop("TRIM")
705
751
 
@@ -979,13 +1025,40 @@ class BigQuery(Dialect):
979
1025
 
980
1026
  return expr
981
1027
 
982
- def _parse_features_at_time(self) -> exp.FeaturesAtTime:
983
- expr = self.expression(
984
- exp.FeaturesAtTime,
985
- this=(self._match(TokenType.TABLE) and self._parse_table())
986
- or self._parse_select(nested=True),
1028
+ def _parse_predict(self) -> exp.Predict:
1029
+ self._match_text_seq("MODEL")
1030
+ this = self._parse_table()
1031
+
1032
+ self._match(TokenType.COMMA)
1033
+ self._match_text_seq("TABLE")
1034
+
1035
+ return self.expression(
1036
+ exp.Predict,
1037
+ this=this,
1038
+ expression=self._parse_table(),
1039
+ params_struct=self._match(TokenType.COMMA) and self._parse_bitwise(),
1040
+ )
1041
+
1042
+ def _parse_generate_embedding(self) -> exp.GenerateEmbedding:
1043
+ self._match_text_seq("MODEL")
1044
+ this = self._parse_table()
1045
+
1046
+ self._match(TokenType.COMMA)
1047
+ self._match_text_seq("TABLE")
1048
+
1049
+ return self.expression(
1050
+ exp.GenerateEmbedding,
1051
+ this=this,
1052
+ expression=self._parse_table(),
1053
+ params_struct=self._match(TokenType.COMMA) and self._parse_bitwise(),
987
1054
  )
988
1055
 
1056
+ def _parse_features_at_time(self) -> exp.FeaturesAtTime:
1057
+ self._match(TokenType.TABLE)
1058
+ this = self._parse_table()
1059
+
1060
+ expr = self.expression(exp.FeaturesAtTime, this=this)
1061
+
989
1062
  while self._match(TokenType.COMMA):
990
1063
  arg = self._parse_lambda()
991
1064
 
@@ -996,6 +1069,37 @@ class BigQuery(Dialect):
996
1069
 
997
1070
  return expr
998
1071
 
1072
+ def _parse_vector_search(self) -> exp.VectorSearch:
1073
+ self._match(TokenType.TABLE)
1074
+ base_table = self._parse_table()
1075
+
1076
+ self._match(TokenType.COMMA)
1077
+
1078
+ column_to_search = self._parse_bitwise()
1079
+ self._match(TokenType.COMMA)
1080
+
1081
+ self._match(TokenType.TABLE)
1082
+ query_table = self._parse_table()
1083
+
1084
+ expr = self.expression(
1085
+ exp.VectorSearch,
1086
+ this=base_table,
1087
+ column_to_search=column_to_search,
1088
+ query_table=query_table,
1089
+ )
1090
+
1091
+ while self._match(TokenType.COMMA):
1092
+ # query_column_to_search can be named argument or positional
1093
+ if self._match(TokenType.STRING, advance=False):
1094
+ query_column = self._parse_string()
1095
+ expr.set("query_column_to_search", query_column)
1096
+ else:
1097
+ arg = self._parse_lambda()
1098
+ if arg:
1099
+ expr.set(arg.this.name, arg)
1100
+
1101
+ return expr
1102
+
999
1103
  def _parse_export_data(self) -> exp.Export:
1000
1104
  self._match_text_seq("DATA")
1001
1105
 
@@ -1043,6 +1147,7 @@ class BigQuery(Dialect):
1043
1147
 
1044
1148
  TRANSFORMS = {
1045
1149
  **generator.Generator.TRANSFORMS,
1150
+ exp.ApproxTopK: rename_func("APPROX_TOP_COUNT"),
1046
1151
  exp.ApproxDistinct: rename_func("APPROX_COUNT_DISTINCT"),
1047
1152
  exp.ArgMax: arg_max_or_min_no_count("MAX_BY"),
1048
1153
  exp.ArgMin: arg_max_or_min_no_count("MIN_BY"),
@@ -1083,6 +1188,7 @@ class BigQuery(Dialect):
1083
1188
  exp.ILike: no_ilike_sql,
1084
1189
  exp.IntDiv: rename_func("DIV"),
1085
1190
  exp.Int64: rename_func("INT64"),
1191
+ exp.JSONBool: rename_func("BOOL"),
1086
1192
  exp.JSONExtract: _json_extract_sql,
1087
1193
  exp.JSONExtractArray: _json_extract_sql,
1088
1194
  exp.JSONExtractScalar: _json_extract_sql,
@@ -345,6 +345,7 @@ class ClickHouse(Dialect):
345
345
  "LEVENSHTEINDISTANCE": exp.Levenshtein.from_arg_list,
346
346
  }
347
347
  FUNCTIONS.pop("TRANSFORM")
348
+ FUNCTIONS.pop("APPROX_TOP_SUM")
348
349
 
349
350
  AGG_FUNCTIONS = {
350
351
  "count",
@@ -379,6 +380,7 @@ class ClickHouse(Dialect):
379
380
  "argMax",
380
381
  "avgWeighted",
381
382
  "topK",
383
+ "approx_top_sum",
382
384
  "topKWeighted",
383
385
  "deltaSum",
384
386
  "deltaSumTimestamp",
@@ -977,6 +979,14 @@ class ClickHouse(Dialect):
977
979
 
978
980
  return value
979
981
 
982
+ def _parse_partitioned_by(self) -> exp.PartitionedByProperty:
983
+ # ClickHouse allows custom expressions as partition key
984
+ # https://clickhouse.com/docs/engines/table-engines/mergetree-family/custom-partitioning-key
985
+ return self.expression(
986
+ exp.PartitionedByProperty,
987
+ this=self._parse_assignment(),
988
+ )
989
+
980
990
  class Generator(generator.Generator):
981
991
  QUERY_HINTS = False
982
992
  STRUCT_DELIMITER = ("(", ")")
@@ -1094,6 +1104,7 @@ class ClickHouse(Dialect):
1094
1104
  exp.DateStrToDate: rename_func("toDate"),
1095
1105
  exp.DateSub: _datetime_delta_sql("DATE_SUB"),
1096
1106
  exp.Explode: rename_func("arrayJoin"),
1107
+ exp.FarmFingerprint: rename_func("farmFingerprint64"),
1097
1108
  exp.Final: lambda self, e: f"{self.sql(e, 'this')} FINAL",
1098
1109
  exp.IsNan: rename_func("isNaN"),
1099
1110
  exp.JSONCast: lambda self, e: f"{self.sql(e, 'this')}.:{self.sql(e, 'to')}",
@@ -668,6 +668,7 @@ class Dialect(metaclass=_Dialect):
668
668
  exp.UnixMillis,
669
669
  },
670
670
  exp.DataType.Type.BINARY: {
671
+ exp.FromBase32,
671
672
  exp.FromBase64,
672
673
  },
673
674
  exp.DataType.Type.BOOLEAN: {
@@ -779,6 +780,7 @@ class Dialect(metaclass=_Dialect):
779
780
  exp.TimeToStr,
780
781
  exp.TimeToTimeStr,
781
782
  exp.Trim,
783
+ exp.ToBase32,
782
784
  exp.ToBase64,
783
785
  exp.TsOrDsToDateStr,
784
786
  exp.UnixToStr,
@@ -65,7 +65,11 @@ class Doris(MySQL):
65
65
  **MySQL.Parser.PROPERTY_PARSERS,
66
66
  "PROPERTIES": lambda self: self._parse_wrapped_properties(),
67
67
  "UNIQUE": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty),
68
+ # Plain KEY without UNIQUE/DUPLICATE/AGGREGATE prefixes should be treated as UniqueKeyProperty with unique=False
69
+ "KEY": lambda self: self._parse_composite_key_property(exp.UniqueKeyProperty),
68
70
  "PARTITION BY": lambda self: self._parse_partition_by_opt_range(),
71
+ "BUILD": lambda self: self._parse_build_property(),
72
+ "REFRESH": lambda self: self._parse_refresh_property(),
69
73
  }
70
74
 
71
75
  def _parse_partitioning_granularity_dynamic(self) -> exp.PartitionByRangePropertyDynamic:
@@ -104,9 +108,27 @@ class Doris(MySQL):
104
108
  part_range = self.expression(exp.PartitionRange, this=name, expressions=values)
105
109
  return self.expression(exp.Partition, expressions=[part_range])
106
110
 
111
+ def _parse_partition_definition_list(self) -> exp.Partition:
112
+ # PARTITION <name> VALUES IN (<value_csv>)
113
+ self._match_text_seq("PARTITION")
114
+ name = self._parse_id_var()
115
+ self._match_text_seq("VALUES", "IN")
116
+ values = self._parse_wrapped_csv(self._parse_expression)
117
+ part_list = self.expression(exp.PartitionList, this=name, expressions=values)
118
+ return self.expression(exp.Partition, expressions=[part_list])
119
+
107
120
  def _parse_partition_by_opt_range(
108
121
  self,
109
- ) -> exp.PartitionedByProperty | exp.PartitionByRangeProperty:
122
+ ) -> exp.PartitionedByProperty | exp.PartitionByRangeProperty | exp.PartitionByListProperty:
123
+ if self._match_text_seq("LIST"):
124
+ return self.expression(
125
+ exp.PartitionByListProperty,
126
+ partition_expressions=self._parse_wrapped_id_vars(),
127
+ create_expressions=self._parse_wrapped_csv(
128
+ self._parse_partition_definition_list
129
+ ),
130
+ )
131
+
110
132
  if not self._match_text_seq("RANGE"):
111
133
  return super()._parse_partitioned_by()
112
134
 
@@ -128,6 +150,28 @@ class Doris(MySQL):
128
150
  create_expressions=create_expressions,
129
151
  )
130
152
 
153
+ def _parse_build_property(self) -> exp.BuildProperty:
154
+ return self.expression(exp.BuildProperty, this=self._parse_var(upper=True))
155
+
156
+ def _parse_refresh_property(self) -> exp.RefreshTriggerProperty:
157
+ method = self._parse_var(upper=True)
158
+
159
+ self._match(TokenType.ON)
160
+
161
+ kind = self._match_texts(("MANUAL", "COMMIT", "SCHEDULE")) and self._prev.text.upper()
162
+ every = self._match_text_seq("EVERY") and self._parse_number()
163
+ unit = self._parse_var(any_token=True) if every else None
164
+ starts = self._match_text_seq("STARTS") and self._parse_string()
165
+
166
+ return self.expression(
167
+ exp.RefreshTriggerProperty,
168
+ method=method,
169
+ kind=kind,
170
+ every=every,
171
+ unit=unit,
172
+ starts=starts,
173
+ )
174
+
131
175
  class Generator(MySQL.Generator):
132
176
  LAST_DAY_SUPPORTS_DATE_PART = False
133
177
  VARCHAR_REQUIRES_SIZE = False
@@ -145,7 +189,10 @@ class Doris(MySQL):
145
189
  **MySQL.Generator.PROPERTIES_LOCATION,
146
190
  exp.UniqueKeyProperty: exp.Properties.Location.POST_SCHEMA,
147
191
  exp.PartitionByRangeProperty: exp.Properties.Location.POST_SCHEMA,
192
+ exp.PartitionByListProperty: exp.Properties.Location.POST_SCHEMA,
148
193
  exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA,
194
+ exp.BuildProperty: exp.Properties.Location.POST_SCHEMA,
195
+ exp.RefreshTriggerProperty: exp.Properties.Location.POST_SCHEMA,
149
196
  }
150
197
 
151
198
  CAST_MAPPING = {}
@@ -662,9 +709,18 @@ class Doris(MySQL):
662
709
  "year",
663
710
  }
664
711
 
712
+ def uniquekeyproperty_sql(
713
+ self, expression: exp.UniqueKeyProperty, prefix: str = "UNIQUE KEY"
714
+ ) -> str:
715
+ create_stmt = expression.find_ancestor(exp.Create)
716
+ if create_stmt and create_stmt.args["properties"].find(exp.MaterializedProperty):
717
+ return super().uniquekeyproperty_sql(expression, prefix="KEY")
718
+
719
+ return super().uniquekeyproperty_sql(expression)
720
+
665
721
  def partition_sql(self, expression: exp.Partition) -> str:
666
722
  parent = expression.parent
667
- if isinstance(parent, exp.PartitionByRangeProperty):
723
+ if isinstance(parent, (exp.PartitionByRangeProperty, exp.PartitionByListProperty)):
668
724
  return ", ".join(self.sql(e) for e in expression.expressions)
669
725
  return super().partition_sql(expression)
670
726
 
@@ -685,7 +741,9 @@ class Doris(MySQL):
685
741
 
686
742
  return f"PARTITION {name} VALUES LESS THAN ({self.sql(values[0])})"
687
743
 
688
- def partitionbyrangepropertydynamic_sql(self, expression):
744
+ def partitionbyrangepropertydynamic_sql(
745
+ self, expression: exp.PartitionByRangePropertyDynamic
746
+ ) -> str:
689
747
  # Generates: FROM ("start") TO ("end") INTERVAL N UNIT
690
748
  start = self.sql(expression, "start")
691
749
  end = self.sql(expression, "end")
@@ -699,15 +757,25 @@ class Doris(MySQL):
699
757
 
700
758
  return f"FROM ({start}) TO ({end}) {interval}"
701
759
 
702
- def partitionbyrangeproperty_sql(self, expression):
703
- partition_expressions = ", ".join(
704
- self.sql(e) for e in expression.args.get("partition_expressions") or []
760
+ def partitionbyrangeproperty_sql(self, expression: exp.PartitionByRangeProperty) -> str:
761
+ partition_expressions = self.expressions(
762
+ expression, key="partition_expressions", indent=False
705
763
  )
706
- create_expressions = expression.args.get("create_expressions") or []
707
- # Handle both static and dynamic partition definitions
708
- create_sql = ", ".join(self.sql(e) for e in create_expressions)
764
+ create_sql = self.expressions(expression, key="create_expressions", indent=False)
709
765
  return f"PARTITION BY RANGE ({partition_expressions}) ({create_sql})"
710
766
 
767
+ def partitionbylistproperty_sql(self, expression: exp.PartitionByListProperty) -> str:
768
+ partition_expressions = self.expressions(
769
+ expression, key="partition_expressions", indent=False
770
+ )
771
+ create_sql = self.expressions(expression, key="create_expressions", indent=False)
772
+ return f"PARTITION BY LIST ({partition_expressions}) ({create_sql})"
773
+
774
+ def partitionlist_sql(self, expression: exp.PartitionList) -> str:
775
+ name = self.sql(expression, "this")
776
+ values = self.expressions(expression, indent=False)
777
+ return f"PARTITION {name} VALUES IN ({values})"
778
+
711
779
  def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str:
712
780
  node = expression.this
713
781
  if isinstance(node, exp.Schema):