sqlglot 27.20.0__tar.gz → 27.22.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.

Potentially problematic release.


This version of sqlglot might be problematic. Click here for more details.

Files changed (228) hide show
  1. {sqlglot-27.20.0 → sqlglot-27.22.0}/CHANGELOG.md +170 -0
  2. {sqlglot-27.20.0 → sqlglot-27.22.0}/PKG-INFO +2 -2
  3. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/_version.py +3 -3
  4. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/bigquery.py +2 -0
  5. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/dialect.py +11 -2
  6. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/duckdb.py +3 -4
  7. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/hive.py +66 -1
  8. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/oracle.py +0 -1
  9. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/presto.py +0 -1
  10. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/risingwave.py +14 -0
  11. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/snowflake.py +85 -6
  12. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/spark.py +0 -1
  13. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/spark2.py +17 -0
  14. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/tsql.py +11 -0
  15. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/expressions.py +56 -4
  16. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/generator.py +12 -3
  17. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/canonicalize.py +1 -1
  18. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/merge_subqueries.py +2 -0
  19. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/optimize_joins.py +38 -4
  20. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/parser.py +63 -48
  21. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/tokens.py +5 -1
  22. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/transforms.py +0 -33
  23. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot.egg-info/PKG-INFO +2 -2
  24. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot.egg-info/requires.txt +1 -1
  25. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglotrs/Cargo.lock +1 -1
  26. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglotrs/Cargo.toml +1 -1
  27. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglotrs/src/tokenizer.rs +6 -15
  28. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_bigquery.py +20 -0
  29. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_databricks.py +2 -0
  30. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_dialect.py +19 -12
  31. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_duckdb.py +26 -1
  32. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_hive.py +39 -1
  33. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_mysql.py +3 -0
  34. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_postgres.py +6 -4
  35. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_redshift.py +2 -0
  36. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_snowflake.py +103 -1
  37. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_spark.py +22 -0
  38. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_tsql.py +14 -0
  39. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/identity.sql +4 -0
  40. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/annotate_functions.sql +196 -0
  41. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/merge_subqueries.sql +28 -0
  42. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/optimize_joins.sql +1 -1
  43. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/optimizer.sql +67 -24
  44. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/tpc-ds.sql +248 -237
  45. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-h/tpc-h.sql +12 -12
  46. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_parser.py +0 -11
  47. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_transforms.py +0 -33
  48. {sqlglot-27.20.0 → sqlglot-27.22.0}/.gitignore +0 -0
  49. {sqlglot-27.20.0 → sqlglot-27.22.0}/.gitpod.yml +0 -0
  50. {sqlglot-27.20.0 → sqlglot-27.22.0}/.pre-commit-config.yaml +0 -0
  51. {sqlglot-27.20.0 → sqlglot-27.22.0}/CONTRIBUTING.md +0 -0
  52. {sqlglot-27.20.0 → sqlglot-27.22.0}/LICENSE +0 -0
  53. {sqlglot-27.20.0 → sqlglot-27.22.0}/MANIFEST.in +0 -0
  54. {sqlglot-27.20.0 → sqlglot-27.22.0}/Makefile +0 -0
  55. {sqlglot-27.20.0 → sqlglot-27.22.0}/README.md +0 -0
  56. {sqlglot-27.20.0 → sqlglot-27.22.0}/pyproject.toml +0 -0
  57. {sqlglot-27.20.0 → sqlglot-27.22.0}/setup.cfg +0 -0
  58. {sqlglot-27.20.0 → sqlglot-27.22.0}/setup.py +0 -0
  59. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/__init__.py +0 -0
  60. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/__main__.py +0 -0
  61. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/_typing.py +0 -0
  62. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/__init__.py +0 -0
  63. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/athena.py +0 -0
  64. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/clickhouse.py +0 -0
  65. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/databricks.py +0 -0
  66. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/doris.py +0 -0
  67. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/dremio.py +0 -0
  68. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/drill.py +0 -0
  69. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/druid.py +0 -0
  70. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/dune.py +0 -0
  71. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/exasol.py +0 -0
  72. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/fabric.py +0 -0
  73. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/materialize.py +0 -0
  74. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/mysql.py +0 -0
  75. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/postgres.py +0 -0
  76. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/prql.py +0 -0
  77. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/redshift.py +0 -0
  78. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/singlestore.py +0 -0
  79. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/solr.py +0 -0
  80. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/sqlite.py +0 -0
  81. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/starrocks.py +0 -0
  82. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/tableau.py +0 -0
  83. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/teradata.py +0 -0
  84. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/dialects/trino.py +0 -0
  85. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/diff.py +0 -0
  86. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/errors.py +0 -0
  87. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/executor/__init__.py +0 -0
  88. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/executor/context.py +0 -0
  89. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/executor/env.py +0 -0
  90. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/executor/python.py +0 -0
  91. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/executor/table.py +0 -0
  92. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/helper.py +0 -0
  93. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/jsonpath.py +0 -0
  94. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/lineage.py +0 -0
  95. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/__init__.py +0 -0
  96. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/annotate_types.py +0 -0
  97. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/eliminate_ctes.py +0 -0
  98. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/eliminate_joins.py +0 -0
  99. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/eliminate_subqueries.py +0 -0
  100. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/isolate_table_selects.py +0 -0
  101. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/normalize.py +0 -0
  102. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/normalize_identifiers.py +0 -0
  103. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/optimizer.py +0 -0
  104. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/pushdown_predicates.py +0 -0
  105. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/pushdown_projections.py +0 -0
  106. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/qualify.py +0 -0
  107. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/qualify_columns.py +0 -0
  108. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/qualify_tables.py +0 -0
  109. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/scope.py +0 -0
  110. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/simplify.py +0 -0
  111. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/optimizer/unnest_subqueries.py +0 -0
  112. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/planner.py +0 -0
  113. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/py.typed +0 -0
  114. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/schema.py +0 -0
  115. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/serde.py +0 -0
  116. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/time.py +0 -0
  117. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot/trie.py +0 -0
  118. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot.egg-info/SOURCES.txt +0 -0
  119. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot.egg-info/dependency_links.txt +0 -0
  120. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot.egg-info/top_level.txt +0 -0
  121. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglot.png +0 -0
  122. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglotrs/benches/dialect_settings.json +0 -0
  123. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglotrs/benches/long.rs +0 -0
  124. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglotrs/benches/token_type_settings.json +0 -0
  125. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglotrs/benches/tokenizer_dialect_settings.json +0 -0
  126. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglotrs/benches/tokenizer_settings.json +0 -0
  127. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglotrs/pyproject.toml +0 -0
  128. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglotrs/src/lib.rs +0 -0
  129. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglotrs/src/settings.rs +0 -0
  130. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglotrs/src/token.rs +0 -0
  131. {sqlglot-27.20.0 → sqlglot-27.22.0}/sqlglotrs/src/trie.rs +0 -0
  132. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/__init__.py +0 -0
  133. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/__init__.py +0 -0
  134. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_athena.py +0 -0
  135. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_clickhouse.py +0 -0
  136. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_doris.py +0 -0
  137. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_dremio.py +0 -0
  138. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_drill.py +0 -0
  139. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_druid.py +0 -0
  140. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_dune.py +0 -0
  141. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_exasol.py +0 -0
  142. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_fabric.py +0 -0
  143. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_materialize.py +0 -0
  144. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_oracle.py +0 -0
  145. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_pipe_syntax.py +0 -0
  146. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_presto.py +0 -0
  147. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_prql.py +0 -0
  148. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_risingwave.py +0 -0
  149. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_singlestore.py +0 -0
  150. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_solr.py +0 -0
  151. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_sqlite.py +0 -0
  152. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_starrocks.py +0 -0
  153. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_tableau.py +0 -0
  154. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_teradata.py +0 -0
  155. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/dialects/test_trino.py +0 -0
  156. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/jsonpath/LICENSE +0 -0
  157. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/jsonpath/cts.json +0 -0
  158. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/annotate_types.sql +0 -0
  159. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/canonicalize.sql +0 -0
  160. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/eliminate_ctes.sql +0 -0
  161. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/eliminate_joins.sql +0 -0
  162. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/eliminate_subqueries.sql +0 -0
  163. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/isolate_table_selects.sql +0 -0
  164. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/normalize.sql +0 -0
  165. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/normalize_identifiers.sql +0 -0
  166. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/pushdown_cte_alias_columns.sql +0 -0
  167. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/pushdown_predicates.sql +0 -0
  168. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/pushdown_projections.sql +0 -0
  169. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/qualify_columns.sql +0 -0
  170. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/qualify_columns__invalid.sql +0 -0
  171. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/qualify_columns__with_invisible.sql +0 -0
  172. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/qualify_columns_ddl.sql +0 -0
  173. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/qualify_tables.sql +0 -0
  174. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/quote_identifiers.sql +0 -0
  175. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/simplify.sql +0 -0
  176. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/call_center.csv.gz +0 -0
  177. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/catalog_page.csv.gz +0 -0
  178. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/catalog_returns.csv.gz +0 -0
  179. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/catalog_sales.csv.gz +0 -0
  180. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/customer.csv.gz +0 -0
  181. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/customer_address.csv.gz +0 -0
  182. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/customer_demographics.csv.gz +0 -0
  183. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/date_dim.csv.gz +0 -0
  184. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/household_demographics.csv.gz +0 -0
  185. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/income_band.csv.gz +0 -0
  186. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/inventory.csv.gz +0 -0
  187. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/item.csv.gz +0 -0
  188. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/promotion.csv.gz +0 -0
  189. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/reason.csv.gz +0 -0
  190. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/ship_mode.csv.gz +0 -0
  191. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/store.csv.gz +0 -0
  192. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/store_returns.csv.gz +0 -0
  193. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/store_sales.csv.gz +0 -0
  194. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/time_dim.csv.gz +0 -0
  195. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/warehouse.csv.gz +0 -0
  196. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/web_page.csv.gz +0 -0
  197. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/web_returns.csv.gz +0 -0
  198. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/web_sales.csv.gz +0 -0
  199. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-ds/web_site.csv.gz +0 -0
  200. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-h/customer.csv.gz +0 -0
  201. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-h/lineitem.csv.gz +0 -0
  202. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-h/nation.csv.gz +0 -0
  203. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-h/orders.csv.gz +0 -0
  204. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-h/part.csv.gz +0 -0
  205. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-h/partsupp.csv.gz +0 -0
  206. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-h/region.csv.gz +0 -0
  207. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/tpc-h/supplier.csv.gz +0 -0
  208. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/optimizer/unnest_subqueries.sql +0 -0
  209. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/partial.sql +0 -0
  210. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/fixtures/pretty.sql +0 -0
  211. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/gen_fixtures.py +0 -0
  212. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/helpers.py +0 -0
  213. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_build.py +0 -0
  214. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_dialect_imports.py +0 -0
  215. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_diff.py +0 -0
  216. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_docs.py +0 -0
  217. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_executor.py +0 -0
  218. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_expressions.py +0 -0
  219. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_generator.py +0 -0
  220. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_helper.py +0 -0
  221. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_jsonpath.py +0 -0
  222. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_lineage.py +0 -0
  223. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_optimizer.py +0 -0
  224. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_schema.py +0 -0
  225. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_serde.py +0 -0
  226. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_time.py +0 -0
  227. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_tokens.py +0 -0
  228. {sqlglot-27.20.0 → sqlglot-27.22.0}/tests/test_transpile.py +0 -0
@@ -1,6 +1,174 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## [v27.21.0] - 2025-10-07
5
+ ### :boom: BREAKING CHANGES
6
+ - due to [`3c7b5c0`](https://github.com/tobymao/sqlglot/commit/3c7b5c0e2dc071b7b9f6da308ba58a3a43da93dc) - Annotate type for snowflake SOUNDEX_P123 function *(PR [#5987](https://github.com/tobymao/sqlglot/pull/5987) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
7
+
8
+ Annotate type for snowflake SOUNDEX_P123 function (#5987)
9
+
10
+ - due to [`f25e42e`](https://github.com/tobymao/sqlglot/commit/f25e42e3f5b3b7b671bd724ba7b09a9b07d13995) - annotate type for Snowflake REGEXP_INSTR function *(PR [#5978](https://github.com/tobymao/sqlglot/pull/5978) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
11
+
12
+ annotate type for Snowflake REGEXP_INSTR function (#5978)
13
+
14
+ - due to [`13cb26e`](https://github.com/tobymao/sqlglot/commit/13cb26e2f29373538d60a8124ddebf95fd22a8d8) - annotate type for Snowflake REGEXP_SUBSTR_ALL function *(PR [#5979](https://github.com/tobymao/sqlglot/pull/5979) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
15
+
16
+ annotate type for Snowflake REGEXP_SUBSTR_ALL function (#5979)
17
+
18
+ - due to [`4ce683e`](https://github.com/tobymao/sqlglot/commit/4ce683eb8ac5716a334cbd7625438b9f89623c7a) - Annotate type for snowflake UNICODE function *(PR [#5993](https://github.com/tobymao/sqlglot/pull/5993) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
19
+
20
+ Annotate type for snowflake UNICODE function (#5993)
21
+
22
+ - due to [`c7657fb`](https://github.com/tobymao/sqlglot/commit/c7657fbd27a4350c424ef65947471ab9ec086831) - remove `unalias_group_by` transformation since it is unsafe *(PR [#5997](https://github.com/tobymao/sqlglot/pull/5997) by [@georgesittas](https://github.com/georgesittas))*:
23
+
24
+ remove `unalias_group_by` transformation since it is unsafe (#5997)
25
+
26
+ - due to [`587196c`](https://github.com/tobymao/sqlglot/commit/587196c9c2d122f73f9deb7e87c2831f27f6ed02) - Annotate type for snowflake STRTOK_TO_ARRAY function *(PR [#5994](https://github.com/tobymao/sqlglot/pull/5994) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
27
+
28
+ Annotate type for snowflake STRTOK_TO_ARRAY function (#5994)
29
+
30
+ - due to [`bced710`](https://github.com/tobymao/sqlglot/commit/bced71084ffb3a8f7a11db843777f05b68f367da) - Annotate type for snowflake STRTOK function. *(PR [#5991](https://github.com/tobymao/sqlglot/pull/5991) by [@georgesittas](https://github.com/georgesittas))*:
31
+
32
+ Annotate type for snowflake STRTOK function. (#5991)
33
+
34
+ - due to [`be1cdc8`](https://github.com/tobymao/sqlglot/commit/be1cdc81b511d462b710b50941d5c2770d901e91) - Fix roundtrip of ~ operator *(PR [#6017](https://github.com/tobymao/sqlglot/pull/6017) by [@VaggelisD](https://github.com/VaggelisD))*:
35
+
36
+ Fix roundtrip of ~ operator (#6017)
37
+
38
+ - due to [`74a13f2`](https://github.com/tobymao/sqlglot/commit/74a13f2a548b9cd41061e835cb3cd9dd2a5a9fb3) - Annotate type for snowflake DIV0 and DIVNULL functions *(PR [#6008](https://github.com/tobymao/sqlglot/pull/6008) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
39
+
40
+ Annotate type for snowflake DIV0 and DIVNULL functions (#6008)
41
+
42
+ - due to [`fec2b31`](https://github.com/tobymao/sqlglot/commit/fec2b31956f2debdad7c53744a577894cd8d747c) - Annotate type for snowflake SEARCH function *(PR [#5985](https://github.com/tobymao/sqlglot/pull/5985) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
43
+
44
+ Annotate type for snowflake SEARCH function (#5985)
45
+
46
+ - due to [`27a76cd`](https://github.com/tobymao/sqlglot/commit/27a76cdfe4212f16f945521eb3997580eacf1d61) - Annotate type for snowflake COT, SIN and TAN functions *(PR [#6022](https://github.com/tobymao/sqlglot/pull/6022) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
47
+
48
+ Annotate type for snowflake COT, SIN and TAN functions (#6022)
49
+
50
+ - due to [`0911276`](https://github.com/tobymao/sqlglot/commit/091127663ab4cb94b02be5aa40c6a46dd7f89243) - annotate type for Snowflake EXP function *(PR [#6007](https://github.com/tobymao/sqlglot/pull/6007) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
51
+
52
+ annotate type for Snowflake EXP function (#6007)
53
+
54
+ - due to [`a96d50e`](https://github.com/tobymao/sqlglot/commit/a96d50e14bed5e87ff2dce9c545e0c48897b64d6) - annotate type for Snowflake COSH function *(PR [#6006](https://github.com/tobymao/sqlglot/pull/6006) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
55
+
56
+ annotate type for Snowflake COSH function (#6006)
57
+
58
+ - due to [`4df58e0`](https://github.com/tobymao/sqlglot/commit/4df58e0f0b8985590fb29a8ab6ba0ced987ac5b9) - annotate type for Snowflake DEGREES function *(PR [#6027](https://github.com/tobymao/sqlglot/pull/6027) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
59
+
60
+ annotate type for Snowflake DEGREES function (#6027)
61
+
62
+ - due to [`db71a20`](https://github.com/tobymao/sqlglot/commit/db71a2023aaeca2ffda782ae7b91fdee356c402e) - annotate type for Snowflake COS function *(PR [#6028](https://github.com/tobymao/sqlglot/pull/6028) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
63
+
64
+ annotate type for Snowflake COS function (#6028)
65
+
66
+ - due to [`5dd2ed3`](https://github.com/tobymao/sqlglot/commit/5dd2ed3c69cf9e8c3e327297e0cc932f0954e108) - bump sqlglotrs to 0.7.0 *(commit by [@georgesittas](https://github.com/georgesittas))*:
67
+
68
+ bump sqlglotrs to 0.7.0
69
+
70
+
71
+ ### :sparkles: New Features
72
+ - [`3c7b5c0`](https://github.com/tobymao/sqlglot/commit/3c7b5c0e2dc071b7b9f6da308ba58a3a43da93dc) - **optimizer**: Annotate type for snowflake SOUNDEX_P123 function *(PR [#5987](https://github.com/tobymao/sqlglot/pull/5987) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
73
+ - [`475c09b`](https://github.com/tobymao/sqlglot/commit/475c09bd27179db4d186638645698dd4ad6553cd) - **optimizer**: Annotate type for snowflake TRANSLATE function *(PR [#5992](https://github.com/tobymao/sqlglot/pull/5992) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
74
+ - [`f25e42e`](https://github.com/tobymao/sqlglot/commit/f25e42e3f5b3b7b671bd724ba7b09a9b07d13995) - **optimizer**: annotate type for Snowflake REGEXP_INSTR function *(PR [#5978](https://github.com/tobymao/sqlglot/pull/5978) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
75
+ - [`13cb26e`](https://github.com/tobymao/sqlglot/commit/13cb26e2f29373538d60a8124ddebf95fd22a8d8) - **optimizer**: annotate type for Snowflake REGEXP_SUBSTR_ALL function *(PR [#5979](https://github.com/tobymao/sqlglot/pull/5979) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
76
+ - [`4ce683e`](https://github.com/tobymao/sqlglot/commit/4ce683eb8ac5716a334cbd7625438b9f89623c7a) - **optimizer**: Annotate type for snowflake UNICODE function *(PR [#5993](https://github.com/tobymao/sqlglot/pull/5993) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
77
+ - [`587196c`](https://github.com/tobymao/sqlglot/commit/587196c9c2d122f73f9deb7e87c2831f27f6ed02) - **optimizer**: Annotate type for snowflake STRTOK_TO_ARRAY function *(PR [#5994](https://github.com/tobymao/sqlglot/pull/5994) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
78
+ - [`bced710`](https://github.com/tobymao/sqlglot/commit/bced71084ffb3a8f7a11db843777f05b68f367da) - **optimizer**: Annotate type for snowflake STRTOK function. *(PR [#5991](https://github.com/tobymao/sqlglot/pull/5991) by [@georgesittas](https://github.com/georgesittas))*
79
+ - [`74a13f2`](https://github.com/tobymao/sqlglot/commit/74a13f2a548b9cd41061e835cb3cd9dd2a5a9fb3) - **optimizer**: Annotate type for snowflake DIV0 and DIVNULL functions *(PR [#6008](https://github.com/tobymao/sqlglot/pull/6008) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
80
+ - [`fec2b31`](https://github.com/tobymao/sqlglot/commit/fec2b31956f2debdad7c53744a577894cd8d747c) - **optimizer**: Annotate type for snowflake SEARCH function *(PR [#5985](https://github.com/tobymao/sqlglot/pull/5985) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
81
+ - [`27a76cd`](https://github.com/tobymao/sqlglot/commit/27a76cdfe4212f16f945521eb3997580eacf1d61) - **optimizer**: Annotate type for snowflake COT, SIN and TAN functions *(PR [#6022](https://github.com/tobymao/sqlglot/pull/6022) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
82
+ - [`8b48f7b`](https://github.com/tobymao/sqlglot/commit/8b48f7b985342cfcc45bc2b94540a1a2bf5995c4) - **optimizer**: Annotate type for snowflake SIGN and ABS functions *(PR [#6025](https://github.com/tobymao/sqlglot/pull/6025) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
83
+ - [`0911276`](https://github.com/tobymao/sqlglot/commit/091127663ab4cb94b02be5aa40c6a46dd7f89243) - **optimizer**: annotate type for Snowflake EXP function *(PR [#6007](https://github.com/tobymao/sqlglot/pull/6007) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
84
+ - [`a96d50e`](https://github.com/tobymao/sqlglot/commit/a96d50e14bed5e87ff2dce9c545e0c48897b64d6) - **optimizer**: annotate type for Snowflake COSH function *(PR [#6006](https://github.com/tobymao/sqlglot/pull/6006) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
85
+ - [`4df58e0`](https://github.com/tobymao/sqlglot/commit/4df58e0f0b8985590fb29a8ab6ba0ced987ac5b9) - **optimizer**: annotate type for Snowflake DEGREES function *(PR [#6027](https://github.com/tobymao/sqlglot/pull/6027) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
86
+ - [`db71a20`](https://github.com/tobymao/sqlglot/commit/db71a2023aaeca2ffda782ae7b91fdee356c402e) - **optimizer**: annotate type for Snowflake COS function *(PR [#6028](https://github.com/tobymao/sqlglot/pull/6028) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
87
+
88
+ ### :bug: Bug Fixes
89
+ - [`51b1bb1`](https://github.com/tobymao/sqlglot/commit/51b1bb178fa952edc13b2cbc6f624d30b0bde798) - move `WATERMARK` logic to risingwave fixes [#5989](https://github.com/tobymao/sqlglot/pull/5989) *(commit by [@georgesittas](https://github.com/georgesittas))*
90
+ - [`033ddf0`](https://github.com/tobymao/sqlglot/commit/033ddf04da895f1f5d38aff5361b2ae0793fefea) - **optimizer**: convert INNER JOINs to LEFT JOINs when merging LEFT JOIN subqueries *(PR [#5980](https://github.com/tobymao/sqlglot/pull/5980) by [@geooo109](https://github.com/geooo109))*
91
+ - :arrow_lower_right: *fixes issue [#5969](https://github.com/tobymao/sqlglot/issues/5969) opened by [@karta0807913](https://github.com/karta0807913)*
92
+ - [`c7657fb`](https://github.com/tobymao/sqlglot/commit/c7657fbd27a4350c424ef65947471ab9ec086831) - remove `unalias_group_by` transformation since it is unsafe *(PR [#5997](https://github.com/tobymao/sqlglot/pull/5997) by [@georgesittas](https://github.com/georgesittas))*
93
+ - :arrow_lower_right: *fixes issue [#5995](https://github.com/tobymao/sqlglot/issues/5995) opened by [@capricornsky0119](https://github.com/capricornsky0119)*
94
+ - [`b6f9694`](https://github.com/tobymao/sqlglot/commit/b6f9694c535cdd1403a63036cc246fda4e6d4d22) - **optimizer**: avoid merging subquery with JOIN when outer query uses JOIN *(PR [#5999](https://github.com/tobymao/sqlglot/pull/5999) by [@geooo109](https://github.com/geooo109))*
95
+ - [`23fd7b9`](https://github.com/tobymao/sqlglot/commit/23fd7b9116541b96e5d89389e862c6004e92d109) - respect multi-part Column units instead of converting to Var *(PR [#6005](https://github.com/tobymao/sqlglot/pull/6005) by [@georgesittas](https://github.com/georgesittas))*
96
+ - [`be1cdc8`](https://github.com/tobymao/sqlglot/commit/be1cdc81b511d462b710b50941d5c2770d901e91) - **duckdb**: Fix roundtrip of ~ operator *(PR [#6017](https://github.com/tobymao/sqlglot/pull/6017) by [@VaggelisD](https://github.com/VaggelisD))*
97
+ - :arrow_lower_right: *fixes issue [#6016](https://github.com/tobymao/sqlglot/issues/6016) opened by [@denis-komarov](https://github.com/denis-komarov)*
98
+ - [`27c278f`](https://github.com/tobymao/sqlglot/commit/27c278f562f5ce98a1a4d31f8e66f148a1f42236) - **parser**: Allow LIMIT with % percentage *(PR [#6019](https://github.com/tobymao/sqlglot/pull/6019) by [@VaggelisD](https://github.com/VaggelisD))*
99
+ - [`39bf3f8`](https://github.com/tobymao/sqlglot/commit/39bf3f893389663796cdd799ef0f1e684f315a01) - **parser**: Allow CUBE & ROLLUP inside GROUPING SETS *(PR [#6018](https://github.com/tobymao/sqlglot/pull/6018) by [@VaggelisD](https://github.com/VaggelisD))*
100
+ - :arrow_lower_right: *fixes issue [#6015](https://github.com/tobymao/sqlglot/issues/6015) opened by [@denis-komarov](https://github.com/denis-komarov)*
101
+ - [`ba7ad34`](https://github.com/tobymao/sqlglot/commit/ba7ad341d5ee1298b8fe54be11ca6252c1a44c99) - **duckdb**: Parse ROW type as STRUCT *(PR [#6020](https://github.com/tobymao/sqlglot/pull/6020) by [@VaggelisD](https://github.com/VaggelisD))*
102
+ - :arrow_lower_right: *fixes issue [#6012](https://github.com/tobymao/sqlglot/issues/6012) opened by [@denis-komarov](https://github.com/denis-komarov)*
103
+ - [`718d6bb`](https://github.com/tobymao/sqlglot/commit/718d6bbf7f40e5b3e99563e2f1ac9eadeff57c3d) - handle unicode heredoc tags & Rust grapheme clusters properly *(PR [#6024](https://github.com/tobymao/sqlglot/pull/6024) by [@georgesittas](https://github.com/georgesittas))*
104
+ - :arrow_lower_right: *fixes issue [#6010](https://github.com/tobymao/sqlglot/issues/6010) opened by [@denis-komarov](https://github.com/denis-komarov)*
105
+ - [`c8cfb9d`](https://github.com/tobymao/sqlglot/commit/c8cfb9db2e789be2dc7f8a154082a9210b736502) - **snowflake**: transpile ARRAY_CONTAINS with VARIANT CAST *(PR [#6029](https://github.com/tobymao/sqlglot/pull/6029) by [@geooo109](https://github.com/geooo109))*
106
+ - :arrow_lower_right: *fixes issue [#6026](https://github.com/tobymao/sqlglot/issues/6026) opened by [@Birkman](https://github.com/Birkman)*
107
+
108
+ ### :wrench: Chores
109
+ - [`1b1c6f8`](https://github.com/tobymao/sqlglot/commit/1b1c6f8d418371d49f0d3511baf3c5e35dd3ef42) - coerce type for EXTRACT canonicalization *(PR [#5998](https://github.com/tobymao/sqlglot/pull/5998) by [@geooo109](https://github.com/geooo109))*
110
+ - :arrow_lower_right: *addresses issue [#5996](https://github.com/tobymao/sqlglot/issues/5996) opened by [@snovik75](https://github.com/snovik75)*
111
+ - [`f00ae73`](https://github.com/tobymao/sqlglot/commit/f00ae735c8f185b4c6c132373c9fa9bbe58e37b7) - **optimizer**: Annotate type for sqrt function *(PR [#6003](https://github.com/tobymao/sqlglot/pull/6003) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
112
+ - [`ac97f14`](https://github.com/tobymao/sqlglot/commit/ac97f14ee1a576a276018f6c9ae1237ecf9ceda7) - simplify `SEARCH` Snowflake instantiation *(commit by [@georgesittas](https://github.com/georgesittas))*
113
+ - [`5dd2ed3`](https://github.com/tobymao/sqlglot/commit/5dd2ed3c69cf9e8c3e327297e0cc932f0954e108) - bump sqlglotrs to 0.7.0 *(commit by [@georgesittas](https://github.com/georgesittas))*
114
+
115
+
116
+ ## [v27.20.0] - 2025-09-30
117
+ ### :boom: BREAKING CHANGES
118
+ - due to [`13a30df`](https://github.com/tobymao/sqlglot/commit/13a30dfa37096df5bfc2c31538325c40a49f7917) - Annotate type for snowflake TRY_BASE64_DECODE_BINARY function *(PR [#5972](https://github.com/tobymao/sqlglot/pull/5972) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
119
+
120
+ Annotate type for snowflake TRY_BASE64_DECODE_BINARY function (#5972)
121
+
122
+ - due to [`1f5fdd7`](https://github.com/tobymao/sqlglot/commit/1f5fdd799c047de167a4572f7ac26b7ad92167f2) - Annotate type for snowflake TRY_BASE64_DECODE_STRING function *(PR [#5974](https://github.com/tobymao/sqlglot/pull/5974) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
123
+
124
+ Annotate type for snowflake TRY_BASE64_DECODE_STRING function (#5974)
125
+
126
+ - due to [`324e82f`](https://github.com/tobymao/sqlglot/commit/324e82fe1fb11722f91341010602a743b151e055) - Annotate type for snowflake TRY_HEX_DECODE_BINARY function *(PR [#5975](https://github.com/tobymao/sqlglot/pull/5975) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
127
+
128
+ Annotate type for snowflake TRY_HEX_DECODE_BINARY function (#5975)
129
+
130
+ - due to [`6caf99d`](https://github.com/tobymao/sqlglot/commit/6caf99d556a3357ffaa6c294a9babcd30dd5fac5) - Annotate type for snowflake TRY_HEX_DECODE_STRING function *(PR [#5976](https://github.com/tobymao/sqlglot/pull/5976) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
131
+
132
+ Annotate type for snowflake TRY_HEX_DECODE_STRING function (#5976)
133
+
134
+ - due to [`73186a8`](https://github.com/tobymao/sqlglot/commit/73186a812ce422c108ee81b3de11da6ee9a9e902) - annotate type for Snowflake REGEXP_COUNT function *(PR [#5963](https://github.com/tobymao/sqlglot/pull/5963) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
135
+
136
+ annotate type for Snowflake REGEXP_COUNT function (#5963)
137
+
138
+ - due to [`c3bdb3c`](https://github.com/tobymao/sqlglot/commit/c3bdb3cd1af1809ed82be0ae40744d9fffc8ce18) - array start index is 1, support array_flatten, fixes [#5983](https://github.com/tobymao/sqlglot/pull/5983) *(commit by [@georgesittas](https://github.com/georgesittas))*:
139
+
140
+ array start index is 1, support array_flatten, fixes #5983
141
+
142
+ - due to [`244fb48`](https://github.com/tobymao/sqlglot/commit/244fb48fc9c4776f427c08b825d139b1c172fd26) - annotate type for Snowflake SPLIT_PART function *(PR [#5988](https://github.com/tobymao/sqlglot/pull/5988) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*:
143
+
144
+ annotate type for Snowflake SPLIT_PART function (#5988)
145
+
146
+ - due to [`0d772e0`](https://github.com/tobymao/sqlglot/commit/0d772e0b9d687b24d49203c05d7a90cc1dce02d5) - add ast node for `DIRECTORY` source *(PR [#5990](https://github.com/tobymao/sqlglot/pull/5990) by [@georgesittas](https://github.com/georgesittas))*:
147
+
148
+ add ast node for `DIRECTORY` source (#5990)
149
+
150
+
151
+ ### :sparkles: New Features
152
+ - [`13a30df`](https://github.com/tobymao/sqlglot/commit/13a30dfa37096df5bfc2c31538325c40a49f7917) - **optimizer**: Annotate type for snowflake TRY_BASE64_DECODE_BINARY function *(PR [#5972](https://github.com/tobymao/sqlglot/pull/5972) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
153
+ - [`1f5fdd7`](https://github.com/tobymao/sqlglot/commit/1f5fdd799c047de167a4572f7ac26b7ad92167f2) - **optimizer**: Annotate type for snowflake TRY_BASE64_DECODE_STRING function *(PR [#5974](https://github.com/tobymao/sqlglot/pull/5974) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
154
+ - [`324e82f`](https://github.com/tobymao/sqlglot/commit/324e82fe1fb11722f91341010602a743b151e055) - **optimizer**: Annotate type for snowflake TRY_HEX_DECODE_BINARY function *(PR [#5975](https://github.com/tobymao/sqlglot/pull/5975) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
155
+ - [`6caf99d`](https://github.com/tobymao/sqlglot/commit/6caf99d556a3357ffaa6c294a9babcd30dd5fac5) - **optimizer**: Annotate type for snowflake TRY_HEX_DECODE_STRING function *(PR [#5976](https://github.com/tobymao/sqlglot/pull/5976) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
156
+ - [`73186a8`](https://github.com/tobymao/sqlglot/commit/73186a812ce422c108ee81b3de11da6ee9a9e902) - **optimizer**: annotate type for Snowflake REGEXP_COUNT function *(PR [#5963](https://github.com/tobymao/sqlglot/pull/5963) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
157
+ - [`6124de7`](https://github.com/tobymao/sqlglot/commit/6124de76fa6d6725e844cd37e09ebfe99469b0ec) - **optimizer**: Annotate type for snowflake SOUNDEX function *(PR [#5986](https://github.com/tobymao/sqlglot/pull/5986) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*
158
+ - [`244fb48`](https://github.com/tobymao/sqlglot/commit/244fb48fc9c4776f427c08b825d139b1c172fd26) - **optimizer**: annotate type for Snowflake SPLIT_PART function *(PR [#5988](https://github.com/tobymao/sqlglot/pull/5988) by [@fivetran-BradfordPaskewitz](https://github.com/fivetran-BradfordPaskewitz))*
159
+ - [`0d772e0`](https://github.com/tobymao/sqlglot/commit/0d772e0b9d687b24d49203c05d7a90cc1dce02d5) - **snowflake**: add ast node for `DIRECTORY` source *(PR [#5990](https://github.com/tobymao/sqlglot/pull/5990) by [@georgesittas](https://github.com/georgesittas))*
160
+
161
+ ### :bug: Bug Fixes
162
+ - [`7a3744f`](https://github.com/tobymao/sqlglot/commit/7a3744f203b93211e5dd97e6730b6bf59d6d96e0) - **sqlite**: support `RANGE CURRENT ROW` in window spec *(commit by [@georgesittas](https://github.com/georgesittas))*
163
+ - [`c3bdb3c`](https://github.com/tobymao/sqlglot/commit/c3bdb3cd1af1809ed82be0ae40744d9fffc8ce18) - **starrocks**: array start index is 1, support array_flatten, fixes [#5983](https://github.com/tobymao/sqlglot/pull/5983) *(commit by [@georgesittas](https://github.com/georgesittas))*
164
+
165
+ ### :recycle: Refactors
166
+ - [`d425ba2`](https://github.com/tobymao/sqlglot/commit/d425ba26b96b368801f8f486fa375cd75105993d) - make hash and eq non recursive *(PR [#5966](https://github.com/tobymao/sqlglot/pull/5966) by [@tobymao](https://github.com/tobymao))*
167
+
168
+ ### :wrench: Chores
169
+ - [`345c6a1`](https://github.com/tobymao/sqlglot/commit/345c6a153481a22d6df1b12ef1863e2133688fdf) - add uv support to Makefile *(PR [#5973](https://github.com/tobymao/sqlglot/pull/5973) by [@eakmanrq](https://github.com/eakmanrq))*
170
+
171
+
4
172
  ## [v27.19.0] - 2025-09-26
5
173
  ### :boom: BREAKING CHANGES
6
174
  - due to [`68473ac`](https://github.com/tobymao/sqlglot/commit/68473ac3ec8dc76512dc76819892a1b0324c7ddc) - Annotate type for snowflake PARSE_URL function *(PR [#5962](https://github.com/tobymao/sqlglot/pull/5962) by [@fivetran-amrutabhimsenayachit](https://github.com/fivetran-amrutabhimsenayachit))*:
@@ -7561,3 +7729,5 @@ Changelog
7561
7729
  [v27.17.0]: https://github.com/tobymao/sqlglot/compare/v27.16.3...v27.17.0
7562
7730
  [v27.18.0]: https://github.com/tobymao/sqlglot/compare/v27.17.0...v27.18.0
7563
7731
  [v27.19.0]: https://github.com/tobymao/sqlglot/compare/v27.18.0...v27.19.0
7732
+ [v27.20.0]: https://github.com/tobymao/sqlglot/compare/v27.19.0...v27.20.0
7733
+ [v27.21.0]: https://github.com/tobymao/sqlglot/compare/v27.20.0...v27.21.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlglot
3
- Version: 27.20.0
3
+ Version: 27.22.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
@@ -33,7 +33,7 @@ Requires-Dist: typing_extensions; extra == "dev"
33
33
  Requires-Dist: maturin<2.0,>=1.4; extra == "dev"
34
34
  Requires-Dist: pyperf; extra == "dev"
35
35
  Provides-Extra: rs
36
- Requires-Dist: sqlglotrs==0.6.2; extra == "rs"
36
+ Requires-Dist: sqlglotrs==0.7.0; extra == "rs"
37
37
  Dynamic: license-file
38
38
  Dynamic: provides-extra
39
39
 
@@ -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.20.0'
32
- __version_tuple__ = version_tuple = (27, 20, 0)
31
+ __version__ = version = '27.22.0'
32
+ __version_tuple__ = version_tuple = (27, 22, 0)
33
33
 
34
- __commit_id__ = commit_id = 'g0d772e0b9'
34
+ __commit_id__ = commit_id = 'gde8cb9805'
@@ -867,6 +867,8 @@ class BigQuery(Dialect):
867
867
  "FROM_HEX": exp.Unhex.from_arg_list,
868
868
  "WEEK": lambda args: exp.WeekStart(this=exp.var(seq_get(args, 0))),
869
869
  }
870
+ # Remove SEARCH to avoid parameter routing issues - let it fall back to Anonymous function
871
+ FUNCTIONS.pop("SEARCH")
870
872
 
871
873
  FUNCTION_PARSERS = {
872
874
  **parser.Parser.FUNCTION_PARSERS,
@@ -525,6 +525,13 @@ class Dialect(metaclass=_Dialect):
525
525
  equivalent of CREATE SCHEMA is CREATE DATABASE.
526
526
  """
527
527
 
528
+ ALTER_TABLE_SUPPORTS_CASCADE = False
529
+ """
530
+ Hive by default does not update the schema of existing partitions when a column is changed.
531
+ the CASCADE clause is used to indicate that the change should be propagated to all existing partitions.
532
+ the Spark dialect, while derived from Hive, does not support the CASCADE clause.
533
+ """
534
+
528
535
  # Whether ADD is present for each column added by ALTER TABLE
529
536
  ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN = True
530
537
 
@@ -1715,7 +1722,7 @@ def unit_to_str(expression: exp.Expression, default: str = "DAY") -> t.Optional[
1715
1722
  def unit_to_var(expression: exp.Expression, default: str = "DAY") -> t.Optional[exp.Expression]:
1716
1723
  unit = expression.args.get("unit")
1717
1724
 
1718
- if isinstance(unit, (exp.Var, exp.Placeholder, exp.WeekStart)):
1725
+ if isinstance(unit, (exp.Var, exp.Placeholder, exp.WeekStart, exp.Column)):
1719
1726
  return unit
1720
1727
 
1721
1728
  value = unit.name if unit else default
@@ -1736,7 +1743,9 @@ def map_date_part(
1736
1743
 
1737
1744
  def map_date_part(part, dialect: DialectType = Dialect):
1738
1745
  mapped = (
1739
- Dialect.get_or_raise(dialect).DATE_PART_MAPPING.get(part.name.upper()) if part else None
1746
+ Dialect.get_or_raise(dialect).DATE_PART_MAPPING.get(part.name.upper())
1747
+ if part and not (isinstance(part, exp.Column) and len(part.parts) != 1)
1748
+ else None
1740
1749
  )
1741
1750
  if mapped:
1742
1751
  return exp.Literal.string(mapped) if part.is_string else exp.var(mapped)
@@ -311,6 +311,7 @@ class DuckDB(Dialect):
311
311
  "PIVOT_WIDER": TokenType.PIVOT,
312
312
  "POSITIONAL": TokenType.POSITIONAL,
313
313
  "RESET": TokenType.COMMAND,
314
+ "ROW": TokenType.STRUCT,
314
315
  "SIGNED": TokenType.INT,
315
316
  "STRING": TokenType.TEXT,
316
317
  "SUMMARIZE": TokenType.SUMMARIZE,
@@ -337,16 +338,14 @@ class DuckDB(Dialect):
337
338
  class Parser(parser.Parser):
338
339
  MAP_KEYS_ARE_ARBITRARY_EXPRESSIONS = True
339
340
 
340
- BITWISE = {
341
- **parser.Parser.BITWISE,
342
- TokenType.TILDA: exp.RegexpLike,
343
- }
341
+ BITWISE = parser.Parser.BITWISE.copy()
344
342
  BITWISE.pop(TokenType.CARET)
345
343
 
346
344
  RANGE_PARSERS = {
347
345
  **parser.Parser.RANGE_PARSERS,
348
346
  TokenType.DAMP: binary_range_parser(exp.ArrayOverlaps),
349
347
  TokenType.CARET_AT: binary_range_parser(exp.StartsWith),
348
+ TokenType.TILDA: binary_range_parser(exp.RegexpFullMatch),
350
349
  }
351
350
 
352
351
  EXPONENT = {
@@ -211,6 +211,7 @@ class Hive(Dialect):
211
211
  SAFE_DIVISION = True
212
212
  ARRAY_AGG_INCLUDES_NULLS = None
213
213
  REGEXP_EXTRACT_DEFAULT_GROUP = 1
214
+ ALTER_TABLE_SUPPORTS_CASCADE = True
214
215
 
215
216
  # https://spark.apache.org/docs/latest/sql-ref-identifier.html#description
216
217
  NORMALIZATION_STRATEGY = NormalizationStrategy.CASE_INSENSITIVE
@@ -310,6 +311,10 @@ class Hive(Dialect):
310
311
  VALUES_FOLLOWED_BY_PAREN = False
311
312
  JOINS_HAVE_EQUAL_PRECEDENCE = True
312
313
  ADD_JOIN_ON_TRUE = True
314
+ ALTER_TABLE_PARTITIONS = True
315
+
316
+ CHANGE_COLUMN_ALTER_SYNTAX = False
317
+ # Whether the dialect supports using ALTER COLUMN syntax with CHANGE COLUMN.
313
318
 
314
319
  FUNCTIONS = {
315
320
  **parser.Parser.FUNCTIONS,
@@ -378,6 +383,11 @@ class Hive(Dialect):
378
383
  ),
379
384
  }
380
385
 
386
+ ALTER_PARSERS = {
387
+ **parser.Parser.ALTER_PARSERS,
388
+ "CHANGE": lambda self: self._parse_alter_table_change(),
389
+ }
390
+
381
391
  def _parse_transform(self) -> t.Optional[exp.Transform | exp.QueryTransform]:
382
392
  if not self._match(TokenType.L_PAREN, advance=False):
383
393
  self._retreat(self._index - 1)
@@ -451,6 +461,35 @@ class Hive(Dialect):
451
461
 
452
462
  return this
453
463
 
464
+ def _parse_alter_table_change(self) -> t.Optional[exp.Expression]:
465
+ self._match(TokenType.COLUMN)
466
+ this = self._parse_field(any_token=True)
467
+
468
+ if self.CHANGE_COLUMN_ALTER_SYNTAX and self._match_text_seq("TYPE"):
469
+ return self.expression(
470
+ exp.AlterColumn,
471
+ this=this,
472
+ dtype=self._parse_types(schema=True),
473
+ )
474
+
475
+ column_new = self._parse_field(any_token=True)
476
+ dtype = self._parse_types(schema=True)
477
+
478
+ comment = self._match(TokenType.COMMENT) and self._parse_string()
479
+
480
+ if not this or not column_new or not dtype:
481
+ self.raise_error(
482
+ "Expected 'CHANGE COLUMN' to be followed by 'column_name' 'column_name' 'data_type'"
483
+ )
484
+
485
+ return self.expression(
486
+ exp.AlterColumn,
487
+ this=this,
488
+ rename_to=column_new,
489
+ dtype=dtype,
490
+ comment=comment,
491
+ )
492
+
454
493
  def _parse_partition_and_order(
455
494
  self,
456
495
  ) -> t.Tuple[t.List[exp.Expression], t.Optional[exp.Expression]]:
@@ -500,6 +539,7 @@ class Hive(Dialect):
500
539
  PAD_FILL_PATTERN_IS_REQUIRED = True
501
540
  SUPPORTS_MEDIAN = False
502
541
  ARRAY_SIZE_NAME = "SIZE"
542
+ ALTER_SET_TYPE = ""
503
543
 
504
544
  EXPRESSIONS_WITHOUT_NESTED_CTES = {
505
545
  exp.Insert,
@@ -531,7 +571,6 @@ class Hive(Dialect):
531
571
 
532
572
  TRANSFORMS = {
533
573
  **generator.Generator.TRANSFORMS,
534
- exp.Group: transforms.preprocess([transforms.unalias_group]),
535
574
  exp.Property: property_sql,
536
575
  exp.AnyValue: rename_func("FIRST"),
537
576
  exp.ApproxDistinct: approx_count_distinct_sql,
@@ -758,6 +797,32 @@ class Hive(Dialect):
758
797
  ),
759
798
  )
760
799
 
800
+ def altercolumn_sql(self, expression: exp.AlterColumn) -> str:
801
+ this = self.sql(expression, "this")
802
+ new_name = self.sql(expression, "rename_to") or this
803
+ dtype = self.sql(expression, "dtype")
804
+ comment = (
805
+ f" COMMENT {self.sql(expression, 'comment')}"
806
+ if self.sql(expression, "comment")
807
+ else ""
808
+ )
809
+ default = self.sql(expression, "default")
810
+ visible = expression.args.get("visible")
811
+ allow_null = expression.args.get("allow_null")
812
+ drop = expression.args.get("drop")
813
+
814
+ if any([default, drop, visible, allow_null, drop]):
815
+ self.unsupported("Unsupported CHANGE COLUMN syntax")
816
+
817
+ if not dtype:
818
+ self.unsupported("CHANGE COLUMN without a type is not supported")
819
+
820
+ return f"CHANGE COLUMN {this} {new_name} {dtype}{comment}"
821
+
822
+ def renamecolumn_sql(self, expression: exp.RenameColumn) -> str:
823
+ self.unsupported("Cannot rename columns without data type defined in Hive")
824
+ return ""
825
+
761
826
  def alterset_sql(self, expression: exp.AlterSet) -> str:
762
827
  exprs = self.expressions(expression, flat=True)
763
828
  exprs = f" {exprs}" if exprs else ""
@@ -307,7 +307,6 @@ class Oracle(Dialect):
307
307
  ),
308
308
  exp.DateTrunc: lambda self, e: self.func("TRUNC", e.this, e.unit),
309
309
  exp.EuclideanDistance: rename_func("L2_DISTANCE"),
310
- exp.Group: transforms.preprocess([transforms.unalias_group]),
311
310
  exp.ILike: no_ilike_sql,
312
311
  exp.LogicalOr: rename_func("MAX"),
313
312
  exp.LogicalAnd: rename_func("MIN"),
@@ -475,7 +475,6 @@ class Presto(Dialect):
475
475
  e: f"WITH_TIMEZONE({self.sql(e, 'this')}, {self.sql(e, 'zone')}) AT TIME ZONE 'UTC'",
476
476
  exp.GenerateSeries: sequence_sql,
477
477
  exp.GenerateDateArray: sequence_sql,
478
- exp.Group: transforms.preprocess([transforms.unalias_group]),
479
478
  exp.If: if_sql(),
480
479
  exp.ILike: no_ilike_sql,
481
480
  exp.Initcap: _initcap_sql,
@@ -25,6 +25,20 @@ class RisingWave(Postgres):
25
25
  "KEY": lambda self: self._parse_encode_property(key=True),
26
26
  }
27
27
 
28
+ CONSTRAINT_PARSERS = {
29
+ **Postgres.Parser.CONSTRAINT_PARSERS,
30
+ "WATERMARK": lambda self: self.expression(
31
+ exp.WatermarkColumnConstraint,
32
+ this=self._match(TokenType.FOR) and self._parse_column(),
33
+ expression=self._match(TokenType.ALIAS) and self._parse_disjunction(),
34
+ ),
35
+ }
36
+
37
+ SCHEMA_UNNAMED_CONSTRAINTS = {
38
+ *Postgres.Parser.SCHEMA_UNNAMED_CONSTRAINTS,
39
+ "WATERMARK",
40
+ }
41
+
28
42
  def _parse_table_hints(self) -> t.Optional[t.List[exp.Expression]]:
29
43
  # There is no hint in risingwave.
30
44
  # Do nothing here to avoid WITH keywords conflict in CREATE SINK statement.
@@ -41,7 +41,18 @@ if t.TYPE_CHECKING:
41
41
  from sqlglot._typing import E, B
42
42
 
43
43
 
44
- # from https://docs.snowflake.com/en/sql-reference/functions/to_timestamp.html
44
+ def _build_strtok(args: t.List) -> exp.SplitPart:
45
+ # Add default delimiter (space) if missing - per Snowflake docs
46
+ if len(args) == 1:
47
+ args.append(exp.Literal.string(" "))
48
+
49
+ # Add default part_index (1) if missing
50
+ if len(args) == 2:
51
+ args.append(exp.Literal.number(1))
52
+
53
+ return exp.SplitPart.from_arg_list(args)
54
+
55
+
45
56
  def _build_datetime(
46
57
  name: str, kind: exp.DataType.Type, safe: bool = False
47
58
  ) -> t.Callable[[t.List], exp.Func]:
@@ -137,12 +148,35 @@ def _build_if_from_div0(args: t.List) -> exp.If:
137
148
  return exp.If(this=cond, true=true, false=false)
138
149
 
139
150
 
151
+ # https://docs.snowflake.com/en/sql-reference/functions/div0null
152
+ def _build_if_from_div0null(args: t.List) -> exp.If:
153
+ lhs = exp._wrap(seq_get(args, 0), exp.Binary)
154
+ rhs = exp._wrap(seq_get(args, 1), exp.Binary)
155
+
156
+ # Returns 0 when divisor is 0 OR NULL
157
+ cond = exp.EQ(this=rhs, expression=exp.Literal.number(0)).or_(
158
+ exp.Is(this=rhs, expression=exp.null())
159
+ )
160
+ true = exp.Literal.number(0)
161
+ false = exp.Div(this=lhs, expression=rhs)
162
+ return exp.If(this=cond, true=true, false=false)
163
+
164
+
140
165
  # https://docs.snowflake.com/en/sql-reference/functions/zeroifnull
141
166
  def _build_if_from_zeroifnull(args: t.List) -> exp.If:
142
167
  cond = exp.Is(this=seq_get(args, 0), expression=exp.Null())
143
168
  return exp.If(this=cond, true=exp.Literal.number(0), false=seq_get(args, 0))
144
169
 
145
170
 
171
+ def _build_search(args: t.List) -> exp.Search:
172
+ kwargs = {
173
+ "this": seq_get(args, 0),
174
+ "expression": seq_get(args, 1),
175
+ **{arg.name.lower(): arg for arg in args[2:] if isinstance(arg, exp.Kwarg)},
176
+ }
177
+ return exp.Search(**kwargs)
178
+
179
+
146
180
  # https://docs.snowflake.com/en/sql-reference/functions/zeroifnull
147
181
  def _build_if_from_nullifzero(args: t.List) -> exp.If:
148
182
  cond = exp.EQ(this=seq_get(args, 0), expression=exp.Literal.number(0))
@@ -529,6 +563,16 @@ class Snowflake(Dialect):
529
563
 
530
564
  TYPE_TO_EXPRESSIONS = {
531
565
  **Dialect.TYPE_TO_EXPRESSIONS,
566
+ exp.DataType.Type.DOUBLE: {
567
+ *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.DOUBLE],
568
+ exp.Cos,
569
+ exp.Cosh,
570
+ exp.Cot,
571
+ exp.Degrees,
572
+ exp.Exp,
573
+ exp.Sin,
574
+ exp.Tan,
575
+ },
532
576
  exp.DataType.Type.INT: {
533
577
  *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.INT],
534
578
  exp.Ascii,
@@ -539,6 +583,7 @@ class Snowflake(Dialect):
539
583
  exp.Levenshtein,
540
584
  exp.JarowinklerSimilarity,
541
585
  exp.StrPosition,
586
+ exp.Unicode,
542
587
  },
543
588
  exp.DataType.Type.VARCHAR: {
544
589
  *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.VARCHAR],
@@ -564,8 +609,10 @@ class Snowflake(Dialect):
564
609
  exp.SHA,
565
610
  exp.SHA2,
566
611
  exp.Soundex,
612
+ exp.SoundexP123,
567
613
  exp.Space,
568
614
  exp.SplitPart,
615
+ exp.Translate,
569
616
  exp.Uuid,
570
617
  },
571
618
  exp.DataType.Type.BINARY: {
@@ -587,6 +634,8 @@ class Snowflake(Dialect):
587
634
  },
588
635
  exp.DataType.Type.ARRAY: {
589
636
  exp.Split,
637
+ exp.RegexpExtractAll,
638
+ exp.StringToArray,
590
639
  },
591
640
  exp.DataType.Type.OBJECT: {
592
641
  exp.ParseUrl,
@@ -595,6 +644,10 @@ class Snowflake(Dialect):
595
644
  exp.DataType.Type.DECIMAL: {
596
645
  exp.RegexpCount,
597
646
  },
647
+ exp.DataType.Type.BOOLEAN: {
648
+ *Dialect.TYPE_TO_EXPRESSIONS[exp.DataType.Type.BOOLEAN],
649
+ exp.Search,
650
+ },
598
651
  }
599
652
 
600
653
  ANNOTATORS = {
@@ -612,13 +665,20 @@ class Snowflake(Dialect):
612
665
  exp.Right,
613
666
  exp.Stuff,
614
667
  exp.Substring,
668
+ exp.Round,
669
+ )
670
+ },
671
+ **{
672
+ expr_type: lambda self, e: self._annotate_with_type(
673
+ e, exp.DataType.build("NUMBER", dialect="snowflake")
674
+ )
675
+ for expr_type in (
676
+ exp.RegexpCount,
677
+ exp.RegexpInstr,
615
678
  )
616
679
  },
617
680
  exp.ConcatWs: lambda self, e: self._annotate_by_args(e, "expressions"),
618
681
  exp.Reverse: _annotate_reverse,
619
- exp.RegexpCount: lambda self, e: self._annotate_with_type(
620
- e, exp.DataType.build("NUMBER", dialect="snowflake")
621
- ),
622
682
  }
623
683
 
624
684
  TIME_MAPPING = {
@@ -691,7 +751,7 @@ class Snowflake(Dialect):
691
751
  "APPROX_PERCENTILE": exp.ApproxQuantile.from_arg_list,
692
752
  "ARRAY_CONSTRUCT": lambda args: exp.Array(expressions=args),
693
753
  "ARRAY_CONTAINS": lambda args: exp.ArrayContains(
694
- this=seq_get(args, 1), expression=seq_get(args, 0)
754
+ this=seq_get(args, 1), expression=seq_get(args, 0), ensure_variant=False
695
755
  ),
696
756
  "ARRAY_GENERATE_RANGE": lambda args: exp.GenerateSeries(
697
757
  # ARRAY_GENERATE_RANGE has an exlusive end; we normalize it to be inclusive
@@ -727,6 +787,7 @@ class Snowflake(Dialect):
727
787
  "DATEDIFF": _build_datediff,
728
788
  "DAYOFWEEKISO": exp.DayOfWeekIso.from_arg_list,
729
789
  "DIV0": _build_if_from_div0,
790
+ "DIV0NULL": _build_if_from_div0null,
730
791
  "EDITDISTANCE": lambda args: exp.Levenshtein(
731
792
  this=seq_get(args, 0), expression=seq_get(args, 1), max_dist=seq_get(args, 2)
732
793
  ),
@@ -765,6 +826,7 @@ class Snowflake(Dialect):
765
826
  "SHA2_BINARY": exp.SHA2Digest.from_arg_list,
766
827
  "SHA2_HEX": exp.SHA2.from_arg_list,
767
828
  "SQUARE": lambda args: exp.Pow(this=seq_get(args, 0), expression=exp.Literal.number(2)),
829
+ "STRTOK": _build_strtok,
768
830
  "TABLE": lambda args: exp.TableFromRows(this=seq_get(args, 0)),
769
831
  "TIMEADD": _build_date_time_add(exp.TimeAdd),
770
832
  "TIMEDIFF": _build_datediff,
@@ -799,6 +861,7 @@ class Snowflake(Dialect):
799
861
  "ZEROIFNULL": _build_if_from_zeroifnull,
800
862
  "LIKE": _build_like(exp.Like),
801
863
  "ILIKE": _build_like(exp.ILike),
864
+ "SEARCH": _build_search,
802
865
  }
803
866
  FUNCTIONS.pop("PREDICT")
804
867
 
@@ -1364,7 +1427,13 @@ class Snowflake(Dialect):
1364
1427
  exp.ArgMax: rename_func("MAX_BY"),
1365
1428
  exp.ArgMin: rename_func("MIN_BY"),
1366
1429
  exp.ArrayConcat: lambda self, e: self.arrayconcat_sql(e, name="ARRAY_CAT"),
1367
- exp.ArrayContains: lambda self, e: self.func("ARRAY_CONTAINS", e.expression, e.this),
1430
+ exp.ArrayContains: lambda self, e: self.func(
1431
+ "ARRAY_CONTAINS",
1432
+ e.expression
1433
+ if e.args.get("ensure_variant") is False
1434
+ else exp.cast(e.expression, exp.DataType.Type.VARIANT, copy=False),
1435
+ e.this,
1436
+ ),
1368
1437
  exp.ArrayIntersect: rename_func("ARRAY_INTERSECTION"),
1369
1438
  exp.AtTimeZone: lambda self, e: self.func(
1370
1439
  "CONVERT_TIMEZONE", e.args.get("zone"), e.this
@@ -1894,3 +1963,13 @@ class Snowflake(Dialect):
1894
1963
  return self.func("TO_CHAR", expression.expressions[0])
1895
1964
 
1896
1965
  return self.function_fallback_sql(expression)
1966
+
1967
+ def splitpart_sql(self, expression: exp.SplitPart) -> str:
1968
+ # Set part_index to 1 if missing
1969
+ if not expression.args.get("delimiter"):
1970
+ expression.set("delimiter", exp.Literal.string(" "))
1971
+
1972
+ if not expression.args.get("part_index"):
1973
+ expression.set("part_index", exp.Literal.number(1))
1974
+
1975
+ return rename_func("SPLIT_PART")(self, expression)