sqlglot 27.29.0__tar.gz → 28.0.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 (236) hide show
  1. {sqlglot-27.29.0 → sqlglot-28.0.0}/CHANGELOG.md +123 -0
  2. {sqlglot-27.29.0 → sqlglot-28.0.0}/PKG-INFO +1 -1
  3. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/_version.py +3 -3
  4. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/bigquery.py +13 -286
  5. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/clickhouse.py +59 -2
  6. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/dialect.py +68 -251
  7. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/dremio.py +4 -1
  8. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/duckdb.py +97 -15
  9. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/exasol.py +66 -1
  10. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/hive.py +4 -8
  11. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/mysql.py +2 -2
  12. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/oracle.py +12 -0
  13. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/postgres.py +24 -22
  14. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/presto.py +13 -16
  15. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/redshift.py +3 -0
  16. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/singlestore.py +1 -1
  17. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/snowflake.py +40 -231
  18. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/spark2.py +3 -48
  19. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/sqlite.py +9 -0
  20. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/teradata.py +5 -8
  21. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/tsql.py +22 -16
  22. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/expressions.py +148 -58
  23. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/generator.py +70 -20
  24. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/helper.py +2 -2
  25. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/lineage.py +1 -1
  26. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/annotate_types.py +80 -25
  27. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/canonicalize.py +6 -1
  28. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/eliminate_joins.py +1 -1
  29. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/eliminate_subqueries.py +2 -2
  30. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/merge_subqueries.py +5 -5
  31. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/normalize.py +20 -13
  32. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/normalize_identifiers.py +17 -3
  33. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/pushdown_predicates.py +1 -1
  34. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/qualify.py +6 -5
  35. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/qualify_columns.py +57 -33
  36. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/qualify_tables.py +1 -1
  37. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/scope.py +4 -4
  38. sqlglot-28.0.0/sqlglot/optimizer/simplify.py +1680 -0
  39. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/unnest_subqueries.py +12 -2
  40. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/parser.py +107 -75
  41. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/planner.py +2 -2
  42. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/tokens.py +2 -0
  43. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/transforms.py +74 -18
  44. sqlglot-28.0.0/sqlglot/typing/__init__.py +314 -0
  45. sqlglot-28.0.0/sqlglot/typing/bigquery.py +326 -0
  46. sqlglot-28.0.0/sqlglot/typing/hive.py +12 -0
  47. sqlglot-28.0.0/sqlglot/typing/presto.py +24 -0
  48. sqlglot-28.0.0/sqlglot/typing/snowflake.py +318 -0
  49. sqlglot-28.0.0/sqlglot/typing/spark2.py +60 -0
  50. sqlglot-28.0.0/sqlglot/typing/tsql.py +9 -0
  51. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot.egg-info/PKG-INFO +1 -1
  52. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot.egg-info/SOURCES.txt +7 -0
  53. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_bigquery.py +303 -10
  54. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_clickhouse.py +73 -5
  55. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_databricks.py +5 -0
  56. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_dialect.py +15 -5
  57. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_duckdb.py +89 -11
  58. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_exasol.py +54 -0
  59. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_mysql.py +17 -11
  60. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_oracle.py +18 -0
  61. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_redshift.py +6 -3
  62. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_snowflake.py +90 -11
  63. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_spark.py +5 -0
  64. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_sqlite.py +22 -0
  65. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_tsql.py +58 -55
  66. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/identity.sql +0 -2
  67. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/annotate_functions.sql +421 -0
  68. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/normalize.sql +1 -1
  69. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/pushdown_projections.sql +5 -2
  70. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/simplify.sql +91 -31
  71. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/unnest_subqueries.sql +16 -0
  72. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_build.py +1 -1
  73. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_expressions.py +7 -5
  74. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_optimizer.py +144 -12
  75. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_parser.py +26 -22
  76. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_transforms.py +95 -1
  77. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_transpile.py +1 -1
  78. sqlglot-27.29.0/sqlglot/optimizer/simplify.py +0 -1605
  79. {sqlglot-27.29.0 → sqlglot-28.0.0}/.gitignore +0 -0
  80. {sqlglot-27.29.0 → sqlglot-28.0.0}/.gitpod.yml +0 -0
  81. {sqlglot-27.29.0 → sqlglot-28.0.0}/.pre-commit-config.yaml +0 -0
  82. {sqlglot-27.29.0 → sqlglot-28.0.0}/CONTRIBUTING.md +0 -0
  83. {sqlglot-27.29.0 → sqlglot-28.0.0}/LICENSE +0 -0
  84. {sqlglot-27.29.0 → sqlglot-28.0.0}/MANIFEST.in +0 -0
  85. {sqlglot-27.29.0 → sqlglot-28.0.0}/Makefile +0 -0
  86. {sqlglot-27.29.0 → sqlglot-28.0.0}/README.md +0 -0
  87. {sqlglot-27.29.0 → sqlglot-28.0.0}/pyproject.toml +0 -0
  88. {sqlglot-27.29.0 → sqlglot-28.0.0}/setup.cfg +0 -0
  89. {sqlglot-27.29.0 → sqlglot-28.0.0}/setup.py +0 -0
  90. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/__init__.py +0 -0
  91. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/__main__.py +0 -0
  92. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/_typing.py +0 -0
  93. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/__init__.py +0 -0
  94. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/athena.py +0 -0
  95. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/databricks.py +0 -0
  96. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/doris.py +0 -0
  97. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/drill.py +0 -0
  98. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/druid.py +0 -0
  99. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/dune.py +0 -0
  100. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/fabric.py +0 -0
  101. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/materialize.py +0 -0
  102. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/prql.py +0 -0
  103. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/risingwave.py +0 -0
  104. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/solr.py +0 -0
  105. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/spark.py +0 -0
  106. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/starrocks.py +0 -0
  107. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/tableau.py +0 -0
  108. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/dialects/trino.py +0 -0
  109. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/diff.py +0 -0
  110. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/errors.py +0 -0
  111. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/executor/__init__.py +0 -0
  112. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/executor/context.py +0 -0
  113. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/executor/env.py +0 -0
  114. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/executor/python.py +0 -0
  115. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/executor/table.py +0 -0
  116. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/jsonpath.py +0 -0
  117. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/__init__.py +0 -0
  118. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/eliminate_ctes.py +0 -0
  119. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/isolate_table_selects.py +0 -0
  120. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/optimize_joins.py +0 -0
  121. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/optimizer.py +0 -0
  122. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/optimizer/pushdown_projections.py +0 -0
  123. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/py.typed +0 -0
  124. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/schema.py +0 -0
  125. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/serde.py +0 -0
  126. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/time.py +0 -0
  127. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot/trie.py +0 -0
  128. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot.egg-info/dependency_links.txt +0 -0
  129. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot.egg-info/requires.txt +0 -0
  130. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot.egg-info/top_level.txt +0 -0
  131. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglot.png +0 -0
  132. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglotrs/Cargo.lock +0 -0
  133. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglotrs/Cargo.toml +0 -0
  134. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglotrs/benches/dialect_settings.json +0 -0
  135. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglotrs/benches/long.rs +0 -0
  136. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglotrs/benches/token_type_settings.json +0 -0
  137. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglotrs/benches/tokenizer_dialect_settings.json +0 -0
  138. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglotrs/benches/tokenizer_settings.json +0 -0
  139. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglotrs/pyproject.toml +0 -0
  140. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglotrs/src/lib.rs +0 -0
  141. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglotrs/src/settings.rs +0 -0
  142. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglotrs/src/token.rs +0 -0
  143. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglotrs/src/tokenizer.rs +0 -0
  144. {sqlglot-27.29.0 → sqlglot-28.0.0}/sqlglotrs/src/trie.rs +0 -0
  145. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/__init__.py +0 -0
  146. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/__init__.py +0 -0
  147. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_athena.py +0 -0
  148. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_doris.py +0 -0
  149. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_dremio.py +0 -0
  150. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_drill.py +0 -0
  151. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_druid.py +0 -0
  152. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_dune.py +0 -0
  153. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_fabric.py +0 -0
  154. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_hive.py +0 -0
  155. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_materialize.py +0 -0
  156. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_pipe_syntax.py +0 -0
  157. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_postgres.py +0 -0
  158. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_presto.py +0 -0
  159. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_prql.py +0 -0
  160. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_risingwave.py +0 -0
  161. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_singlestore.py +0 -0
  162. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_solr.py +0 -0
  163. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_starrocks.py +0 -0
  164. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_tableau.py +0 -0
  165. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_teradata.py +0 -0
  166. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/dialects/test_trino.py +0 -0
  167. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/jsonpath/LICENSE +0 -0
  168. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/jsonpath/cts.json +0 -0
  169. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/annotate_types.sql +0 -0
  170. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/canonicalize.sql +0 -0
  171. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/eliminate_ctes.sql +0 -0
  172. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/eliminate_joins.sql +0 -0
  173. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/eliminate_subqueries.sql +0 -0
  174. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/isolate_table_selects.sql +0 -0
  175. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/merge_subqueries.sql +0 -0
  176. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/normalize_identifiers.sql +0 -0
  177. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/optimize_joins.sql +0 -0
  178. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/optimizer.sql +0 -0
  179. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/pushdown_cte_alias_columns.sql +0 -0
  180. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/pushdown_predicates.sql +0 -0
  181. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/qualify_columns.sql +0 -0
  182. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/qualify_columns__invalid.sql +0 -0
  183. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/qualify_columns__with_invisible.sql +0 -0
  184. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/qualify_columns_ddl.sql +0 -0
  185. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/qualify_tables.sql +0 -0
  186. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/quote_identifiers.sql +0 -0
  187. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/call_center.csv.gz +0 -0
  188. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/catalog_page.csv.gz +0 -0
  189. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/catalog_returns.csv.gz +0 -0
  190. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/catalog_sales.csv.gz +0 -0
  191. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/customer.csv.gz +0 -0
  192. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/customer_address.csv.gz +0 -0
  193. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/customer_demographics.csv.gz +0 -0
  194. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/date_dim.csv.gz +0 -0
  195. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/household_demographics.csv.gz +0 -0
  196. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/income_band.csv.gz +0 -0
  197. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/inventory.csv.gz +0 -0
  198. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/item.csv.gz +0 -0
  199. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/promotion.csv.gz +0 -0
  200. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/reason.csv.gz +0 -0
  201. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/ship_mode.csv.gz +0 -0
  202. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/store.csv.gz +0 -0
  203. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/store_returns.csv.gz +0 -0
  204. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/store_sales.csv.gz +0 -0
  205. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/time_dim.csv.gz +0 -0
  206. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/tpc-ds.sql +0 -0
  207. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/warehouse.csv.gz +0 -0
  208. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/web_page.csv.gz +0 -0
  209. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/web_returns.csv.gz +0 -0
  210. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/web_sales.csv.gz +0 -0
  211. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-ds/web_site.csv.gz +0 -0
  212. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-h/customer.csv.gz +0 -0
  213. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-h/lineitem.csv.gz +0 -0
  214. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-h/nation.csv.gz +0 -0
  215. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-h/orders.csv.gz +0 -0
  216. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-h/part.csv.gz +0 -0
  217. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-h/partsupp.csv.gz +0 -0
  218. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-h/region.csv.gz +0 -0
  219. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-h/supplier.csv.gz +0 -0
  220. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/optimizer/tpc-h/tpc-h.sql +0 -0
  221. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/partial.sql +0 -0
  222. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/fixtures/pretty.sql +0 -0
  223. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/gen_fixtures.py +0 -0
  224. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/helpers.py +0 -0
  225. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_dialect_imports.py +0 -0
  226. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_diff.py +0 -0
  227. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_docs.py +0 -0
  228. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_executor.py +0 -0
  229. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_generator.py +0 -0
  230. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_helper.py +0 -0
  231. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_jsonpath.py +0 -0
  232. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_lineage.py +0 -0
  233. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_schema.py +0 -0
  234. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_serde.py +0 -0
  235. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_time.py +0 -0
  236. {sqlglot-27.29.0 → sqlglot-28.0.0}/tests/test_tokens.py +0 -0
@@ -1,6 +1,128 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## [v27.29.0] - 2025-10-29
5
+ ### :boom: BREAKING CHANGES
6
+ - due to [`5242cdd`](https://github.com/tobymao/sqlglot/commit/5242cddf487e367e7f543ca19d9bccae858f36ac) - annotate type for bq LENGTH *(commit by [@geooo109](https://github.com/geooo109))*:
7
+
8
+ annotate type for bq LENGTH
9
+
10
+ - due to [`0fc6dbf`](https://github.com/tobymao/sqlglot/commit/0fc6dbf2e7b611fa0977e3c3e61be1cc84bcf4a9) - add GREATEST_IGNORE_NULLS function support *(PR [#6161](https://github.com/tobymao/sqlglot/pull/6161) by [@fivetran-ashashankar](https://github.com/fivetran-ashashankar))*:
11
+
12
+ add GREATEST_IGNORE_NULLS function support (#6161)
13
+
14
+ - due to [`d382a31`](https://github.com/tobymao/sqlglot/commit/d382a3106d5ce2e9b75527aacd4a37d1f8e16d18) - simplify double negation only if the inner expr is BOOLEAN *(PR [#6151](https://github.com/tobymao/sqlglot/pull/6151) by [@geooo109](https://github.com/geooo109))*:
15
+
16
+ simplify double negation only if the inner expr is BOOLEAN (#6151)
17
+
18
+ - due to [`bcf6c89`](https://github.com/tobymao/sqlglot/commit/bcf6c89a47abd3c2c4383d1c908f892b6619b6fa) - add type annotation tests for snowflake BOOLAND *(PR [#6153](https://github.com/tobymao/sqlglot/pull/6153) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*:
19
+
20
+ add type annotation tests for snowflake BOOLAND (#6153)
21
+
22
+ - due to [`52d1eec`](https://github.com/tobymao/sqlglot/commit/52d1eecaad505703e8b22dcfe8954652f57985b6) - Annotate type for snowflake TIMESTAMP_FROM_PARTS function *(PR [#6139](https://github.com/tobymao/sqlglot/pull/6139) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
23
+
24
+ Annotate type for snowflake TIMESTAMP_FROM_PARTS function (#6139)
25
+
26
+ - due to [`8651fe6`](https://github.com/tobymao/sqlglot/commit/8651fe6526dea865c0d54d6d53086359a7835d32) - annotate types for BOOLOR *(PR [#6159](https://github.com/tobymao/sqlglot/pull/6159) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*:
27
+
28
+ annotate types for BOOLOR (#6159)
29
+
30
+ - due to [`812ba9a`](https://github.com/tobymao/sqlglot/commit/812ba9abad8247df81c8f8b514336c8766292112) - Annotate type for snowflake date parts functions *(PR [#6158](https://github.com/tobymao/sqlglot/pull/6158) by [@fivetran-MichaelLee](https://github.com/fivetran-MichaelLee))*:
31
+
32
+ Annotate type for snowflake date parts functions (#6158)
33
+
34
+ - due to [`9f8c123`](https://github.com/tobymao/sqlglot/commit/9f8c123ae44249e274334d0aa551ac33814f2b32) - make qualify table callback more generic *(PR [#6171](https://github.com/tobymao/sqlglot/pull/6171) by [@tobymao](https://github.com/tobymao))*:
35
+
36
+ make qualify table callback more generic (#6171)
37
+
38
+ - due to [`74b4e7c`](https://github.com/tobymao/sqlglot/commit/74b4e7c311e9d4ff39ce2e4d91940eced96aa32f) - fix type annotation for Snowflake BOOLOR and BOOLAND *(PR [#6169](https://github.com/tobymao/sqlglot/pull/6169) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*:
39
+
40
+ fix type annotation for Snowflake BOOLOR and BOOLAND (#6169)
41
+
42
+ - due to [`ef87520`](https://github.com/tobymao/sqlglot/commit/ef875204596b8529f3358025c7a61d757a999bdc) - Transpile `REGEXP_REPLACE` with 'g' option *(PR [#6174](https://github.com/tobymao/sqlglot/pull/6174) by [@VaggelisD](https://github.com/VaggelisD))*:
43
+
44
+ Transpile `REGEXP_REPLACE` with 'g' option (#6174)
45
+
46
+ - due to [`93071e2`](https://github.com/tobymao/sqlglot/commit/93071e255406f62ea83dd89a3be4871b7edfb3fe) - Fix simplify_parens from removing negated *(PR [#6194](https://github.com/tobymao/sqlglot/pull/6194) by [@VaggelisD](https://github.com/VaggelisD))*:
47
+
48
+ Fix simplify_parens from removing negated (#6194)
49
+
50
+ - due to [`e90168a`](https://github.com/tobymao/sqlglot/commit/e90168a6829b85534edcecec7d0df2a8b1b56fc4) - annotate type for Snowflake's `IS_NULL_VALUE` function *(PR [#6186](https://github.com/tobymao/sqlglot/pull/6186) by [@fivetran-ashashankar](https://github.com/fivetran-ashashankar))*:
51
+
52
+ annotate type for Snowflake's `IS_NULL_VALUE` function (#6186)
53
+
54
+ - due to [`c93b535`](https://github.com/tobymao/sqlglot/commit/c93b5354827282c806899c36b11e7a7598e96e38) - annotate type for LEAST_IGNORE_NULLS *(PR [#6196](https://github.com/tobymao/sqlglot/pull/6196) by [@fivetran-ashashankar](https://github.com/fivetran-ashashankar))*:
55
+
56
+ annotate type for LEAST_IGNORE_NULLS (#6196)
57
+
58
+ - due to [`f60c71f`](https://github.com/tobymao/sqlglot/commit/f60c71fb03db91bfe90430d032ac16f4945d5dff) - annotate types for REGR_VALX *(PR [#6198](https://github.com/tobymao/sqlglot/pull/6198) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*:
59
+
60
+ annotate types for REGR_VALX (#6198)
61
+
62
+ - due to [`b82c571`](https://github.com/tobymao/sqlglot/commit/b82c57131707297abe174539023b9cb62b7cd6c7) - annotate types for REGR_VALY *(PR [#6206](https://github.com/tobymao/sqlglot/pull/6206) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*:
63
+
64
+ annotate types for REGR_VALY (#6206)
65
+
66
+
67
+ ### :sparkles: New Features
68
+ - [`5242cdd`](https://github.com/tobymao/sqlglot/commit/5242cddf487e367e7f543ca19d9bccae858f36ac) - **optimizer**: annotate type for bq LENGTH *(commit by [@geooo109](https://github.com/geooo109))*
69
+ - [`0fc6dbf`](https://github.com/tobymao/sqlglot/commit/0fc6dbf2e7b611fa0977e3c3e61be1cc84bcf4a9) - **snowflake**: add GREATEST_IGNORE_NULLS function support *(PR [#6161](https://github.com/tobymao/sqlglot/pull/6161) by [@fivetran-ashashankar](https://github.com/fivetran-ashashankar))*
70
+ - [`54ecadc`](https://github.com/tobymao/sqlglot/commit/54ecadc57b8f1e87fd2a2ba35a5366d75231ea85) - **duckdb**: support `KV_METADATA` in `COPY` statement closes [#6165](https://github.com/tobymao/sqlglot/pull/6165) *(commit by [@georgesittas](https://github.com/georgesittas))*
71
+ - [`e241964`](https://github.com/tobymao/sqlglot/commit/e2419642a4966a4da194147aa488793eae152af4) - **duckdb**: support `USING` condition for `MERGE` closes [#6162](https://github.com/tobymao/sqlglot/pull/6162) *(commit by [@georgesittas](https://github.com/georgesittas))*
72
+ - [`bcf6c89`](https://github.com/tobymao/sqlglot/commit/bcf6c89a47abd3c2c4383d1c908f892b6619b6fa) - **optimizer**: add type annotation tests for snowflake BOOLAND *(PR [#6153](https://github.com/tobymao/sqlglot/pull/6153) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
73
+ - [`52d1eec`](https://github.com/tobymao/sqlglot/commit/52d1eecaad505703e8b22dcfe8954652f57985b6) - **optimizer**: Annotate type for snowflake TIMESTAMP_FROM_PARTS function *(PR [#6139](https://github.com/tobymao/sqlglot/pull/6139) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
74
+ - [`8651fe6`](https://github.com/tobymao/sqlglot/commit/8651fe6526dea865c0d54d6d53086359a7835d32) - **optimizer**: annotate types for BOOLOR *(PR [#6159](https://github.com/tobymao/sqlglot/pull/6159) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
75
+ - [`812ba9a`](https://github.com/tobymao/sqlglot/commit/812ba9abad8247df81c8f8b514336c8766292112) - **optimizer**: Annotate type for snowflake date parts functions *(PR [#6158](https://github.com/tobymao/sqlglot/pull/6158) by [@fivetran-MichaelLee](https://github.com/fivetran-MichaelLee))*
76
+ - [`9f8c123`](https://github.com/tobymao/sqlglot/commit/9f8c123ae44249e274334d0aa551ac33814f2b32) - make qualify table callback more generic *(PR [#6171](https://github.com/tobymao/sqlglot/pull/6171) by [@tobymao](https://github.com/tobymao))*
77
+ - [`74b4e7c`](https://github.com/tobymao/sqlglot/commit/74b4e7c311e9d4ff39ce2e4d91940eced96aa32f) - **optimizer**: fix type annotation for Snowflake BOOLOR and BOOLAND *(PR [#6169](https://github.com/tobymao/sqlglot/pull/6169) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
78
+ - [`e90168a`](https://github.com/tobymao/sqlglot/commit/e90168a6829b85534edcecec7d0df2a8b1b56fc4) - **optimizer**: annotate type for Snowflake's `IS_NULL_VALUE` function *(PR [#6186](https://github.com/tobymao/sqlglot/pull/6186) by [@fivetran-ashashankar](https://github.com/fivetran-ashashankar))*
79
+ - [`cea2595`](https://github.com/tobymao/sqlglot/commit/cea25952c98e70f2a4c35e675fe7ee4df0af02cd) - **duckdb**: Transpile DATE function from BQ->DuckDB *(PR [#6178](https://github.com/tobymao/sqlglot/pull/6178) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
80
+ - [`00aaa47`](https://github.com/tobymao/sqlglot/commit/00aaa47feff1cf9e69320074c35d9adfc8538026) - **duckDB**: Transpile BigQuery's CURRENT_DATE (Conversion) function to DuckDB *(PR [#6189](https://github.com/tobymao/sqlglot/pull/6189) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
81
+ - [`c93b535`](https://github.com/tobymao/sqlglot/commit/c93b5354827282c806899c36b11e7a7598e96e38) - **snowflake**: annotate type for LEAST_IGNORE_NULLS *(PR [#6196](https://github.com/tobymao/sqlglot/pull/6196) by [@fivetran-ashashankar](https://github.com/fivetran-ashashankar))*
82
+ - [`d2162fb`](https://github.com/tobymao/sqlglot/commit/d2162fbece0747b8ee42fa1f78e26baa0c944d41) - check same ref on Expression.__eq__ *(PR [#6200](https://github.com/tobymao/sqlglot/pull/6200) by [@georgesittas](https://github.com/georgesittas))*
83
+ - [`f60c71f`](https://github.com/tobymao/sqlglot/commit/f60c71fb03db91bfe90430d032ac16f4945d5dff) - **optimizer**: annotate types for REGR_VALX *(PR [#6198](https://github.com/tobymao/sqlglot/pull/6198) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
84
+ - [`42e0ae4`](https://github.com/tobymao/sqlglot/commit/42e0ae43b3531bf6c593bcac2ece2ab1d969e5e1) - **duckdb**: transpile BigQuery function TIMESTAMP_SUB to DuckDB *(PR [#6202](https://github.com/tobymao/sqlglot/pull/6202) by [@toriwei](https://github.com/toriwei))*
85
+ - [`b82c571`](https://github.com/tobymao/sqlglot/commit/b82c57131707297abe174539023b9cb62b7cd6c7) - **snowflake**: annotate types for REGR_VALY *(PR [#6206](https://github.com/tobymao/sqlglot/pull/6206) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
86
+
87
+ ### :bug: Bug Fixes
88
+ - [`3acf796`](https://github.com/tobymao/sqlglot/commit/3acf7965105a098fea6336df0c304d94acbd05ec) - **duckdb**: Allow ESCAPE NULL *(PR [#6164](https://github.com/tobymao/sqlglot/pull/6164) by [@VaggelisD](https://github.com/VaggelisD))*
89
+ - :arrow_lower_right: *fixes issue [#6160](https://github.com/tobymao/sqlglot/issues/6160) opened by [@denis-komarov](https://github.com/denis-komarov)*
90
+ - [`f7f1fca`](https://github.com/tobymao/sqlglot/commit/f7f1fca39a75df16ebb93f038e6277a25b8be6b9) - **duckdb**: Support positional index in list comprehension *(PR [#6163](https://github.com/tobymao/sqlglot/pull/6163) by [@VaggelisD](https://github.com/VaggelisD))*
91
+ - :arrow_lower_right: *fixes issue [#6156](https://github.com/tobymao/sqlglot/issues/6156) opened by [@denis-komarov](https://github.com/denis-komarov)*
92
+ - [`d382a31`](https://github.com/tobymao/sqlglot/commit/d382a3106d5ce2e9b75527aacd4a37d1f8e16d18) - **optimizer**: simplify double negation only if the inner expr is BOOLEAN *(PR [#6151](https://github.com/tobymao/sqlglot/pull/6151) by [@geooo109](https://github.com/geooo109))*
93
+ - :arrow_lower_right: *fixes issue [#6129](https://github.com/tobymao/sqlglot/issues/6129) opened by [@dllggyx](https://github.com/dllggyx)*
94
+ - [`dfe6b3c`](https://github.com/tobymao/sqlglot/commit/dfe6b3c8e6db40e22e626e2d56e9a7008dd75c32) - **optimizer**: Disambiguate JOIN ON columns during qualify *(PR [#6155](https://github.com/tobymao/sqlglot/pull/6155) by [@VaggelisD](https://github.com/VaggelisD))*
95
+ - :arrow_lower_right: *fixes issue [#6132](https://github.com/tobymao/sqlglot/issues/6132) opened by [@Fosly](https://github.com/Fosly)*
96
+ - [`f267ece`](https://github.com/tobymao/sqlglot/commit/f267ecea92b0751f6b35a4ad0c70fe6754e49038) - normalize before qualifying tables *(PR [#6176](https://github.com/tobymao/sqlglot/pull/6176) by [@georgesittas](https://github.com/georgesittas))*
97
+ - :arrow_lower_right: *fixes issue [#6167](https://github.com/tobymao/sqlglot/issues/6167) opened by [@schelip](https://github.com/schelip)*
98
+ - [`ef87520`](https://github.com/tobymao/sqlglot/commit/ef875204596b8529f3358025c7a61d757a999bdc) - **postgres, duckdb**: Transpile `REGEXP_REPLACE` with 'g' option *(PR [#6174](https://github.com/tobymao/sqlglot/pull/6174) by [@VaggelisD](https://github.com/VaggelisD))*
99
+ - :arrow_lower_right: *fixes issue [#6170](https://github.com/tobymao/sqlglot/issues/6170) opened by [@kyle-cheung](https://github.com/kyle-cheung)*
100
+ - [`51a8d70`](https://github.com/tobymao/sqlglot/commit/51a8d700a9602278d1e98425af0fa87d02c739fe) - **parser**: allow LIMIT % OFFSET *(PR [#6184](https://github.com/tobymao/sqlglot/pull/6184) by [@toriwei](https://github.com/toriwei))*
101
+ - :arrow_lower_right: *fixes issue [#6166](https://github.com/tobymao/sqlglot/issues/6166) opened by [@denis-komarov](https://github.com/denis-komarov)*
102
+ - [`8bf0a9f`](https://github.com/tobymao/sqlglot/commit/8bf0a9fe8e167984dc2e7b43d52d3850e063da3f) - **duckdb**: Cast literal arg to timestamp for epoch_us function *(PR [#6190](https://github.com/tobymao/sqlglot/pull/6190) by [@vchan](https://github.com/vchan))*
103
+ - [`93071e2`](https://github.com/tobymao/sqlglot/commit/93071e255406f62ea83dd89a3be4871b7edfb3fe) - **optimizer**: Fix simplify_parens from removing negated *(PR [#6194](https://github.com/tobymao/sqlglot/pull/6194) by [@VaggelisD](https://github.com/VaggelisD))*
104
+ - :arrow_lower_right: *fixes issue [#6179](https://github.com/tobymao/sqlglot/issues/6179) opened by [@dllggyx](https://github.com/dllggyx)*
105
+ - [`2ac3a03`](https://github.com/tobymao/sqlglot/commit/2ac3a03409d9239d0cf7fb265843d7837a0a3fcd) - **lineage**: correct star detection and add join star tests *(PR [#6185](https://github.com/tobymao/sqlglot/pull/6185) by [@lancewl](https://github.com/lancewl))*
106
+ - [`c9ae2eb`](https://github.com/tobymao/sqlglot/commit/c9ae2ebdb86abdb767f2fcb00da0b6277b4aea45) - **duckdb**: transpile BigQuery TIMESTAMP_ADD to duckdb *(PR [#6188](https://github.com/tobymao/sqlglot/pull/6188) by [@toriwei](https://github.com/toriwei))*
107
+ - [`ba0e17a`](https://github.com/tobymao/sqlglot/commit/ba0e17a25af417e24162bfab49c3074454a5c1a8) - **snowflake**: Transpile `ARRAY_CONCAT_AGG` to `ARRAY_FLATTEN(ARRAY_AGG(...))` *(PR [#6192](https://github.com/tobymao/sqlglot/pull/6192) by [@ozadari](https://github.com/ozadari))*
108
+ - [`730e4cc`](https://github.com/tobymao/sqlglot/commit/730e4cc5b77bff9135667193cc0a65c24cdfb6b5) - **trino**: Allow 2nd arg for FIRST/LAST functions *(PR [#6205](https://github.com/tobymao/sqlglot/pull/6205) by [@VaggelisD](https://github.com/VaggelisD))*
109
+ - :arrow_lower_right: *fixes issue [#6204](https://github.com/tobymao/sqlglot/issues/6204) opened by [@Harmuth94](https://github.com/Harmuth94)*
110
+
111
+ ### :recycle: Refactors
112
+ - [`6d775fd`](https://github.com/tobymao/sqlglot/commit/6d775fdb6091cb866c27c0f1141514b23d689284) - snowflake GREATEST type checks *(commit by [@geooo109](https://github.com/geooo109))*
113
+ - [`e797fb1`](https://github.com/tobymao/sqlglot/commit/e797fb105f7fa4e7bd42698eda71037cae9fd155) - update `LIKE` operator when using functional syntax with spark dialect *(PR [#6173](https://github.com/tobymao/sqlglot/pull/6173) by [@themattmorris](https://github.com/themattmorris))*
114
+ - :arrow_lower_right: *addresses issue [#6172](https://github.com/tobymao/sqlglot/issues/6172) opened by [@themattmorris](https://github.com/themattmorris)*
115
+
116
+ ### :wrench: Chores
117
+ - [`aca106c`](https://github.com/tobymao/sqlglot/commit/aca106c660b8aaf229065ec5c5a4a80d10e8daf6) - **optimizer**: add type annotation tests for snowflake GREATEST *(PR [#6157](https://github.com/tobymao/sqlglot/pull/6157) by [@fivetran-ashashankar](https://github.com/fivetran-ashashankar))*
118
+ - [`f763604`](https://github.com/tobymao/sqlglot/commit/f7636041d7b796545ed923ffd4803521f05fa7ea) - add `IS [NOT]` tests *(commit by [@georgesittas](https://github.com/georgesittas))*
119
+ - [`1ab5854`](https://github.com/tobymao/sqlglot/commit/1ab5854216da591e6036ac103239ac0280e09c3d) - **optimizer**: add snowflake test for [NOT] IN *(PR [#6180](https://github.com/tobymao/sqlglot/pull/6180) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
120
+ - [`64939ce`](https://github.com/tobymao/sqlglot/commit/64939ce9926f4740387a151311e918e807bfa681) - **optimizer**: add annotation tests for ZEROIFNULL *(PR [#6187](https://github.com/tobymao/sqlglot/pull/6187) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
121
+ - [`4b6bcdd`](https://github.com/tobymao/sqlglot/commit/4b6bcdd4dc297bd42ad000ffda98d14110565dc9) - **optimizer**: Add tests for snowflake's `NULLIFZERO` *(PR [#6197](https://github.com/tobymao/sqlglot/pull/6197) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
122
+ - [`ef68075`](https://github.com/tobymao/sqlglot/commit/ef680756c33da180ed2f21fb6113a0123db341c9) - **optimizer**: add annotation tests for NVL2 *(PR [#6208](https://github.com/tobymao/sqlglot/pull/6208) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
123
+ - [`7f550f2`](https://github.com/tobymao/sqlglot/commit/7f550f22da40d8c1cfc8afb183d6e4dbd50241ea) - **optimizer**: add annotation tests for NVL *(PR [#6207](https://github.com/tobymao/sqlglot/pull/6207) by [@fivetran-felixhuang](https://github.com/fivetran-felixhuang))*
124
+
125
+
4
126
  ## [v27.28.0] - 2025-10-21
5
127
  ### :boom: BREAKING CHANGES
6
128
  - due to [`2238ac2`](https://github.com/tobymao/sqlglot/commit/2238ac27478bd272ba39928bbec1075c4191ee1b) - transpile timestamp literals in datediff fixes [#6083](https://github.com/tobymao/sqlglot/pull/6083) *(PR [#6086](https://github.com/tobymao/sqlglot/pull/6086) by [@georgesittas](https://github.com/georgesittas))*:
@@ -8047,3 +8169,4 @@ Changelog
8047
8169
  [v27.26.0]: https://github.com/tobymao/sqlglot/compare/v27.25.2...v27.26.0
8048
8170
  [v27.27.0]: https://github.com/tobymao/sqlglot/compare/v27.26.0...v27.27.0
8049
8171
  [v27.28.0]: https://github.com/tobymao/sqlglot/compare/v27.27.0...v27.28.0
8172
+ [v27.29.0]: https://github.com/tobymao/sqlglot/compare/v27.28.1...v27.29.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlglot
3
- Version: 27.29.0
3
+ Version: 28.0.0
4
4
  Summary: An easily customizable SQL parser and transpiler
5
5
  Author-email: Toby Mao <toby.mao@gmail.com>
6
6
  License-Expression: MIT
@@ -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.29.0'
32
- __version_tuple__ = version_tuple = (27, 29, 0)
31
+ __version__ = version = '28.0.0'
32
+ __version_tuple__ = version_tuple = (28, 0, 0)
33
33
 
34
- __commit_id__ = commit_id = 'g7f550f22d'
34
+ __commit_id__ = commit_id = 'g73abfac4c'
@@ -12,7 +12,6 @@ from sqlglot._typing import E
12
12
  from sqlglot.dialects.dialect import (
13
13
  Dialect,
14
14
  NormalizationStrategy,
15
- annotate_with_type_lambda,
16
15
  arg_max_or_min_no_count,
17
16
  binary_from_function,
18
17
  date_add_interval_sql,
@@ -34,9 +33,10 @@ from sqlglot.dialects.dialect import (
34
33
  strposition_sql,
35
34
  groupconcat_sql,
36
35
  )
36
+ from sqlglot.generator import unsupported_args
37
37
  from sqlglot.helper import seq_get, split_num_words
38
38
  from sqlglot.tokens import TokenType
39
- from sqlglot.generator import unsupported_args
39
+ from sqlglot.typing.bigquery import EXPRESSION_METADATA
40
40
 
41
41
  if t.TYPE_CHECKING:
42
42
  from sqlglot._typing import Lit
@@ -290,59 +290,6 @@ def _str_to_datetime_sql(
290
290
  return self.func(f"PARSE_{dtype}", fmt, this, expression.args.get("zone"))
291
291
 
292
292
 
293
- def _annotate_math_functions(self: TypeAnnotator, expression: E) -> E:
294
- """
295
- Many BigQuery math functions such as CEIL, FLOOR etc follow this return type convention:
296
- +---------+---------+---------+------------+---------+
297
- | INPUT | INT64 | NUMERIC | BIGNUMERIC | FLOAT64 |
298
- +---------+---------+---------+------------+---------+
299
- | OUTPUT | FLOAT64 | NUMERIC | BIGNUMERIC | FLOAT64 |
300
- +---------+---------+---------+------------+---------+
301
- """
302
- self._annotate_args(expression)
303
-
304
- this: exp.Expression = expression.this
305
-
306
- self._set_type(
307
- expression,
308
- exp.DataType.Type.DOUBLE if this.is_type(*exp.DataType.INTEGER_TYPES) else this.type,
309
- )
310
- return expression
311
-
312
-
313
- def _annotate_by_args_with_coerce(self: TypeAnnotator, expression: E) -> E:
314
- """
315
- +------------+------------+------------+-------------+---------+
316
- | INPUT | INT64 | NUMERIC | BIGNUMERIC | FLOAT64 |
317
- +------------+------------+------------+-------------+---------+
318
- | INT64 | INT64 | NUMERIC | BIGNUMERIC | FLOAT64 |
319
- | NUMERIC | NUMERIC | NUMERIC | BIGNUMERIC | FLOAT64 |
320
- | BIGNUMERIC | BIGNUMERIC | BIGNUMERIC | BIGNUMERIC | FLOAT64 |
321
- | FLOAT64 | FLOAT64 | FLOAT64 | FLOAT64 | FLOAT64 |
322
- +------------+------------+------------+-------------+---------+
323
- """
324
- self._annotate_args(expression)
325
-
326
- self._set_type(expression, self._maybe_coerce(expression.this.type, expression.expression.type))
327
- return expression
328
-
329
-
330
- def _annotate_by_args_approx_top(self: TypeAnnotator, expression: exp.ApproxTopK) -> exp.ApproxTopK:
331
- self._annotate_args(expression)
332
-
333
- struct_type = exp.DataType(
334
- this=exp.DataType.Type.STRUCT,
335
- expressions=[expression.this.type, exp.DataType(this=exp.DataType.Type.BIGINT)],
336
- nested=True,
337
- )
338
- self._set_type(
339
- expression,
340
- exp.DataType(this=exp.DataType.Type.ARRAY, expressions=[struct_type], nested=True),
341
- )
342
-
343
- return expression
344
-
345
-
346
293
  @unsupported_args("ins_cost", "del_cost", "sub_cost")
347
294
  def _levenshtein_sql(self: BigQuery.Generator, expression: exp.Levenshtein) -> str:
348
295
  max_dist = expression.args.get("max_dist")
@@ -398,44 +345,6 @@ def _json_extract_sql(self: BigQuery.Generator, expression: JSON_EXTRACT_TYPE) -
398
345
  return sql
399
346
 
400
347
 
401
- def _annotate_concat(self: TypeAnnotator, expression: exp.Concat) -> exp.Concat:
402
- annotated = self._annotate_by_args(expression, "expressions")
403
-
404
- # Args must be BYTES or types that can be cast to STRING, return type is either BYTES or STRING
405
- # https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#concat
406
- if not annotated.is_type(exp.DataType.Type.BINARY, exp.DataType.Type.UNKNOWN):
407
- annotated.type = exp.DataType.Type.VARCHAR
408
-
409
- return annotated
410
-
411
-
412
- def _annotate_array(self: TypeAnnotator, expression: exp.Array) -> exp.Array:
413
- array_args = expression.expressions
414
-
415
- # BigQuery behaves as follows:
416
- #
417
- # SELECT t, TYPEOF(t) FROM (SELECT 'foo') AS t -- foo, STRUCT<STRING>
418
- # SELECT ARRAY(SELECT 'foo'), TYPEOF(ARRAY(SELECT 'foo')) -- foo, ARRAY<STRING>
419
- if (
420
- len(array_args) == 1
421
- and isinstance(select := array_args[0].unnest(), exp.Select)
422
- and (query_type := select.meta.get("query_type")) is not None
423
- and query_type.is_type(exp.DataType.Type.STRUCT)
424
- and len(query_type.expressions) == 1
425
- and isinstance(col_def := query_type.expressions[0], exp.ColumnDef)
426
- and (projection_type := col_def.kind) is not None
427
- and not projection_type.is_type(exp.DataType.Type.UNKNOWN)
428
- ):
429
- array_type = exp.DataType(
430
- this=exp.DataType.Type.ARRAY,
431
- expressions=[projection_type.copy()],
432
- nested=True,
433
- )
434
- return self._annotate_with_type(expression, array_type)
435
-
436
- return self._annotate_by_args(expression, "expressions", array=True)
437
-
438
-
439
348
  class BigQuery(Dialect):
440
349
  WEEK_OFFSET = -1
441
350
  UNNEST_COLUMN_ONLY = True
@@ -446,6 +355,8 @@ class BigQuery(Dialect):
446
355
  FORCE_EARLY_ALIAS_REF_EXPANSION = True
447
356
  PRESERVE_ORIGINAL_NAMES = True
448
357
  HEX_STRING_IS_INTEGER_TYPE = True
358
+ BYTE_STRING_IS_BYTES_TYPE = True
359
+ UUID_IS_STRING_TYPE = True
449
360
 
450
361
  # https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#case_sensitivity
451
362
  NORMALIZATION_STRATEGY = NormalizationStrategy.CASE_INSENSITIVE
@@ -493,198 +404,7 @@ class BigQuery(Dialect):
493
404
  COERCES_TO[exp.DataType.Type.DECIMAL] |= {exp.DataType.Type.BIGDECIMAL}
494
405
  COERCES_TO[exp.DataType.Type.BIGINT] |= {exp.DataType.Type.BIGDECIMAL}
495
406
 
496
- # BigQuery maps Type.TIMESTAMP to DATETIME, so we need to amend the inferred types
497
- TYPE_TO_EXPRESSIONS = {
498
- **Dialect.TYPE_TO_EXPRESSIONS,
499
- exp.DataType.Type.BIGINT: {
500
- *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.BIGINT],
501
- exp.Ascii,
502
- exp.BitwiseAndAgg,
503
- exp.BitwiseOrAgg,
504
- exp.BitwiseXorAgg,
505
- exp.BitwiseCount,
506
- exp.ByteLength,
507
- exp.DenseRank,
508
- exp.FarmFingerprint,
509
- exp.Grouping,
510
- exp.LaxInt64,
511
- exp.Length,
512
- exp.Ntile,
513
- exp.Rank,
514
- exp.RangeBucket,
515
- exp.RegexpInstr,
516
- exp.RowNumber,
517
- exp.Unicode,
518
- },
519
- exp.DataType.Type.BINARY: {
520
- *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.BINARY],
521
- exp.ByteString,
522
- exp.CodePointsToBytes,
523
- exp.MD5Digest,
524
- exp.SHA,
525
- exp.SHA2,
526
- exp.Unhex,
527
- },
528
- exp.DataType.Type.BOOLEAN: {
529
- *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.BOOLEAN],
530
- exp.IsInf,
531
- exp.IsNan,
532
- exp.JSONBool,
533
- exp.LaxBool,
534
- },
535
- exp.DataType.Type.DATE: {
536
- *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.DATE],
537
- exp.DateFromUnixDate,
538
- },
539
- exp.DataType.Type.DATETIME: {
540
- *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.DATETIME],
541
- exp.ParseDatetime,
542
- exp.TimestampFromParts,
543
- },
544
- exp.DataType.Type.DECIMAL: {
545
- exp.ParseNumeric,
546
- },
547
- exp.DataType.Type.BIGDECIMAL: {
548
- exp.ParseBignumeric,
549
- },
550
- exp.DataType.Type.DOUBLE: {
551
- *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.DOUBLE],
552
- exp.Acos,
553
- exp.Acosh,
554
- exp.Asin,
555
- exp.Asinh,
556
- exp.Atan,
557
- exp.Atanh,
558
- exp.Atan2,
559
- exp.Cbrt,
560
- exp.Corr,
561
- exp.Cot,
562
- exp.CosineDistance,
563
- exp.Coth,
564
- exp.CovarPop,
565
- exp.CovarSamp,
566
- exp.Csc,
567
- exp.Csch,
568
- exp.CumeDist,
569
- exp.EuclideanDistance,
570
- exp.Float64,
571
- exp.LaxFloat64,
572
- exp.PercentRank,
573
- exp.Rand,
574
- exp.Sec,
575
- exp.Sech,
576
- exp.Sin,
577
- exp.Sinh,
578
- },
579
- exp.DataType.Type.JSON: {
580
- *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.JSON],
581
- exp.JSONArray,
582
- exp.JSONArrayAppend,
583
- exp.JSONArrayInsert,
584
- exp.JSONObject,
585
- exp.JSONRemove,
586
- exp.JSONSet,
587
- exp.JSONStripNulls,
588
- },
589
- exp.DataType.Type.TIME: {
590
- *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.TIME],
591
- exp.ParseTime,
592
- exp.TimeFromParts,
593
- exp.TimeTrunc,
594
- exp.TsOrDsToTime,
595
- },
596
- exp.DataType.Type.VARCHAR: {
597
- *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.VARCHAR],
598
- exp.CodePointsToString,
599
- exp.Format,
600
- exp.JSONExtractScalar,
601
- exp.JSONType,
602
- exp.LaxString,
603
- exp.LowerHex,
604
- exp.Normalize,
605
- exp.SafeConvertBytesToString,
606
- exp.Soundex,
607
- exp.Uuid,
608
- },
609
- exp.DataType.Type.TIMESTAMPTZ: Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.TIMESTAMP],
610
- }
611
- TYPE_TO_EXPRESSIONS.pop(exp.DataType.Type.TIMESTAMP)
612
-
613
- ANNOTATORS = {
614
- **Dialect.ANNOTATORS,
615
- **{
616
- expr_type: annotate_with_type_lambda(data_type)
617
- for data_type, expressions in TYPE_TO_EXPRESSIONS.items()
618
- for expr_type in expressions
619
- },
620
- **{
621
- expr_type: lambda self, e: _annotate_math_functions(self, e)
622
- for expr_type in (exp.Floor, exp.Ceil, exp.Log, exp.Ln, exp.Sqrt, exp.Exp, exp.Round)
623
- },
624
- **{
625
- expr_type: lambda self, e: self._annotate_by_args(e, "this")
626
- for expr_type in (
627
- exp.Abs,
628
- exp.ArgMax,
629
- exp.ArgMin,
630
- exp.DateTrunc,
631
- exp.DatetimeTrunc,
632
- exp.FirstValue,
633
- exp.GroupConcat,
634
- exp.IgnoreNulls,
635
- exp.JSONExtract,
636
- exp.Lead,
637
- exp.Left,
638
- exp.Lower,
639
- exp.NthValue,
640
- exp.Pad,
641
- exp.PercentileDisc,
642
- exp.RegexpExtract,
643
- exp.RegexpReplace,
644
- exp.Repeat,
645
- exp.Replace,
646
- exp.RespectNulls,
647
- exp.Reverse,
648
- exp.Right,
649
- exp.SafeNegate,
650
- exp.Sign,
651
- exp.Substring,
652
- exp.TimestampTrunc,
653
- exp.Translate,
654
- exp.Trim,
655
- exp.Upper,
656
- )
657
- },
658
- exp.ApproxTopSum: lambda self, e: _annotate_by_args_approx_top(self, e),
659
- exp.ApproxTopK: lambda self, e: _annotate_by_args_approx_top(self, e),
660
- exp.ApproxQuantiles: lambda self, e: self._annotate_by_args(e, "this", array=True),
661
- exp.Array: _annotate_array,
662
- exp.ArrayConcat: lambda self, e: self._annotate_by_args(e, "this", "expressions"),
663
- exp.Concat: _annotate_concat,
664
- exp.GenerateTimestampArray: lambda self, e: self._annotate_with_type(
665
- e, exp.DataType.build("ARRAY<TIMESTAMP>", dialect="bigquery")
666
- ),
667
- exp.JSONExtractArray: lambda self, e: self._annotate_by_args(e, "this", array=True),
668
- exp.JSONFormat: lambda self, e: self._annotate_with_type(
669
- e, exp.DataType.Type.JSON if e.args.get("to_json") else exp.DataType.Type.VARCHAR
670
- ),
671
- exp.JSONKeysAtDepth: lambda self, e: self._annotate_with_type(
672
- e, exp.DataType.build("ARRAY<VARCHAR>", dialect="bigquery")
673
- ),
674
- exp.JSONValueArray: lambda self, e: self._annotate_with_type(
675
- e, exp.DataType.build("ARRAY<VARCHAR>", dialect="bigquery")
676
- ),
677
- exp.Lag: lambda self, e: self._annotate_by_args(e, "this", "default"),
678
- exp.PercentileCont: lambda self, e: _annotate_by_args_with_coerce(self, e),
679
- exp.RegexpExtractAll: lambda self, e: self._annotate_by_args(e, "this", array=True),
680
- exp.SafeAdd: lambda self, e: _annotate_by_args_with_coerce(self, e),
681
- exp.SafeMultiply: lambda self, e: _annotate_by_args_with_coerce(self, e),
682
- exp.SafeSubtract: lambda self, e: _annotate_by_args_with_coerce(self, e),
683
- exp.Split: lambda self, e: self._annotate_by_args(e, "this", array=True),
684
- exp.ToCodePoints: lambda self, e: self._annotate_with_type(
685
- e, exp.DataType.build("ARRAY<BIGINT>", dialect="bigquery")
686
- ),
687
- }
407
+ EXPRESSION_METADATA = EXPRESSION_METADATA.copy()
688
408
 
689
409
  def normalize_identifier(self, expression: E) -> E:
690
410
  if (
@@ -890,7 +610,11 @@ class BigQuery(Dialect):
890
610
 
891
611
  FUNCTION_PARSERS = {
892
612
  **parser.Parser.FUNCTION_PARSERS,
893
- "ARRAY": lambda self: self.expression(exp.Array, expressions=[self._parse_statement()]),
613
+ "ARRAY": lambda self: self.expression(
614
+ exp.Array,
615
+ expressions=[self._parse_statement()],
616
+ struct_name_inheritance=True,
617
+ ),
894
618
  "JSON_ARRAY": lambda self: self.expression(
895
619
  exp.JSONArray, expressions=self._parse_csv(self._parse_bitwise)
896
620
  ),
@@ -1126,6 +850,9 @@ class BigQuery(Dialect):
1126
850
  ) -> t.Optional[exp.Expression]:
1127
851
  bracket = super()._parse_bracket(this)
1128
852
 
853
+ if isinstance(bracket, exp.Array):
854
+ bracket.set("struct_name_inheritance", True)
855
+
1129
856
  if this is bracket:
1130
857
  return bracket
1131
858
 
@@ -9,6 +9,7 @@ from sqlglot.dialects.dialect import (
9
9
  arg_max_or_min_no_count,
10
10
  build_date_delta,
11
11
  build_formatted_time,
12
+ build_like,
12
13
  inline_array_sql,
13
14
  json_extract_segments,
14
15
  json_path_key_only_name,
@@ -188,6 +189,43 @@ def _map_sql(self: ClickHouse.Generator, expression: exp.Map | exp.VarMap) -> st
188
189
  return f"{{{csv_args}}}"
189
190
 
190
191
 
192
+ def _build_timestamp_trunc(unit: str) -> t.Callable[[t.List], exp.TimestampTrunc]:
193
+ return lambda args: exp.TimestampTrunc(
194
+ this=seq_get(args, 0), unit=exp.var(unit), zone=seq_get(args, 1)
195
+ )
196
+
197
+
198
+ def _build_split_by_char(args: t.List) -> exp.Split | exp.Anonymous:
199
+ sep = seq_get(args, 0)
200
+ if isinstance(sep, exp.Literal):
201
+ sep_value = sep.to_py()
202
+ if isinstance(sep_value, str) and len(sep_value.encode("utf-8")) == 1:
203
+ return _build_split(exp.Split)(args)
204
+
205
+ return exp.Anonymous(this="splitByChar", expressions=args)
206
+
207
+
208
+ def _build_split(exp_class: t.Type[E]) -> t.Callable[[t.List], E]:
209
+ return lambda args: exp_class(
210
+ this=seq_get(args, 1), expression=seq_get(args, 0), limit=seq_get(args, 2)
211
+ )
212
+
213
+
214
+ # Skip the 'week' unit since ClickHouse's toStartOfWeek
215
+ # uses an extra mode argument to specify the first day of the week
216
+ TIMESTAMP_TRUNC_UNITS = {
217
+ "MICROSECOND",
218
+ "MILLISECOND",
219
+ "SECOND",
220
+ "MINUTE",
221
+ "HOUR",
222
+ "DAY",
223
+ "MONTH",
224
+ "QUARTER",
225
+ "YEAR",
226
+ }
227
+
228
+
191
229
  class ClickHouse(Dialect):
192
230
  INDEX_OFFSET = 1
193
231
  NORMALIZE_FUNCTIONS: bool | str = False
@@ -308,6 +346,10 @@ class ClickHouse(Dialect):
308
346
 
309
347
  FUNCTIONS = {
310
348
  **parser.Parser.FUNCTIONS,
349
+ **{
350
+ f"TOSTARTOF{unit}": _build_timestamp_trunc(unit=unit)
351
+ for unit in TIMESTAMP_TRUNC_UNITS
352
+ },
311
353
  "ANY": exp.AnyValue.from_arg_list,
312
354
  "ARRAYSUM": exp.ArraySum.from_arg_list,
313
355
  "ARRAYREVERSE": exp.ArrayReverse.from_arg_list,
@@ -322,13 +364,17 @@ class ClickHouse(Dialect):
322
364
  "DATE_SUB": build_date_delta(exp.DateSub, default_unit=None),
323
365
  "DATESUB": build_date_delta(exp.DateSub, default_unit=None),
324
366
  "FORMATDATETIME": _build_datetime_format(exp.TimeToStr),
367
+ "HAS": exp.ArrayContains.from_arg_list,
368
+ "ILIKE": build_like(exp.ILike),
325
369
  "JSONEXTRACTSTRING": build_json_extract_path(
326
370
  exp.JSONExtractScalar, zero_based_indexing=False
327
371
  ),
328
372
  "LENGTH": lambda args: exp.Length(this=seq_get(args, 0), binary=True),
373
+ "LIKE": build_like(exp.Like),
329
374
  "L2Distance": exp.EuclideanDistance.from_arg_list,
330
375
  "MAP": parser.build_var_map,
331
376
  "MATCH": exp.RegexpLike.from_arg_list,
377
+ "NOTLIKE": build_like(exp.Like, not_like=True),
332
378
  "PARSEDATETIME": _build_datetime_format(exp.ParseDatetime),
333
379
  "RANDCANONICAL": exp.Rand.from_arg_list,
334
380
  "STR_TO_DATE": _build_str_to_date,
@@ -336,11 +382,15 @@ class ClickHouse(Dialect):
336
382
  "TIMESTAMPSUB": build_date_delta(exp.TimestampSub, default_unit=None),
337
383
  "TIMESTAMP_ADD": build_date_delta(exp.TimestampAdd, default_unit=None),
338
384
  "TIMESTAMPADD": build_date_delta(exp.TimestampAdd, default_unit=None),
385
+ "TOMONDAY": _build_timestamp_trunc("WEEK"),
339
386
  "UNIQ": exp.ApproxDistinct.from_arg_list,
340
387
  "XOR": lambda args: exp.Xor(expressions=args),
341
388
  "MD5": exp.MD5Digest.from_arg_list,
342
389
  "SHA256": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(256)),
343
390
  "SHA512": lambda args: exp.SHA2(this=seq_get(args, 0), length=exp.Literal.number(512)),
391
+ "SPLITBYCHAR": _build_split_by_char,
392
+ "SPLITBYREGEXP": _build_split(exp.RegexpSplit),
393
+ "SPLITBYSTRING": _build_split(exp.Split),
344
394
  "SUBSTRINGINDEX": exp.SubstringIndex.from_arg_list,
345
395
  "TOTYPENAME": exp.Typeof.from_arg_list,
346
396
  "EDITDISTANCE": exp.Levenshtein.from_arg_list,
@@ -771,7 +821,7 @@ class ClickHouse(Dialect):
771
821
  if join:
772
822
  method = join.args.get("method")
773
823
  join.set("method", None)
774
- join.set("global", method)
824
+ join.set("global_", method)
775
825
 
776
826
  # tbl ARRAY JOIN arr <-- this should be a `Column` reference, not a `Table`
777
827
  # https://clickhouse.com/docs/en/sql-reference/statements/select/array-join
@@ -1087,6 +1137,7 @@ class ClickHouse(Dialect):
1087
1137
  exp.AnyValue: rename_func("any"),
1088
1138
  exp.ApproxDistinct: rename_func("uniq"),
1089
1139
  exp.ArrayConcat: rename_func("arrayConcat"),
1140
+ exp.ArrayContains: rename_func("has"),
1090
1141
  exp.ArrayFilter: lambda self, e: self.func("arrayFilter", e.expression, e.this),
1091
1142
  exp.ArrayRemove: remove_from_array_using_filter,
1092
1143
  exp.ArrayReverse: rename_func("arrayReverse"),
@@ -1149,8 +1200,14 @@ class ClickHouse(Dialect):
1149
1200
  exp.MD5: lambda self, e: self.func("LOWER", self.func("HEX", self.func("MD5", e.this))),
1150
1201
  exp.SHA: rename_func("SHA1"),
1151
1202
  exp.SHA2: sha256_sql,
1203
+ exp.Split: lambda self, e: self.func(
1204
+ "splitByString", e.args.get("expression"), e.this, e.args.get("limit")
1205
+ ),
1206
+ exp.RegexpSplit: lambda self, e: self.func(
1207
+ "splitByRegexp", e.args.get("expression"), e.this, e.args.get("limit")
1208
+ ),
1152
1209
  exp.UnixToTime: _unix_to_time_sql,
1153
- exp.TimestampTrunc: timestamptrunc_sql(zone=True),
1210
+ exp.TimestampTrunc: timestamptrunc_sql(func="dateTrunc", zone=True),
1154
1211
  exp.Trim: lambda self, e: trim_sql(self, e, default_trim_type="BOTH"),
1155
1212
  exp.Variance: rename_func("varSamp"),
1156
1213
  exp.SchemaCommentProperty: lambda self, e: self.naked_property(e),