1
0
Fork 0

Merging upstream version 26.15.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-04-21 09:50:04 +02:00
parent 2a79d9df75
commit de6539b796
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
58 changed files with 4878 additions and 4677 deletions

View file

@ -1,6 +1,22 @@
Changelog Changelog
========= =========
## [v26.14.0] - 2025-04-15
### :boom: BREAKING CHANGES
- due to [`cb20038`](https://github.com/tobymao/sqlglot/commit/cb2003875fc6e149bd4a631e99c312a04435a46b) - treat GO as command *(PR [#4978](https://github.com/tobymao/sqlglot/pull/4978) by [@georgesittas](https://github.com/georgesittas))*:
treat GO as command (#4978)
- due to [`60e26b8`](https://github.com/tobymao/sqlglot/commit/60e26b868242a05a7fdc2725bd21a127910a6fb7) - improve transpilability of GET_JSON_OBJECT by parsing json path *(PR [#4980](https://github.com/tobymao/sqlglot/pull/4980) by [@georgesittas](https://github.com/georgesittas))*:
improve transpilability of GET_JSON_OBJECT by parsing json path (#4980)
### :bug: Bug Fixes
- [`cb20038`](https://github.com/tobymao/sqlglot/commit/cb2003875fc6e149bd4a631e99c312a04435a46b) - **tsql**: treat GO as command *(PR [#4978](https://github.com/tobymao/sqlglot/pull/4978) by [@georgesittas](https://github.com/georgesittas))*
- [`60e26b8`](https://github.com/tobymao/sqlglot/commit/60e26b868242a05a7fdc2725bd21a127910a6fb7) - **hive**: improve transpilability of GET_JSON_OBJECT by parsing json path *(PR [#4980](https://github.com/tobymao/sqlglot/pull/4980) by [@georgesittas](https://github.com/georgesittas))*
## [v26.13.2] - 2025-04-14 ## [v26.13.2] - 2025-04-14
### :bug: Bug Fixes ### :bug: Bug Fixes
- [`9693dbd`](https://github.com/tobymao/sqlglot/commit/9693dbd18b98b2699cade738a254f71f2ee8ce74) - **clickhouse**: avoid superfluous parentheses in DISTINCT ON (...) *(commit by [@georgesittas](https://github.com/georgesittas))* - [`9693dbd`](https://github.com/tobymao/sqlglot/commit/9693dbd18b98b2699cade738a254f71f2ee8ce74) - **clickhouse**: avoid superfluous parentheses in DISTINCT ON (...) *(commit by [@georgesittas](https://github.com/georgesittas))*
@ -6341,3 +6357,4 @@ Changelog
[v26.13.0]: https://github.com/tobymao/sqlglot/compare/v26.12.1...v26.13.0 [v26.13.0]: https://github.com/tobymao/sqlglot/compare/v26.12.1...v26.13.0
[v26.13.1]: https://github.com/tobymao/sqlglot/compare/v26.13.0...v26.13.1 [v26.13.1]: https://github.com/tobymao/sqlglot/compare/v26.13.0...v26.13.1
[v26.13.2]: https://github.com/tobymao/sqlglot/compare/v26.13.1...v26.13.2 [v26.13.2]: https://github.com/tobymao/sqlglot/compare/v26.13.1...v26.13.2
[v26.14.0]: https://github.com/tobymao/sqlglot/compare/v26.13.2...v26.14.0

File diff suppressed because one or more lines are too long

View file

@ -84,8 +84,8 @@
</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a><span class="n">__version_tuple__</span><span class="p">:</span> <span class="n">VERSION_TUPLE</span> </span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a><span class="n">__version_tuple__</span><span class="p">:</span> <span class="n">VERSION_TUPLE</span>
</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a><span class="n">version_tuple</span><span class="p">:</span> <span class="n">VERSION_TUPLE</span> </span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a><span class="n">version_tuple</span><span class="p">:</span> <span class="n">VERSION_TUPLE</span>
</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> </span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a>
</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a><span class="n">__version__</span> <span class="o">=</span> <span class="n">version</span> <span class="o">=</span> <span class="s1">&#39;26.13.2&#39;</span> </span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a><span class="n">__version__</span> <span class="o">=</span> <span class="n">version</span> <span class="o">=</span> <span class="s1">&#39;26.14.0&#39;</span>
</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a><span class="n">__version_tuple__</span> <span class="o">=</span> <span class="n">version_tuple</span> <span class="o">=</span> <span class="p">(</span><span class="mi">26</span><span class="p">,</span> <span class="mi">13</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> </span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a><span class="n">__version_tuple__</span> <span class="o">=</span> <span class="n">version_tuple</span> <span class="o">=</span> <span class="p">(</span><span class="mi">26</span><span class="p">,</span> <span class="mi">14</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
</span></pre></div> </span></pre></div>
@ -93,7 +93,7 @@
<section id="__version__"> <section id="__version__">
<div class="attr variable"> <div class="attr variable">
<span class="name">__version__</span><span class="annotation">: str</span> = <span class="name">__version__</span><span class="annotation">: str</span> =
<span class="default_value">&#39;26.13.2&#39;</span> <span class="default_value">&#39;26.14.0&#39;</span>
</div> </div>
@ -105,7 +105,7 @@
<section id="__version_tuple__"> <section id="__version_tuple__">
<div class="attr variable"> <div class="attr variable">
<span class="name">__version_tuple__</span><span class="annotation">: object</span> = <span class="name">__version_tuple__</span><span class="annotation">: object</span> =
<span class="default_value">(26, 13, 2)</span> <span class="default_value">(26, 14, 0)</span>
</div> </div>
@ -117,7 +117,7 @@
<section id="version"> <section id="version">
<div class="attr variable"> <div class="attr variable">
<span class="name">version</span><span class="annotation">: str</span> = <span class="name">version</span><span class="annotation">: str</span> =
<span class="default_value">&#39;26.13.2&#39;</span> <span class="default_value">&#39;26.14.0&#39;</span>
</div> </div>
@ -129,7 +129,7 @@
<section id="version_tuple"> <section id="version_tuple">
<div class="attr variable"> <div class="attr variable">
<span class="name">version_tuple</span><span class="annotation">: object</span> = <span class="name">version_tuple</span><span class="annotation">: object</span> =
<span class="default_value">(26, 13, 2)</span> <span class="default_value">(26, 14, 0)</span>
</div> </div>

View file

@ -355,7 +355,7 @@ dialect implementations in order to understand how their various components can
<section id="Athena"> <section id="Athena">
<div class="attr variable"> <div class="attr variable">
<span class="name">Athena</span> = <span class="name">Athena</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264100748240&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401428831184&#39;&gt;</span>
</div> </div>
@ -367,7 +367,7 @@ dialect implementations in order to understand how their various components can
<section id="BigQuery"> <section id="BigQuery">
<div class="attr variable"> <div class="attr variable">
<span class="name">BigQuery</span> = <span class="name">BigQuery</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264100743344&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401428826288&#39;&gt;</span>
</div> </div>
@ -379,7 +379,7 @@ dialect implementations in order to understand how their various components can
<section id="ClickHouse"> <section id="ClickHouse">
<div class="attr variable"> <div class="attr variable">
<span class="name">ClickHouse</span> = <span class="name">ClickHouse</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264115191664&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401444880144&#39;&gt;</span>
</div> </div>
@ -391,7 +391,7 @@ dialect implementations in order to understand how their various components can
<section id="Databricks"> <section id="Databricks">
<div class="attr variable"> <div class="attr variable">
<span class="name">Databricks</span> = <span class="name">Databricks</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264112300352&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401441104288&#39;&gt;</span>
</div> </div>
@ -403,7 +403,7 @@ dialect implementations in order to understand how their various components can
<section id="Doris"> <section id="Doris">
<div class="attr variable"> <div class="attr variable">
<span class="name">Doris</span> = <span class="name">Doris</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264112292576&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401441096368&#39;&gt;</span>
</div> </div>
@ -415,7 +415,7 @@ dialect implementations in order to understand how their various components can
<section id="Drill"> <section id="Drill">
<div class="attr variable"> <div class="attr variable">
<span class="name">Drill</span> = <span class="name">Drill</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264108318464&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401437204320&#39;&gt;</span>
</div> </div>
@ -427,7 +427,7 @@ dialect implementations in order to understand how their various components can
<section id="Druid"> <section id="Druid">
<div class="attr variable"> <div class="attr variable">
<span class="name">Druid</span> = <span class="name">Druid</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264108317552&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401437203312&#39;&gt;</span>
</div> </div>
@ -439,7 +439,7 @@ dialect implementations in order to understand how their various components can
<section id="DuckDB"> <section id="DuckDB">
<div class="attr variable"> <div class="attr variable">
<span class="name">DuckDB</span> = <span class="name">DuckDB</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264107845824&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401436698768&#39;&gt;</span>
</div> </div>
@ -451,7 +451,7 @@ dialect implementations in order to understand how their various components can
<section id="Dune"> <section id="Dune">
<div class="attr variable"> <div class="attr variable">
<span class="name">Dune</span> = <span class="name">Dune</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264116948320&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401444164208&#39;&gt;</span>
</div> </div>
@ -463,7 +463,7 @@ dialect implementations in order to understand how their various components can
<section id="Hive"> <section id="Hive">
<div class="attr variable"> <div class="attr variable">
<span class="name">Hive</span> = <span class="name">Hive</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264116955808&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401444170880&#39;&gt;</span>
</div> </div>
@ -475,7 +475,7 @@ dialect implementations in order to understand how their various components can
<section id="Materialize"> <section id="Materialize">
<div class="attr variable"> <div class="attr variable">
<span class="name">Materialize</span> = <span class="name">Materialize</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264111251152&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401440465504&#39;&gt;</span>
</div> </div>
@ -487,7 +487,7 @@ dialect implementations in order to understand how their various components can
<section id="MySQL"> <section id="MySQL">
<div class="attr variable"> <div class="attr variable">
<span class="name">MySQL</span> = <span class="name">MySQL</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264115116528&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401444677632&#39;&gt;</span>
</div> </div>
@ -499,7 +499,7 @@ dialect implementations in order to understand how their various components can
<section id="Oracle"> <section id="Oracle">
<div class="attr variable"> <div class="attr variable">
<span class="name">Oracle</span> = <span class="name">Oracle</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264102972624&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401431039232&#39;&gt;</span>
</div> </div>
@ -511,7 +511,7 @@ dialect implementations in order to understand how their various components can
<section id="Postgres"> <section id="Postgres">
<div class="attr variable"> <div class="attr variable">
<span class="name">Postgres</span> = <span class="name">Postgres</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264111467168&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401440107120&#39;&gt;</span>
</div> </div>
@ -523,7 +523,7 @@ dialect implementations in order to understand how their various components can
<section id="Presto"> <section id="Presto">
<div class="attr variable"> <div class="attr variable">
<span class="name">Presto</span> = <span class="name">Presto</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264102706336&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401430772944&#39;&gt;</span>
</div> </div>
@ -535,7 +535,7 @@ dialect implementations in order to understand how their various components can
<section id="PRQL"> <section id="PRQL">
<div class="attr variable"> <div class="attr variable">
<span class="name">PRQL</span> = <span class="name">PRQL</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264102696928&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401430763440&#39;&gt;</span>
</div> </div>
@ -547,7 +547,7 @@ dialect implementations in order to understand how their various components can
<section id="Redshift"> <section id="Redshift">
<div class="attr variable"> <div class="attr variable">
<span class="name">Redshift</span> = <span class="name">Redshift</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264103185808&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401431252416&#39;&gt;</span>
</div> </div>
@ -559,7 +559,7 @@ dialect implementations in order to understand how their various components can
<section id="RisingWave"> <section id="RisingWave">
<div class="attr variable"> <div class="attr variable">
<span class="name">RisingWave</span> = <span class="name">RisingWave</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264103194400&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401431260912&#39;&gt;</span>
</div> </div>
@ -571,7 +571,7 @@ dialect implementations in order to understand how their various components can
<section id="Snowflake"> <section id="Snowflake">
<div class="attr variable"> <div class="attr variable">
<span class="name">Snowflake</span> = <span class="name">Snowflake</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264102785376&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401430851984&#39;&gt;</span>
</div> </div>
@ -583,7 +583,7 @@ dialect implementations in order to understand how their various components can
<section id="Spark"> <section id="Spark">
<div class="attr variable"> <div class="attr variable">
<span class="name">Spark</span> = <span class="name">Spark</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264102778560&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401430845072&#39;&gt;</span>
</div> </div>
@ -595,7 +595,7 @@ dialect implementations in order to understand how their various components can
<section id="Spark2"> <section id="Spark2">
<div class="attr variable"> <div class="attr variable">
<span class="name">Spark2</span> = <span class="name">Spark2</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264117325104&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401444539840&#39;&gt;</span>
</div> </div>
@ -607,7 +607,7 @@ dialect implementations in order to understand how their various components can
<section id="SQLite"> <section id="SQLite">
<div class="attr variable"> <div class="attr variable">
<span class="name">SQLite</span> = <span class="name">SQLite</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264117328656&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401444543392&#39;&gt;</span>
</div> </div>
@ -619,7 +619,7 @@ dialect implementations in order to understand how their various components can
<section id="StarRocks"> <section id="StarRocks">
<div class="attr variable"> <div class="attr variable">
<span class="name">StarRocks</span> = <span class="name">StarRocks</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264112789664&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401441410064&#39;&gt;</span>
</div> </div>
@ -631,7 +631,7 @@ dialect implementations in order to understand how their various components can
<section id="Tableau"> <section id="Tableau">
<div class="attr variable"> <div class="attr variable">
<span class="name">Tableau</span> = <span class="name">Tableau</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264112797488&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401441421296&#39;&gt;</span>
</div> </div>
@ -643,7 +643,7 @@ dialect implementations in order to understand how their various components can
<section id="Teradata"> <section id="Teradata">
<div class="attr variable"> <div class="attr variable">
<span class="name">Teradata</span> = <span class="name">Teradata</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264112400192&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401441187648&#39;&gt;</span>
</div> </div>
@ -655,7 +655,7 @@ dialect implementations in order to understand how their various components can
<section id="Trino"> <section id="Trino">
<div class="attr variable"> <div class="attr variable">
<span class="name">Trino</span> = <span class="name">Trino</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264112391696&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401441179200&#39;&gt;</span>
</div> </div>
@ -667,7 +667,7 @@ dialect implementations in order to understand how their various components can
<section id="TSQL"> <section id="TSQL">
<div class="attr variable"> <div class="attr variable">
<span class="name">TSQL</span> = <span class="name">TSQL</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264115133680&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401444636176&#39;&gt;</span>
</div> </div>
@ -679,7 +679,7 @@ dialect implementations in order to understand how their various components can
<section id="Dialect"> <section id="Dialect">
<div class="attr variable"> <div class="attr variable">
<span class="name">Dialect</span> = <span class="name">Dialect</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264105668192&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401433734752&#39;&gt;</span>
</div> </div>
@ -691,7 +691,7 @@ dialect implementations in order to understand how their various components can
<section id="Dialects"> <section id="Dialects">
<div class="attr variable"> <div class="attr variable">
<span class="name">Dialects</span> = <span class="name">Dialects</span> =
<span class="default_value">&lt;MagicMock id=&#39;140264105670064&#39;&gt;</span> <span class="default_value">&lt;MagicMock id=&#39;140401433736528&#39;&gt;</span>
</div> </div>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -62264,7 +62264,7 @@ Otherwise, this resets the expressions.</li>
<div id="DataType.STRUCT_TYPES" class="classattr"> <div id="DataType.STRUCT_TYPES" class="classattr">
<div class="attr variable"> <div class="attr variable">
<span class="name">STRUCT_TYPES</span> = <span class="name">STRUCT_TYPES</span> =
<span class="default_value">{&lt;Type.OBJECT: &#39;OBJECT&#39;&gt;, &lt;Type.UNION: &#39;UNION&#39;&gt;, &lt;Type.STRUCT: &#39;STRUCT&#39;&gt;, &lt;Type.NESTED: &#39;NESTED&#39;&gt;}</span> <span class="default_value">{&lt;Type.UNION: &#39;UNION&#39;&gt;, &lt;Type.OBJECT: &#39;OBJECT&#39;&gt;, &lt;Type.STRUCT: &#39;STRUCT&#39;&gt;, &lt;Type.NESTED: &#39;NESTED&#39;&gt;}</span>
</div> </div>
@ -62276,7 +62276,7 @@ Otherwise, this resets the expressions.</li>
<div id="DataType.ARRAY_TYPES" class="classattr"> <div id="DataType.ARRAY_TYPES" class="classattr">
<div class="attr variable"> <div class="attr variable">
<span class="name">ARRAY_TYPES</span> = <span class="name">ARRAY_TYPES</span> =
<span class="default_value">{&lt;Type.ARRAY: &#39;ARRAY&#39;&gt;, &lt;Type.LIST: &#39;LIST&#39;&gt;}</span> <span class="default_value">{&lt;Type.LIST: &#39;LIST&#39;&gt;, &lt;Type.ARRAY: &#39;ARRAY&#39;&gt;}</span>
</div> </div>
@ -62289,7 +62289,7 @@ Otherwise, this resets the expressions.</li>
<div class="attr variable"> <div class="attr variable">
<span class="name">NESTED_TYPES</span> = <span class="name">NESTED_TYPES</span> =
<input id="DataType.NESTED_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="DataType.NESTED_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="DataType.NESTED_TYPES-view-value"></label><span class="default_value">{&lt;Type.OBJECT: &#39;OBJECT&#39;&gt;, &lt;Type.MAP: &#39;MAP&#39;&gt;, &lt;Type.LIST: &#39;LIST&#39;&gt;, &lt;Type.STRUCT: &#39;STRUCT&#39;&gt;, &lt;Type.NESTED: &#39;NESTED&#39;&gt;, &lt;Type.ARRAY: &#39;ARRAY&#39;&gt;, &lt;Type.UNION: &#39;UNION&#39;&gt;}</span> <label class="view-value-button pdoc-button" for="DataType.NESTED_TYPES-view-value"></label><span class="default_value">{&lt;Type.UNION: &#39;UNION&#39;&gt;, &lt;Type.OBJECT: &#39;OBJECT&#39;&gt;, &lt;Type.MAP: &#39;MAP&#39;&gt;, &lt;Type.NESTED: &#39;NESTED&#39;&gt;, &lt;Type.LIST: &#39;LIST&#39;&gt;, &lt;Type.STRUCT: &#39;STRUCT&#39;&gt;, &lt;Type.ARRAY: &#39;ARRAY&#39;&gt;}</span>
</div> </div>
@ -62302,7 +62302,7 @@ Otherwise, this resets the expressions.</li>
<div class="attr variable"> <div class="attr variable">
<span class="name">TEXT_TYPES</span> = <span class="name">TEXT_TYPES</span> =
<input id="DataType.TEXT_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="DataType.TEXT_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="DataType.TEXT_TYPES-view-value"></label><span class="default_value">{&lt;Type.VARCHAR: &#39;VARCHAR&#39;&gt;, &lt;Type.TEXT: &#39;TEXT&#39;&gt;, &lt;Type.NVARCHAR: &#39;NVARCHAR&#39;&gt;, &lt;Type.CHAR: &#39;CHAR&#39;&gt;, &lt;Type.NCHAR: &#39;NCHAR&#39;&gt;, &lt;Type.NAME: &#39;NAME&#39;&gt;}</span> <label class="view-value-button pdoc-button" for="DataType.TEXT_TYPES-view-value"></label><span class="default_value">{&lt;Type.TEXT: &#39;TEXT&#39;&gt;, &lt;Type.CHAR: &#39;CHAR&#39;&gt;, &lt;Type.NAME: &#39;NAME&#39;&gt;, &lt;Type.NVARCHAR: &#39;NVARCHAR&#39;&gt;, &lt;Type.NCHAR: &#39;NCHAR&#39;&gt;, &lt;Type.VARCHAR: &#39;VARCHAR&#39;&gt;}</span>
</div> </div>
@ -62315,7 +62315,7 @@ Otherwise, this resets the expressions.</li>
<div class="attr variable"> <div class="attr variable">
<span class="name">SIGNED_INTEGER_TYPES</span> = <span class="name">SIGNED_INTEGER_TYPES</span> =
<input id="DataType.SIGNED_INTEGER_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="DataType.SIGNED_INTEGER_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="DataType.SIGNED_INTEGER_TYPES-view-value"></label><span class="default_value">{&lt;Type.BIGINT: &#39;BIGINT&#39;&gt;, &lt;Type.SMALLINT: &#39;SMALLINT&#39;&gt;, &lt;Type.INT128: &#39;INT128&#39;&gt;, &lt;Type.TINYINT: &#39;TINYINT&#39;&gt;, &lt;Type.INT256: &#39;INT256&#39;&gt;, &lt;Type.INT: &#39;INT&#39;&gt;, &lt;Type.MEDIUMINT: &#39;MEDIUMINT&#39;&gt;}</span> <label class="view-value-button pdoc-button" for="DataType.SIGNED_INTEGER_TYPES-view-value"></label><span class="default_value">{&lt;Type.INT: &#39;INT&#39;&gt;, &lt;Type.TINYINT: &#39;TINYINT&#39;&gt;, &lt;Type.MEDIUMINT: &#39;MEDIUMINT&#39;&gt;, &lt;Type.SMALLINT: &#39;SMALLINT&#39;&gt;, &lt;Type.INT256: &#39;INT256&#39;&gt;, &lt;Type.INT128: &#39;INT128&#39;&gt;, &lt;Type.BIGINT: &#39;BIGINT&#39;&gt;}</span>
</div> </div>
@ -62328,7 +62328,7 @@ Otherwise, this resets the expressions.</li>
<div class="attr variable"> <div class="attr variable">
<span class="name">UNSIGNED_INTEGER_TYPES</span> = <span class="name">UNSIGNED_INTEGER_TYPES</span> =
<input id="DataType.UNSIGNED_INTEGER_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="DataType.UNSIGNED_INTEGER_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="DataType.UNSIGNED_INTEGER_TYPES-view-value"></label><span class="default_value">{&lt;Type.UINT128: &#39;UINT128&#39;&gt;, &lt;Type.UINT256: &#39;UINT256&#39;&gt;, &lt;Type.UINT: &#39;UINT&#39;&gt;, &lt;Type.UMEDIUMINT: &#39;UMEDIUMINT&#39;&gt;, &lt;Type.USMALLINT: &#39;USMALLINT&#39;&gt;, &lt;Type.UBIGINT: &#39;UBIGINT&#39;&gt;, &lt;Type.UTINYINT: &#39;UTINYINT&#39;&gt;}</span> <label class="view-value-button pdoc-button" for="DataType.UNSIGNED_INTEGER_TYPES-view-value"></label><span class="default_value">{&lt;Type.UINT256: &#39;UINT256&#39;&gt;, &lt;Type.UINT: &#39;UINT&#39;&gt;, &lt;Type.UBIGINT: &#39;UBIGINT&#39;&gt;, &lt;Type.UMEDIUMINT: &#39;UMEDIUMINT&#39;&gt;, &lt;Type.UTINYINT: &#39;UTINYINT&#39;&gt;, &lt;Type.UINT128: &#39;UINT128&#39;&gt;, &lt;Type.USMALLINT: &#39;USMALLINT&#39;&gt;}</span>
</div> </div>
@ -62341,7 +62341,7 @@ Otherwise, this resets the expressions.</li>
<div class="attr variable"> <div class="attr variable">
<span class="name">INTEGER_TYPES</span> = <span class="name">INTEGER_TYPES</span> =
<input id="DataType.INTEGER_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="DataType.INTEGER_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="DataType.INTEGER_TYPES-view-value"></label><span class="default_value">{&lt;Type.BIGINT: &#39;BIGINT&#39;&gt;, &lt;Type.SMALLINT: &#39;SMALLINT&#39;&gt;, &lt;Type.UINT128: &#39;UINT128&#39;&gt;, &lt;Type.INT128: &#39;INT128&#39;&gt;, &lt;Type.TINYINT: &#39;TINYINT&#39;&gt;, &lt;Type.UINT256: &#39;UINT256&#39;&gt;, &lt;Type.UINT: &#39;UINT&#39;&gt;, &lt;Type.UMEDIUMINT: &#39;UMEDIUMINT&#39;&gt;, &lt;Type.BIT: &#39;BIT&#39;&gt;, &lt;Type.USMALLINT: &#39;USMALLINT&#39;&gt;, &lt;Type.INT256: &#39;INT256&#39;&gt;, &lt;Type.INT: &#39;INT&#39;&gt;, &lt;Type.UBIGINT: &#39;UBIGINT&#39;&gt;, &lt;Type.UTINYINT: &#39;UTINYINT&#39;&gt;, &lt;Type.MEDIUMINT: &#39;MEDIUMINT&#39;&gt;}</span> <label class="view-value-button pdoc-button" for="DataType.INTEGER_TYPES-view-value"></label><span class="default_value">{&lt;Type.UINT256: &#39;UINT256&#39;&gt;, &lt;Type.INT: &#39;INT&#39;&gt;, &lt;Type.UINT: &#39;UINT&#39;&gt;, &lt;Type.UBIGINT: &#39;UBIGINT&#39;&gt;, &lt;Type.TINYINT: &#39;TINYINT&#39;&gt;, &lt;Type.MEDIUMINT: &#39;MEDIUMINT&#39;&gt;, &lt;Type.UMEDIUMINT: &#39;UMEDIUMINT&#39;&gt;, &lt;Type.UTINYINT: &#39;UTINYINT&#39;&gt;, &lt;Type.BIT: &#39;BIT&#39;&gt;, &lt;Type.SMALLINT: &#39;SMALLINT&#39;&gt;, &lt;Type.USMALLINT: &#39;USMALLINT&#39;&gt;, &lt;Type.INT256: &#39;INT256&#39;&gt;, &lt;Type.UINT128: &#39;UINT128&#39;&gt;, &lt;Type.INT128: &#39;INT128&#39;&gt;, &lt;Type.BIGINT: &#39;BIGINT&#39;&gt;}</span>
</div> </div>
@ -62353,7 +62353,7 @@ Otherwise, this resets the expressions.</li>
<div id="DataType.FLOAT_TYPES" class="classattr"> <div id="DataType.FLOAT_TYPES" class="classattr">
<div class="attr variable"> <div class="attr variable">
<span class="name">FLOAT_TYPES</span> = <span class="name">FLOAT_TYPES</span> =
<span class="default_value">{&lt;Type.FLOAT: &#39;FLOAT&#39;&gt;, &lt;Type.DOUBLE: &#39;DOUBLE&#39;&gt;}</span> <span class="default_value">{&lt;Type.DOUBLE: &#39;DOUBLE&#39;&gt;, &lt;Type.FLOAT: &#39;FLOAT&#39;&gt;}</span>
</div> </div>
@ -62366,7 +62366,7 @@ Otherwise, this resets the expressions.</li>
<div class="attr variable"> <div class="attr variable">
<span class="name">REAL_TYPES</span> = <span class="name">REAL_TYPES</span> =
<input id="DataType.REAL_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="DataType.REAL_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="DataType.REAL_TYPES-view-value"></label><span class="default_value">{&lt;Type.UDOUBLE: &#39;UDOUBLE&#39;&gt;, &lt;Type.DECIMAL32: &#39;DECIMAL32&#39;&gt;, &lt;Type.DECIMAL128: &#39;DECIMAL128&#39;&gt;, &lt;Type.DOUBLE: &#39;DOUBLE&#39;&gt;, &lt;Type.SMALLMONEY: &#39;SMALLMONEY&#39;&gt;, &lt;Type.DECIMAL256: &#39;DECIMAL256&#39;&gt;, &lt;Type.FLOAT: &#39;FLOAT&#39;&gt;, &lt;Type.UDECIMAL: &#39;UDECIMAL&#39;&gt;, &lt;Type.DECIMAL: &#39;DECIMAL&#39;&gt;, &lt;Type.MONEY: &#39;MONEY&#39;&gt;, &lt;Type.DECIMAL64: &#39;DECIMAL64&#39;&gt;, &lt;Type.BIGDECIMAL: &#39;BIGDECIMAL&#39;&gt;}</span> <label class="view-value-button pdoc-button" for="DataType.REAL_TYPES-view-value"></label><span class="default_value">{&lt;Type.UDECIMAL: &#39;UDECIMAL&#39;&gt;, &lt;Type.FLOAT: &#39;FLOAT&#39;&gt;, &lt;Type.MONEY: &#39;MONEY&#39;&gt;, &lt;Type.DECIMAL: &#39;DECIMAL&#39;&gt;, &lt;Type.DECIMAL256: &#39;DECIMAL256&#39;&gt;, &lt;Type.UDOUBLE: &#39;UDOUBLE&#39;&gt;, &lt;Type.DECIMAL64: &#39;DECIMAL64&#39;&gt;, &lt;Type.DECIMAL128: &#39;DECIMAL128&#39;&gt;, &lt;Type.SMALLMONEY: &#39;SMALLMONEY&#39;&gt;, &lt;Type.BIGDECIMAL: &#39;BIGDECIMAL&#39;&gt;, &lt;Type.DOUBLE: &#39;DOUBLE&#39;&gt;, &lt;Type.DECIMAL32: &#39;DECIMAL32&#39;&gt;}</span>
</div> </div>
@ -62379,7 +62379,7 @@ Otherwise, this resets the expressions.</li>
<div class="attr variable"> <div class="attr variable">
<span class="name">NUMERIC_TYPES</span> = <span class="name">NUMERIC_TYPES</span> =
<input id="DataType.NUMERIC_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="DataType.NUMERIC_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="DataType.NUMERIC_TYPES-view-value"></label><span class="default_value">{&lt;Type.BIGINT: &#39;BIGINT&#39;&gt;, &lt;Type.SMALLINT: &#39;SMALLINT&#39;&gt;, &lt;Type.UINT256: &#39;UINT256&#39;&gt;, &lt;Type.BIT: &#39;BIT&#39;&gt;, &lt;Type.UMEDIUMINT: &#39;UMEDIUMINT&#39;&gt;, &lt;Type.DOUBLE: &#39;DOUBLE&#39;&gt;, &lt;Type.USMALLINT: &#39;USMALLINT&#39;&gt;, &lt;Type.INT256: &#39;INT256&#39;&gt;, &lt;Type.INT: &#39;INT&#39;&gt;, &lt;Type.SMALLMONEY: &#39;SMALLMONEY&#39;&gt;, &lt;Type.UTINYINT: &#39;UTINYINT&#39;&gt;, &lt;Type.UDECIMAL: &#39;UDECIMAL&#39;&gt;, &lt;Type.MEDIUMINT: &#39;MEDIUMINT&#39;&gt;, &lt;Type.MONEY: &#39;MONEY&#39;&gt;, &lt;Type.DECIMAL: &#39;DECIMAL&#39;&gt;, &lt;Type.UINT128: &#39;UINT128&#39;&gt;, &lt;Type.UDOUBLE: &#39;UDOUBLE&#39;&gt;, &lt;Type.FLOAT: &#39;FLOAT&#39;&gt;, &lt;Type.INT128: &#39;INT128&#39;&gt;, &lt;Type.TINYINT: &#39;TINYINT&#39;&gt;, &lt;Type.UINT: &#39;UINT&#39;&gt;, &lt;Type.UBIGINT: &#39;UBIGINT&#39;&gt;, &lt;Type.DECIMAL256: &#39;DECIMAL256&#39;&gt;, &lt;Type.DECIMAL32: &#39;DECIMAL32&#39;&gt;, &lt;Type.DECIMAL128: &#39;DECIMAL128&#39;&gt;, &lt;Type.DECIMAL64: &#39;DECIMAL64&#39;&gt;, &lt;Type.BIGDECIMAL: &#39;BIGDECIMAL&#39;&gt;}</span> <label class="view-value-button pdoc-button" for="DataType.NUMERIC_TYPES-view-value"></label><span class="default_value">{&lt;Type.UINT: &#39;UINT&#39;&gt;, &lt;Type.UBIGINT: &#39;UBIGINT&#39;&gt;, &lt;Type.DECIMAL: &#39;DECIMAL&#39;&gt;, &lt;Type.UMEDIUMINT: &#39;UMEDIUMINT&#39;&gt;, &lt;Type.BIT: &#39;BIT&#39;&gt;, &lt;Type.SMALLMONEY: &#39;SMALLMONEY&#39;&gt;, &lt;Type.SMALLINT: &#39;SMALLINT&#39;&gt;, &lt;Type.TINYINT: &#39;TINYINT&#39;&gt;, &lt;Type.INT256: &#39;INT256&#39;&gt;, &lt;Type.UINT128: &#39;UINT128&#39;&gt;, &lt;Type.INT128: &#39;INT128&#39;&gt;, &lt;Type.BIGINT: &#39;BIGINT&#39;&gt;, &lt;Type.DECIMAL32: &#39;DECIMAL32&#39;&gt;, &lt;Type.UINT256: &#39;UINT256&#39;&gt;, &lt;Type.UDECIMAL: &#39;UDECIMAL&#39;&gt;, &lt;Type.INT: &#39;INT&#39;&gt;, &lt;Type.FLOAT: &#39;FLOAT&#39;&gt;, &lt;Type.MONEY: &#39;MONEY&#39;&gt;, &lt;Type.DECIMAL256: &#39;DECIMAL256&#39;&gt;, &lt;Type.MEDIUMINT: &#39;MEDIUMINT&#39;&gt;, &lt;Type.UTINYINT: &#39;UTINYINT&#39;&gt;, &lt;Type.UDOUBLE: &#39;UDOUBLE&#39;&gt;, &lt;Type.DECIMAL64: &#39;DECIMAL64&#39;&gt;, &lt;Type.DECIMAL128: &#39;DECIMAL128&#39;&gt;, &lt;Type.BIGDECIMAL: &#39;BIGDECIMAL&#39;&gt;, &lt;Type.DOUBLE: &#39;DOUBLE&#39;&gt;, &lt;Type.USMALLINT: &#39;USMALLINT&#39;&gt;}</span>
</div> </div>
@ -62392,7 +62392,7 @@ Otherwise, this resets the expressions.</li>
<div class="attr variable"> <div class="attr variable">
<span class="name">TEMPORAL_TYPES</span> = <span class="name">TEMPORAL_TYPES</span> =
<input id="DataType.TEMPORAL_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="DataType.TEMPORAL_TYPES-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="DataType.TEMPORAL_TYPES-view-value"></label><span class="default_value">{&lt;Type.TIMETZ: &#39;TIMETZ&#39;&gt;, &lt;Type.TIMESTAMP: &#39;TIMESTAMP&#39;&gt;, &lt;Type.DATE32: &#39;DATE32&#39;&gt;, &lt;Type.DATETIME: &#39;DATETIME&#39;&gt;, &lt;Type.SMALLDATETIME: &#39;SMALLDATETIME&#39;&gt;, &lt;Type.TIME: &#39;TIME&#39;&gt;, &lt;Type.TIMESTAMP_S: &#39;TIMESTAMP_S&#39;&gt;, &lt;Type.TIMESTAMP_NS: &#39;TIMESTAMP_NS&#39;&gt;, &lt;Type.DATETIME2: &#39;DATETIME2&#39;&gt;, &lt;Type.DATETIME64: &#39;DATETIME64&#39;&gt;, &lt;Type.TIMESTAMPNTZ: &#39;TIMESTAMPNTZ&#39;&gt;, &lt;Type.TIMESTAMP_MS: &#39;TIMESTAMP_MS&#39;&gt;, &lt;Type.TIMESTAMPTZ: &#39;TIMESTAMPTZ&#39;&gt;, &lt;Type.DATE: &#39;DATE&#39;&gt;, &lt;Type.TIMESTAMPLTZ: &#39;TIMESTAMPLTZ&#39;&gt;}</span> <label class="view-value-button pdoc-button" for="DataType.TEMPORAL_TYPES-view-value"></label><span class="default_value">{&lt;Type.DATE32: &#39;DATE32&#39;&gt;, &lt;Type.DATE: &#39;DATE&#39;&gt;, &lt;Type.SMALLDATETIME: &#39;SMALLDATETIME&#39;&gt;, &lt;Type.TIMESTAMP_MS: &#39;TIMESTAMP_MS&#39;&gt;, &lt;Type.TIMESTAMP: &#39;TIMESTAMP&#39;&gt;, &lt;Type.TIME: &#39;TIME&#39;&gt;, &lt;Type.TIMETZ: &#39;TIMETZ&#39;&gt;, &lt;Type.DATETIME2: &#39;DATETIME2&#39;&gt;, &lt;Type.TIMESTAMP_NS: &#39;TIMESTAMP_NS&#39;&gt;, &lt;Type.TIMESTAMP_S: &#39;TIMESTAMP_S&#39;&gt;, &lt;Type.TIMESTAMPTZ: &#39;TIMESTAMPTZ&#39;&gt;, &lt;Type.TIMESTAMPNTZ: &#39;TIMESTAMPNTZ&#39;&gt;, &lt;Type.TIMESTAMPLTZ: &#39;TIMESTAMPLTZ&#39;&gt;, &lt;Type.DATETIME: &#39;DATETIME&#39;&gt;, &lt;Type.DATETIME64: &#39;DATETIME64&#39;&gt;}</span>
</div> </div>

View file

@ -12211,7 +12211,7 @@ Default: True</li>
<div class="attr variable"> <div class="attr variable">
<span class="name">SUPPORTED_JSON_PATH_PARTS</span> = <span class="name">SUPPORTED_JSON_PATH_PARTS</span> =
<input id="Generator.SUPPORTED_JSON_PATH_PARTS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="Generator.SUPPORTED_JSON_PATH_PARTS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="Generator.SUPPORTED_JSON_PATH_PARTS-view-value"></label><span class="default_value">{&lt;class &#39;<a href="expressions.html#JSONPathRoot">sqlglot.expressions.JSONPathRoot</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathRecursive">sqlglot.expressions.JSONPathRecursive</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathKey">sqlglot.expressions.JSONPathKey</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathWildcard">sqlglot.expressions.JSONPathWildcard</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathFilter">sqlglot.expressions.JSONPathFilter</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathUnion">sqlglot.expressions.JSONPathUnion</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathSubscript">sqlglot.expressions.JSONPathSubscript</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathSelector">sqlglot.expressions.JSONPathSelector</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathSlice">sqlglot.expressions.JSONPathSlice</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathScript">sqlglot.expressions.JSONPathScript</a>&#39;&gt;}</span> <label class="view-value-button pdoc-button" for="Generator.SUPPORTED_JSON_PATH_PARTS-view-value"></label><span class="default_value">{&lt;class &#39;<a href="expressions.html#JSONPathFilter">sqlglot.expressions.JSONPathFilter</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathUnion">sqlglot.expressions.JSONPathUnion</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathSubscript">sqlglot.expressions.JSONPathSubscript</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathSelector">sqlglot.expressions.JSONPathSelector</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathSlice">sqlglot.expressions.JSONPathSlice</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathScript">sqlglot.expressions.JSONPathScript</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathRoot">sqlglot.expressions.JSONPathRoot</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathWildcard">sqlglot.expressions.JSONPathWildcard</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathRecursive">sqlglot.expressions.JSONPathRecursive</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathKey">sqlglot.expressions.JSONPathKey</a>&#39;&gt;}</span>
</div> </div>
@ -12649,7 +12649,7 @@ Default: True</li>
<div id="Generator.PARAMETERIZABLE_TEXT_TYPES" class="classattr"> <div id="Generator.PARAMETERIZABLE_TEXT_TYPES" class="classattr">
<div class="attr variable"> <div class="attr variable">
<span class="name">PARAMETERIZABLE_TEXT_TYPES</span> = <span class="name">PARAMETERIZABLE_TEXT_TYPES</span> =
<span class="default_value">{&lt;Type.NVARCHAR: &#39;NVARCHAR&#39;&gt;, &lt;Type.CHAR: &#39;CHAR&#39;&gt;, &lt;Type.NCHAR: &#39;NCHAR&#39;&gt;, &lt;Type.VARCHAR: &#39;VARCHAR&#39;&gt;}</span> <span class="default_value">{&lt;Type.NVARCHAR: &#39;NVARCHAR&#39;&gt;, &lt;Type.VARCHAR: &#39;VARCHAR&#39;&gt;, &lt;Type.NCHAR: &#39;NCHAR&#39;&gt;, &lt;Type.CHAR: &#39;CHAR&#39;&gt;}</span>
</div> </div>

View file

@ -1926,7 +1926,7 @@ belong to some totally-ordered set.</p>
<section id="DATE_UNITS"> <section id="DATE_UNITS">
<div class="attr variable"> <div class="attr variable">
<span class="name">DATE_UNITS</span> = <span class="name">DATE_UNITS</span> =
<span class="default_value">{&#39;day&#39;, &#39;month&#39;, &#39;year&#39;, &#39;week&#39;, &#39;quarter&#39;, &#39;year_month&#39;}</span> <span class="default_value">{&#39;year&#39;, &#39;month&#39;, &#39;day&#39;, &#39;year_month&#39;, &#39;quarter&#39;, &#39;week&#39;}</span>
</div> </div>

View file

@ -641,7 +641,7 @@
<div class="attr variable"> <div class="attr variable">
<span class="name">ALL_JSON_PATH_PARTS</span> = <span class="name">ALL_JSON_PATH_PARTS</span> =
<input id="ALL_JSON_PATH_PARTS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="ALL_JSON_PATH_PARTS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="ALL_JSON_PATH_PARTS-view-value"></label><span class="default_value">{&lt;class &#39;<a href="expressions.html#JSONPathRoot">sqlglot.expressions.JSONPathRoot</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathRecursive">sqlglot.expressions.JSONPathRecursive</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathKey">sqlglot.expressions.JSONPathKey</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathWildcard">sqlglot.expressions.JSONPathWildcard</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathFilter">sqlglot.expressions.JSONPathFilter</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathUnion">sqlglot.expressions.JSONPathUnion</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathSubscript">sqlglot.expressions.JSONPathSubscript</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathSelector">sqlglot.expressions.JSONPathSelector</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathSlice">sqlglot.expressions.JSONPathSlice</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathScript">sqlglot.expressions.JSONPathScript</a>&#39;&gt;}</span> <label class="view-value-button pdoc-button" for="ALL_JSON_PATH_PARTS-view-value"></label><span class="default_value">{&lt;class &#39;<a href="expressions.html#JSONPathFilter">sqlglot.expressions.JSONPathFilter</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathUnion">sqlglot.expressions.JSONPathUnion</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathSubscript">sqlglot.expressions.JSONPathSubscript</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathSelector">sqlglot.expressions.JSONPathSelector</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathSlice">sqlglot.expressions.JSONPathSlice</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathScript">sqlglot.expressions.JSONPathScript</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathRoot">sqlglot.expressions.JSONPathRoot</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathWildcard">sqlglot.expressions.JSONPathWildcard</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathRecursive">sqlglot.expressions.JSONPathRecursive</a>&#39;&gt;, &lt;class &#39;<a href="expressions.html#JSONPathKey">sqlglot.expressions.JSONPathKey</a>&#39;&gt;}</span>
</div> </div>

File diff suppressed because one or more lines are too long

View file

@ -580,7 +580,7 @@ queries if it would result in multiple table selects in a single query:</p>
<div class="attr variable"> <div class="attr variable">
<span class="name">UNMERGABLE_ARGS</span> = <span class="name">UNMERGABLE_ARGS</span> =
<input id="UNMERGABLE_ARGS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="UNMERGABLE_ARGS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="UNMERGABLE_ARGS-view-value"></label><span class="default_value">{&#39;into&#39;, &#39;limit&#39;, &#39;sample&#39;, &#39;with&#39;, &#39;distinct&#39;, &#39;laterals&#39;, &#39;group&#39;, &#39;distribute&#39;, &#39;cluster&#39;, &#39;kind&#39;, &#39;format&#39;, &#39;prewhere&#39;, &#39;having&#39;, &#39;qualify&#39;, &#39;match&#39;, &#39;connect&#39;, &#39;operation_modifiers&#39;, &#39;offset&#39;, &#39;options&#39;, &#39;locks&#39;, &#39;pivots&#39;, &#39;settings&#39;, &#39;sort&#39;, &#39;windows&#39;}</span> <label class="view-value-button pdoc-button" for="UNMERGABLE_ARGS-view-value"></label><span class="default_value">{&#39;qualify&#39;, &#39;with&#39;, &#39;laterals&#39;, &#39;kind&#39;, &#39;windows&#39;, &#39;into&#39;, &#39;group&#39;, &#39;distinct&#39;, &#39;connect&#39;, &#39;pivots&#39;, &#39;locks&#39;, &#39;sample&#39;, &#39;match&#39;, &#39;operation_modifiers&#39;, &#39;having&#39;, &#39;options&#39;, &#39;format&#39;, &#39;distribute&#39;, &#39;settings&#39;, &#39;limit&#39;, &#39;sort&#39;, &#39;offset&#39;, &#39;cluster&#39;, &#39;prewhere&#39;}</span>
</div> </div>

View file

@ -3250,7 +3250,7 @@ prefix are statically known.</p>
<div class="attr variable"> <div class="attr variable">
<span class="name">DATETRUNC_COMPARISONS</span> = <span class="name">DATETRUNC_COMPARISONS</span> =
<input id="DATETRUNC_COMPARISONS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="DATETRUNC_COMPARISONS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="DATETRUNC_COMPARISONS-view-value"></label><span class="default_value">{&lt;class &#39;<a href="../expressions.html#LTE">sqlglot.expressions.LTE</a>&#39;&gt;, &lt;class &#39;<a href="../expressions.html#In">sqlglot.expressions.In</a>&#39;&gt;, &lt;class &#39;<a href="../expressions.html#GTE">sqlglot.expressions.GTE</a>&#39;&gt;, &lt;class &#39;<a href="../expressions.html#EQ">sqlglot.expressions.EQ</a>&#39;&gt;, &lt;class &#39;<a href="../expressions.html#NEQ">sqlglot.expressions.NEQ</a>&#39;&gt;, &lt;class &#39;<a href="../expressions.html#GT">sqlglot.expressions.GT</a>&#39;&gt;, &lt;class &#39;<a href="../expressions.html#LT">sqlglot.expressions.LT</a>&#39;&gt;}</span> <label class="view-value-button pdoc-button" for="DATETRUNC_COMPARISONS-view-value"></label><span class="default_value">{&lt;class &#39;<a href="../expressions.html#In">sqlglot.expressions.In</a>&#39;&gt;, &lt;class &#39;<a href="../expressions.html#GTE">sqlglot.expressions.GTE</a>&#39;&gt;, &lt;class &#39;<a href="../expressions.html#EQ">sqlglot.expressions.EQ</a>&#39;&gt;, &lt;class &#39;<a href="../expressions.html#LTE">sqlglot.expressions.LTE</a>&#39;&gt;, &lt;class &#39;<a href="../expressions.html#GT">sqlglot.expressions.GT</a>&#39;&gt;, &lt;class &#39;<a href="../expressions.html#LT">sqlglot.expressions.LT</a>&#39;&gt;, &lt;class &#39;<a href="../expressions.html#NEQ">sqlglot.expressions.NEQ</a>&#39;&gt;}</span>
</div> </div>
@ -3334,7 +3334,7 @@ prefix are statically known.</p>
<section id="JOINS"> <section id="JOINS">
<div class="attr variable"> <div class="attr variable">
<span class="name">JOINS</span> = <span class="name">JOINS</span> =
<span class="default_value">{(&#39;&#39;, &#39;&#39;), (&#39;RIGHT&#39;, &#39;&#39;), (&#39;RIGHT&#39;, &#39;OUTER&#39;), (&#39;&#39;, &#39;INNER&#39;)}</span> <span class="default_value">{(&#39;RIGHT&#39;, &#39;&#39;), (&#39;&#39;, &#39;INNER&#39;), (&#39;RIGHT&#39;, &#39;OUTER&#39;), (&#39;&#39;, &#39;&#39;)}</span>
</div> </div>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -9434,7 +9434,7 @@
<div class="attr variable"> <div class="attr variable">
<span class="name">TOKENS_PRECEDING_HINT</span> = <span class="name">TOKENS_PRECEDING_HINT</span> =
<input id="Tokenizer.TOKENS_PRECEDING_HINT-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="Tokenizer.TOKENS_PRECEDING_HINT-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="Tokenizer.TOKENS_PRECEDING_HINT-view-value"></label><span class="default_value">{&lt;<a href="#TokenType.INSERT">TokenType.INSERT</a>: &#39;INSERT&#39;&gt;, &lt;<a href="#TokenType.SELECT">TokenType.SELECT</a>: &#39;SELECT&#39;&gt;, &lt;<a href="#TokenType.DELETE">TokenType.DELETE</a>: &#39;DELETE&#39;&gt;, &lt;<a href="#TokenType.UPDATE">TokenType.UPDATE</a>: &#39;UPDATE&#39;&gt;}</span> <label class="view-value-button pdoc-button" for="Tokenizer.TOKENS_PRECEDING_HINT-view-value"></label><span class="default_value">{&lt;<a href="#TokenType.SELECT">TokenType.SELECT</a>: &#39;SELECT&#39;&gt;, &lt;<a href="#TokenType.UPDATE">TokenType.UPDATE</a>: &#39;UPDATE&#39;&gt;, &lt;<a href="#TokenType.DELETE">TokenType.DELETE</a>: &#39;DELETE&#39;&gt;, &lt;<a href="#TokenType.INSERT">TokenType.INSERT</a>: &#39;INSERT&#39;&gt;}</span>
</div> </div>
@ -9473,7 +9473,7 @@
<div class="attr variable"> <div class="attr variable">
<span class="name">COMMANDS</span> = <span class="name">COMMANDS</span> =
<input id="Tokenizer.COMMANDS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> <input id="Tokenizer.COMMANDS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<label class="view-value-button pdoc-button" for="Tokenizer.COMMANDS-view-value"></label><span class="default_value">{&lt;<a href="#TokenType.EXECUTE">TokenType.EXECUTE</a>: &#39;EXECUTE&#39;&gt;, &lt;<a href="#TokenType.SHOW">TokenType.SHOW</a>: &#39;SHOW&#39;&gt;, &lt;<a href="#TokenType.FETCH">TokenType.FETCH</a>: &#39;FETCH&#39;&gt;, &lt;<a href="#TokenType.RENAME">TokenType.RENAME</a>: &#39;RENAME&#39;&gt;, &lt;<a href="#TokenType.COMMAND">TokenType.COMMAND</a>: &#39;COMMAND&#39;&gt;}</span> <label class="view-value-button pdoc-button" for="Tokenizer.COMMANDS-view-value"></label><span class="default_value">{&lt;<a href="#TokenType.EXECUTE">TokenType.EXECUTE</a>: &#39;EXECUTE&#39;&gt;, &lt;<a href="#TokenType.SHOW">TokenType.SHOW</a>: &#39;SHOW&#39;&gt;, &lt;<a href="#TokenType.COMMAND">TokenType.COMMAND</a>: &#39;COMMAND&#39;&gt;, &lt;<a href="#TokenType.FETCH">TokenType.FETCH</a>: &#39;FETCH&#39;&gt;, &lt;<a href="#TokenType.RENAME">TokenType.RENAME</a>: &#39;RENAME&#39;&gt;}</span>
</div> </div>

View file

@ -610,6 +610,8 @@ class Hive(Dialect):
e: f"({self.expressions(e, 'this', indent=False)})", e: f"({self.expressions(e, 'this', indent=False)})",
exp.NotForReplicationColumnConstraint: lambda *_: "", exp.NotForReplicationColumnConstraint: lambda *_: "",
exp.OnProperty: lambda *_: "", exp.OnProperty: lambda *_: "",
exp.PartitionedByBucket: lambda self, e: self.func("BUCKET", e.expression, e.this),
exp.PartitionByTruncate: lambda self, e: self.func("TRUNCATE", e.expression, e.this),
exp.PrimaryKeyColumnConstraint: lambda *_: "PRIMARY KEY", exp.PrimaryKeyColumnConstraint: lambda *_: "PRIMARY KEY",
exp.WeekOfYear: rename_func("WEEKOFYEAR"), exp.WeekOfYear: rename_func("WEEKOFYEAR"),
exp.DayOfMonth: rename_func("DAYOFMONTH"), exp.DayOfMonth: rename_func("DAYOFMONTH"),

View file

@ -586,7 +586,6 @@ class Postgres(Dialect):
[transforms.add_within_group_for_percentiles] [transforms.add_within_group_for_percentiles]
), ),
exp.Pivot: no_pivot_sql, exp.Pivot: no_pivot_sql,
exp.Pow: lambda self, e: self.binary(e, "^"),
exp.Rand: rename_func("RANDOM"), exp.Rand: rename_func("RANDOM"),
exp.RegexpLike: lambda self, e: self.binary(e, "~"), exp.RegexpLike: lambda self, e: self.binary(e, "~"),
exp.RegexpILike: lambda self, e: self.binary(e, "~*"), exp.RegexpILike: lambda self, e: self.binary(e, "~*"),

View file

@ -57,8 +57,12 @@ def _no_sort_array(self: Presto.Generator, expression: exp.SortArray) -> str:
def _schema_sql(self: Presto.Generator, expression: exp.Schema) -> str: def _schema_sql(self: Presto.Generator, expression: exp.Schema) -> str:
if isinstance(expression.parent, exp.PartitionedByProperty): if isinstance(expression.parent, exp.PartitionedByProperty):
columns = ", ".join(f"'{c.name}'" for c in expression.expressions) partition_exprs = [
return f"ARRAY[{columns}]" self.sql(c) if isinstance(c, (exp.Func, exp.Property)) else self.sql(c, "this")
for c in expression.expressions
]
return self.sql(exp.Array(expressions=[exp.Literal.string(c) for c in partition_exprs]))
if expression.parent: if expression.parent:
for schema in expression.parent.find_all(exp.Schema): for schema in expression.parent.find_all(exp.Schema):

View file

@ -221,9 +221,6 @@ class Redshift(Postgres):
# Postgres doesn't support JSON_PARSE, but Redshift does # Postgres doesn't support JSON_PARSE, but Redshift does
TRANSFORMS.pop(exp.ParseJSON) TRANSFORMS.pop(exp.ParseJSON)
# Redshift uses the POW | POWER (expr1, expr2) syntax instead of expr1 ^ expr2 (postgres)
TRANSFORMS.pop(exp.Pow)
# Redshift supports these functions # Redshift supports these functions
TRANSFORMS.pop(exp.AnyValue) TRANSFORMS.pop(exp.AnyValue)
TRANSFORMS.pop(exp.LastDay) TRANSFORMS.pop(exp.LastDay)

View file

@ -1933,7 +1933,7 @@ class TransformColumnConstraint(ColumnConstraintKind):
class PrimaryKeyColumnConstraint(ColumnConstraintKind): class PrimaryKeyColumnConstraint(ColumnConstraintKind):
arg_types = {"desc": False} arg_types = {"desc": False, "options": False}
class TitleColumnConstraint(ColumnConstraintKind): class TitleColumnConstraint(ColumnConstraintKind):
@ -1941,7 +1941,13 @@ class TitleColumnConstraint(ColumnConstraintKind):
class UniqueColumnConstraint(ColumnConstraintKind): class UniqueColumnConstraint(ColumnConstraintKind):
arg_types = {"this": False, "index_type": False, "on_conflict": False, "nulls": False} arg_types = {
"this": False,
"index_type": False,
"on_conflict": False,
"nulls": False,
"options": False,
}
class UppercaseColumnConstraint(ColumnConstraintKind): class UppercaseColumnConstraint(ColumnConstraintKind):
@ -2140,6 +2146,7 @@ class ForeignKey(Expression):
"reference": False, "reference": False,
"delete": False, "delete": False,
"update": False, "update": False,
"options": False,
} }
@ -2917,6 +2924,14 @@ class PartitionedByProperty(Property):
arg_types = {"this": True} arg_types = {"this": True}
class PartitionedByBucket(Property):
arg_types = {"this": True, "expression": True}
class PartitionByTruncate(Property):
arg_types = {"this": True, "expression": True}
# https://docs.starrocks.io/docs/sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE/ # https://docs.starrocks.io/docs/sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE/
class PartitionByRangeProperty(Property): class PartitionByRangeProperty(Property):
arg_types = {"partition_expressions": True, "create_expressions": True} arg_types = {"partition_expressions": True, "create_expressions": True}

View file

@ -170,6 +170,8 @@ class Generator(metaclass=_Generator):
exp.Operator: lambda self, e: self.binary(e, ""), # The operator is produced in `binary` exp.Operator: lambda self, e: self.binary(e, ""), # The operator is produced in `binary`
exp.OutputModelProperty: lambda self, e: f"OUTPUT{self.sql(e, 'this')}", exp.OutputModelProperty: lambda self, e: f"OUTPUT{self.sql(e, 'this')}",
exp.PathColumnConstraint: lambda self, e: f"PATH {self.sql(e, 'this')}", exp.PathColumnConstraint: lambda self, e: f"PATH {self.sql(e, 'this')}",
exp.PartitionedByBucket: lambda self, e: self.func("BUCKET", e.this, e.expression),
exp.PartitionByTruncate: lambda self, e: self.func("TRUNCATE", e.this, e.expression),
exp.PivotAny: lambda self, e: f"ANY{self.sql(e, 'this')}", exp.PivotAny: lambda self, e: f"ANY{self.sql(e, 'this')}",
exp.ProjectionPolicyColumnConstraint: lambda self, exp.ProjectionPolicyColumnConstraint: lambda self,
e: f"PROJECTION POLICY {self.sql(e, 'this')}", e: f"PROJECTION POLICY {self.sql(e, 'this')}",
@ -1064,7 +1066,9 @@ class Generator(metaclass=_Generator):
desc = expression.args.get("desc") desc = expression.args.get("desc")
if desc is not None: if desc is not None:
return f"PRIMARY KEY{' DESC' if desc else ' ASC'}" return f"PRIMARY KEY{' DESC' if desc else ' ASC'}"
return "PRIMARY KEY" options = self.expressions(expression, key="options", flat=True, sep=" ")
options = f" {options}" if options else ""
return f"PRIMARY KEY{options}"
def uniquecolumnconstraint_sql(self, expression: exp.UniqueColumnConstraint) -> str: def uniquecolumnconstraint_sql(self, expression: exp.UniqueColumnConstraint) -> str:
this = self.sql(expression, "this") this = self.sql(expression, "this")
@ -1074,7 +1078,9 @@ class Generator(metaclass=_Generator):
on_conflict = self.sql(expression, "on_conflict") on_conflict = self.sql(expression, "on_conflict")
on_conflict = f" {on_conflict}" if on_conflict else "" on_conflict = f" {on_conflict}" if on_conflict else ""
nulls_sql = " NULLS NOT DISTINCT" if expression.args.get("nulls") else "" nulls_sql = " NULLS NOT DISTINCT" if expression.args.get("nulls") else ""
return f"UNIQUE{nulls_sql}{this}{index_type}{on_conflict}" options = self.expressions(expression, key="options", flat=True, sep=" ")
options = f" {options}" if options else ""
return f"UNIQUE{nulls_sql}{this}{index_type}{on_conflict}{options}"
def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str: def createable_sql(self, expression: exp.Create, locations: t.DefaultDict) -> str:
return self.sql(expression, "this") return self.sql(expression, "this")
@ -2919,7 +2925,9 @@ class Generator(metaclass=_Generator):
delete = f" ON DELETE {delete}" if delete else "" delete = f" ON DELETE {delete}" if delete else ""
update = self.sql(expression, "update") update = self.sql(expression, "update")
update = f" ON UPDATE {update}" if update else "" update = f" ON UPDATE {update}" if update else ""
return f"FOREIGN KEY{expressions}{reference}{delete}{update}" options = self.expressions(expression, key="options", flat=True, sep=" ")
options = f" {options}" if options else ""
return f"FOREIGN KEY{expressions}{reference}{delete}{update}{options}"
def primarykey_sql(self, expression: exp.ForeignKey) -> str: def primarykey_sql(self, expression: exp.ForeignKey) -> str:
expressions = self.expressions(expression, flat=True) expressions = self.expressions(expression, flat=True)

View file

@ -93,15 +93,18 @@ def remove_redundant_casts(expression: exp.Expression) -> exp.Expression:
if ( if (
isinstance(expression, exp.Cast) isinstance(expression, exp.Cast)
and expression.this.type and expression.this.type
and expression.to.this == expression.this.type.this and expression.to == expression.this.type
): ):
return expression.this return expression.this
if ( if (
isinstance(expression, (exp.Date, exp.TsOrDsToDate)) isinstance(expression, (exp.Date, exp.TsOrDsToDate))
and expression.this.type and expression.this.type
and expression.this.type.this == exp.DataType.Type.DATE and expression.this.type.this == exp.DataType.Type.DATE
and not expression.this.type.expressions
): ):
return expression.this return expression.this
return expression return expression

View file

@ -105,7 +105,7 @@ def unnest(select, parent_select, next_alias_name):
.from_(select.subquery("_q", copy=False), copy=False) .from_(select.subquery("_q", copy=False), copy=False)
.group_by(exp.column(value.alias, "_q"), copy=False) .group_by(exp.column(value.alias, "_q"), copy=False)
) )
else: elif not find_in_scope(value.this, exp.AggFunc):
select = select.group_by(value.this, copy=False) select = select.group_by(value.this, copy=False)
parent_select.join( parent_select.join(

View file

@ -218,7 +218,7 @@ class Parser(metaclass=_Parser):
"GENERATE_DATE_ARRAY": lambda args: exp.GenerateDateArray( "GENERATE_DATE_ARRAY": lambda args: exp.GenerateDateArray(
start=seq_get(args, 0), start=seq_get(args, 0),
end=seq_get(args, 1), end=seq_get(args, 1),
step=seq_get(args, 2) or exp.Interval(this=exp.Literal.number(1), unit=exp.var("DAY")), step=seq_get(args, 2) or exp.Interval(this=exp.Literal.string(1), unit=exp.var("DAY")),
), ),
"GLOB": lambda args: exp.Glob(this=seq_get(args, 1), expression=seq_get(args, 0)), "GLOB": lambda args: exp.Glob(this=seq_get(args, 1), expression=seq_get(args, 0)),
"HEX": build_hex, "HEX": build_hex,
@ -1100,8 +1100,32 @@ class Parser(metaclass=_Parser):
"WITH": lambda self: self.expression( "WITH": lambda self: self.expression(
exp.Properties, expressions=self._parse_wrapped_properties() exp.Properties, expressions=self._parse_wrapped_properties()
), ),
"BUCKET": lambda self: self._parse_partitioned_by_bucket_or_truncate(),
"TRUNCATE": lambda self: self._parse_partitioned_by_bucket_or_truncate(),
} }
def _parse_partitioned_by_bucket_or_truncate(self) -> exp.Expression:
klass = (
exp.PartitionedByBucket
if self._prev.text.upper() == "BUCKET"
else exp.PartitionByTruncate
)
args = self._parse_wrapped_csv(lambda: self._parse_primary() or self._parse_column())
this, expression = seq_get(args, 0), seq_get(args, 1)
if isinstance(this, exp.Literal):
# Check for Iceberg partition transforms (bucket / truncate) and ensure their arguments are in the right order
# - For Hive, it's `bucket(<num buckets>, <col name>)` or `truncate(<num_chars>, <col_name>)`
# - For Trino, it's reversed - `bucket(<col name>, <num buckets>)` or `truncate(<col_name>, <num_chars>)`
# Both variants are canonicalized in the latter i.e `bucket(<col name>, <num buckets>)`
#
# Hive ref: https://docs.aws.amazon.com/athena/latest/ug/querying-iceberg-creating-tables.html#querying-iceberg-partitioning
# Trino ref: https://docs.aws.amazon.com/athena/latest/ug/create-table-as.html#ctas-table-properties
this, expression = expression, this
return self.expression(klass, this=this, expression=expression)
ALTER_PARSERS = { ALTER_PARSERS = {
"ADD": lambda self: self._parse_alter_table_add(), "ADD": lambda self: self._parse_alter_table_add(),
"AS": lambda self: self._parse_select(), "AS": lambda self: self._parse_select(),
@ -1132,6 +1156,8 @@ class Parser(metaclass=_Parser):
"PRIMARY KEY", "PRIMARY KEY",
"UNIQUE", "UNIQUE",
"WATERMARK", "WATERMARK",
"BUCKET",
"TRUNCATE",
} }
NO_PAREN_FUNCTION_PARSERS = { NO_PAREN_FUNCTION_PARSERS = {
@ -1300,7 +1326,7 @@ class Parser(metaclass=_Parser):
"BTREE", "BTREE",
"HASH", "HASH",
), ),
**dict.fromkeys(("DEFERRABLE", "NORELY"), tuple()), **dict.fromkeys(("DEFERRABLE", "NORELY", "RELY"), tuple()),
} }
INSERT_ALTERNATIVES = {"ABORT", "FAIL", "IGNORE", "REPLACE", "ROLLBACK"} INSERT_ALTERNATIVES = {"ABORT", "FAIL", "IGNORE", "REPLACE", "ROLLBACK"}
@ -1338,7 +1364,7 @@ class Parser(metaclass=_Parser):
NULL_TOKENS = {TokenType.NULL} NULL_TOKENS = {TokenType.NULL}
UNNEST_OFFSET_ALIAS_TOKENS = ID_VAR_TOKENS - SET_OPERATIONS UNNEST_OFFSET_ALIAS_TOKENS = TABLE_ALIAS_TOKENS - SET_OPERATIONS
SELECT_START_TOKENS = {TokenType.L_PAREN, TokenType.WITH, TokenType.SELECT} SELECT_START_TOKENS = {TokenType.L_PAREN, TokenType.WITH, TokenType.SELECT}
@ -5989,6 +6015,7 @@ class Parser(metaclass=_Parser):
this=self._parse_schema(self._parse_unique_key()), this=self._parse_schema(self._parse_unique_key()),
index_type=self._match(TokenType.USING) and self._advance_any() and self._prev.text, index_type=self._match(TokenType.USING) and self._advance_any() and self._prev.text,
on_conflict=self._parse_on_conflict(), on_conflict=self._parse_on_conflict(),
options=self._parse_key_constraint_options(),
) )
def _parse_key_constraint_options(self) -> t.List[str]: def _parse_key_constraint_options(self) -> t.List[str]:
@ -6037,7 +6064,7 @@ class Parser(metaclass=_Parser):
def _parse_foreign_key(self) -> exp.ForeignKey: def _parse_foreign_key(self) -> exp.ForeignKey:
expressions = self._parse_wrapped_id_vars() expressions = self._parse_wrapped_id_vars()
reference = self._parse_references() reference = self._parse_references()
options = {} on_options = {}
while self._match(TokenType.ON): while self._match(TokenType.ON):
if not self._match_set((TokenType.DELETE, TokenType.UPDATE)): if not self._match_set((TokenType.DELETE, TokenType.UPDATE)):
@ -6054,13 +6081,14 @@ class Parser(metaclass=_Parser):
self._advance() self._advance()
action = self._prev.text.upper() action = self._prev.text.upper()
options[kind] = action on_options[kind] = action
return self.expression( return self.expression(
exp.ForeignKey, exp.ForeignKey,
expressions=expressions, expressions=expressions,
reference=reference, reference=reference,
**options, # type: ignore options=self._parse_key_constraint_options(),
**on_options, # type: ignore
) )
def _parse_primary_key_part(self) -> t.Optional[exp.Expression]: def _parse_primary_key_part(self) -> t.Optional[exp.Expression]:
@ -6087,7 +6115,11 @@ class Parser(metaclass=_Parser):
) )
if not in_props and not self._match(TokenType.L_PAREN, advance=False): if not in_props and not self._match(TokenType.L_PAREN, advance=False):
return self.expression(exp.PrimaryKeyColumnConstraint, desc=desc) return self.expression(
exp.PrimaryKeyColumnConstraint,
desc=desc,
options=self._parse_key_constraint_options(),
)
expressions = self._parse_wrapped_csv( expressions = self._parse_wrapped_csv(
self._parse_primary_key_part, optional=wrapped_optional self._parse_primary_key_part, optional=wrapped_optional

View file

@ -202,6 +202,67 @@ class TestAthena(Validator):
identify=True, identify=True,
) )
def test_create_table(self):
# There are two CREATE TABLE syntaxes
# Both hit Athena's Hive engine but creating an Iceberg table is different from creating a normal Hive table
table_schema = exp.Schema(
this=exp.to_table("foo.bar"),
expressions=[
exp.ColumnDef(this=exp.to_identifier("a"), kind=exp.DataType.build("int")),
exp.ColumnDef(this=exp.to_identifier("b"), kind=exp.DataType.build("varchar")),
],
)
# Hive tables - CREATE EXTERNAL TABLE
ct_hive = exp.Create(
this=table_schema,
kind="TABLE",
properties=exp.Properties(
expressions=[
exp.ExternalProperty(),
exp.FileFormatProperty(this=exp.Literal.string("parquet")),
exp.LocationProperty(this=exp.Literal.string("s3://foo")),
exp.PartitionedByProperty(
this=exp.Schema(expressions=[exp.to_column("partition_col")])
),
]
),
)
self.assertEqual(
ct_hive.sql(dialect=self.dialect, identify=True),
"CREATE EXTERNAL TABLE `foo`.`bar` (`a` INT, `b` STRING) STORED AS PARQUET LOCATION 's3://foo' PARTITIONED BY (`partition_col`)",
)
# Iceberg tables - CREATE TABLE... TBLPROPERTIES ('table_type'='iceberg')
# no EXTERNAL keyword and the 'table_type=iceberg' property must be set
# ref: https://docs.aws.amazon.com/athena/latest/ug/querying-iceberg-creating-tables.html#querying-iceberg-partitioning
ct_iceberg = exp.Create(
this=table_schema,
kind="TABLE",
properties=exp.Properties(
expressions=[
exp.FileFormatProperty(this=exp.Literal.string("parquet")),
exp.LocationProperty(this=exp.Literal.string("s3://foo")),
exp.PartitionedByProperty(
this=exp.Schema(
expressions=[
exp.to_column("partition_col"),
exp.PartitionedByBucket(
this=exp.to_column("a"), expression=exp.Literal.number(4)
),
]
)
),
exp.Property(this=exp.var("table_type"), value=exp.Literal.string("iceberg")),
]
),
)
self.assertEqual(
ct_iceberg.sql(dialect=self.dialect, identify=True),
"CREATE TABLE `foo`.`bar` (`a` INT, `b` STRING) STORED AS PARQUET LOCATION 's3://foo' PARTITIONED BY (`partition_col`, BUCKET(4, `a`)) TBLPROPERTIES ('table_type'='iceberg')",
)
def test_ctas(self): def test_ctas(self):
# Hive tables use 'external_location' to specify the table location, Iceberg tables use 'location' to specify the table location # Hive tables use 'external_location' to specify the table location, Iceberg tables use 'location' to specify the table location
# In addition, Hive tables used 'partitioned_by' to specify the partition fields and Iceberg tables use 'partitioning' to specify the partition fields # In addition, Hive tables used 'partitioned_by' to specify the partition fields and Iceberg tables use 'partitioning' to specify the partition fields
@ -223,7 +284,11 @@ class TestAthena(Validator):
) )
self.assertEqual( self.assertEqual(
ctas_hive.sql(dialect=self.dialect, identify=True), ctas_hive.sql(dialect=self.dialect, identify=True),
"CREATE TABLE \"foo\".\"bar\" WITH (format='parquet', external_location='s3://foo', partitioned_by=ARRAY['partition_col']) AS SELECT 1", "CREATE TABLE \"foo\".\"bar\" WITH (format='parquet', external_location='s3://foo', partitioned_by=ARRAY['\"partition_col\"']) AS SELECT 1",
)
self.assertEqual(
ctas_hive.sql(dialect=self.dialect, identify=False),
"CREATE TABLE foo.bar WITH (format='parquet', external_location='s3://foo', partitioned_by=ARRAY['partition_col']) AS SELECT 1",
) )
ctas_iceberg = exp.Create( ctas_iceberg = exp.Create(
@ -234,7 +299,14 @@ class TestAthena(Validator):
exp.Property(this=exp.var("table_type"), value=exp.Literal.string("iceberg")), exp.Property(this=exp.var("table_type"), value=exp.Literal.string("iceberg")),
exp.LocationProperty(this=exp.Literal.string("s3://foo")), exp.LocationProperty(this=exp.Literal.string("s3://foo")),
exp.PartitionedByProperty( exp.PartitionedByProperty(
this=exp.Schema(expressions=[exp.to_column("partition_col")]) this=exp.Schema(
expressions=[
exp.to_column("partition_col"),
exp.PartitionedByBucket(
this=exp.to_column("a"), expression=exp.Literal.number(4)
),
]
)
), ),
] ]
), ),
@ -242,5 +314,9 @@ class TestAthena(Validator):
) )
self.assertEqual( self.assertEqual(
ctas_iceberg.sql(dialect=self.dialect, identify=True), ctas_iceberg.sql(dialect=self.dialect, identify=True),
"CREATE TABLE \"foo\".\"bar\" WITH (table_type='iceberg', location='s3://foo', partitioning=ARRAY['partition_col']) AS SELECT 1", "CREATE TABLE \"foo\".\"bar\" WITH (table_type='iceberg', location='s3://foo', partitioning=ARRAY['\"partition_col\"', 'BUCKET(\"a\", 4)']) AS SELECT 1",
)
self.assertEqual(
ctas_iceberg.sql(dialect=self.dialect, identify=False),
"CREATE TABLE foo.bar WITH (table_type='iceberg', location='s3://foo', partitioning=ARRAY['partition_col', 'BUCKET(a, 4)']) AS SELECT 1",
) )

View file

@ -308,10 +308,6 @@ LANGUAGE js AS
"""SELECT JSON '"foo"' AS json_data""", """SELECT JSON '"foo"' AS json_data""",
"""SELECT PARSE_JSON('"foo"') AS json_data""", """SELECT PARSE_JSON('"foo"') AS json_data""",
) )
self.validate_identity(
"SELECT * FROM UNNEST(x) WITH OFFSET EXCEPT DISTINCT SELECT * FROM UNNEST(y) WITH OFFSET",
"SELECT * FROM UNNEST(x) WITH OFFSET AS offset EXCEPT DISTINCT SELECT * FROM UNNEST(y) WITH OFFSET AS offset",
)
self.validate_identity( self.validate_identity(
"SELECT * FROM (SELECT a, b, c FROM test) PIVOT(SUM(b) d, COUNT(*) e FOR c IN ('x', 'y'))", "SELECT * FROM (SELECT a, b, c FROM test) PIVOT(SUM(b) d, COUNT(*) e FOR c IN ('x', 'y'))",
"SELECT * FROM (SELECT a, b, c FROM test) PIVOT(SUM(b) AS d, COUNT(*) AS e FOR c IN ('x', 'y'))", "SELECT * FROM (SELECT a, b, c FROM test) PIVOT(SUM(b) AS d, COUNT(*) AS e FOR c IN ('x', 'y'))",
@ -1519,8 +1515,8 @@ WHERE
self.validate_all( self.validate_all(
"SELECT GENERATE_DATE_ARRAY('2016-10-05', '2016-10-08')", "SELECT GENERATE_DATE_ARRAY('2016-10-05', '2016-10-08')",
write={ write={
"duckdb": "SELECT CAST(GENERATE_SERIES(CAST('2016-10-05' AS DATE), CAST('2016-10-08' AS DATE), INTERVAL 1 DAY) AS DATE[])", "duckdb": "SELECT CAST(GENERATE_SERIES(CAST('2016-10-05' AS DATE), CAST('2016-10-08' AS DATE), INTERVAL '1' DAY) AS DATE[])",
"bigquery": "SELECT GENERATE_DATE_ARRAY('2016-10-05', '2016-10-08', INTERVAL 1 DAY)", "bigquery": "SELECT GENERATE_DATE_ARRAY('2016-10-05', '2016-10-08', INTERVAL '1' DAY)",
}, },
) )
self.validate_all( self.validate_all(
@ -2424,3 +2420,16 @@ OPTIONS (
"SELECT 1 AS x UNION ALL STRICT CORRESPONDING BY (foo, bar) SELECT 2 AS x", "SELECT 1 AS x UNION ALL STRICT CORRESPONDING BY (foo, bar) SELECT 2 AS x",
"SELECT 1 AS x UNION ALL BY NAME ON (foo, bar) SELECT 2 AS x", "SELECT 1 AS x UNION ALL BY NAME ON (foo, bar) SELECT 2 AS x",
) )
def test_with_offset(self):
self.validate_identity(
"SELECT * FROM UNNEST(x) WITH OFFSET EXCEPT DISTINCT SELECT * FROM UNNEST(y) WITH OFFSET",
"SELECT * FROM UNNEST(x) WITH OFFSET AS offset EXCEPT DISTINCT SELECT * FROM UNNEST(y) WITH OFFSET AS offset",
)
for join_ops in ("LEFT", "RIGHT", "FULL", "NATURAL", "SEMI", "ANTI"):
with self.subTest(f"Testing {join_ops} in test_with_offset"):
self.validate_identity(
f"SELECT * FROM t1, UNNEST([1, 2]) AS hit WITH OFFSET {join_ops} JOIN foo",
f"SELECT * FROM t1, UNNEST([1, 2]) AS hit WITH OFFSET AS offset {join_ops} JOIN foo",
)

View file

@ -1034,7 +1034,7 @@ class TestDuckDB(Validator):
"clickhouse": "fromUnixTimestamp64Milli(CAST(x AS Nullable(Int64)))", "clickhouse": "fromUnixTimestamp64Milli(CAST(x AS Nullable(Int64)))",
"duckdb": "EPOCH_MS(x)", "duckdb": "EPOCH_MS(x)",
"mysql": "FROM_UNIXTIME(x / POWER(10, 3))", "mysql": "FROM_UNIXTIME(x / POWER(10, 3))",
"postgres": "TO_TIMESTAMP(CAST(x AS DOUBLE PRECISION) / 10 ^ 3)", "postgres": "TO_TIMESTAMP(CAST(x AS DOUBLE PRECISION) / POWER(10, 3))",
"presto": "FROM_UNIXTIME(CAST(x AS DOUBLE) / POW(10, 3))", "presto": "FROM_UNIXTIME(CAST(x AS DOUBLE) / POW(10, 3))",
"spark": "TIMESTAMP_MILLIS(x)", "spark": "TIMESTAMP_MILLIS(x)",
}, },

View file

@ -568,7 +568,7 @@ FROM json_data, field_ids""",
"x ^ y", "x ^ y",
write={ write={
"": "POWER(x, y)", "": "POWER(x, y)",
"postgres": "x ^ y", "postgres": "POWER(x, y)",
}, },
) )
self.validate_all( self.validate_all(
@ -765,7 +765,7 @@ FROM json_data, field_ids""",
"x / y ^ z", "x / y ^ z",
write={ write={
"": "x / POWER(y, z)", "": "x / POWER(y, z)",
"postgres": "x / y ^ z", "postgres": "x / POWER(y, z)",
}, },
) )
self.validate_all( self.validate_all(

View file

@ -609,7 +609,7 @@ class TestSnowflake(Validator):
"hive": "POWER(x, 2)", "hive": "POWER(x, 2)",
"mysql": "POWER(x, 2)", "mysql": "POWER(x, 2)",
"oracle": "POWER(x, 2)", "oracle": "POWER(x, 2)",
"postgres": "x ^ 2", "postgres": "POWER(x, 2)",
"presto": "POWER(x, 2)", "presto": "POWER(x, 2)",
"redshift": "POWER(x, 2)", "redshift": "POWER(x, 2)",
"snowflake": "POWER(x, 2)", "snowflake": "POWER(x, 2)",
@ -2563,3 +2563,12 @@ SINGLE = TRUE""",
"duckdb": f"SELECT LISTAGG({distinct}col, '|SEPARATOR|' ORDER BY col2) FROM t", "duckdb": f"SELECT LISTAGG({distinct}col, '|SEPARATOR|' ORDER BY col2) FROM t",
}, },
) )
def test_rely_options(self):
for option in ("NORELY", "RELY"):
self.validate_identity(
f"CREATE TABLE t (col1 INT PRIMARY KEY {option}, col2 INT UNIQUE {option}, col3 INT NOT NULL FOREIGN KEY REFERENCES other_t (id) {option})"
)
self.validate_identity(
f"CREATE TABLE t (col1 INT, col2 INT, col3 INT, PRIMARY KEY (col1) {option}, UNIQUE (col1, col2) {option}, FOREIGN KEY (col3) REFERENCES other_t (id) {option})"
)

View file

@ -56,7 +56,7 @@ class TestSpark(Validator):
"CREATE TABLE x USING ICEBERG PARTITIONED BY (MONTHS(y)) LOCATION 's3://z'", "CREATE TABLE x USING ICEBERG PARTITIONED BY (MONTHS(y)) LOCATION 's3://z'",
write={ write={
"duckdb": "CREATE TABLE x", "duckdb": "CREATE TABLE x",
"presto": "CREATE TABLE x WITH (FORMAT='ICEBERG', PARTITIONED_BY=ARRAY['MONTHS'])", "presto": "CREATE TABLE x WITH (FORMAT='ICEBERG', PARTITIONED_BY=ARRAY['MONTHS(y)'])",
"hive": "CREATE TABLE x STORED AS ICEBERG PARTITIONED BY (MONTHS(y)) LOCATION 's3://z'", "hive": "CREATE TABLE x STORED AS ICEBERG PARTITIONED BY (MONTHS(y)) LOCATION 's3://z'",
"spark": "CREATE TABLE x USING ICEBERG PARTITIONED BY (MONTHS(y)) LOCATION 's3://z'", "spark": "CREATE TABLE x USING ICEBERG PARTITIONED BY (MONTHS(y)) LOCATION 's3://z'",
}, },

View file

@ -93,6 +93,16 @@ class TestTrino(Validator):
"CREATE TABLE foo.bar WITH (LOCATION='s3://bucket/foo/bar') AS SELECT 1" "CREATE TABLE foo.bar WITH (LOCATION='s3://bucket/foo/bar') AS SELECT 1"
) )
# Hive connector syntax (partitioned_by)
self.validate_identity(
"CREATE TABLE foo (a VARCHAR, b INTEGER, c DATE) WITH (PARTITIONED_BY=ARRAY['a', 'b'])"
)
# Iceberg connector syntax (partitioning, can contain Iceberg transform expressions)
self.validate_identity(
"CREATE TABLE foo (a VARCHAR, b INTEGER, c DATE) WITH (PARTITIONING=ARRAY['a', 'bucket(4, b)', 'month(c)'])",
)
def test_analyze(self): def test_analyze(self):
self.validate_identity("ANALYZE tbl") self.validate_identity("ANALYZE tbl")
self.validate_identity("ANALYZE tbl WITH (prop1=val1, prop2=val2)") self.validate_identity("ANALYZE tbl WITH (prop1=val1, prop2=val2)")

View file

@ -124,6 +124,12 @@ SELECT CAST(CAST(`t`.`some_col` AS DATE) AS DATETIME) < CAST(CAST(`t`.`other_col
-------------------------------------- --------------------------------------
-- Remove redundant casts -- Remove redundant casts
-------------------------------------- --------------------------------------
CAST(CAST("foo" AS DECIMAL(4, 2)) AS DECIMAL(8, 4)) AS "x";
CAST(CAST("foo" AS DECIMAL(4, 2)) AS DECIMAL(8, 4)) AS "x";
CAST(CAST("foo" AS DECIMAL(4, 2)) AS DECIMAL(4, 2)) AS "x";
CAST("foo" AS DECIMAL(4, 2)) AS "x";
CAST(CAST('2023-01-01' AS DATE) AS DATE); CAST(CAST('2023-01-01' AS DATE) AS DATE);
CAST('2023-01-01' AS DATE); CAST('2023-01-01' AS DATE);

View file

@ -67,3 +67,14 @@ SELECT x.a > _u_0.b FROM x CROSS JOIN (SELECT SUM(y.a) AS b FROM y) AS _u_0;
SELECT (SELECT MAX(t2.c1) AS c1 FROM t2 WHERE t2.c2 = t1.c2 AND t2.c3 <= TRUNC(t1.c3)) AS c FROM t1; SELECT (SELECT MAX(t2.c1) AS c1 FROM t2 WHERE t2.c2 = t1.c2 AND t2.c3 <= TRUNC(t1.c3)) AS c FROM t1;
SELECT _u_0.c1 AS c FROM t1 LEFT JOIN (SELECT MAX(t2.c1) AS c1, t2.c2 AS _u_1, MAX(t2.c3) AS _u_2 FROM t2 WHERE TRUE AND TRUE GROUP BY t2.c2) AS _u_0 ON _u_0._u_1 = t1.c2 WHERE _u_0._u_2 <= TRUNC(t1.c3); SELECT _u_0.c1 AS c FROM t1 LEFT JOIN (SELECT MAX(t2.c1) AS c1, t2.c2 AS _u_1, MAX(t2.c3) AS _u_2 FROM t2 WHERE TRUE AND TRUE GROUP BY t2.c2) AS _u_0 ON _u_0._u_1 = t1.c2 WHERE _u_0._u_2 <= TRUNC(t1.c3);
SELECT s.t AS t FROM s WHERE 1 IN (SELECT t.a AS a FROM t WHERE t.b > 1);
SELECT s.t AS t FROM s LEFT JOIN (SELECT t.a AS a FROM t WHERE t.b > 1 GROUP BY t.a) AS _u_0 ON 1 = _u_0.a WHERE NOT _u_0.a IS NULL;
# title: can't create GROUP BY clause with an aggregate
SELECT s.t FROM s WHERE 1 IN (SELECT MAX(t.a) AS t1 FROM t);
SELECT s.t FROM s LEFT JOIN (SELECT MAX(t.a) AS t1 FROM t) AS _u_0 ON 1 = _u_0.t1 WHERE NOT _u_0.t1 IS NULL;
# title: can't create GROUP BY clause with an aggregate (nested)
SELECT s.t FROM s WHERE 1 IN (SELECT MAX(t.a) + 1 AS t1 FROM t);
SELECT s.t FROM s LEFT JOIN (SELECT MAX(t.a) + 1 AS t1 FROM t) AS _u_0 ON 1 = _u_0.t1 WHERE NOT _u_0.t1 IS NULL

View file

@ -533,6 +533,11 @@ class TestOptimizer(unittest.TestCase):
def test_simplify(self): def test_simplify(self):
self.check_file("simplify", simplify) self.check_file("simplify", simplify)
# Ensure simplify mutates the AST properly
expression = parse_one("SELECT 1 + 2")
simplify(expression.selects[0])
self.assertEqual(expression.sql(), "SELECT 3")
expression = parse_one("SELECT a, c, b FROM table1 WHERE 1 = 1") expression = parse_one("SELECT a, c, b FROM table1 WHERE 1 = 1")
self.assertEqual(simplify(simplify(expression.find(exp.Where))).sql(), "WHERE TRUE") self.assertEqual(simplify(simplify(expression.find(exp.Where))).sql(), "WHERE TRUE")