summaryrefslogtreecommitdiffstats
path: root/docs/sqlglot/dialects/presto.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/sqlglot/dialects/presto.html')
-rw-r--r--docs/sqlglot/dialects/presto.html1058
1 files changed, 629 insertions, 429 deletions
diff --git a/docs/sqlglot/dialects/presto.html b/docs/sqlglot/dialects/presto.html
index d23baf6..63ae5ce 100644
--- a/docs/sqlglot/dialects/presto.html
+++ b/docs/sqlglot/dialects/presto.html
@@ -151,6 +151,9 @@
<a class="variable" href="#Presto.Generator.TRANSFORMS">TRANSFORMS</a>
</li>
<li>
+ <a class="variable" href="#Presto.Generator.RESERVED_KEYWORDS">RESERVED_KEYWORDS</a>
+ </li>
+ <li>
<a class="function" href="#Presto.Generator.strtounix_sql">strtounix_sql</a>
</li>
<li>
@@ -714,114 +717,175 @@
</span><span id="L-443"><a href="#L-443"><span class="linenos">443</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Xor</span><span class="p">:</span> <span class="n">bool_xor_sql</span><span class="p">,</span>
</span><span id="L-444"><a href="#L-444"><span class="linenos">444</span></a> <span class="p">}</span>
</span><span id="L-445"><a href="#L-445"><span class="linenos">445</span></a>
-</span><span id="L-446"><a href="#L-446"><span class="linenos">446</span></a> <span class="k">def</span> <span class="nf">strtounix_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="L-447"><a href="#L-447"><span class="linenos">447</span></a> <span class="c1"># Since `TO_UNIXTIME` requires a `TIMESTAMP`, we need to parse the argument into one.</span>
-</span><span id="L-448"><a href="#L-448"><span class="linenos">448</span></a> <span class="c1"># To do this, we first try to `DATE_PARSE` it, but since this can fail when there&#39;s a</span>
-</span><span id="L-449"><a href="#L-449"><span class="linenos">449</span></a> <span class="c1"># timezone involved, we wrap it in a `TRY` call and use `PARSE_DATETIME` as a fallback,</span>
-</span><span id="L-450"><a href="#L-450"><span class="linenos">450</span></a> <span class="c1"># which seems to be using the same time mapping as Hive, as per:</span>
-</span><span id="L-451"><a href="#L-451"><span class="linenos">451</span></a> <span class="c1"># https://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html</span>
-</span><span id="L-452"><a href="#L-452"><span class="linenos">452</span></a> <span class="n">value_as_text</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">)</span>
-</span><span id="L-453"><a href="#L-453"><span class="linenos">453</span></a> <span class="n">parse_without_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;DATE_PARSE&quot;</span><span class="p">,</span> <span class="n">value_as_text</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span>
-</span><span id="L-454"><a href="#L-454"><span class="linenos">454</span></a> <span class="n">parse_with_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
-</span><span id="L-455"><a href="#L-455"><span class="linenos">455</span></a> <span class="s2">&quot;PARSE_DATETIME&quot;</span><span class="p">,</span>
-</span><span id="L-456"><a href="#L-456"><span class="linenos">456</span></a> <span class="n">value_as_text</span><span class="p">,</span>
-</span><span id="L-457"><a href="#L-457"><span class="linenos">457</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_MAPPING</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_TRIE</span><span class="p">),</span>
-</span><span id="L-458"><a href="#L-458"><span class="linenos">458</span></a> <span class="p">)</span>
-</span><span id="L-459"><a href="#L-459"><span class="linenos">459</span></a> <span class="n">coalesced</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;COALESCE&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TRY&quot;</span><span class="p">,</span> <span class="n">parse_without_tz</span><span class="p">),</span> <span class="n">parse_with_tz</span><span class="p">)</span>
-</span><span id="L-460"><a href="#L-460"><span class="linenos">460</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TO_UNIXTIME&quot;</span><span class="p">,</span> <span class="n">coalesced</span><span class="p">)</span>
-</span><span id="L-461"><a href="#L-461"><span class="linenos">461</span></a>
-</span><span id="L-462"><a href="#L-462"><span class="linenos">462</span></a> <span class="k">def</span> <span class="nf">bracket_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="L-463"><a href="#L-463"><span class="linenos">463</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;safe&quot;</span><span class="p">):</span>
-</span><span id="L-464"><a href="#L-464"><span class="linenos">464</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
-</span><span id="L-465"><a href="#L-465"><span class="linenos">465</span></a> <span class="s2">&quot;ELEMENT_AT&quot;</span><span class="p">,</span>
-</span><span id="L-466"><a href="#L-466"><span class="linenos">466</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
-</span><span id="L-467"><a href="#L-467"><span class="linenos">467</span></a> <span class="n">seq_get</span><span class="p">(</span>
-</span><span id="L-468"><a href="#L-468"><span class="linenos">468</span></a> <span class="n">apply_index_offset</span><span class="p">(</span>
-</span><span id="L-469"><a href="#L-469"><span class="linenos">469</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
-</span><span id="L-470"><a href="#L-470"><span class="linenos">470</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span>
-</span><span id="L-471"><a href="#L-471"><span class="linenos">471</span></a> <span class="mi">1</span> <span class="o">-</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;offset&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
-</span><span id="L-472"><a href="#L-472"><span class="linenos">472</span></a> <span class="p">),</span>
-</span><span id="L-473"><a href="#L-473"><span class="linenos">473</span></a> <span class="mi">0</span><span class="p">,</span>
-</span><span id="L-474"><a href="#L-474"><span class="linenos">474</span></a> <span class="p">),</span>
-</span><span id="L-475"><a href="#L-475"><span class="linenos">475</span></a> <span class="p">)</span>
-</span><span id="L-476"><a href="#L-476"><span class="linenos">476</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">bracket_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="L-477"><a href="#L-477"><span class="linenos">477</span></a>
-</span><span id="L-478"><a href="#L-478"><span class="linenos">478</span></a> <span class="k">def</span> <span class="nf">struct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="L-479"><a href="#L-479"><span class="linenos">479</span></a> <span class="kn">from</span> <span class="nn">sqlglot.optimizer.annotate_types</span> <span class="kn">import</span> <span class="n">annotate_types</span>
-</span><span id="L-480"><a href="#L-480"><span class="linenos">480</span></a>
-</span><span id="L-481"><a href="#L-481"><span class="linenos">481</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">annotate_types</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="L-482"><a href="#L-482"><span class="linenos">482</span></a> <span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
-</span><span id="L-483"><a href="#L-483"><span class="linenos">483</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
-</span><span id="L-484"><a href="#L-484"><span class="linenos">484</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">False</span>
-</span><span id="L-485"><a href="#L-485"><span class="linenos">485</span></a>
-</span><span id="L-486"><a href="#L-486"><span class="linenos">486</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
-</span><span id="L-487"><a href="#L-487"><span class="linenos">487</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">PropertyEQ</span><span class="p">):</span>
-</span><span id="L-488"><a href="#L-488"><span class="linenos">488</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span> <span class="ow">and</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">):</span>
-</span><span id="L-489"><a href="#L-489"><span class="linenos">489</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">True</span>
-</span><span id="L-490"><a href="#L-490"><span class="linenos">490</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="L-491"><a href="#L-491"><span class="linenos">491</span></a> <span class="n">schema</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
-</span><span id="L-492"><a href="#L-492"><span class="linenos">492</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">&quot;expression&quot;</span><span class="p">))</span>
-</span><span id="L-493"><a href="#L-493"><span class="linenos">493</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="L-494"><a href="#L-494"><span class="linenos">494</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
-</span><span id="L-495"><a href="#L-495"><span class="linenos">495</span></a>
-</span><span id="L-496"><a href="#L-496"><span class="linenos">496</span></a> <span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span>
-</span><span id="L-497"><a href="#L-497"><span class="linenos">497</span></a>
-</span><span id="L-498"><a href="#L-498"><span class="linenos">498</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">size</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> <span class="o">!=</span> <span class="n">size</span><span class="p">:</span>
-</span><span id="L-499"><a href="#L-499"><span class="linenos">499</span></a> <span class="k">if</span> <span class="n">unknown_type</span><span class="p">:</span>
-</span><span id="L-500"><a href="#L-500"><span class="linenos">500</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span>
-</span><span id="L-501"><a href="#L-501"><span class="linenos">501</span></a> <span class="s2">&quot;Cannot convert untyped key-value definitions (try annotate_types).&quot;</span>
-</span><span id="L-502"><a href="#L-502"><span class="linenos">502</span></a> <span class="p">)</span>
-</span><span id="L-503"><a href="#L-503"><span class="linenos">503</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;ROW&quot;</span><span class="p">,</span> <span class="o">*</span><span class="n">values</span><span class="p">)</span>
-</span><span id="L-504"><a href="#L-504"><span class="linenos">504</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;CAST(ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">values</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span><span class="si">}</span><span class="s2">))&quot;</span>
-</span><span id="L-505"><a href="#L-505"><span class="linenos">505</span></a>
-</span><span id="L-506"><a href="#L-506"><span class="linenos">506</span></a> <span class="k">def</span> <span class="nf">interval_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="L-507"><a href="#L-507"><span class="linenos">507</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">&quot;unit&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;WEEK&quot;</span><span class="p">):</span>
-</span><span id="L-508"><a href="#L-508"><span class="linenos">508</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;(</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> * INTERVAL &#39;7&#39; DAY)&quot;</span>
-</span><span id="L-509"><a href="#L-509"><span class="linenos">509</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">interval_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="L-510"><a href="#L-510"><span class="linenos">510</span></a>
-</span><span id="L-511"><a href="#L-511"><span class="linenos">511</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Transaction</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="L-512"><a href="#L-512"><span class="linenos">512</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;modes&quot;</span><span class="p">)</span>
-</span><span id="L-513"><a href="#L-513"><span class="linenos">513</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; </span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">modes</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
-</span><span id="L-514"><a href="#L-514"><span class="linenos">514</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">&quot;</span>
-</span><span id="L-515"><a href="#L-515"><span class="linenos">515</span></a>
-</span><span id="L-516"><a href="#L-516"><span class="linenos">516</span></a> <span class="k">def</span> <span class="nf">generateseries_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="L-517"><a href="#L-517"><span class="linenos">517</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;start&quot;</span><span class="p">]</span>
-</span><span id="L-518"><a href="#L-518"><span class="linenos">518</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;end&quot;</span><span class="p">]</span>
-</span><span id="L-519"><a href="#L-519"><span class="linenos">519</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;step&quot;</span><span class="p">)</span>
-</span><span id="L-520"><a href="#L-520"><span class="linenos">520</span></a>
-</span><span id="L-521"><a href="#L-521"><span class="linenos">521</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
-</span><span id="L-522"><a href="#L-522"><span class="linenos">522</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span>
-</span><span id="L-523"><a href="#L-523"><span class="linenos">523</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
-</span><span id="L-524"><a href="#L-524"><span class="linenos">524</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">end</span><span class="o">.</span><span class="n">to</span>
-</span><span id="L-525"><a href="#L-525"><span class="linenos">525</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="L-526"><a href="#L-526"><span class="linenos">526</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span>
-</span><span id="L-527"><a href="#L-527"><span class="linenos">527</span></a>
-</span><span id="L-528"><a href="#L-528"><span class="linenos">528</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">and</span> <span class="n">target_type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">&quot;timestamp&quot;</span><span class="p">):</span>
-</span><span id="L-529"><a href="#L-529"><span class="linenos">529</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">is</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span><span class="p">:</span>
-</span><span id="L-530"><a href="#L-530"><span class="linenos">530</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
-</span><span id="L-531"><a href="#L-531"><span class="linenos">531</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="L-532"><a href="#L-532"><span class="linenos">532</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
-</span><span id="L-533"><a href="#L-533"><span class="linenos">533</span></a>
-</span><span id="L-534"><a href="#L-534"><span class="linenos">534</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;SEQUENCE&quot;</span><span class="p">,</span> <span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">,</span> <span class="n">step</span><span class="p">)</span>
-</span><span id="L-535"><a href="#L-535"><span class="linenos">535</span></a>
-</span><span id="L-536"><a href="#L-536"><span class="linenos">536</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span>
-</span><span id="L-537"><a href="#L-537"><span class="linenos">537</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">fetch</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">limit</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">]</span>
-</span><span id="L-538"><a href="#L-538"><span class="linenos">538</span></a> <span class="p">)</span> <span class="o">-&gt;</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span>
-</span><span id="L-539"><a href="#L-539"><span class="linenos">539</span></a> <span class="k">return</span> <span class="p">[</span>
-</span><span id="L-540"><a href="#L-540"><span class="linenos">540</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;offset&quot;</span><span class="p">),</span>
-</span><span id="L-541"><a href="#L-541"><span class="linenos">541</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">limit</span><span class="p">),</span>
-</span><span id="L-542"><a href="#L-542"><span class="linenos">542</span></a> <span class="p">]</span>
-</span><span id="L-543"><a href="#L-543"><span class="linenos">543</span></a>
-</span><span id="L-544"><a href="#L-544"><span class="linenos">544</span></a> <span class="k">def</span> <span class="nf">create_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="L-545"><a href="#L-545"><span class="linenos">545</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
-</span><span id="L-546"><a href="#L-546"><span class="linenos">546</span></a><span class="sd"> Presto doesn&#39;t support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span>
-</span><span id="L-547"><a href="#L-547"><span class="linenos">547</span></a><span class="sd"> so we need to remove them</span>
-</span><span id="L-548"><a href="#L-548"><span class="linenos">548</span></a><span class="sd"> &quot;&quot;&quot;</span>
-</span><span id="L-549"><a href="#L-549"><span class="linenos">549</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;kind&quot;</span><span class="p">]</span>
-</span><span id="L-550"><a href="#L-550"><span class="linenos">550</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span>
-</span><span id="L-551"><a href="#L-551"><span class="linenos">551</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">&quot;VIEW&quot;</span> <span class="ow">and</span> <span class="n">schema</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
-</span><span id="L-552"><a href="#L-552"><span class="linenos">552</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">&quot;expressions&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
-</span><span id="L-553"><a href="#L-553"><span class="linenos">553</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">create_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="L-446"><a href="#L-446"><span class="linenos">446</span></a> <span class="n">RESERVED_KEYWORDS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="L-447"><a href="#L-447"><span class="linenos">447</span></a> <span class="s2">&quot;alter&quot;</span><span class="p">,</span>
+</span><span id="L-448"><a href="#L-448"><span class="linenos">448</span></a> <span class="s2">&quot;and&quot;</span><span class="p">,</span>
+</span><span id="L-449"><a href="#L-449"><span class="linenos">449</span></a> <span class="s2">&quot;as&quot;</span><span class="p">,</span>
+</span><span id="L-450"><a href="#L-450"><span class="linenos">450</span></a> <span class="s2">&quot;between&quot;</span><span class="p">,</span>
+</span><span id="L-451"><a href="#L-451"><span class="linenos">451</span></a> <span class="s2">&quot;by&quot;</span><span class="p">,</span>
+</span><span id="L-452"><a href="#L-452"><span class="linenos">452</span></a> <span class="s2">&quot;case&quot;</span><span class="p">,</span>
+</span><span id="L-453"><a href="#L-453"><span class="linenos">453</span></a> <span class="s2">&quot;cast&quot;</span><span class="p">,</span>
+</span><span id="L-454"><a href="#L-454"><span class="linenos">454</span></a> <span class="s2">&quot;constraint&quot;</span><span class="p">,</span>
+</span><span id="L-455"><a href="#L-455"><span class="linenos">455</span></a> <span class="s2">&quot;create&quot;</span><span class="p">,</span>
+</span><span id="L-456"><a href="#L-456"><span class="linenos">456</span></a> <span class="s2">&quot;cross&quot;</span><span class="p">,</span>
+</span><span id="L-457"><a href="#L-457"><span class="linenos">457</span></a> <span class="s2">&quot;current_time&quot;</span><span class="p">,</span>
+</span><span id="L-458"><a href="#L-458"><span class="linenos">458</span></a> <span class="s2">&quot;current_timestamp&quot;</span><span class="p">,</span>
+</span><span id="L-459"><a href="#L-459"><span class="linenos">459</span></a> <span class="s2">&quot;deallocate&quot;</span><span class="p">,</span>
+</span><span id="L-460"><a href="#L-460"><span class="linenos">460</span></a> <span class="s2">&quot;delete&quot;</span><span class="p">,</span>
+</span><span id="L-461"><a href="#L-461"><span class="linenos">461</span></a> <span class="s2">&quot;describe&quot;</span><span class="p">,</span>
+</span><span id="L-462"><a href="#L-462"><span class="linenos">462</span></a> <span class="s2">&quot;distinct&quot;</span><span class="p">,</span>
+</span><span id="L-463"><a href="#L-463"><span class="linenos">463</span></a> <span class="s2">&quot;drop&quot;</span><span class="p">,</span>
+</span><span id="L-464"><a href="#L-464"><span class="linenos">464</span></a> <span class="s2">&quot;else&quot;</span><span class="p">,</span>
+</span><span id="L-465"><a href="#L-465"><span class="linenos">465</span></a> <span class="s2">&quot;end&quot;</span><span class="p">,</span>
+</span><span id="L-466"><a href="#L-466"><span class="linenos">466</span></a> <span class="s2">&quot;escape&quot;</span><span class="p">,</span>
+</span><span id="L-467"><a href="#L-467"><span class="linenos">467</span></a> <span class="s2">&quot;except&quot;</span><span class="p">,</span>
+</span><span id="L-468"><a href="#L-468"><span class="linenos">468</span></a> <span class="s2">&quot;execute&quot;</span><span class="p">,</span>
+</span><span id="L-469"><a href="#L-469"><span class="linenos">469</span></a> <span class="s2">&quot;exists&quot;</span><span class="p">,</span>
+</span><span id="L-470"><a href="#L-470"><span class="linenos">470</span></a> <span class="s2">&quot;extract&quot;</span><span class="p">,</span>
+</span><span id="L-471"><a href="#L-471"><span class="linenos">471</span></a> <span class="s2">&quot;false&quot;</span><span class="p">,</span>
+</span><span id="L-472"><a href="#L-472"><span class="linenos">472</span></a> <span class="s2">&quot;for&quot;</span><span class="p">,</span>
+</span><span id="L-473"><a href="#L-473"><span class="linenos">473</span></a> <span class="s2">&quot;from&quot;</span><span class="p">,</span>
+</span><span id="L-474"><a href="#L-474"><span class="linenos">474</span></a> <span class="s2">&quot;full&quot;</span><span class="p">,</span>
+</span><span id="L-475"><a href="#L-475"><span class="linenos">475</span></a> <span class="s2">&quot;group&quot;</span><span class="p">,</span>
+</span><span id="L-476"><a href="#L-476"><span class="linenos">476</span></a> <span class="s2">&quot;having&quot;</span><span class="p">,</span>
+</span><span id="L-477"><a href="#L-477"><span class="linenos">477</span></a> <span class="s2">&quot;in&quot;</span><span class="p">,</span>
+</span><span id="L-478"><a href="#L-478"><span class="linenos">478</span></a> <span class="s2">&quot;inner&quot;</span><span class="p">,</span>
+</span><span id="L-479"><a href="#L-479"><span class="linenos">479</span></a> <span class="s2">&quot;insert&quot;</span><span class="p">,</span>
+</span><span id="L-480"><a href="#L-480"><span class="linenos">480</span></a> <span class="s2">&quot;intersect&quot;</span><span class="p">,</span>
+</span><span id="L-481"><a href="#L-481"><span class="linenos">481</span></a> <span class="s2">&quot;into&quot;</span><span class="p">,</span>
+</span><span id="L-482"><a href="#L-482"><span class="linenos">482</span></a> <span class="s2">&quot;is&quot;</span><span class="p">,</span>
+</span><span id="L-483"><a href="#L-483"><span class="linenos">483</span></a> <span class="s2">&quot;join&quot;</span><span class="p">,</span>
+</span><span id="L-484"><a href="#L-484"><span class="linenos">484</span></a> <span class="s2">&quot;left&quot;</span><span class="p">,</span>
+</span><span id="L-485"><a href="#L-485"><span class="linenos">485</span></a> <span class="s2">&quot;like&quot;</span><span class="p">,</span>
+</span><span id="L-486"><a href="#L-486"><span class="linenos">486</span></a> <span class="s2">&quot;natural&quot;</span><span class="p">,</span>
+</span><span id="L-487"><a href="#L-487"><span class="linenos">487</span></a> <span class="s2">&quot;not&quot;</span><span class="p">,</span>
+</span><span id="L-488"><a href="#L-488"><span class="linenos">488</span></a> <span class="s2">&quot;null&quot;</span><span class="p">,</span>
+</span><span id="L-489"><a href="#L-489"><span class="linenos">489</span></a> <span class="s2">&quot;on&quot;</span><span class="p">,</span>
+</span><span id="L-490"><a href="#L-490"><span class="linenos">490</span></a> <span class="s2">&quot;or&quot;</span><span class="p">,</span>
+</span><span id="L-491"><a href="#L-491"><span class="linenos">491</span></a> <span class="s2">&quot;order&quot;</span><span class="p">,</span>
+</span><span id="L-492"><a href="#L-492"><span class="linenos">492</span></a> <span class="s2">&quot;outer&quot;</span><span class="p">,</span>
+</span><span id="L-493"><a href="#L-493"><span class="linenos">493</span></a> <span class="s2">&quot;prepare&quot;</span><span class="p">,</span>
+</span><span id="L-494"><a href="#L-494"><span class="linenos">494</span></a> <span class="s2">&quot;right&quot;</span><span class="p">,</span>
+</span><span id="L-495"><a href="#L-495"><span class="linenos">495</span></a> <span class="s2">&quot;select&quot;</span><span class="p">,</span>
+</span><span id="L-496"><a href="#L-496"><span class="linenos">496</span></a> <span class="s2">&quot;table&quot;</span><span class="p">,</span>
+</span><span id="L-497"><a href="#L-497"><span class="linenos">497</span></a> <span class="s2">&quot;then&quot;</span><span class="p">,</span>
+</span><span id="L-498"><a href="#L-498"><span class="linenos">498</span></a> <span class="s2">&quot;true&quot;</span><span class="p">,</span>
+</span><span id="L-499"><a href="#L-499"><span class="linenos">499</span></a> <span class="s2">&quot;union&quot;</span><span class="p">,</span>
+</span><span id="L-500"><a href="#L-500"><span class="linenos">500</span></a> <span class="s2">&quot;using&quot;</span><span class="p">,</span>
+</span><span id="L-501"><a href="#L-501"><span class="linenos">501</span></a> <span class="s2">&quot;values&quot;</span><span class="p">,</span>
+</span><span id="L-502"><a href="#L-502"><span class="linenos">502</span></a> <span class="s2">&quot;when&quot;</span><span class="p">,</span>
+</span><span id="L-503"><a href="#L-503"><span class="linenos">503</span></a> <span class="s2">&quot;where&quot;</span><span class="p">,</span>
+</span><span id="L-504"><a href="#L-504"><span class="linenos">504</span></a> <span class="s2">&quot;with&quot;</span><span class="p">,</span>
+</span><span id="L-505"><a href="#L-505"><span class="linenos">505</span></a> <span class="p">}</span>
+</span><span id="L-506"><a href="#L-506"><span class="linenos">506</span></a>
+</span><span id="L-507"><a href="#L-507"><span class="linenos">507</span></a> <span class="k">def</span> <span class="nf">strtounix_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="L-508"><a href="#L-508"><span class="linenos">508</span></a> <span class="c1"># Since `TO_UNIXTIME` requires a `TIMESTAMP`, we need to parse the argument into one.</span>
+</span><span id="L-509"><a href="#L-509"><span class="linenos">509</span></a> <span class="c1"># To do this, we first try to `DATE_PARSE` it, but since this can fail when there&#39;s a</span>
+</span><span id="L-510"><a href="#L-510"><span class="linenos">510</span></a> <span class="c1"># timezone involved, we wrap it in a `TRY` call and use `PARSE_DATETIME` as a fallback,</span>
+</span><span id="L-511"><a href="#L-511"><span class="linenos">511</span></a> <span class="c1"># which seems to be using the same time mapping as Hive, as per:</span>
+</span><span id="L-512"><a href="#L-512"><span class="linenos">512</span></a> <span class="c1"># https://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html</span>
+</span><span id="L-513"><a href="#L-513"><span class="linenos">513</span></a> <span class="n">value_as_text</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">)</span>
+</span><span id="L-514"><a href="#L-514"><span class="linenos">514</span></a> <span class="n">parse_without_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;DATE_PARSE&quot;</span><span class="p">,</span> <span class="n">value_as_text</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span>
+</span><span id="L-515"><a href="#L-515"><span class="linenos">515</span></a> <span class="n">parse_with_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
+</span><span id="L-516"><a href="#L-516"><span class="linenos">516</span></a> <span class="s2">&quot;PARSE_DATETIME&quot;</span><span class="p">,</span>
+</span><span id="L-517"><a href="#L-517"><span class="linenos">517</span></a> <span class="n">value_as_text</span><span class="p">,</span>
+</span><span id="L-518"><a href="#L-518"><span class="linenos">518</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_MAPPING</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_TRIE</span><span class="p">),</span>
+</span><span id="L-519"><a href="#L-519"><span class="linenos">519</span></a> <span class="p">)</span>
+</span><span id="L-520"><a href="#L-520"><span class="linenos">520</span></a> <span class="n">coalesced</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;COALESCE&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TRY&quot;</span><span class="p">,</span> <span class="n">parse_without_tz</span><span class="p">),</span> <span class="n">parse_with_tz</span><span class="p">)</span>
+</span><span id="L-521"><a href="#L-521"><span class="linenos">521</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TO_UNIXTIME&quot;</span><span class="p">,</span> <span class="n">coalesced</span><span class="p">)</span>
+</span><span id="L-522"><a href="#L-522"><span class="linenos">522</span></a>
+</span><span id="L-523"><a href="#L-523"><span class="linenos">523</span></a> <span class="k">def</span> <span class="nf">bracket_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="L-524"><a href="#L-524"><span class="linenos">524</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;safe&quot;</span><span class="p">):</span>
+</span><span id="L-525"><a href="#L-525"><span class="linenos">525</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
+</span><span id="L-526"><a href="#L-526"><span class="linenos">526</span></a> <span class="s2">&quot;ELEMENT_AT&quot;</span><span class="p">,</span>
+</span><span id="L-527"><a href="#L-527"><span class="linenos">527</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
+</span><span id="L-528"><a href="#L-528"><span class="linenos">528</span></a> <span class="n">seq_get</span><span class="p">(</span>
+</span><span id="L-529"><a href="#L-529"><span class="linenos">529</span></a> <span class="n">apply_index_offset</span><span class="p">(</span>
+</span><span id="L-530"><a href="#L-530"><span class="linenos">530</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
+</span><span id="L-531"><a href="#L-531"><span class="linenos">531</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span>
+</span><span id="L-532"><a href="#L-532"><span class="linenos">532</span></a> <span class="mi">1</span> <span class="o">-</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;offset&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
+</span><span id="L-533"><a href="#L-533"><span class="linenos">533</span></a> <span class="p">),</span>
+</span><span id="L-534"><a href="#L-534"><span class="linenos">534</span></a> <span class="mi">0</span><span class="p">,</span>
+</span><span id="L-535"><a href="#L-535"><span class="linenos">535</span></a> <span class="p">),</span>
+</span><span id="L-536"><a href="#L-536"><span class="linenos">536</span></a> <span class="p">)</span>
+</span><span id="L-537"><a href="#L-537"><span class="linenos">537</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">bracket_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="L-538"><a href="#L-538"><span class="linenos">538</span></a>
+</span><span id="L-539"><a href="#L-539"><span class="linenos">539</span></a> <span class="k">def</span> <span class="nf">struct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="L-540"><a href="#L-540"><span class="linenos">540</span></a> <span class="kn">from</span> <span class="nn">sqlglot.optimizer.annotate_types</span> <span class="kn">import</span> <span class="n">annotate_types</span>
+</span><span id="L-541"><a href="#L-541"><span class="linenos">541</span></a>
+</span><span id="L-542"><a href="#L-542"><span class="linenos">542</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">annotate_types</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="L-543"><a href="#L-543"><span class="linenos">543</span></a> <span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+</span><span id="L-544"><a href="#L-544"><span class="linenos">544</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+</span><span id="L-545"><a href="#L-545"><span class="linenos">545</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">False</span>
+</span><span id="L-546"><a href="#L-546"><span class="linenos">546</span></a>
+</span><span id="L-547"><a href="#L-547"><span class="linenos">547</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
+</span><span id="L-548"><a href="#L-548"><span class="linenos">548</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">PropertyEQ</span><span class="p">):</span>
+</span><span id="L-549"><a href="#L-549"><span class="linenos">549</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span> <span class="ow">and</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">):</span>
+</span><span id="L-550"><a href="#L-550"><span class="linenos">550</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">True</span>
+</span><span id="L-551"><a href="#L-551"><span class="linenos">551</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="L-552"><a href="#L-552"><span class="linenos">552</span></a> <span class="n">schema</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
+</span><span id="L-553"><a href="#L-553"><span class="linenos">553</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">&quot;expression&quot;</span><span class="p">))</span>
+</span><span id="L-554"><a href="#L-554"><span class="linenos">554</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="L-555"><a href="#L-555"><span class="linenos">555</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
+</span><span id="L-556"><a href="#L-556"><span class="linenos">556</span></a>
+</span><span id="L-557"><a href="#L-557"><span class="linenos">557</span></a> <span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span>
+</span><span id="L-558"><a href="#L-558"><span class="linenos">558</span></a>
+</span><span id="L-559"><a href="#L-559"><span class="linenos">559</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">size</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> <span class="o">!=</span> <span class="n">size</span><span class="p">:</span>
+</span><span id="L-560"><a href="#L-560"><span class="linenos">560</span></a> <span class="k">if</span> <span class="n">unknown_type</span><span class="p">:</span>
+</span><span id="L-561"><a href="#L-561"><span class="linenos">561</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span>
+</span><span id="L-562"><a href="#L-562"><span class="linenos">562</span></a> <span class="s2">&quot;Cannot convert untyped key-value definitions (try annotate_types).&quot;</span>
+</span><span id="L-563"><a href="#L-563"><span class="linenos">563</span></a> <span class="p">)</span>
+</span><span id="L-564"><a href="#L-564"><span class="linenos">564</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;ROW&quot;</span><span class="p">,</span> <span class="o">*</span><span class="n">values</span><span class="p">)</span>
+</span><span id="L-565"><a href="#L-565"><span class="linenos">565</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;CAST(ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">values</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span><span class="si">}</span><span class="s2">))&quot;</span>
+</span><span id="L-566"><a href="#L-566"><span class="linenos">566</span></a>
+</span><span id="L-567"><a href="#L-567"><span class="linenos">567</span></a> <span class="k">def</span> <span class="nf">interval_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="L-568"><a href="#L-568"><span class="linenos">568</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">&quot;unit&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;WEEK&quot;</span><span class="p">):</span>
+</span><span id="L-569"><a href="#L-569"><span class="linenos">569</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;(</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> * INTERVAL &#39;7&#39; DAY)&quot;</span>
+</span><span id="L-570"><a href="#L-570"><span class="linenos">570</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">interval_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="L-571"><a href="#L-571"><span class="linenos">571</span></a>
+</span><span id="L-572"><a href="#L-572"><span class="linenos">572</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Transaction</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="L-573"><a href="#L-573"><span class="linenos">573</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;modes&quot;</span><span class="p">)</span>
+</span><span id="L-574"><a href="#L-574"><span class="linenos">574</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; </span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">modes</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
+</span><span id="L-575"><a href="#L-575"><span class="linenos">575</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="L-576"><a href="#L-576"><span class="linenos">576</span></a>
+</span><span id="L-577"><a href="#L-577"><span class="linenos">577</span></a> <span class="k">def</span> <span class="nf">generateseries_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="L-578"><a href="#L-578"><span class="linenos">578</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;start&quot;</span><span class="p">]</span>
+</span><span id="L-579"><a href="#L-579"><span class="linenos">579</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;end&quot;</span><span class="p">]</span>
+</span><span id="L-580"><a href="#L-580"><span class="linenos">580</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;step&quot;</span><span class="p">)</span>
+</span><span id="L-581"><a href="#L-581"><span class="linenos">581</span></a>
+</span><span id="L-582"><a href="#L-582"><span class="linenos">582</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
+</span><span id="L-583"><a href="#L-583"><span class="linenos">583</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span>
+</span><span id="L-584"><a href="#L-584"><span class="linenos">584</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
+</span><span id="L-585"><a href="#L-585"><span class="linenos">585</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">end</span><span class="o">.</span><span class="n">to</span>
+</span><span id="L-586"><a href="#L-586"><span class="linenos">586</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="L-587"><a href="#L-587"><span class="linenos">587</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span>
+</span><span id="L-588"><a href="#L-588"><span class="linenos">588</span></a>
+</span><span id="L-589"><a href="#L-589"><span class="linenos">589</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">and</span> <span class="n">target_type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">&quot;timestamp&quot;</span><span class="p">):</span>
+</span><span id="L-590"><a href="#L-590"><span class="linenos">590</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">is</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span><span class="p">:</span>
+</span><span id="L-591"><a href="#L-591"><span class="linenos">591</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
+</span><span id="L-592"><a href="#L-592"><span class="linenos">592</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="L-593"><a href="#L-593"><span class="linenos">593</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
+</span><span id="L-594"><a href="#L-594"><span class="linenos">594</span></a>
+</span><span id="L-595"><a href="#L-595"><span class="linenos">595</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;SEQUENCE&quot;</span><span class="p">,</span> <span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">,</span> <span class="n">step</span><span class="p">)</span>
+</span><span id="L-596"><a href="#L-596"><span class="linenos">596</span></a>
+</span><span id="L-597"><a href="#L-597"><span class="linenos">597</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span>
+</span><span id="L-598"><a href="#L-598"><span class="linenos">598</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">fetch</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">limit</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">]</span>
+</span><span id="L-599"><a href="#L-599"><span class="linenos">599</span></a> <span class="p">)</span> <span class="o">-&gt;</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span>
+</span><span id="L-600"><a href="#L-600"><span class="linenos">600</span></a> <span class="k">return</span> <span class="p">[</span>
+</span><span id="L-601"><a href="#L-601"><span class="linenos">601</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;offset&quot;</span><span class="p">),</span>
+</span><span id="L-602"><a href="#L-602"><span class="linenos">602</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">limit</span><span class="p">),</span>
+</span><span id="L-603"><a href="#L-603"><span class="linenos">603</span></a> <span class="p">]</span>
+</span><span id="L-604"><a href="#L-604"><span class="linenos">604</span></a>
+</span><span id="L-605"><a href="#L-605"><span class="linenos">605</span></a> <span class="k">def</span> <span class="nf">create_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="L-606"><a href="#L-606"><span class="linenos">606</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
+</span><span id="L-607"><a href="#L-607"><span class="linenos">607</span></a><span class="sd"> Presto doesn&#39;t support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span>
+</span><span id="L-608"><a href="#L-608"><span class="linenos">608</span></a><span class="sd"> so we need to remove them</span>
+</span><span id="L-609"><a href="#L-609"><span class="linenos">609</span></a><span class="sd"> &quot;&quot;&quot;</span>
+</span><span id="L-610"><a href="#L-610"><span class="linenos">610</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;kind&quot;</span><span class="p">]</span>
+</span><span id="L-611"><a href="#L-611"><span class="linenos">611</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span>
+</span><span id="L-612"><a href="#L-612"><span class="linenos">612</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">&quot;VIEW&quot;</span> <span class="ow">and</span> <span class="n">schema</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
+</span><span id="L-613"><a href="#L-613"><span class="linenos">613</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">&quot;expressions&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
+</span><span id="L-614"><a href="#L-614"><span class="linenos">614</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">create_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
</span></pre></div>
@@ -1088,114 +1152,175 @@
</span><span id="Presto-444"><a href="#Presto-444"><span class="linenos">444</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Xor</span><span class="p">:</span> <span class="n">bool_xor_sql</span><span class="p">,</span>
</span><span id="Presto-445"><a href="#Presto-445"><span class="linenos">445</span></a> <span class="p">}</span>
</span><span id="Presto-446"><a href="#Presto-446"><span class="linenos">446</span></a>
-</span><span id="Presto-447"><a href="#Presto-447"><span class="linenos">447</span></a> <span class="k">def</span> <span class="nf">strtounix_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto-448"><a href="#Presto-448"><span class="linenos">448</span></a> <span class="c1"># Since `TO_UNIXTIME` requires a `TIMESTAMP`, we need to parse the argument into one.</span>
-</span><span id="Presto-449"><a href="#Presto-449"><span class="linenos">449</span></a> <span class="c1"># To do this, we first try to `DATE_PARSE` it, but since this can fail when there&#39;s a</span>
-</span><span id="Presto-450"><a href="#Presto-450"><span class="linenos">450</span></a> <span class="c1"># timezone involved, we wrap it in a `TRY` call and use `PARSE_DATETIME` as a fallback,</span>
-</span><span id="Presto-451"><a href="#Presto-451"><span class="linenos">451</span></a> <span class="c1"># which seems to be using the same time mapping as Hive, as per:</span>
-</span><span id="Presto-452"><a href="#Presto-452"><span class="linenos">452</span></a> <span class="c1"># https://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html</span>
-</span><span id="Presto-453"><a href="#Presto-453"><span class="linenos">453</span></a> <span class="n">value_as_text</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">)</span>
-</span><span id="Presto-454"><a href="#Presto-454"><span class="linenos">454</span></a> <span class="n">parse_without_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;DATE_PARSE&quot;</span><span class="p">,</span> <span class="n">value_as_text</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span>
-</span><span id="Presto-455"><a href="#Presto-455"><span class="linenos">455</span></a> <span class="n">parse_with_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
-</span><span id="Presto-456"><a href="#Presto-456"><span class="linenos">456</span></a> <span class="s2">&quot;PARSE_DATETIME&quot;</span><span class="p">,</span>
-</span><span id="Presto-457"><a href="#Presto-457"><span class="linenos">457</span></a> <span class="n">value_as_text</span><span class="p">,</span>
-</span><span id="Presto-458"><a href="#Presto-458"><span class="linenos">458</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_MAPPING</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_TRIE</span><span class="p">),</span>
-</span><span id="Presto-459"><a href="#Presto-459"><span class="linenos">459</span></a> <span class="p">)</span>
-</span><span id="Presto-460"><a href="#Presto-460"><span class="linenos">460</span></a> <span class="n">coalesced</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;COALESCE&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TRY&quot;</span><span class="p">,</span> <span class="n">parse_without_tz</span><span class="p">),</span> <span class="n">parse_with_tz</span><span class="p">)</span>
-</span><span id="Presto-461"><a href="#Presto-461"><span class="linenos">461</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TO_UNIXTIME&quot;</span><span class="p">,</span> <span class="n">coalesced</span><span class="p">)</span>
-</span><span id="Presto-462"><a href="#Presto-462"><span class="linenos">462</span></a>
-</span><span id="Presto-463"><a href="#Presto-463"><span class="linenos">463</span></a> <span class="k">def</span> <span class="nf">bracket_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto-464"><a href="#Presto-464"><span class="linenos">464</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;safe&quot;</span><span class="p">):</span>
-</span><span id="Presto-465"><a href="#Presto-465"><span class="linenos">465</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
-</span><span id="Presto-466"><a href="#Presto-466"><span class="linenos">466</span></a> <span class="s2">&quot;ELEMENT_AT&quot;</span><span class="p">,</span>
-</span><span id="Presto-467"><a href="#Presto-467"><span class="linenos">467</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
-</span><span id="Presto-468"><a href="#Presto-468"><span class="linenos">468</span></a> <span class="n">seq_get</span><span class="p">(</span>
-</span><span id="Presto-469"><a href="#Presto-469"><span class="linenos">469</span></a> <span class="n">apply_index_offset</span><span class="p">(</span>
-</span><span id="Presto-470"><a href="#Presto-470"><span class="linenos">470</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
-</span><span id="Presto-471"><a href="#Presto-471"><span class="linenos">471</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span>
-</span><span id="Presto-472"><a href="#Presto-472"><span class="linenos">472</span></a> <span class="mi">1</span> <span class="o">-</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;offset&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
-</span><span id="Presto-473"><a href="#Presto-473"><span class="linenos">473</span></a> <span class="p">),</span>
-</span><span id="Presto-474"><a href="#Presto-474"><span class="linenos">474</span></a> <span class="mi">0</span><span class="p">,</span>
-</span><span id="Presto-475"><a href="#Presto-475"><span class="linenos">475</span></a> <span class="p">),</span>
-</span><span id="Presto-476"><a href="#Presto-476"><span class="linenos">476</span></a> <span class="p">)</span>
-</span><span id="Presto-477"><a href="#Presto-477"><span class="linenos">477</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">bracket_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="Presto-478"><a href="#Presto-478"><span class="linenos">478</span></a>
-</span><span id="Presto-479"><a href="#Presto-479"><span class="linenos">479</span></a> <span class="k">def</span> <span class="nf">struct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto-480"><a href="#Presto-480"><span class="linenos">480</span></a> <span class="kn">from</span> <span class="nn">sqlglot.optimizer.annotate_types</span> <span class="kn">import</span> <span class="n">annotate_types</span>
-</span><span id="Presto-481"><a href="#Presto-481"><span class="linenos">481</span></a>
-</span><span id="Presto-482"><a href="#Presto-482"><span class="linenos">482</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">annotate_types</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="Presto-483"><a href="#Presto-483"><span class="linenos">483</span></a> <span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
-</span><span id="Presto-484"><a href="#Presto-484"><span class="linenos">484</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
-</span><span id="Presto-485"><a href="#Presto-485"><span class="linenos">485</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">False</span>
-</span><span id="Presto-486"><a href="#Presto-486"><span class="linenos">486</span></a>
-</span><span id="Presto-487"><a href="#Presto-487"><span class="linenos">487</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
-</span><span id="Presto-488"><a href="#Presto-488"><span class="linenos">488</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">PropertyEQ</span><span class="p">):</span>
-</span><span id="Presto-489"><a href="#Presto-489"><span class="linenos">489</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span> <span class="ow">and</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">):</span>
-</span><span id="Presto-490"><a href="#Presto-490"><span class="linenos">490</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">True</span>
-</span><span id="Presto-491"><a href="#Presto-491"><span class="linenos">491</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Presto-492"><a href="#Presto-492"><span class="linenos">492</span></a> <span class="n">schema</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
-</span><span id="Presto-493"><a href="#Presto-493"><span class="linenos">493</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">&quot;expression&quot;</span><span class="p">))</span>
-</span><span id="Presto-494"><a href="#Presto-494"><span class="linenos">494</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Presto-495"><a href="#Presto-495"><span class="linenos">495</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
-</span><span id="Presto-496"><a href="#Presto-496"><span class="linenos">496</span></a>
-</span><span id="Presto-497"><a href="#Presto-497"><span class="linenos">497</span></a> <span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span>
-</span><span id="Presto-498"><a href="#Presto-498"><span class="linenos">498</span></a>
-</span><span id="Presto-499"><a href="#Presto-499"><span class="linenos">499</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">size</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> <span class="o">!=</span> <span class="n">size</span><span class="p">:</span>
-</span><span id="Presto-500"><a href="#Presto-500"><span class="linenos">500</span></a> <span class="k">if</span> <span class="n">unknown_type</span><span class="p">:</span>
-</span><span id="Presto-501"><a href="#Presto-501"><span class="linenos">501</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span>
-</span><span id="Presto-502"><a href="#Presto-502"><span class="linenos">502</span></a> <span class="s2">&quot;Cannot convert untyped key-value definitions (try annotate_types).&quot;</span>
-</span><span id="Presto-503"><a href="#Presto-503"><span class="linenos">503</span></a> <span class="p">)</span>
-</span><span id="Presto-504"><a href="#Presto-504"><span class="linenos">504</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;ROW&quot;</span><span class="p">,</span> <span class="o">*</span><span class="n">values</span><span class="p">)</span>
-</span><span id="Presto-505"><a href="#Presto-505"><span class="linenos">505</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;CAST(ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">values</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span><span class="si">}</span><span class="s2">))&quot;</span>
-</span><span id="Presto-506"><a href="#Presto-506"><span class="linenos">506</span></a>
-</span><span id="Presto-507"><a href="#Presto-507"><span class="linenos">507</span></a> <span class="k">def</span> <span class="nf">interval_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto-508"><a href="#Presto-508"><span class="linenos">508</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">&quot;unit&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;WEEK&quot;</span><span class="p">):</span>
-</span><span id="Presto-509"><a href="#Presto-509"><span class="linenos">509</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;(</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> * INTERVAL &#39;7&#39; DAY)&quot;</span>
-</span><span id="Presto-510"><a href="#Presto-510"><span class="linenos">510</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">interval_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="Presto-511"><a href="#Presto-511"><span class="linenos">511</span></a>
-</span><span id="Presto-512"><a href="#Presto-512"><span class="linenos">512</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Transaction</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto-513"><a href="#Presto-513"><span class="linenos">513</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;modes&quot;</span><span class="p">)</span>
-</span><span id="Presto-514"><a href="#Presto-514"><span class="linenos">514</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; </span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">modes</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
-</span><span id="Presto-515"><a href="#Presto-515"><span class="linenos">515</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">&quot;</span>
-</span><span id="Presto-516"><a href="#Presto-516"><span class="linenos">516</span></a>
-</span><span id="Presto-517"><a href="#Presto-517"><span class="linenos">517</span></a> <span class="k">def</span> <span class="nf">generateseries_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto-518"><a href="#Presto-518"><span class="linenos">518</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;start&quot;</span><span class="p">]</span>
-</span><span id="Presto-519"><a href="#Presto-519"><span class="linenos">519</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;end&quot;</span><span class="p">]</span>
-</span><span id="Presto-520"><a href="#Presto-520"><span class="linenos">520</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;step&quot;</span><span class="p">)</span>
-</span><span id="Presto-521"><a href="#Presto-521"><span class="linenos">521</span></a>
-</span><span id="Presto-522"><a href="#Presto-522"><span class="linenos">522</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
-</span><span id="Presto-523"><a href="#Presto-523"><span class="linenos">523</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span>
-</span><span id="Presto-524"><a href="#Presto-524"><span class="linenos">524</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
-</span><span id="Presto-525"><a href="#Presto-525"><span class="linenos">525</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">end</span><span class="o">.</span><span class="n">to</span>
-</span><span id="Presto-526"><a href="#Presto-526"><span class="linenos">526</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Presto-527"><a href="#Presto-527"><span class="linenos">527</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span>
-</span><span id="Presto-528"><a href="#Presto-528"><span class="linenos">528</span></a>
-</span><span id="Presto-529"><a href="#Presto-529"><span class="linenos">529</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">and</span> <span class="n">target_type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">&quot;timestamp&quot;</span><span class="p">):</span>
-</span><span id="Presto-530"><a href="#Presto-530"><span class="linenos">530</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">is</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span><span class="p">:</span>
-</span><span id="Presto-531"><a href="#Presto-531"><span class="linenos">531</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
-</span><span id="Presto-532"><a href="#Presto-532"><span class="linenos">532</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Presto-533"><a href="#Presto-533"><span class="linenos">533</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
-</span><span id="Presto-534"><a href="#Presto-534"><span class="linenos">534</span></a>
-</span><span id="Presto-535"><a href="#Presto-535"><span class="linenos">535</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;SEQUENCE&quot;</span><span class="p">,</span> <span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">,</span> <span class="n">step</span><span class="p">)</span>
-</span><span id="Presto-536"><a href="#Presto-536"><span class="linenos">536</span></a>
-</span><span id="Presto-537"><a href="#Presto-537"><span class="linenos">537</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span>
-</span><span id="Presto-538"><a href="#Presto-538"><span class="linenos">538</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">fetch</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">limit</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">]</span>
-</span><span id="Presto-539"><a href="#Presto-539"><span class="linenos">539</span></a> <span class="p">)</span> <span class="o">-&gt;</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span>
-</span><span id="Presto-540"><a href="#Presto-540"><span class="linenos">540</span></a> <span class="k">return</span> <span class="p">[</span>
-</span><span id="Presto-541"><a href="#Presto-541"><span class="linenos">541</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;offset&quot;</span><span class="p">),</span>
-</span><span id="Presto-542"><a href="#Presto-542"><span class="linenos">542</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">limit</span><span class="p">),</span>
-</span><span id="Presto-543"><a href="#Presto-543"><span class="linenos">543</span></a> <span class="p">]</span>
-</span><span id="Presto-544"><a href="#Presto-544"><span class="linenos">544</span></a>
-</span><span id="Presto-545"><a href="#Presto-545"><span class="linenos">545</span></a> <span class="k">def</span> <span class="nf">create_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto-546"><a href="#Presto-546"><span class="linenos">546</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
-</span><span id="Presto-547"><a href="#Presto-547"><span class="linenos">547</span></a><span class="sd"> Presto doesn&#39;t support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span>
-</span><span id="Presto-548"><a href="#Presto-548"><span class="linenos">548</span></a><span class="sd"> so we need to remove them</span>
-</span><span id="Presto-549"><a href="#Presto-549"><span class="linenos">549</span></a><span class="sd"> &quot;&quot;&quot;</span>
-</span><span id="Presto-550"><a href="#Presto-550"><span class="linenos">550</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;kind&quot;</span><span class="p">]</span>
-</span><span id="Presto-551"><a href="#Presto-551"><span class="linenos">551</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span>
-</span><span id="Presto-552"><a href="#Presto-552"><span class="linenos">552</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">&quot;VIEW&quot;</span> <span class="ow">and</span> <span class="n">schema</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
-</span><span id="Presto-553"><a href="#Presto-553"><span class="linenos">553</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">&quot;expressions&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
-</span><span id="Presto-554"><a href="#Presto-554"><span class="linenos">554</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">create_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="Presto-447"><a href="#Presto-447"><span class="linenos">447</span></a> <span class="n">RESERVED_KEYWORDS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Presto-448"><a href="#Presto-448"><span class="linenos">448</span></a> <span class="s2">&quot;alter&quot;</span><span class="p">,</span>
+</span><span id="Presto-449"><a href="#Presto-449"><span class="linenos">449</span></a> <span class="s2">&quot;and&quot;</span><span class="p">,</span>
+</span><span id="Presto-450"><a href="#Presto-450"><span class="linenos">450</span></a> <span class="s2">&quot;as&quot;</span><span class="p">,</span>
+</span><span id="Presto-451"><a href="#Presto-451"><span class="linenos">451</span></a> <span class="s2">&quot;between&quot;</span><span class="p">,</span>
+</span><span id="Presto-452"><a href="#Presto-452"><span class="linenos">452</span></a> <span class="s2">&quot;by&quot;</span><span class="p">,</span>
+</span><span id="Presto-453"><a href="#Presto-453"><span class="linenos">453</span></a> <span class="s2">&quot;case&quot;</span><span class="p">,</span>
+</span><span id="Presto-454"><a href="#Presto-454"><span class="linenos">454</span></a> <span class="s2">&quot;cast&quot;</span><span class="p">,</span>
+</span><span id="Presto-455"><a href="#Presto-455"><span class="linenos">455</span></a> <span class="s2">&quot;constraint&quot;</span><span class="p">,</span>
+</span><span id="Presto-456"><a href="#Presto-456"><span class="linenos">456</span></a> <span class="s2">&quot;create&quot;</span><span class="p">,</span>
+</span><span id="Presto-457"><a href="#Presto-457"><span class="linenos">457</span></a> <span class="s2">&quot;cross&quot;</span><span class="p">,</span>
+</span><span id="Presto-458"><a href="#Presto-458"><span class="linenos">458</span></a> <span class="s2">&quot;current_time&quot;</span><span class="p">,</span>
+</span><span id="Presto-459"><a href="#Presto-459"><span class="linenos">459</span></a> <span class="s2">&quot;current_timestamp&quot;</span><span class="p">,</span>
+</span><span id="Presto-460"><a href="#Presto-460"><span class="linenos">460</span></a> <span class="s2">&quot;deallocate&quot;</span><span class="p">,</span>
+</span><span id="Presto-461"><a href="#Presto-461"><span class="linenos">461</span></a> <span class="s2">&quot;delete&quot;</span><span class="p">,</span>
+</span><span id="Presto-462"><a href="#Presto-462"><span class="linenos">462</span></a> <span class="s2">&quot;describe&quot;</span><span class="p">,</span>
+</span><span id="Presto-463"><a href="#Presto-463"><span class="linenos">463</span></a> <span class="s2">&quot;distinct&quot;</span><span class="p">,</span>
+</span><span id="Presto-464"><a href="#Presto-464"><span class="linenos">464</span></a> <span class="s2">&quot;drop&quot;</span><span class="p">,</span>
+</span><span id="Presto-465"><a href="#Presto-465"><span class="linenos">465</span></a> <span class="s2">&quot;else&quot;</span><span class="p">,</span>
+</span><span id="Presto-466"><a href="#Presto-466"><span class="linenos">466</span></a> <span class="s2">&quot;end&quot;</span><span class="p">,</span>
+</span><span id="Presto-467"><a href="#Presto-467"><span class="linenos">467</span></a> <span class="s2">&quot;escape&quot;</span><span class="p">,</span>
+</span><span id="Presto-468"><a href="#Presto-468"><span class="linenos">468</span></a> <span class="s2">&quot;except&quot;</span><span class="p">,</span>
+</span><span id="Presto-469"><a href="#Presto-469"><span class="linenos">469</span></a> <span class="s2">&quot;execute&quot;</span><span class="p">,</span>
+</span><span id="Presto-470"><a href="#Presto-470"><span class="linenos">470</span></a> <span class="s2">&quot;exists&quot;</span><span class="p">,</span>
+</span><span id="Presto-471"><a href="#Presto-471"><span class="linenos">471</span></a> <span class="s2">&quot;extract&quot;</span><span class="p">,</span>
+</span><span id="Presto-472"><a href="#Presto-472"><span class="linenos">472</span></a> <span class="s2">&quot;false&quot;</span><span class="p">,</span>
+</span><span id="Presto-473"><a href="#Presto-473"><span class="linenos">473</span></a> <span class="s2">&quot;for&quot;</span><span class="p">,</span>
+</span><span id="Presto-474"><a href="#Presto-474"><span class="linenos">474</span></a> <span class="s2">&quot;from&quot;</span><span class="p">,</span>
+</span><span id="Presto-475"><a href="#Presto-475"><span class="linenos">475</span></a> <span class="s2">&quot;full&quot;</span><span class="p">,</span>
+</span><span id="Presto-476"><a href="#Presto-476"><span class="linenos">476</span></a> <span class="s2">&quot;group&quot;</span><span class="p">,</span>
+</span><span id="Presto-477"><a href="#Presto-477"><span class="linenos">477</span></a> <span class="s2">&quot;having&quot;</span><span class="p">,</span>
+</span><span id="Presto-478"><a href="#Presto-478"><span class="linenos">478</span></a> <span class="s2">&quot;in&quot;</span><span class="p">,</span>
+</span><span id="Presto-479"><a href="#Presto-479"><span class="linenos">479</span></a> <span class="s2">&quot;inner&quot;</span><span class="p">,</span>
+</span><span id="Presto-480"><a href="#Presto-480"><span class="linenos">480</span></a> <span class="s2">&quot;insert&quot;</span><span class="p">,</span>
+</span><span id="Presto-481"><a href="#Presto-481"><span class="linenos">481</span></a> <span class="s2">&quot;intersect&quot;</span><span class="p">,</span>
+</span><span id="Presto-482"><a href="#Presto-482"><span class="linenos">482</span></a> <span class="s2">&quot;into&quot;</span><span class="p">,</span>
+</span><span id="Presto-483"><a href="#Presto-483"><span class="linenos">483</span></a> <span class="s2">&quot;is&quot;</span><span class="p">,</span>
+</span><span id="Presto-484"><a href="#Presto-484"><span class="linenos">484</span></a> <span class="s2">&quot;join&quot;</span><span class="p">,</span>
+</span><span id="Presto-485"><a href="#Presto-485"><span class="linenos">485</span></a> <span class="s2">&quot;left&quot;</span><span class="p">,</span>
+</span><span id="Presto-486"><a href="#Presto-486"><span class="linenos">486</span></a> <span class="s2">&quot;like&quot;</span><span class="p">,</span>
+</span><span id="Presto-487"><a href="#Presto-487"><span class="linenos">487</span></a> <span class="s2">&quot;natural&quot;</span><span class="p">,</span>
+</span><span id="Presto-488"><a href="#Presto-488"><span class="linenos">488</span></a> <span class="s2">&quot;not&quot;</span><span class="p">,</span>
+</span><span id="Presto-489"><a href="#Presto-489"><span class="linenos">489</span></a> <span class="s2">&quot;null&quot;</span><span class="p">,</span>
+</span><span id="Presto-490"><a href="#Presto-490"><span class="linenos">490</span></a> <span class="s2">&quot;on&quot;</span><span class="p">,</span>
+</span><span id="Presto-491"><a href="#Presto-491"><span class="linenos">491</span></a> <span class="s2">&quot;or&quot;</span><span class="p">,</span>
+</span><span id="Presto-492"><a href="#Presto-492"><span class="linenos">492</span></a> <span class="s2">&quot;order&quot;</span><span class="p">,</span>
+</span><span id="Presto-493"><a href="#Presto-493"><span class="linenos">493</span></a> <span class="s2">&quot;outer&quot;</span><span class="p">,</span>
+</span><span id="Presto-494"><a href="#Presto-494"><span class="linenos">494</span></a> <span class="s2">&quot;prepare&quot;</span><span class="p">,</span>
+</span><span id="Presto-495"><a href="#Presto-495"><span class="linenos">495</span></a> <span class="s2">&quot;right&quot;</span><span class="p">,</span>
+</span><span id="Presto-496"><a href="#Presto-496"><span class="linenos">496</span></a> <span class="s2">&quot;select&quot;</span><span class="p">,</span>
+</span><span id="Presto-497"><a href="#Presto-497"><span class="linenos">497</span></a> <span class="s2">&quot;table&quot;</span><span class="p">,</span>
+</span><span id="Presto-498"><a href="#Presto-498"><span class="linenos">498</span></a> <span class="s2">&quot;then&quot;</span><span class="p">,</span>
+</span><span id="Presto-499"><a href="#Presto-499"><span class="linenos">499</span></a> <span class="s2">&quot;true&quot;</span><span class="p">,</span>
+</span><span id="Presto-500"><a href="#Presto-500"><span class="linenos">500</span></a> <span class="s2">&quot;union&quot;</span><span class="p">,</span>
+</span><span id="Presto-501"><a href="#Presto-501"><span class="linenos">501</span></a> <span class="s2">&quot;using&quot;</span><span class="p">,</span>
+</span><span id="Presto-502"><a href="#Presto-502"><span class="linenos">502</span></a> <span class="s2">&quot;values&quot;</span><span class="p">,</span>
+</span><span id="Presto-503"><a href="#Presto-503"><span class="linenos">503</span></a> <span class="s2">&quot;when&quot;</span><span class="p">,</span>
+</span><span id="Presto-504"><a href="#Presto-504"><span class="linenos">504</span></a> <span class="s2">&quot;where&quot;</span><span class="p">,</span>
+</span><span id="Presto-505"><a href="#Presto-505"><span class="linenos">505</span></a> <span class="s2">&quot;with&quot;</span><span class="p">,</span>
+</span><span id="Presto-506"><a href="#Presto-506"><span class="linenos">506</span></a> <span class="p">}</span>
+</span><span id="Presto-507"><a href="#Presto-507"><span class="linenos">507</span></a>
+</span><span id="Presto-508"><a href="#Presto-508"><span class="linenos">508</span></a> <span class="k">def</span> <span class="nf">strtounix_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto-509"><a href="#Presto-509"><span class="linenos">509</span></a> <span class="c1"># Since `TO_UNIXTIME` requires a `TIMESTAMP`, we need to parse the argument into one.</span>
+</span><span id="Presto-510"><a href="#Presto-510"><span class="linenos">510</span></a> <span class="c1"># To do this, we first try to `DATE_PARSE` it, but since this can fail when there&#39;s a</span>
+</span><span id="Presto-511"><a href="#Presto-511"><span class="linenos">511</span></a> <span class="c1"># timezone involved, we wrap it in a `TRY` call and use `PARSE_DATETIME` as a fallback,</span>
+</span><span id="Presto-512"><a href="#Presto-512"><span class="linenos">512</span></a> <span class="c1"># which seems to be using the same time mapping as Hive, as per:</span>
+</span><span id="Presto-513"><a href="#Presto-513"><span class="linenos">513</span></a> <span class="c1"># https://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html</span>
+</span><span id="Presto-514"><a href="#Presto-514"><span class="linenos">514</span></a> <span class="n">value_as_text</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">)</span>
+</span><span id="Presto-515"><a href="#Presto-515"><span class="linenos">515</span></a> <span class="n">parse_without_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;DATE_PARSE&quot;</span><span class="p">,</span> <span class="n">value_as_text</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span>
+</span><span id="Presto-516"><a href="#Presto-516"><span class="linenos">516</span></a> <span class="n">parse_with_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
+</span><span id="Presto-517"><a href="#Presto-517"><span class="linenos">517</span></a> <span class="s2">&quot;PARSE_DATETIME&quot;</span><span class="p">,</span>
+</span><span id="Presto-518"><a href="#Presto-518"><span class="linenos">518</span></a> <span class="n">value_as_text</span><span class="p">,</span>
+</span><span id="Presto-519"><a href="#Presto-519"><span class="linenos">519</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_MAPPING</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_TRIE</span><span class="p">),</span>
+</span><span id="Presto-520"><a href="#Presto-520"><span class="linenos">520</span></a> <span class="p">)</span>
+</span><span id="Presto-521"><a href="#Presto-521"><span class="linenos">521</span></a> <span class="n">coalesced</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;COALESCE&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TRY&quot;</span><span class="p">,</span> <span class="n">parse_without_tz</span><span class="p">),</span> <span class="n">parse_with_tz</span><span class="p">)</span>
+</span><span id="Presto-522"><a href="#Presto-522"><span class="linenos">522</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TO_UNIXTIME&quot;</span><span class="p">,</span> <span class="n">coalesced</span><span class="p">)</span>
+</span><span id="Presto-523"><a href="#Presto-523"><span class="linenos">523</span></a>
+</span><span id="Presto-524"><a href="#Presto-524"><span class="linenos">524</span></a> <span class="k">def</span> <span class="nf">bracket_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto-525"><a href="#Presto-525"><span class="linenos">525</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;safe&quot;</span><span class="p">):</span>
+</span><span id="Presto-526"><a href="#Presto-526"><span class="linenos">526</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
+</span><span id="Presto-527"><a href="#Presto-527"><span class="linenos">527</span></a> <span class="s2">&quot;ELEMENT_AT&quot;</span><span class="p">,</span>
+</span><span id="Presto-528"><a href="#Presto-528"><span class="linenos">528</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
+</span><span id="Presto-529"><a href="#Presto-529"><span class="linenos">529</span></a> <span class="n">seq_get</span><span class="p">(</span>
+</span><span id="Presto-530"><a href="#Presto-530"><span class="linenos">530</span></a> <span class="n">apply_index_offset</span><span class="p">(</span>
+</span><span id="Presto-531"><a href="#Presto-531"><span class="linenos">531</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
+</span><span id="Presto-532"><a href="#Presto-532"><span class="linenos">532</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span>
+</span><span id="Presto-533"><a href="#Presto-533"><span class="linenos">533</span></a> <span class="mi">1</span> <span class="o">-</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;offset&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
+</span><span id="Presto-534"><a href="#Presto-534"><span class="linenos">534</span></a> <span class="p">),</span>
+</span><span id="Presto-535"><a href="#Presto-535"><span class="linenos">535</span></a> <span class="mi">0</span><span class="p">,</span>
+</span><span id="Presto-536"><a href="#Presto-536"><span class="linenos">536</span></a> <span class="p">),</span>
+</span><span id="Presto-537"><a href="#Presto-537"><span class="linenos">537</span></a> <span class="p">)</span>
+</span><span id="Presto-538"><a href="#Presto-538"><span class="linenos">538</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">bracket_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="Presto-539"><a href="#Presto-539"><span class="linenos">539</span></a>
+</span><span id="Presto-540"><a href="#Presto-540"><span class="linenos">540</span></a> <span class="k">def</span> <span class="nf">struct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto-541"><a href="#Presto-541"><span class="linenos">541</span></a> <span class="kn">from</span> <span class="nn">sqlglot.optimizer.annotate_types</span> <span class="kn">import</span> <span class="n">annotate_types</span>
+</span><span id="Presto-542"><a href="#Presto-542"><span class="linenos">542</span></a>
+</span><span id="Presto-543"><a href="#Presto-543"><span class="linenos">543</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">annotate_types</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="Presto-544"><a href="#Presto-544"><span class="linenos">544</span></a> <span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+</span><span id="Presto-545"><a href="#Presto-545"><span class="linenos">545</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+</span><span id="Presto-546"><a href="#Presto-546"><span class="linenos">546</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">False</span>
+</span><span id="Presto-547"><a href="#Presto-547"><span class="linenos">547</span></a>
+</span><span id="Presto-548"><a href="#Presto-548"><span class="linenos">548</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
+</span><span id="Presto-549"><a href="#Presto-549"><span class="linenos">549</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">PropertyEQ</span><span class="p">):</span>
+</span><span id="Presto-550"><a href="#Presto-550"><span class="linenos">550</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span> <span class="ow">and</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">):</span>
+</span><span id="Presto-551"><a href="#Presto-551"><span class="linenos">551</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">True</span>
+</span><span id="Presto-552"><a href="#Presto-552"><span class="linenos">552</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Presto-553"><a href="#Presto-553"><span class="linenos">553</span></a> <span class="n">schema</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
+</span><span id="Presto-554"><a href="#Presto-554"><span class="linenos">554</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">&quot;expression&quot;</span><span class="p">))</span>
+</span><span id="Presto-555"><a href="#Presto-555"><span class="linenos">555</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Presto-556"><a href="#Presto-556"><span class="linenos">556</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
+</span><span id="Presto-557"><a href="#Presto-557"><span class="linenos">557</span></a>
+</span><span id="Presto-558"><a href="#Presto-558"><span class="linenos">558</span></a> <span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span>
+</span><span id="Presto-559"><a href="#Presto-559"><span class="linenos">559</span></a>
+</span><span id="Presto-560"><a href="#Presto-560"><span class="linenos">560</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">size</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> <span class="o">!=</span> <span class="n">size</span><span class="p">:</span>
+</span><span id="Presto-561"><a href="#Presto-561"><span class="linenos">561</span></a> <span class="k">if</span> <span class="n">unknown_type</span><span class="p">:</span>
+</span><span id="Presto-562"><a href="#Presto-562"><span class="linenos">562</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span>
+</span><span id="Presto-563"><a href="#Presto-563"><span class="linenos">563</span></a> <span class="s2">&quot;Cannot convert untyped key-value definitions (try annotate_types).&quot;</span>
+</span><span id="Presto-564"><a href="#Presto-564"><span class="linenos">564</span></a> <span class="p">)</span>
+</span><span id="Presto-565"><a href="#Presto-565"><span class="linenos">565</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;ROW&quot;</span><span class="p">,</span> <span class="o">*</span><span class="n">values</span><span class="p">)</span>
+</span><span id="Presto-566"><a href="#Presto-566"><span class="linenos">566</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;CAST(ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">values</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span><span class="si">}</span><span class="s2">))&quot;</span>
+</span><span id="Presto-567"><a href="#Presto-567"><span class="linenos">567</span></a>
+</span><span id="Presto-568"><a href="#Presto-568"><span class="linenos">568</span></a> <span class="k">def</span> <span class="nf">interval_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto-569"><a href="#Presto-569"><span class="linenos">569</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">&quot;unit&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;WEEK&quot;</span><span class="p">):</span>
+</span><span id="Presto-570"><a href="#Presto-570"><span class="linenos">570</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;(</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> * INTERVAL &#39;7&#39; DAY)&quot;</span>
+</span><span id="Presto-571"><a href="#Presto-571"><span class="linenos">571</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">interval_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="Presto-572"><a href="#Presto-572"><span class="linenos">572</span></a>
+</span><span id="Presto-573"><a href="#Presto-573"><span class="linenos">573</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Transaction</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto-574"><a href="#Presto-574"><span class="linenos">574</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;modes&quot;</span><span class="p">)</span>
+</span><span id="Presto-575"><a href="#Presto-575"><span class="linenos">575</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; </span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">modes</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
+</span><span id="Presto-576"><a href="#Presto-576"><span class="linenos">576</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="Presto-577"><a href="#Presto-577"><span class="linenos">577</span></a>
+</span><span id="Presto-578"><a href="#Presto-578"><span class="linenos">578</span></a> <span class="k">def</span> <span class="nf">generateseries_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto-579"><a href="#Presto-579"><span class="linenos">579</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;start&quot;</span><span class="p">]</span>
+</span><span id="Presto-580"><a href="#Presto-580"><span class="linenos">580</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;end&quot;</span><span class="p">]</span>
+</span><span id="Presto-581"><a href="#Presto-581"><span class="linenos">581</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;step&quot;</span><span class="p">)</span>
+</span><span id="Presto-582"><a href="#Presto-582"><span class="linenos">582</span></a>
+</span><span id="Presto-583"><a href="#Presto-583"><span class="linenos">583</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
+</span><span id="Presto-584"><a href="#Presto-584"><span class="linenos">584</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span>
+</span><span id="Presto-585"><a href="#Presto-585"><span class="linenos">585</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
+</span><span id="Presto-586"><a href="#Presto-586"><span class="linenos">586</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">end</span><span class="o">.</span><span class="n">to</span>
+</span><span id="Presto-587"><a href="#Presto-587"><span class="linenos">587</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Presto-588"><a href="#Presto-588"><span class="linenos">588</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span>
+</span><span id="Presto-589"><a href="#Presto-589"><span class="linenos">589</span></a>
+</span><span id="Presto-590"><a href="#Presto-590"><span class="linenos">590</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">and</span> <span class="n">target_type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">&quot;timestamp&quot;</span><span class="p">):</span>
+</span><span id="Presto-591"><a href="#Presto-591"><span class="linenos">591</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">is</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span><span class="p">:</span>
+</span><span id="Presto-592"><a href="#Presto-592"><span class="linenos">592</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
+</span><span id="Presto-593"><a href="#Presto-593"><span class="linenos">593</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Presto-594"><a href="#Presto-594"><span class="linenos">594</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
+</span><span id="Presto-595"><a href="#Presto-595"><span class="linenos">595</span></a>
+</span><span id="Presto-596"><a href="#Presto-596"><span class="linenos">596</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;SEQUENCE&quot;</span><span class="p">,</span> <span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">,</span> <span class="n">step</span><span class="p">)</span>
+</span><span id="Presto-597"><a href="#Presto-597"><span class="linenos">597</span></a>
+</span><span id="Presto-598"><a href="#Presto-598"><span class="linenos">598</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span>
+</span><span id="Presto-599"><a href="#Presto-599"><span class="linenos">599</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">fetch</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">limit</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">]</span>
+</span><span id="Presto-600"><a href="#Presto-600"><span class="linenos">600</span></a> <span class="p">)</span> <span class="o">-&gt;</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span>
+</span><span id="Presto-601"><a href="#Presto-601"><span class="linenos">601</span></a> <span class="k">return</span> <span class="p">[</span>
+</span><span id="Presto-602"><a href="#Presto-602"><span class="linenos">602</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;offset&quot;</span><span class="p">),</span>
+</span><span id="Presto-603"><a href="#Presto-603"><span class="linenos">603</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">limit</span><span class="p">),</span>
+</span><span id="Presto-604"><a href="#Presto-604"><span class="linenos">604</span></a> <span class="p">]</span>
+</span><span id="Presto-605"><a href="#Presto-605"><span class="linenos">605</span></a>
+</span><span id="Presto-606"><a href="#Presto-606"><span class="linenos">606</span></a> <span class="k">def</span> <span class="nf">create_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto-607"><a href="#Presto-607"><span class="linenos">607</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
+</span><span id="Presto-608"><a href="#Presto-608"><span class="linenos">608</span></a><span class="sd"> Presto doesn&#39;t support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span>
+</span><span id="Presto-609"><a href="#Presto-609"><span class="linenos">609</span></a><span class="sd"> so we need to remove them</span>
+</span><span id="Presto-610"><a href="#Presto-610"><span class="linenos">610</span></a><span class="sd"> &quot;&quot;&quot;</span>
+</span><span id="Presto-611"><a href="#Presto-611"><span class="linenos">611</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;kind&quot;</span><span class="p">]</span>
+</span><span id="Presto-612"><a href="#Presto-612"><span class="linenos">612</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span>
+</span><span id="Presto-613"><a href="#Presto-613"><span class="linenos">613</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">&quot;VIEW&quot;</span> <span class="ow">and</span> <span class="n">schema</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
+</span><span id="Presto-614"><a href="#Presto-614"><span class="linenos">614</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">&quot;expressions&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
+</span><span id="Presto-615"><a href="#Presto-615"><span class="linenos">615</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">create_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
</span></pre></div>
@@ -1851,7 +1976,7 @@ Default: 3</li>
<div class="attr variable">
<span class="name">TABLE_ALIAS_TOKENS</span> =
<input id="Presto.Parser.TABLE_ALIAS_TOKENS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
- <label class="view-value-button pdoc-button" for="Presto.Parser.TABLE_ALIAS_TOKENS-view-value"></label><span class="default_value">{&lt;TokenType.IPADDRESS: &#39;IPADDRESS&#39;&gt;, &lt;TokenType.VARIANT: &#39;VARIANT&#39;&gt;, &lt;TokenType.GEOGRAPHY: &#39;GEOGRAPHY&#39;&gt;, &lt;TokenType.SHOW: &#39;SHOW&#39;&gt;, &lt;TokenType.VOLATILE: &#39;VOLATILE&#39;&gt;, &lt;TokenType.TIMESTAMP: &#39;TIMESTAMP&#39;&gt;, &lt;TokenType.USE: &#39;USE&#39;&gt;, &lt;TokenType.UTINYINT: &#39;UTINYINT&#39;&gt;, &lt;TokenType.REFERENCES: &#39;REFERENCES&#39;&gt;, &lt;TokenType.INTERVAL: &#39;INTERVAL&#39;&gt;, &lt;TokenType.BIGINT: &#39;BIGINT&#39;&gt;, &lt;TokenType.SETTINGS: &#39;SETTINGS&#39;&gt;, &lt;TokenType.TIMESTAMPLTZ: &#39;TIMESTAMPLTZ&#39;&gt;, &lt;TokenType.DATEMULTIRANGE: &#39;DATEMULTIRANGE&#39;&gt;, &lt;TokenType.USMALLINT: &#39;USMALLINT&#39;&gt;, &lt;TokenType.TIMESTAMP_S: &#39;TIMESTAMP_S&#39;&gt;, &lt;TokenType.TSRANGE: &#39;TSRANGE&#39;&gt;, &lt;TokenType.ESCAPE: &#39;ESCAPE&#39;&gt;, &lt;TokenType.TIMESTAMP_NS: &#39;TIMESTAMP_NS&#39;&gt;, &lt;TokenType.MONEY: &#39;MONEY&#39;&gt;, &lt;TokenType.GEOMETRY: &#39;GEOMETRY&#39;&gt;, &lt;TokenType.FIRST: &#39;FIRST&#39;&gt;, &lt;TokenType.FUNCTION: &#39;FUNCTION&#39;&gt;, &lt;TokenType.YEAR: &#39;YEAR&#39;&gt;, &lt;TokenType.ANTI: &#39;ANTI&#39;&gt;, &lt;TokenType.USERDEFINED: &#39;USERDEFINED&#39;&gt;, &lt;TokenType.IDENTIFIER: &#39;IDENTIFIER&#39;&gt;, &lt;TokenType.BIGSERIAL: &#39;BIGSERIAL&#39;&gt;, &lt;TokenType.STRUCT: &#39;STRUCT&#39;&gt;, &lt;TokenType.FINAL: &#39;FINAL&#39;&gt;, &lt;TokenType.TRUNCATE: &#39;TRUNCATE&#39;&gt;, &lt;TokenType.ASC: &#39;ASC&#39;&gt;, &lt;TokenType.OBJECT: &#39;OBJECT&#39;&gt;, &lt;TokenType.INT128: &#39;INT128&#39;&gt;, &lt;TokenType.BOOLEAN: &#39;BOOLEAN&#39;&gt;, &lt;TokenType.MODEL: &#39;MODEL&#39;&gt;, &lt;TokenType.DELETE: &#39;DELETE&#39;&gt;, &lt;TokenType.ISNULL: &#39;ISNULL&#39;&gt;, &lt;TokenType.DATETIME: &#39;DATETIME&#39;&gt;, &lt;TokenType.DEFAULT: &#39;DEFAULT&#39;&gt;, &lt;TokenType.CHAR: &#39;CHAR&#39;&gt;, &lt;TokenType.DECIMAL: &#39;DECIMAL&#39;&gt;, &lt;TokenType.AGGREGATEFUNCTION: &#39;AGGREGATEFUNCTION&#39;&gt;, &lt;TokenType.SIMPLEAGGREGATEFUNCTION: &#39;SIMPLEAGGREGATEFUNCTION&#39;&gt;, &lt;TokenType.DATABASE: &#39;DATABASE&#39;&gt;, &lt;TokenType.PSEUDO_TYPE: &#39;PSEUDO_TYPE&#39;&gt;, &lt;TokenType.ARRAY: &#39;ARRAY&#39;&gt;, &lt;TokenType.TABLE: &#39;TABLE&#39;&gt;, &lt;TokenType.CASE: &#39;CASE&#39;&gt;, &lt;TokenType.ENUM16: &#39;ENUM16&#39;&gt;, &lt;TokenType.FIXEDSTRING: &#39;FIXEDSTRING&#39;&gt;, &lt;TokenType.NESTED: &#39;NESTED&#39;&gt;, &lt;TokenType.INT8RANGE: &#39;INT8RANGE&#39;&gt;, &lt;TokenType.CURRENT_TIMESTAMP: &#39;CURRENT_TIMESTAMP&#39;&gt;, &lt;TokenType.COLUMN: &#39;COLUMN&#39;&gt;, &lt;TokenType.RECURSIVE: &#39;RECURSIVE&#39;&gt;, &lt;TokenType.UINT128: &#39;UINT128&#39;&gt;, &lt;TokenType.BINARY: &#39;BINARY&#39;&gt;, &lt;TokenType.BIT: &#39;BIT&#39;&gt;, &lt;TokenType.HLLSKETCH: &#39;HLLSKETCH&#39;&gt;, &lt;TokenType.INT4MULTIRANGE: &#39;INT4MULTIRANGE&#39;&gt;, &lt;TokenType.CACHE: &#39;CACHE&#39;&gt;, &lt;TokenType.VIEW: &#39;VIEW&#39;&gt;, &lt;TokenType.PARTITION: &#39;PARTITION&#39;&gt;, &lt;TokenType.NVARCHAR: &#39;NVARCHAR&#39;&gt;, &lt;TokenType.MERGE: &#39;MERGE&#39;&gt;, &lt;TokenType.SMALLINT: &#39;SMALLINT&#39;&gt;, &lt;TokenType.CURRENT_TIME: &#39;CURRENT_TIME&#39;&gt;, &lt;TokenType.SERIAL: &#39;SERIAL&#39;&gt;, &lt;TokenType.INET: &#39;INET&#39;&gt;, &lt;TokenType.INT8MULTIRANGE: &#39;INT8MULTIRANGE&#39;&gt;, &lt;TokenType.FALSE: &#39;FALSE&#39;&gt;, &lt;TokenType.DESCRIBE: &#39;DESCRIBE&#39;&gt;, &lt;TokenType.ROWS: &#39;ROWS&#39;&gt;, &lt;TokenType.EXECUTE: &#39;EXECUTE&#39;&gt;, &lt;TokenType.DATETIME64: &#39;DATETIME64&#39;&gt;, &lt;TokenType.SEQUENCE: &#39;SEQUENCE&#39;&gt;, &lt;TokenType.HSTORE: &#39;HSTORE&#39;&gt;, &lt;TokenType.FORMAT: &#39;FORMAT&#39;&gt;, &lt;TokenType.IPV4: &#39;IPV4&#39;&gt;, &lt;TokenType.ORDINALITY: &#39;ORDINALITY&#39;&gt;, &lt;TokenType.SOME: &#39;SOME&#39;&gt;, &lt;TokenType.RANGE: &#39;RANGE&#39;&gt;, &lt;TokenType.IPPREFIX: &#39;IPPREFIX&#39;&gt;, &lt;TokenType.PROCEDURE: &#39;PROCEDURE&#39;&gt;, &lt;TokenType.INT4RANGE: &#39;INT4RANGE&#39;&gt;, &lt;TokenType.NEXT: &#39;NEXT&#39;&gt;, &lt;TokenType.BIGDECIMAL: &#39;BIGDECIMAL&#39;&gt;, &lt;TokenType.OVERLAPS: &#39;OVERLAPS&#39;&gt;, &lt;TokenType.UINT: &#39;UINT&#39;&gt;, &lt;TokenType.DIV: &#39;DIV&#39;&gt;, &lt;TokenType.SUPER: &#39;SUPER&#39;&gt;, &lt;TokenType.JSONB: &#39;JSONB&#39;&gt;, &lt;TokenType.TIMESTAMPTZ: &#39;TIMESTAMPTZ&#39;&gt;, &lt;TokenType.TOP: &#39;TOP&#39;&gt;, &lt;TokenType.PIVOT: &#39;PIVOT&#39;&gt;, &lt;TokenType.KEEP: &#39;KEEP&#39;&gt;, &lt;TokenType.VARBINARY: &#39;VARBINARY&#39;&gt;, &lt;TokenType.TINYTEXT: &#39;TINYTEXT&#39;&gt;, &lt;TokenType.TIMESTAMP_MS: &#39;TIMESTAMP_MS&#39;&gt;, &lt;TokenType.FLOAT: &#39;FLOAT&#39;&gt;, &lt;TokenType.TEXT: &#39;TEXT&#39;&gt;, &lt;TokenType.UNKNOWN: &#39;UNKNOWN&#39;&gt;, &lt;TokenType.STORAGE_INTEGRATION: &#39;STORAGE_INTEGRATION&#39;&gt;, &lt;TokenType.BEGIN: &#39;BEGIN&#39;&gt;, &lt;TokenType.VARCHAR: &#39;VARCHAR&#39;&gt;, &lt;TokenType.XML: &#39;XML&#39;&gt;, &lt;TokenType.LOAD: &#39;LOAD&#39;&gt;, &lt;TokenType.UNIQUEIDENTIFIER: &#39;UNIQUEIDENTIFIER&#39;&gt;, &lt;TokenType.LONGTEXT: &#39;LONGTEXT&#39;&gt;, &lt;TokenType.IPV6: &#39;IPV6&#39;&gt;, &lt;TokenType.COMMAND: &#39;COMMAND&#39;&gt;, &lt;TokenType.FILTER: &#39;FILTER&#39;&gt;, &lt;TokenType.COMMENT: &#39;COMMENT&#39;&gt;, &lt;TokenType.LONGBLOB: &#39;LONGBLOB&#39;&gt;, &lt;TokenType.INT256: &#39;INT256&#39;&gt;, &lt;TokenType.TINYINT: &#39;TINYINT&#39;&gt;, &lt;TokenType.UNIQUE: &#39;UNIQUE&#39;&gt;, &lt;TokenType.NAME: &#39;NAME&#39;&gt;, &lt;TokenType.TIMETZ: &#39;TIMETZ&#39;&gt;, &lt;TokenType.ROW: &#39;ROW&#39;&gt;, &lt;TokenType.MEDIUMTEXT: &#39;MEDIUMTEXT&#39;&gt;, &lt;TokenType.CURRENT_DATE: &#39;CURRENT_DATE&#39;&gt;, &lt;TokenType.TIME: &#39;TIME&#39;&gt;, &lt;TokenType.DATE32: &#39;DATE32&#39;&gt;, &lt;TokenType.VAR: &#39;VAR&#39;&gt;, &lt;TokenType.TSMULTIRANGE: &#39;TSMULTIRANGE&#39;&gt;, &lt;TokenType.NUMMULTIRANGE: &#39;NUMMULTIRANGE&#39;&gt;, &lt;TokenType.JSON: &#39;JSON&#39;&gt;, &lt;TokenType.LOWCARDINALITY: &#39;LOWCARDINALITY&#39;&gt;, &lt;TokenType.ROWVERSION: &#39;ROWVERSION&#39;&gt;, &lt;TokenType.MAP: &#39;MAP&#39;&gt;, &lt;TokenType.DATERANGE: &#39;DATERANGE&#39;&gt;, &lt;TokenType.TRUE: &#39;TRUE&#39;&gt;, &lt;TokenType.TSTZRANGE: &#39;TSTZRANGE&#39;&gt;, &lt;TokenType.UDECIMAL: &#39;UDECIMAL&#39;&gt;, &lt;TokenType.TINYBLOB: &#39;TINYBLOB&#39;&gt;, &lt;TokenType.CONSTRAINT: &#39;CONSTRAINT&#39;&gt;, &lt;TokenType.END: &#39;END&#39;&gt;, &lt;TokenType.SEMI: &#39;SEMI&#39;&gt;, &lt;TokenType.NCHAR: &#39;NCHAR&#39;&gt;, &lt;TokenType.SMALLSERIAL: &#39;SMALLSERIAL&#39;&gt;, &lt;TokenType.BPCHAR: &#39;BPCHAR&#39;&gt;, &lt;TokenType.SET: &#39;SET&#39;&gt;, &lt;TokenType.SCHEMA: &#39;SCHEMA&#39;&gt;, &lt;TokenType.TEMPORARY: &#39;TEMPORARY&#39;&gt;, &lt;TokenType.SMALLMONEY: &#39;SMALLMONEY&#39;&gt;, &lt;TokenType.CURRENT_DATETIME: &#39;CURRENT_DATETIME&#39;&gt;, &lt;TokenType.REPLACE: &#39;REPLACE&#39;&gt;, &lt;TokenType.ENUM8: &#39;ENUM8&#39;&gt;, &lt;TokenType.CURRENT_USER: &#39;CURRENT_USER&#39;&gt;, &lt;TokenType.UMEDIUMINT: &#39;UMEDIUMINT&#39;&gt;, &lt;TokenType.IMAGE: &#39;IMAGE&#39;&gt;, &lt;TokenType.INT: &#39;INT&#39;&gt;, &lt;TokenType.DESC: &#39;DESC&#39;&gt;, &lt;TokenType.ALL: &#39;ALL&#39;&gt;, &lt;TokenType.UPDATE: &#39;UPDATE&#39;&gt;, &lt;TokenType.OBJECT_IDENTIFIER: &#39;OBJECT_IDENTIFIER&#39;&gt;, &lt;TokenType.REFRESH: &#39;REFRESH&#39;&gt;, &lt;TokenType.MEDIUMINT: &#39;MEDIUMINT&#39;&gt;, &lt;TokenType.FOREIGN_KEY: &#39;FOREIGN_KEY&#39;&gt;, &lt;TokenType.PERCENT: &#39;PERCENT&#39;&gt;, &lt;TokenType.ENUM: &#39;ENUM&#39;&gt;, &lt;TokenType.ANY: &#39;ANY&#39;&gt;, &lt;TokenType.MEDIUMBLOB: &#39;MEDIUMBLOB&#39;&gt;, &lt;TokenType.NUMRANGE: &#39;NUMRANGE&#39;&gt;, &lt;TokenType.DATE: &#39;DATE&#39;&gt;, &lt;TokenType.EXISTS: &#39;EXISTS&#39;&gt;, &lt;TokenType.AUTO_INCREMENT: &#39;AUTO_INCREMENT&#39;&gt;, &lt;TokenType.DOUBLE: &#39;DOUBLE&#39;&gt;, &lt;TokenType.UBIGINT: &#39;UBIGINT&#39;&gt;, &lt;TokenType.TSTZMULTIRANGE: &#39;TSTZMULTIRANGE&#39;&gt;, &lt;TokenType.PRAGMA: &#39;PRAGMA&#39;&gt;, &lt;TokenType.DICTIONARY: &#39;DICTIONARY&#39;&gt;, &lt;TokenType.IS: &#39;IS&#39;&gt;, &lt;TokenType.COLLATE: &#39;COLLATE&#39;&gt;, &lt;TokenType.UINT256: &#39;UINT256&#39;&gt;, &lt;TokenType.UUID: &#39;UUID&#39;&gt;, &lt;TokenType.COMMIT: &#39;COMMIT&#39;&gt;, &lt;TokenType.OVERWRITE: &#39;OVERWRITE&#39;&gt;, &lt;TokenType.UNPIVOT: &#39;UNPIVOT&#39;&gt;, &lt;TokenType.KILL: &#39;KILL&#39;&gt;, &lt;TokenType.NULLABLE: &#39;NULLABLE&#39;&gt;, &lt;TokenType.OPERATOR: &#39;OPERATOR&#39;&gt;, &lt;TokenType.NULL: &#39;NULL&#39;&gt;, &lt;TokenType.INDEX: &#39;INDEX&#39;&gt;}</span>
+ <label class="view-value-button pdoc-button" for="Presto.Parser.TABLE_ALIAS_TOKENS-view-value"></label><span class="default_value">{&lt;TokenType.BIGINT: &#39;BIGINT&#39;&gt;, &lt;TokenType.RANGE: &#39;RANGE&#39;&gt;, &lt;TokenType.SMALLINT: &#39;SMALLINT&#39;&gt;, &lt;TokenType.ROW: &#39;ROW&#39;&gt;, &lt;TokenType.COMMENT: &#39;COMMENT&#39;&gt;, &lt;TokenType.PROCEDURE: &#39;PROCEDURE&#39;&gt;, &lt;TokenType.HLLSKETCH: &#39;HLLSKETCH&#39;&gt;, &lt;TokenType.COMMIT: &#39;COMMIT&#39;&gt;, &lt;TokenType.TABLE: &#39;TABLE&#39;&gt;, &lt;TokenType.CONSTRAINT: &#39;CONSTRAINT&#39;&gt;, &lt;TokenType.REFERENCES: &#39;REFERENCES&#39;&gt;, &lt;TokenType.UNIQUEIDENTIFIER: &#39;UNIQUEIDENTIFIER&#39;&gt;, &lt;TokenType.MONEY: &#39;MONEY&#39;&gt;, &lt;TokenType.IPV4: &#39;IPV4&#39;&gt;, &lt;TokenType.SETTINGS: &#39;SETTINGS&#39;&gt;, &lt;TokenType.NAME: &#39;NAME&#39;&gt;, &lt;TokenType.UINT128: &#39;UINT128&#39;&gt;, &lt;TokenType.FALSE: &#39;FALSE&#39;&gt;, &lt;TokenType.ENUM16: &#39;ENUM16&#39;&gt;, &lt;TokenType.TIMESTAMP_MS: &#39;TIMESTAMP_MS&#39;&gt;, &lt;TokenType.UINT256: &#39;UINT256&#39;&gt;, &lt;TokenType.CASE: &#39;CASE&#39;&gt;, &lt;TokenType.ISNULL: &#39;ISNULL&#39;&gt;, &lt;TokenType.ANTI: &#39;ANTI&#39;&gt;, &lt;TokenType.FINAL: &#39;FINAL&#39;&gt;, &lt;TokenType.IPV6: &#39;IPV6&#39;&gt;, &lt;TokenType.GEOMETRY: &#39;GEOMETRY&#39;&gt;, &lt;TokenType.BIGDECIMAL: &#39;BIGDECIMAL&#39;&gt;, &lt;TokenType.CURRENT_DATETIME: &#39;CURRENT_DATETIME&#39;&gt;, &lt;TokenType.MODEL: &#39;MODEL&#39;&gt;, &lt;TokenType.VARIANT: &#39;VARIANT&#39;&gt;, &lt;TokenType.DESC: &#39;DESC&#39;&gt;, &lt;TokenType.IS: &#39;IS&#39;&gt;, &lt;TokenType.TIMESTAMP_NS: &#39;TIMESTAMP_NS&#39;&gt;, &lt;TokenType.LOWCARDINALITY: &#39;LOWCARDINALITY&#39;&gt;, &lt;TokenType.BIGSERIAL: &#39;BIGSERIAL&#39;&gt;, &lt;TokenType.LONGTEXT: &#39;LONGTEXT&#39;&gt;, &lt;TokenType.TIMETZ: &#39;TIMETZ&#39;&gt;, &lt;TokenType.ROWVERSION: &#39;ROWVERSION&#39;&gt;, &lt;TokenType.UTINYINT: &#39;UTINYINT&#39;&gt;, &lt;TokenType.JSONB: &#39;JSONB&#39;&gt;, &lt;TokenType.TIMESTAMPLTZ: &#39;TIMESTAMPLTZ&#39;&gt;, &lt;TokenType.DATETIME: &#39;DATETIME&#39;&gt;, &lt;TokenType.NUMMULTIRANGE: &#39;NUMMULTIRANGE&#39;&gt;, &lt;TokenType.USE: &#39;USE&#39;&gt;, &lt;TokenType.USMALLINT: &#39;USMALLINT&#39;&gt;, &lt;TokenType.SMALLSERIAL: &#39;SMALLSERIAL&#39;&gt;, &lt;TokenType.DECIMAL: &#39;DECIMAL&#39;&gt;, &lt;TokenType.KILL: &#39;KILL&#39;&gt;, &lt;TokenType.EXECUTE: &#39;EXECUTE&#39;&gt;, &lt;TokenType.COLLATE: &#39;COLLATE&#39;&gt;, &lt;TokenType.OVERWRITE: &#39;OVERWRITE&#39;&gt;, &lt;TokenType.SOME: &#39;SOME&#39;&gt;, &lt;TokenType.NEXT: &#39;NEXT&#39;&gt;, &lt;TokenType.BOOLEAN: &#39;BOOLEAN&#39;&gt;, &lt;TokenType.AGGREGATEFUNCTION: &#39;AGGREGATEFUNCTION&#39;&gt;, &lt;TokenType.INET: &#39;INET&#39;&gt;, &lt;TokenType.CURRENT_TIME: &#39;CURRENT_TIME&#39;&gt;, &lt;TokenType.FORMAT: &#39;FORMAT&#39;&gt;, &lt;TokenType.DATEMULTIRANGE: &#39;DATEMULTIRANGE&#39;&gt;, &lt;TokenType.KEEP: &#39;KEEP&#39;&gt;, &lt;TokenType.MEDIUMBLOB: &#39;MEDIUMBLOB&#39;&gt;, &lt;TokenType.ROWS: &#39;ROWS&#39;&gt;, &lt;TokenType.IMAGE: &#39;IMAGE&#39;&gt;, &lt;TokenType.TRUE: &#39;TRUE&#39;&gt;, &lt;TokenType.AUTO_INCREMENT: &#39;AUTO_INCREMENT&#39;&gt;, &lt;TokenType.SEQUENCE: &#39;SEQUENCE&#39;&gt;, &lt;TokenType.OBJECT_IDENTIFIER: &#39;OBJECT_IDENTIFIER&#39;&gt;, &lt;TokenType.DEFAULT: &#39;DEFAULT&#39;&gt;, &lt;TokenType.DATE32: &#39;DATE32&#39;&gt;, &lt;TokenType.INT128: &#39;INT128&#39;&gt;, &lt;TokenType.FIRST: &#39;FIRST&#39;&gt;, &lt;TokenType.FIXEDSTRING: &#39;FIXEDSTRING&#39;&gt;, &lt;TokenType.NCHAR: &#39;NCHAR&#39;&gt;, &lt;TokenType.STRUCT: &#39;STRUCT&#39;&gt;, &lt;TokenType.UINT: &#39;UINT&#39;&gt;, &lt;TokenType.BINARY: &#39;BINARY&#39;&gt;, &lt;TokenType.DATETIME64: &#39;DATETIME64&#39;&gt;, &lt;TokenType.TSTZMULTIRANGE: &#39;TSTZMULTIRANGE&#39;&gt;, &lt;TokenType.OVERLAPS: &#39;OVERLAPS&#39;&gt;, &lt;TokenType.STORAGE_INTEGRATION: &#39;STORAGE_INTEGRATION&#39;&gt;, &lt;TokenType.EXISTS: &#39;EXISTS&#39;&gt;, &lt;TokenType.TSMULTIRANGE: &#39;TSMULTIRANGE&#39;&gt;, &lt;TokenType.MERGE: &#39;MERGE&#39;&gt;, &lt;TokenType.ARRAY: &#39;ARRAY&#39;&gt;, &lt;TokenType.XML: &#39;XML&#39;&gt;, &lt;TokenType.ASC: &#39;ASC&#39;&gt;, &lt;TokenType.UBIGINT: &#39;UBIGINT&#39;&gt;, &lt;TokenType.CHAR: &#39;CHAR&#39;&gt;, &lt;TokenType.TIMESTAMP: &#39;TIMESTAMP&#39;&gt;, &lt;TokenType.PSEUDO_TYPE: &#39;PSEUDO_TYPE&#39;&gt;, &lt;TokenType.HSTORE: &#39;HSTORE&#39;&gt;, &lt;TokenType.UPDATE: &#39;UPDATE&#39;&gt;, &lt;TokenType.PRAGMA: &#39;PRAGMA&#39;&gt;, &lt;TokenType.DESCRIBE: &#39;DESCRIBE&#39;&gt;, &lt;TokenType.VIEW: &#39;VIEW&#39;&gt;, &lt;TokenType.VARCHAR: &#39;VARCHAR&#39;&gt;, &lt;TokenType.REPLACE: &#39;REPLACE&#39;&gt;, &lt;TokenType.NUMRANGE: &#39;NUMRANGE&#39;&gt;, &lt;TokenType.SEMI: &#39;SEMI&#39;&gt;, &lt;TokenType.TSTZRANGE: &#39;TSTZRANGE&#39;&gt;, &lt;TokenType.CURRENT_TIMESTAMP: &#39;CURRENT_TIMESTAMP&#39;&gt;, &lt;TokenType.TIME: &#39;TIME&#39;&gt;, &lt;TokenType.MEDIUMTEXT: &#39;MEDIUMTEXT&#39;&gt;, &lt;TokenType.TSRANGE: &#39;TSRANGE&#39;&gt;, &lt;TokenType.TOP: &#39;TOP&#39;&gt;, &lt;TokenType.FOREIGN_KEY: &#39;FOREIGN_KEY&#39;&gt;, &lt;TokenType.BPCHAR: &#39;BPCHAR&#39;&gt;, &lt;TokenType.INT4RANGE: &#39;INT4RANGE&#39;&gt;, &lt;TokenType.TEXT: &#39;TEXT&#39;&gt;, &lt;TokenType.USERDEFINED: &#39;USERDEFINED&#39;&gt;, &lt;TokenType.NVARCHAR: &#39;NVARCHAR&#39;&gt;, &lt;TokenType.REFRESH: &#39;REFRESH&#39;&gt;, &lt;TokenType.SMALLMONEY: &#39;SMALLMONEY&#39;&gt;, &lt;TokenType.OBJECT: &#39;OBJECT&#39;&gt;, &lt;TokenType.COLUMN: &#39;COLUMN&#39;&gt;, &lt;TokenType.INDEX: &#39;INDEX&#39;&gt;, &lt;TokenType.INT256: &#39;INT256&#39;&gt;, &lt;TokenType.LONGBLOB: &#39;LONGBLOB&#39;&gt;, &lt;TokenType.VARBINARY: &#39;VARBINARY&#39;&gt;, &lt;TokenType.VAR: &#39;VAR&#39;&gt;, &lt;TokenType.BIT: &#39;BIT&#39;&gt;, &lt;TokenType.SIMPLEAGGREGATEFUNCTION: &#39;SIMPLEAGGREGATEFUNCTION&#39;&gt;, &lt;TokenType.NULL: &#39;NULL&#39;&gt;, &lt;TokenType.NULLABLE: &#39;NULLABLE&#39;&gt;, &lt;TokenType.NESTED: &#39;NESTED&#39;&gt;, &lt;TokenType.MAP: &#39;MAP&#39;&gt;, &lt;TokenType.CACHE: &#39;CACHE&#39;&gt;, &lt;TokenType.DIV: &#39;DIV&#39;&gt;, &lt;TokenType.IDENTIFIER: &#39;IDENTIFIER&#39;&gt;, &lt;TokenType.TRUNCATE: &#39;TRUNCATE&#39;&gt;, &lt;TokenType.DOUBLE: &#39;DOUBLE&#39;&gt;, &lt;TokenType.ENUM: &#39;ENUM&#39;&gt;, &lt;TokenType.IPPREFIX: &#39;IPPREFIX&#39;&gt;, &lt;TokenType.PIVOT: &#39;PIVOT&#39;&gt;, &lt;TokenType.TINYINT: &#39;TINYINT&#39;&gt;, &lt;TokenType.ORDINALITY: &#39;ORDINALITY&#39;&gt;, &lt;TokenType.DATABASE: &#39;DATABASE&#39;&gt;, &lt;TokenType.SET: &#39;SET&#39;&gt;, &lt;TokenType.PARTITION: &#39;PARTITION&#39;&gt;, &lt;TokenType.UMEDIUMINT: &#39;UMEDIUMINT&#39;&gt;, &lt;TokenType.DATERANGE: &#39;DATERANGE&#39;&gt;, &lt;TokenType.YEAR: &#39;YEAR&#39;&gt;, &lt;TokenType.BEGIN: &#39;BEGIN&#39;&gt;, &lt;TokenType.DICTIONARY: &#39;DICTIONARY&#39;&gt;, &lt;TokenType.SERIAL: &#39;SERIAL&#39;&gt;, &lt;TokenType.INT: &#39;INT&#39;&gt;, &lt;TokenType.DELETE: &#39;DELETE&#39;&gt;, &lt;TokenType.TINYBLOB: &#39;TINYBLOB&#39;&gt;, &lt;TokenType.FLOAT: &#39;FLOAT&#39;&gt;, &lt;TokenType.PERCENT: &#39;PERCENT&#39;&gt;, &lt;TokenType.CURRENT_DATE: &#39;CURRENT_DATE&#39;&gt;, &lt;TokenType.INTERVAL: &#39;INTERVAL&#39;&gt;, &lt;TokenType.VOLATILE: &#39;VOLATILE&#39;&gt;, &lt;TokenType.RECURSIVE: &#39;RECURSIVE&#39;&gt;, &lt;TokenType.LOAD: &#39;LOAD&#39;&gt;, &lt;TokenType.TIMESTAMPTZ: &#39;TIMESTAMPTZ&#39;&gt;, &lt;TokenType.SUPER: &#39;SUPER&#39;&gt;, &lt;TokenType.FILTER: &#39;FILTER&#39;&gt;, &lt;TokenType.GEOGRAPHY: &#39;GEOGRAPHY&#39;&gt;, &lt;TokenType.ESCAPE: &#39;ESCAPE&#39;&gt;, &lt;TokenType.FUNCTION: &#39;FUNCTION&#39;&gt;, &lt;TokenType.ANY: &#39;ANY&#39;&gt;, &lt;TokenType.DATE: &#39;DATE&#39;&gt;, &lt;TokenType.TINYTEXT: &#39;TINYTEXT&#39;&gt;, &lt;TokenType.TIMESTAMP_S: &#39;TIMESTAMP_S&#39;&gt;, &lt;TokenType.UNIQUE: &#39;UNIQUE&#39;&gt;, &lt;TokenType.UNPIVOT: &#39;UNPIVOT&#39;&gt;, &lt;TokenType.TEMPORARY: &#39;TEMPORARY&#39;&gt;, &lt;TokenType.INT4MULTIRANGE: &#39;INT4MULTIRANGE&#39;&gt;, &lt;TokenType.IPADDRESS: &#39;IPADDRESS&#39;&gt;, &lt;TokenType.UDECIMAL: &#39;UDECIMAL&#39;&gt;, &lt;TokenType.OPERATOR: &#39;OPERATOR&#39;&gt;, &lt;TokenType.ALL: &#39;ALL&#39;&gt;, &lt;TokenType.MEDIUMINT: &#39;MEDIUMINT&#39;&gt;, &lt;TokenType.CURRENT_USER: &#39;CURRENT_USER&#39;&gt;, &lt;TokenType.UNKNOWN: &#39;UNKNOWN&#39;&gt;, &lt;TokenType.UUID: &#39;UUID&#39;&gt;, &lt;TokenType.COMMAND: &#39;COMMAND&#39;&gt;, &lt;TokenType.INT8RANGE: &#39;INT8RANGE&#39;&gt;, &lt;TokenType.ENUM8: &#39;ENUM8&#39;&gt;, &lt;TokenType.SCHEMA: &#39;SCHEMA&#39;&gt;, &lt;TokenType.END: &#39;END&#39;&gt;, &lt;TokenType.JSON: &#39;JSON&#39;&gt;, &lt;TokenType.INT8MULTIRANGE: &#39;INT8MULTIRANGE&#39;&gt;, &lt;TokenType.SHOW: &#39;SHOW&#39;&gt;}</span>
</div>
@@ -1984,6 +2109,7 @@ Default: 3</li>
<dd id="Presto.Parser.JSON_ARROWS_REQUIRE_JSON_TYPE" class="variable"><a href="../parser.html#Parser.JSON_ARROWS_REQUIRE_JSON_TYPE">JSON_ARROWS_REQUIRE_JSON_TYPE</a></dd>
<dd id="Presto.Parser.SUPPORTS_IMPLICIT_UNNEST" class="variable"><a href="../parser.html#Parser.SUPPORTS_IMPLICIT_UNNEST">SUPPORTS_IMPLICIT_UNNEST</a></dd>
<dd id="Presto.Parser.INTERVAL_SPANS" class="variable"><a href="../parser.html#Parser.INTERVAL_SPANS">INTERVAL_SPANS</a></dd>
+ <dd id="Presto.Parser.SUPPORTS_PARTITION_SELECTION" class="variable"><a href="../parser.html#Parser.SUPPORTS_PARTITION_SELECTION">SUPPORTS_PARTITION_SELECTION</a></dd>
<dd id="Presto.Parser.error_level" class="variable"><a href="../parser.html#Parser.error_level">error_level</a></dd>
<dd id="Presto.Parser.error_message_context" class="variable"><a href="../parser.html#Parser.error_message_context">error_message_context</a></dd>
<dd id="Presto.Parser.max_errors" class="variable"><a href="../parser.html#Parser.max_errors">max_errors</a></dd>
@@ -2172,114 +2298,175 @@ Default: 3</li>
</span><span id="Presto.Generator-444"><a href="#Presto.Generator-444"><span class="linenos">444</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Xor</span><span class="p">:</span> <span class="n">bool_xor_sql</span><span class="p">,</span>
</span><span id="Presto.Generator-445"><a href="#Presto.Generator-445"><span class="linenos">445</span></a> <span class="p">}</span>
</span><span id="Presto.Generator-446"><a href="#Presto.Generator-446"><span class="linenos">446</span></a>
-</span><span id="Presto.Generator-447"><a href="#Presto.Generator-447"><span class="linenos">447</span></a> <span class="k">def</span> <span class="nf">strtounix_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator-448"><a href="#Presto.Generator-448"><span class="linenos">448</span></a> <span class="c1"># Since `TO_UNIXTIME` requires a `TIMESTAMP`, we need to parse the argument into one.</span>
-</span><span id="Presto.Generator-449"><a href="#Presto.Generator-449"><span class="linenos">449</span></a> <span class="c1"># To do this, we first try to `DATE_PARSE` it, but since this can fail when there&#39;s a</span>
-</span><span id="Presto.Generator-450"><a href="#Presto.Generator-450"><span class="linenos">450</span></a> <span class="c1"># timezone involved, we wrap it in a `TRY` call and use `PARSE_DATETIME` as a fallback,</span>
-</span><span id="Presto.Generator-451"><a href="#Presto.Generator-451"><span class="linenos">451</span></a> <span class="c1"># which seems to be using the same time mapping as Hive, as per:</span>
-</span><span id="Presto.Generator-452"><a href="#Presto.Generator-452"><span class="linenos">452</span></a> <span class="c1"># https://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html</span>
-</span><span id="Presto.Generator-453"><a href="#Presto.Generator-453"><span class="linenos">453</span></a> <span class="n">value_as_text</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">)</span>
-</span><span id="Presto.Generator-454"><a href="#Presto.Generator-454"><span class="linenos">454</span></a> <span class="n">parse_without_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;DATE_PARSE&quot;</span><span class="p">,</span> <span class="n">value_as_text</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span>
-</span><span id="Presto.Generator-455"><a href="#Presto.Generator-455"><span class="linenos">455</span></a> <span class="n">parse_with_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
-</span><span id="Presto.Generator-456"><a href="#Presto.Generator-456"><span class="linenos">456</span></a> <span class="s2">&quot;PARSE_DATETIME&quot;</span><span class="p">,</span>
-</span><span id="Presto.Generator-457"><a href="#Presto.Generator-457"><span class="linenos">457</span></a> <span class="n">value_as_text</span><span class="p">,</span>
-</span><span id="Presto.Generator-458"><a href="#Presto.Generator-458"><span class="linenos">458</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_MAPPING</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_TRIE</span><span class="p">),</span>
-</span><span id="Presto.Generator-459"><a href="#Presto.Generator-459"><span class="linenos">459</span></a> <span class="p">)</span>
-</span><span id="Presto.Generator-460"><a href="#Presto.Generator-460"><span class="linenos">460</span></a> <span class="n">coalesced</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;COALESCE&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TRY&quot;</span><span class="p">,</span> <span class="n">parse_without_tz</span><span class="p">),</span> <span class="n">parse_with_tz</span><span class="p">)</span>
-</span><span id="Presto.Generator-461"><a href="#Presto.Generator-461"><span class="linenos">461</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TO_UNIXTIME&quot;</span><span class="p">,</span> <span class="n">coalesced</span><span class="p">)</span>
-</span><span id="Presto.Generator-462"><a href="#Presto.Generator-462"><span class="linenos">462</span></a>
-</span><span id="Presto.Generator-463"><a href="#Presto.Generator-463"><span class="linenos">463</span></a> <span class="k">def</span> <span class="nf">bracket_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator-464"><a href="#Presto.Generator-464"><span class="linenos">464</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;safe&quot;</span><span class="p">):</span>
-</span><span id="Presto.Generator-465"><a href="#Presto.Generator-465"><span class="linenos">465</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
-</span><span id="Presto.Generator-466"><a href="#Presto.Generator-466"><span class="linenos">466</span></a> <span class="s2">&quot;ELEMENT_AT&quot;</span><span class="p">,</span>
-</span><span id="Presto.Generator-467"><a href="#Presto.Generator-467"><span class="linenos">467</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
-</span><span id="Presto.Generator-468"><a href="#Presto.Generator-468"><span class="linenos">468</span></a> <span class="n">seq_get</span><span class="p">(</span>
-</span><span id="Presto.Generator-469"><a href="#Presto.Generator-469"><span class="linenos">469</span></a> <span class="n">apply_index_offset</span><span class="p">(</span>
-</span><span id="Presto.Generator-470"><a href="#Presto.Generator-470"><span class="linenos">470</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
-</span><span id="Presto.Generator-471"><a href="#Presto.Generator-471"><span class="linenos">471</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span>
-</span><span id="Presto.Generator-472"><a href="#Presto.Generator-472"><span class="linenos">472</span></a> <span class="mi">1</span> <span class="o">-</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;offset&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
-</span><span id="Presto.Generator-473"><a href="#Presto.Generator-473"><span class="linenos">473</span></a> <span class="p">),</span>
-</span><span id="Presto.Generator-474"><a href="#Presto.Generator-474"><span class="linenos">474</span></a> <span class="mi">0</span><span class="p">,</span>
-</span><span id="Presto.Generator-475"><a href="#Presto.Generator-475"><span class="linenos">475</span></a> <span class="p">),</span>
-</span><span id="Presto.Generator-476"><a href="#Presto.Generator-476"><span class="linenos">476</span></a> <span class="p">)</span>
-</span><span id="Presto.Generator-477"><a href="#Presto.Generator-477"><span class="linenos">477</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">bracket_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="Presto.Generator-478"><a href="#Presto.Generator-478"><span class="linenos">478</span></a>
-</span><span id="Presto.Generator-479"><a href="#Presto.Generator-479"><span class="linenos">479</span></a> <span class="k">def</span> <span class="nf">struct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator-480"><a href="#Presto.Generator-480"><span class="linenos">480</span></a> <span class="kn">from</span> <span class="nn">sqlglot.optimizer.annotate_types</span> <span class="kn">import</span> <span class="n">annotate_types</span>
-</span><span id="Presto.Generator-481"><a href="#Presto.Generator-481"><span class="linenos">481</span></a>
-</span><span id="Presto.Generator-482"><a href="#Presto.Generator-482"><span class="linenos">482</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">annotate_types</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="Presto.Generator-483"><a href="#Presto.Generator-483"><span class="linenos">483</span></a> <span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
-</span><span id="Presto.Generator-484"><a href="#Presto.Generator-484"><span class="linenos">484</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
-</span><span id="Presto.Generator-485"><a href="#Presto.Generator-485"><span class="linenos">485</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">False</span>
-</span><span id="Presto.Generator-486"><a href="#Presto.Generator-486"><span class="linenos">486</span></a>
-</span><span id="Presto.Generator-487"><a href="#Presto.Generator-487"><span class="linenos">487</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
-</span><span id="Presto.Generator-488"><a href="#Presto.Generator-488"><span class="linenos">488</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">PropertyEQ</span><span class="p">):</span>
-</span><span id="Presto.Generator-489"><a href="#Presto.Generator-489"><span class="linenos">489</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span> <span class="ow">and</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">):</span>
-</span><span id="Presto.Generator-490"><a href="#Presto.Generator-490"><span class="linenos">490</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">True</span>
-</span><span id="Presto.Generator-491"><a href="#Presto.Generator-491"><span class="linenos">491</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Presto.Generator-492"><a href="#Presto.Generator-492"><span class="linenos">492</span></a> <span class="n">schema</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
-</span><span id="Presto.Generator-493"><a href="#Presto.Generator-493"><span class="linenos">493</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">&quot;expression&quot;</span><span class="p">))</span>
-</span><span id="Presto.Generator-494"><a href="#Presto.Generator-494"><span class="linenos">494</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Presto.Generator-495"><a href="#Presto.Generator-495"><span class="linenos">495</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
-</span><span id="Presto.Generator-496"><a href="#Presto.Generator-496"><span class="linenos">496</span></a>
-</span><span id="Presto.Generator-497"><a href="#Presto.Generator-497"><span class="linenos">497</span></a> <span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span>
-</span><span id="Presto.Generator-498"><a href="#Presto.Generator-498"><span class="linenos">498</span></a>
-</span><span id="Presto.Generator-499"><a href="#Presto.Generator-499"><span class="linenos">499</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">size</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> <span class="o">!=</span> <span class="n">size</span><span class="p">:</span>
-</span><span id="Presto.Generator-500"><a href="#Presto.Generator-500"><span class="linenos">500</span></a> <span class="k">if</span> <span class="n">unknown_type</span><span class="p">:</span>
-</span><span id="Presto.Generator-501"><a href="#Presto.Generator-501"><span class="linenos">501</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span>
-</span><span id="Presto.Generator-502"><a href="#Presto.Generator-502"><span class="linenos">502</span></a> <span class="s2">&quot;Cannot convert untyped key-value definitions (try annotate_types).&quot;</span>
-</span><span id="Presto.Generator-503"><a href="#Presto.Generator-503"><span class="linenos">503</span></a> <span class="p">)</span>
-</span><span id="Presto.Generator-504"><a href="#Presto.Generator-504"><span class="linenos">504</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;ROW&quot;</span><span class="p">,</span> <span class="o">*</span><span class="n">values</span><span class="p">)</span>
-</span><span id="Presto.Generator-505"><a href="#Presto.Generator-505"><span class="linenos">505</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;CAST(ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">values</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span><span class="si">}</span><span class="s2">))&quot;</span>
-</span><span id="Presto.Generator-506"><a href="#Presto.Generator-506"><span class="linenos">506</span></a>
-</span><span id="Presto.Generator-507"><a href="#Presto.Generator-507"><span class="linenos">507</span></a> <span class="k">def</span> <span class="nf">interval_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator-508"><a href="#Presto.Generator-508"><span class="linenos">508</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">&quot;unit&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;WEEK&quot;</span><span class="p">):</span>
-</span><span id="Presto.Generator-509"><a href="#Presto.Generator-509"><span class="linenos">509</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;(</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> * INTERVAL &#39;7&#39; DAY)&quot;</span>
-</span><span id="Presto.Generator-510"><a href="#Presto.Generator-510"><span class="linenos">510</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">interval_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="Presto.Generator-511"><a href="#Presto.Generator-511"><span class="linenos">511</span></a>
-</span><span id="Presto.Generator-512"><a href="#Presto.Generator-512"><span class="linenos">512</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Transaction</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator-513"><a href="#Presto.Generator-513"><span class="linenos">513</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;modes&quot;</span><span class="p">)</span>
-</span><span id="Presto.Generator-514"><a href="#Presto.Generator-514"><span class="linenos">514</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; </span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">modes</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
-</span><span id="Presto.Generator-515"><a href="#Presto.Generator-515"><span class="linenos">515</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">&quot;</span>
-</span><span id="Presto.Generator-516"><a href="#Presto.Generator-516"><span class="linenos">516</span></a>
-</span><span id="Presto.Generator-517"><a href="#Presto.Generator-517"><span class="linenos">517</span></a> <span class="k">def</span> <span class="nf">generateseries_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator-518"><a href="#Presto.Generator-518"><span class="linenos">518</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;start&quot;</span><span class="p">]</span>
-</span><span id="Presto.Generator-519"><a href="#Presto.Generator-519"><span class="linenos">519</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;end&quot;</span><span class="p">]</span>
-</span><span id="Presto.Generator-520"><a href="#Presto.Generator-520"><span class="linenos">520</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;step&quot;</span><span class="p">)</span>
-</span><span id="Presto.Generator-521"><a href="#Presto.Generator-521"><span class="linenos">521</span></a>
-</span><span id="Presto.Generator-522"><a href="#Presto.Generator-522"><span class="linenos">522</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
-</span><span id="Presto.Generator-523"><a href="#Presto.Generator-523"><span class="linenos">523</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span>
-</span><span id="Presto.Generator-524"><a href="#Presto.Generator-524"><span class="linenos">524</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
-</span><span id="Presto.Generator-525"><a href="#Presto.Generator-525"><span class="linenos">525</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">end</span><span class="o">.</span><span class="n">to</span>
-</span><span id="Presto.Generator-526"><a href="#Presto.Generator-526"><span class="linenos">526</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Presto.Generator-527"><a href="#Presto.Generator-527"><span class="linenos">527</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span>
-</span><span id="Presto.Generator-528"><a href="#Presto.Generator-528"><span class="linenos">528</span></a>
-</span><span id="Presto.Generator-529"><a href="#Presto.Generator-529"><span class="linenos">529</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">and</span> <span class="n">target_type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">&quot;timestamp&quot;</span><span class="p">):</span>
-</span><span id="Presto.Generator-530"><a href="#Presto.Generator-530"><span class="linenos">530</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">is</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span><span class="p">:</span>
-</span><span id="Presto.Generator-531"><a href="#Presto.Generator-531"><span class="linenos">531</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
-</span><span id="Presto.Generator-532"><a href="#Presto.Generator-532"><span class="linenos">532</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Presto.Generator-533"><a href="#Presto.Generator-533"><span class="linenos">533</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
-</span><span id="Presto.Generator-534"><a href="#Presto.Generator-534"><span class="linenos">534</span></a>
-</span><span id="Presto.Generator-535"><a href="#Presto.Generator-535"><span class="linenos">535</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;SEQUENCE&quot;</span><span class="p">,</span> <span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">,</span> <span class="n">step</span><span class="p">)</span>
-</span><span id="Presto.Generator-536"><a href="#Presto.Generator-536"><span class="linenos">536</span></a>
-</span><span id="Presto.Generator-537"><a href="#Presto.Generator-537"><span class="linenos">537</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span>
-</span><span id="Presto.Generator-538"><a href="#Presto.Generator-538"><span class="linenos">538</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">fetch</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">limit</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">]</span>
-</span><span id="Presto.Generator-539"><a href="#Presto.Generator-539"><span class="linenos">539</span></a> <span class="p">)</span> <span class="o">-&gt;</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span>
-</span><span id="Presto.Generator-540"><a href="#Presto.Generator-540"><span class="linenos">540</span></a> <span class="k">return</span> <span class="p">[</span>
-</span><span id="Presto.Generator-541"><a href="#Presto.Generator-541"><span class="linenos">541</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;offset&quot;</span><span class="p">),</span>
-</span><span id="Presto.Generator-542"><a href="#Presto.Generator-542"><span class="linenos">542</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">limit</span><span class="p">),</span>
-</span><span id="Presto.Generator-543"><a href="#Presto.Generator-543"><span class="linenos">543</span></a> <span class="p">]</span>
-</span><span id="Presto.Generator-544"><a href="#Presto.Generator-544"><span class="linenos">544</span></a>
-</span><span id="Presto.Generator-545"><a href="#Presto.Generator-545"><span class="linenos">545</span></a> <span class="k">def</span> <span class="nf">create_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator-546"><a href="#Presto.Generator-546"><span class="linenos">546</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
-</span><span id="Presto.Generator-547"><a href="#Presto.Generator-547"><span class="linenos">547</span></a><span class="sd"> Presto doesn&#39;t support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span>
-</span><span id="Presto.Generator-548"><a href="#Presto.Generator-548"><span class="linenos">548</span></a><span class="sd"> so we need to remove them</span>
-</span><span id="Presto.Generator-549"><a href="#Presto.Generator-549"><span class="linenos">549</span></a><span class="sd"> &quot;&quot;&quot;</span>
-</span><span id="Presto.Generator-550"><a href="#Presto.Generator-550"><span class="linenos">550</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;kind&quot;</span><span class="p">]</span>
-</span><span id="Presto.Generator-551"><a href="#Presto.Generator-551"><span class="linenos">551</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span>
-</span><span id="Presto.Generator-552"><a href="#Presto.Generator-552"><span class="linenos">552</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">&quot;VIEW&quot;</span> <span class="ow">and</span> <span class="n">schema</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
-</span><span id="Presto.Generator-553"><a href="#Presto.Generator-553"><span class="linenos">553</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">&quot;expressions&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
-</span><span id="Presto.Generator-554"><a href="#Presto.Generator-554"><span class="linenos">554</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">create_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="Presto.Generator-447"><a href="#Presto.Generator-447"><span class="linenos">447</span></a> <span class="n">RESERVED_KEYWORDS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Presto.Generator-448"><a href="#Presto.Generator-448"><span class="linenos">448</span></a> <span class="s2">&quot;alter&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-449"><a href="#Presto.Generator-449"><span class="linenos">449</span></a> <span class="s2">&quot;and&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-450"><a href="#Presto.Generator-450"><span class="linenos">450</span></a> <span class="s2">&quot;as&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-451"><a href="#Presto.Generator-451"><span class="linenos">451</span></a> <span class="s2">&quot;between&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-452"><a href="#Presto.Generator-452"><span class="linenos">452</span></a> <span class="s2">&quot;by&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-453"><a href="#Presto.Generator-453"><span class="linenos">453</span></a> <span class="s2">&quot;case&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-454"><a href="#Presto.Generator-454"><span class="linenos">454</span></a> <span class="s2">&quot;cast&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-455"><a href="#Presto.Generator-455"><span class="linenos">455</span></a> <span class="s2">&quot;constraint&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-456"><a href="#Presto.Generator-456"><span class="linenos">456</span></a> <span class="s2">&quot;create&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-457"><a href="#Presto.Generator-457"><span class="linenos">457</span></a> <span class="s2">&quot;cross&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-458"><a href="#Presto.Generator-458"><span class="linenos">458</span></a> <span class="s2">&quot;current_time&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-459"><a href="#Presto.Generator-459"><span class="linenos">459</span></a> <span class="s2">&quot;current_timestamp&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-460"><a href="#Presto.Generator-460"><span class="linenos">460</span></a> <span class="s2">&quot;deallocate&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-461"><a href="#Presto.Generator-461"><span class="linenos">461</span></a> <span class="s2">&quot;delete&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-462"><a href="#Presto.Generator-462"><span class="linenos">462</span></a> <span class="s2">&quot;describe&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-463"><a href="#Presto.Generator-463"><span class="linenos">463</span></a> <span class="s2">&quot;distinct&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-464"><a href="#Presto.Generator-464"><span class="linenos">464</span></a> <span class="s2">&quot;drop&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-465"><a href="#Presto.Generator-465"><span class="linenos">465</span></a> <span class="s2">&quot;else&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-466"><a href="#Presto.Generator-466"><span class="linenos">466</span></a> <span class="s2">&quot;end&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-467"><a href="#Presto.Generator-467"><span class="linenos">467</span></a> <span class="s2">&quot;escape&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-468"><a href="#Presto.Generator-468"><span class="linenos">468</span></a> <span class="s2">&quot;except&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-469"><a href="#Presto.Generator-469"><span class="linenos">469</span></a> <span class="s2">&quot;execute&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-470"><a href="#Presto.Generator-470"><span class="linenos">470</span></a> <span class="s2">&quot;exists&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-471"><a href="#Presto.Generator-471"><span class="linenos">471</span></a> <span class="s2">&quot;extract&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-472"><a href="#Presto.Generator-472"><span class="linenos">472</span></a> <span class="s2">&quot;false&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-473"><a href="#Presto.Generator-473"><span class="linenos">473</span></a> <span class="s2">&quot;for&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-474"><a href="#Presto.Generator-474"><span class="linenos">474</span></a> <span class="s2">&quot;from&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-475"><a href="#Presto.Generator-475"><span class="linenos">475</span></a> <span class="s2">&quot;full&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-476"><a href="#Presto.Generator-476"><span class="linenos">476</span></a> <span class="s2">&quot;group&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-477"><a href="#Presto.Generator-477"><span class="linenos">477</span></a> <span class="s2">&quot;having&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-478"><a href="#Presto.Generator-478"><span class="linenos">478</span></a> <span class="s2">&quot;in&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-479"><a href="#Presto.Generator-479"><span class="linenos">479</span></a> <span class="s2">&quot;inner&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-480"><a href="#Presto.Generator-480"><span class="linenos">480</span></a> <span class="s2">&quot;insert&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-481"><a href="#Presto.Generator-481"><span class="linenos">481</span></a> <span class="s2">&quot;intersect&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-482"><a href="#Presto.Generator-482"><span class="linenos">482</span></a> <span class="s2">&quot;into&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-483"><a href="#Presto.Generator-483"><span class="linenos">483</span></a> <span class="s2">&quot;is&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-484"><a href="#Presto.Generator-484"><span class="linenos">484</span></a> <span class="s2">&quot;join&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-485"><a href="#Presto.Generator-485"><span class="linenos">485</span></a> <span class="s2">&quot;left&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-486"><a href="#Presto.Generator-486"><span class="linenos">486</span></a> <span class="s2">&quot;like&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-487"><a href="#Presto.Generator-487"><span class="linenos">487</span></a> <span class="s2">&quot;natural&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-488"><a href="#Presto.Generator-488"><span class="linenos">488</span></a> <span class="s2">&quot;not&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-489"><a href="#Presto.Generator-489"><span class="linenos">489</span></a> <span class="s2">&quot;null&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-490"><a href="#Presto.Generator-490"><span class="linenos">490</span></a> <span class="s2">&quot;on&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-491"><a href="#Presto.Generator-491"><span class="linenos">491</span></a> <span class="s2">&quot;or&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-492"><a href="#Presto.Generator-492"><span class="linenos">492</span></a> <span class="s2">&quot;order&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-493"><a href="#Presto.Generator-493"><span class="linenos">493</span></a> <span class="s2">&quot;outer&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-494"><a href="#Presto.Generator-494"><span class="linenos">494</span></a> <span class="s2">&quot;prepare&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-495"><a href="#Presto.Generator-495"><span class="linenos">495</span></a> <span class="s2">&quot;right&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-496"><a href="#Presto.Generator-496"><span class="linenos">496</span></a> <span class="s2">&quot;select&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-497"><a href="#Presto.Generator-497"><span class="linenos">497</span></a> <span class="s2">&quot;table&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-498"><a href="#Presto.Generator-498"><span class="linenos">498</span></a> <span class="s2">&quot;then&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-499"><a href="#Presto.Generator-499"><span class="linenos">499</span></a> <span class="s2">&quot;true&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-500"><a href="#Presto.Generator-500"><span class="linenos">500</span></a> <span class="s2">&quot;union&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-501"><a href="#Presto.Generator-501"><span class="linenos">501</span></a> <span class="s2">&quot;using&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-502"><a href="#Presto.Generator-502"><span class="linenos">502</span></a> <span class="s2">&quot;values&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-503"><a href="#Presto.Generator-503"><span class="linenos">503</span></a> <span class="s2">&quot;when&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-504"><a href="#Presto.Generator-504"><span class="linenos">504</span></a> <span class="s2">&quot;where&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-505"><a href="#Presto.Generator-505"><span class="linenos">505</span></a> <span class="s2">&quot;with&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-506"><a href="#Presto.Generator-506"><span class="linenos">506</span></a> <span class="p">}</span>
+</span><span id="Presto.Generator-507"><a href="#Presto.Generator-507"><span class="linenos">507</span></a>
+</span><span id="Presto.Generator-508"><a href="#Presto.Generator-508"><span class="linenos">508</span></a> <span class="k">def</span> <span class="nf">strtounix_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator-509"><a href="#Presto.Generator-509"><span class="linenos">509</span></a> <span class="c1"># Since `TO_UNIXTIME` requires a `TIMESTAMP`, we need to parse the argument into one.</span>
+</span><span id="Presto.Generator-510"><a href="#Presto.Generator-510"><span class="linenos">510</span></a> <span class="c1"># To do this, we first try to `DATE_PARSE` it, but since this can fail when there&#39;s a</span>
+</span><span id="Presto.Generator-511"><a href="#Presto.Generator-511"><span class="linenos">511</span></a> <span class="c1"># timezone involved, we wrap it in a `TRY` call and use `PARSE_DATETIME` as a fallback,</span>
+</span><span id="Presto.Generator-512"><a href="#Presto.Generator-512"><span class="linenos">512</span></a> <span class="c1"># which seems to be using the same time mapping as Hive, as per:</span>
+</span><span id="Presto.Generator-513"><a href="#Presto.Generator-513"><span class="linenos">513</span></a> <span class="c1"># https://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html</span>
+</span><span id="Presto.Generator-514"><a href="#Presto.Generator-514"><span class="linenos">514</span></a> <span class="n">value_as_text</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">)</span>
+</span><span id="Presto.Generator-515"><a href="#Presto.Generator-515"><span class="linenos">515</span></a> <span class="n">parse_without_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;DATE_PARSE&quot;</span><span class="p">,</span> <span class="n">value_as_text</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span>
+</span><span id="Presto.Generator-516"><a href="#Presto.Generator-516"><span class="linenos">516</span></a> <span class="n">parse_with_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
+</span><span id="Presto.Generator-517"><a href="#Presto.Generator-517"><span class="linenos">517</span></a> <span class="s2">&quot;PARSE_DATETIME&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-518"><a href="#Presto.Generator-518"><span class="linenos">518</span></a> <span class="n">value_as_text</span><span class="p">,</span>
+</span><span id="Presto.Generator-519"><a href="#Presto.Generator-519"><span class="linenos">519</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_MAPPING</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_TRIE</span><span class="p">),</span>
+</span><span id="Presto.Generator-520"><a href="#Presto.Generator-520"><span class="linenos">520</span></a> <span class="p">)</span>
+</span><span id="Presto.Generator-521"><a href="#Presto.Generator-521"><span class="linenos">521</span></a> <span class="n">coalesced</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;COALESCE&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TRY&quot;</span><span class="p">,</span> <span class="n">parse_without_tz</span><span class="p">),</span> <span class="n">parse_with_tz</span><span class="p">)</span>
+</span><span id="Presto.Generator-522"><a href="#Presto.Generator-522"><span class="linenos">522</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TO_UNIXTIME&quot;</span><span class="p">,</span> <span class="n">coalesced</span><span class="p">)</span>
+</span><span id="Presto.Generator-523"><a href="#Presto.Generator-523"><span class="linenos">523</span></a>
+</span><span id="Presto.Generator-524"><a href="#Presto.Generator-524"><span class="linenos">524</span></a> <span class="k">def</span> <span class="nf">bracket_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator-525"><a href="#Presto.Generator-525"><span class="linenos">525</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;safe&quot;</span><span class="p">):</span>
+</span><span id="Presto.Generator-526"><a href="#Presto.Generator-526"><span class="linenos">526</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
+</span><span id="Presto.Generator-527"><a href="#Presto.Generator-527"><span class="linenos">527</span></a> <span class="s2">&quot;ELEMENT_AT&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator-528"><a href="#Presto.Generator-528"><span class="linenos">528</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
+</span><span id="Presto.Generator-529"><a href="#Presto.Generator-529"><span class="linenos">529</span></a> <span class="n">seq_get</span><span class="p">(</span>
+</span><span id="Presto.Generator-530"><a href="#Presto.Generator-530"><span class="linenos">530</span></a> <span class="n">apply_index_offset</span><span class="p">(</span>
+</span><span id="Presto.Generator-531"><a href="#Presto.Generator-531"><span class="linenos">531</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
+</span><span id="Presto.Generator-532"><a href="#Presto.Generator-532"><span class="linenos">532</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span>
+</span><span id="Presto.Generator-533"><a href="#Presto.Generator-533"><span class="linenos">533</span></a> <span class="mi">1</span> <span class="o">-</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;offset&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
+</span><span id="Presto.Generator-534"><a href="#Presto.Generator-534"><span class="linenos">534</span></a> <span class="p">),</span>
+</span><span id="Presto.Generator-535"><a href="#Presto.Generator-535"><span class="linenos">535</span></a> <span class="mi">0</span><span class="p">,</span>
+</span><span id="Presto.Generator-536"><a href="#Presto.Generator-536"><span class="linenos">536</span></a> <span class="p">),</span>
+</span><span id="Presto.Generator-537"><a href="#Presto.Generator-537"><span class="linenos">537</span></a> <span class="p">)</span>
+</span><span id="Presto.Generator-538"><a href="#Presto.Generator-538"><span class="linenos">538</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">bracket_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="Presto.Generator-539"><a href="#Presto.Generator-539"><span class="linenos">539</span></a>
+</span><span id="Presto.Generator-540"><a href="#Presto.Generator-540"><span class="linenos">540</span></a> <span class="k">def</span> <span class="nf">struct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator-541"><a href="#Presto.Generator-541"><span class="linenos">541</span></a> <span class="kn">from</span> <span class="nn">sqlglot.optimizer.annotate_types</span> <span class="kn">import</span> <span class="n">annotate_types</span>
+</span><span id="Presto.Generator-542"><a href="#Presto.Generator-542"><span class="linenos">542</span></a>
+</span><span id="Presto.Generator-543"><a href="#Presto.Generator-543"><span class="linenos">543</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">annotate_types</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="Presto.Generator-544"><a href="#Presto.Generator-544"><span class="linenos">544</span></a> <span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+</span><span id="Presto.Generator-545"><a href="#Presto.Generator-545"><span class="linenos">545</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+</span><span id="Presto.Generator-546"><a href="#Presto.Generator-546"><span class="linenos">546</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">False</span>
+</span><span id="Presto.Generator-547"><a href="#Presto.Generator-547"><span class="linenos">547</span></a>
+</span><span id="Presto.Generator-548"><a href="#Presto.Generator-548"><span class="linenos">548</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
+</span><span id="Presto.Generator-549"><a href="#Presto.Generator-549"><span class="linenos">549</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">PropertyEQ</span><span class="p">):</span>
+</span><span id="Presto.Generator-550"><a href="#Presto.Generator-550"><span class="linenos">550</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span> <span class="ow">and</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">):</span>
+</span><span id="Presto.Generator-551"><a href="#Presto.Generator-551"><span class="linenos">551</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">True</span>
+</span><span id="Presto.Generator-552"><a href="#Presto.Generator-552"><span class="linenos">552</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Presto.Generator-553"><a href="#Presto.Generator-553"><span class="linenos">553</span></a> <span class="n">schema</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
+</span><span id="Presto.Generator-554"><a href="#Presto.Generator-554"><span class="linenos">554</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">&quot;expression&quot;</span><span class="p">))</span>
+</span><span id="Presto.Generator-555"><a href="#Presto.Generator-555"><span class="linenos">555</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Presto.Generator-556"><a href="#Presto.Generator-556"><span class="linenos">556</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
+</span><span id="Presto.Generator-557"><a href="#Presto.Generator-557"><span class="linenos">557</span></a>
+</span><span id="Presto.Generator-558"><a href="#Presto.Generator-558"><span class="linenos">558</span></a> <span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span>
+</span><span id="Presto.Generator-559"><a href="#Presto.Generator-559"><span class="linenos">559</span></a>
+</span><span id="Presto.Generator-560"><a href="#Presto.Generator-560"><span class="linenos">560</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">size</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> <span class="o">!=</span> <span class="n">size</span><span class="p">:</span>
+</span><span id="Presto.Generator-561"><a href="#Presto.Generator-561"><span class="linenos">561</span></a> <span class="k">if</span> <span class="n">unknown_type</span><span class="p">:</span>
+</span><span id="Presto.Generator-562"><a href="#Presto.Generator-562"><span class="linenos">562</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span>
+</span><span id="Presto.Generator-563"><a href="#Presto.Generator-563"><span class="linenos">563</span></a> <span class="s2">&quot;Cannot convert untyped key-value definitions (try annotate_types).&quot;</span>
+</span><span id="Presto.Generator-564"><a href="#Presto.Generator-564"><span class="linenos">564</span></a> <span class="p">)</span>
+</span><span id="Presto.Generator-565"><a href="#Presto.Generator-565"><span class="linenos">565</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;ROW&quot;</span><span class="p">,</span> <span class="o">*</span><span class="n">values</span><span class="p">)</span>
+</span><span id="Presto.Generator-566"><a href="#Presto.Generator-566"><span class="linenos">566</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;CAST(ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">values</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span><span class="si">}</span><span class="s2">))&quot;</span>
+</span><span id="Presto.Generator-567"><a href="#Presto.Generator-567"><span class="linenos">567</span></a>
+</span><span id="Presto.Generator-568"><a href="#Presto.Generator-568"><span class="linenos">568</span></a> <span class="k">def</span> <span class="nf">interval_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator-569"><a href="#Presto.Generator-569"><span class="linenos">569</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">&quot;unit&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;WEEK&quot;</span><span class="p">):</span>
+</span><span id="Presto.Generator-570"><a href="#Presto.Generator-570"><span class="linenos">570</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;(</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> * INTERVAL &#39;7&#39; DAY)&quot;</span>
+</span><span id="Presto.Generator-571"><a href="#Presto.Generator-571"><span class="linenos">571</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">interval_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="Presto.Generator-572"><a href="#Presto.Generator-572"><span class="linenos">572</span></a>
+</span><span id="Presto.Generator-573"><a href="#Presto.Generator-573"><span class="linenos">573</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Transaction</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator-574"><a href="#Presto.Generator-574"><span class="linenos">574</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;modes&quot;</span><span class="p">)</span>
+</span><span id="Presto.Generator-575"><a href="#Presto.Generator-575"><span class="linenos">575</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; </span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">modes</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
+</span><span id="Presto.Generator-576"><a href="#Presto.Generator-576"><span class="linenos">576</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="Presto.Generator-577"><a href="#Presto.Generator-577"><span class="linenos">577</span></a>
+</span><span id="Presto.Generator-578"><a href="#Presto.Generator-578"><span class="linenos">578</span></a> <span class="k">def</span> <span class="nf">generateseries_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator-579"><a href="#Presto.Generator-579"><span class="linenos">579</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;start&quot;</span><span class="p">]</span>
+</span><span id="Presto.Generator-580"><a href="#Presto.Generator-580"><span class="linenos">580</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;end&quot;</span><span class="p">]</span>
+</span><span id="Presto.Generator-581"><a href="#Presto.Generator-581"><span class="linenos">581</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;step&quot;</span><span class="p">)</span>
+</span><span id="Presto.Generator-582"><a href="#Presto.Generator-582"><span class="linenos">582</span></a>
+</span><span id="Presto.Generator-583"><a href="#Presto.Generator-583"><span class="linenos">583</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
+</span><span id="Presto.Generator-584"><a href="#Presto.Generator-584"><span class="linenos">584</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span>
+</span><span id="Presto.Generator-585"><a href="#Presto.Generator-585"><span class="linenos">585</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
+</span><span id="Presto.Generator-586"><a href="#Presto.Generator-586"><span class="linenos">586</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">end</span><span class="o">.</span><span class="n">to</span>
+</span><span id="Presto.Generator-587"><a href="#Presto.Generator-587"><span class="linenos">587</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Presto.Generator-588"><a href="#Presto.Generator-588"><span class="linenos">588</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span>
+</span><span id="Presto.Generator-589"><a href="#Presto.Generator-589"><span class="linenos">589</span></a>
+</span><span id="Presto.Generator-590"><a href="#Presto.Generator-590"><span class="linenos">590</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">and</span> <span class="n">target_type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">&quot;timestamp&quot;</span><span class="p">):</span>
+</span><span id="Presto.Generator-591"><a href="#Presto.Generator-591"><span class="linenos">591</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">is</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span><span class="p">:</span>
+</span><span id="Presto.Generator-592"><a href="#Presto.Generator-592"><span class="linenos">592</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
+</span><span id="Presto.Generator-593"><a href="#Presto.Generator-593"><span class="linenos">593</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Presto.Generator-594"><a href="#Presto.Generator-594"><span class="linenos">594</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
+</span><span id="Presto.Generator-595"><a href="#Presto.Generator-595"><span class="linenos">595</span></a>
+</span><span id="Presto.Generator-596"><a href="#Presto.Generator-596"><span class="linenos">596</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;SEQUENCE&quot;</span><span class="p">,</span> <span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">,</span> <span class="n">step</span><span class="p">)</span>
+</span><span id="Presto.Generator-597"><a href="#Presto.Generator-597"><span class="linenos">597</span></a>
+</span><span id="Presto.Generator-598"><a href="#Presto.Generator-598"><span class="linenos">598</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span>
+</span><span id="Presto.Generator-599"><a href="#Presto.Generator-599"><span class="linenos">599</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">fetch</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">limit</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">]</span>
+</span><span id="Presto.Generator-600"><a href="#Presto.Generator-600"><span class="linenos">600</span></a> <span class="p">)</span> <span class="o">-&gt;</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span>
+</span><span id="Presto.Generator-601"><a href="#Presto.Generator-601"><span class="linenos">601</span></a> <span class="k">return</span> <span class="p">[</span>
+</span><span id="Presto.Generator-602"><a href="#Presto.Generator-602"><span class="linenos">602</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;offset&quot;</span><span class="p">),</span>
+</span><span id="Presto.Generator-603"><a href="#Presto.Generator-603"><span class="linenos">603</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">limit</span><span class="p">),</span>
+</span><span id="Presto.Generator-604"><a href="#Presto.Generator-604"><span class="linenos">604</span></a> <span class="p">]</span>
+</span><span id="Presto.Generator-605"><a href="#Presto.Generator-605"><span class="linenos">605</span></a>
+</span><span id="Presto.Generator-606"><a href="#Presto.Generator-606"><span class="linenos">606</span></a> <span class="k">def</span> <span class="nf">create_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator-607"><a href="#Presto.Generator-607"><span class="linenos">607</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
+</span><span id="Presto.Generator-608"><a href="#Presto.Generator-608"><span class="linenos">608</span></a><span class="sd"> Presto doesn&#39;t support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span>
+</span><span id="Presto.Generator-609"><a href="#Presto.Generator-609"><span class="linenos">609</span></a><span class="sd"> so we need to remove them</span>
+</span><span id="Presto.Generator-610"><a href="#Presto.Generator-610"><span class="linenos">610</span></a><span class="sd"> &quot;&quot;&quot;</span>
+</span><span id="Presto.Generator-611"><a href="#Presto.Generator-611"><span class="linenos">611</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;kind&quot;</span><span class="p">]</span>
+</span><span id="Presto.Generator-612"><a href="#Presto.Generator-612"><span class="linenos">612</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span>
+</span><span id="Presto.Generator-613"><a href="#Presto.Generator-613"><span class="linenos">613</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">&quot;VIEW&quot;</span> <span class="ow">and</span> <span class="n">schema</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
+</span><span id="Presto.Generator-614"><a href="#Presto.Generator-614"><span class="linenos">614</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">&quot;expressions&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
+</span><span id="Presto.Generator-615"><a href="#Presto.Generator-615"><span class="linenos">615</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">create_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
</span></pre></div>
@@ -2497,7 +2684,7 @@ Default: True</li>
<div class="attr variable">
<span class="name">TYPE_MAPPING</span> =
<input id="Presto.Generator.TYPE_MAPPING-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
- <label class="view-value-button pdoc-button" for="Presto.Generator.TYPE_MAPPING-view-value"></label><span class="default_value">{&lt;Type.NCHAR: &#39;NCHAR&#39;&gt;: &#39;CHAR&#39;, &lt;Type.NVARCHAR: &#39;NVARCHAR&#39;&gt;: &#39;VARCHAR&#39;, &lt;Type.MEDIUMTEXT: &#39;MEDIUMTEXT&#39;&gt;: &#39;TEXT&#39;, &lt;Type.LONGTEXT: &#39;LONGTEXT&#39;&gt;: &#39;TEXT&#39;, &lt;Type.TINYTEXT: &#39;TINYTEXT&#39;&gt;: &#39;TEXT&#39;, &lt;Type.MEDIUMBLOB: &#39;MEDIUMBLOB&#39;&gt;: &#39;BLOB&#39;, &lt;Type.LONGBLOB: &#39;LONGBLOB&#39;&gt;: &#39;BLOB&#39;, &lt;Type.TINYBLOB: &#39;TINYBLOB&#39;&gt;: &#39;BLOB&#39;, &lt;Type.INET: &#39;INET&#39;&gt;: &#39;INET&#39;, &lt;Type.INT: &#39;INT&#39;&gt;: &#39;INTEGER&#39;, &lt;Type.FLOAT: &#39;FLOAT&#39;&gt;: &#39;REAL&#39;, &lt;Type.BINARY: &#39;BINARY&#39;&gt;: &#39;VARBINARY&#39;, &lt;Type.TEXT: &#39;TEXT&#39;&gt;: &#39;VARCHAR&#39;, &lt;Type.TIMETZ: &#39;TIMETZ&#39;&gt;: &#39;TIME&#39;, &lt;Type.TIMESTAMPTZ: &#39;TIMESTAMPTZ&#39;&gt;: &#39;TIMESTAMP&#39;, &lt;Type.STRUCT: &#39;STRUCT&#39;&gt;: &#39;ROW&#39;, &lt;Type.DATETIME: &#39;DATETIME&#39;&gt;: &#39;TIMESTAMP&#39;, &lt;Type.DATETIME64: &#39;DATETIME64&#39;&gt;: &#39;TIMESTAMP&#39;}</span>
+ <label class="view-value-button pdoc-button" for="Presto.Generator.TYPE_MAPPING-view-value"></label><span class="default_value">{&lt;Type.NCHAR: &#39;NCHAR&#39;&gt;: &#39;CHAR&#39;, &lt;Type.NVARCHAR: &#39;NVARCHAR&#39;&gt;: &#39;VARCHAR&#39;, &lt;Type.MEDIUMTEXT: &#39;MEDIUMTEXT&#39;&gt;: &#39;TEXT&#39;, &lt;Type.LONGTEXT: &#39;LONGTEXT&#39;&gt;: &#39;TEXT&#39;, &lt;Type.TINYTEXT: &#39;TINYTEXT&#39;&gt;: &#39;TEXT&#39;, &lt;Type.MEDIUMBLOB: &#39;MEDIUMBLOB&#39;&gt;: &#39;BLOB&#39;, &lt;Type.LONGBLOB: &#39;LONGBLOB&#39;&gt;: &#39;BLOB&#39;, &lt;Type.TINYBLOB: &#39;TINYBLOB&#39;&gt;: &#39;BLOB&#39;, &lt;Type.INET: &#39;INET&#39;&gt;: &#39;INET&#39;, &lt;Type.ROWVERSION: &#39;ROWVERSION&#39;&gt;: &#39;VARBINARY&#39;, &lt;Type.INT: &#39;INT&#39;&gt;: &#39;INTEGER&#39;, &lt;Type.FLOAT: &#39;FLOAT&#39;&gt;: &#39;REAL&#39;, &lt;Type.BINARY: &#39;BINARY&#39;&gt;: &#39;VARBINARY&#39;, &lt;Type.TEXT: &#39;TEXT&#39;&gt;: &#39;VARCHAR&#39;, &lt;Type.TIMETZ: &#39;TIMETZ&#39;&gt;: &#39;TIME&#39;, &lt;Type.TIMESTAMPTZ: &#39;TIMESTAMPTZ&#39;&gt;: &#39;TIMESTAMP&#39;, &lt;Type.STRUCT: &#39;STRUCT&#39;&gt;: &#39;ROW&#39;, &lt;Type.DATETIME: &#39;DATETIME&#39;&gt;: &#39;TIMESTAMP&#39;, &lt;Type.DATETIME64: &#39;DATETIME64&#39;&gt;: &#39;TIMESTAMP&#39;}</span>
</div>
@@ -2519,6 +2706,19 @@ Default: True</li>
</div>
+ <div id="Presto.Generator.RESERVED_KEYWORDS" class="classattr">
+ <div class="attr variable">
+ <span class="name">RESERVED_KEYWORDS</span> =
+<input id="Presto.Generator.RESERVED_KEYWORDS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
+ <label class="view-value-button pdoc-button" for="Presto.Generator.RESERVED_KEYWORDS-view-value"></label><span class="default_value">{&#39;where&#39;, &#39;null&#39;, &#39;outer&#39;, &#39;cross&#39;, &#39;execute&#39;, &#39;and&#39;, &#39;for&#39;, &#39;right&#39;, &#39;in&#39;, &#39;current_timestamp&#39;, &#39;group&#39;, &#39;select&#39;, &#39;by&#39;, &#39;case&#39;, &#39;between&#39;, &#39;extract&#39;, &#39;intersect&#39;, &#39;table&#39;, &#39;into&#39;, &#39;escape&#39;, &#39;end&#39;, &#39;true&#39;, &#39;delete&#39;, &#39;as&#39;, &#39;then&#39;, &#39;values&#39;, &#39;deallocate&#39;, &#39;else&#39;, &#39;left&#39;, &#39;order&#39;, &#39;drop&#39;, &#39;exists&#39;, &#39;when&#39;, &#39;constraint&#39;, &#39;with&#39;, &#39;is&#39;, &#39;not&#39;, &#39;natural&#39;, &#39;using&#39;, &#39;create&#39;, &#39;full&#39;, &#39;having&#39;, &#39;except&#39;, &#39;union&#39;, &#39;on&#39;, &#39;distinct&#39;, &#39;from&#39;, &#39;inner&#39;, &#39;false&#39;, &#39;cast&#39;, &#39;join&#39;, &#39;describe&#39;, &#39;insert&#39;, &#39;like&#39;, &#39;or&#39;, &#39;alter&#39;, &#39;current_time&#39;, &#39;prepare&#39;}</span>
+
+
+ </div>
+ <a class="headerlink" href="#Presto.Generator.RESERVED_KEYWORDS"></a>
+
+
+
+ </div>
<div id="Presto.Generator.strtounix_sql" class="classattr">
<input id="Presto.Generator.strtounix_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
<div class="attr function">
@@ -2530,21 +2730,21 @@ Default: True</li>
</div>
<a class="headerlink" href="#Presto.Generator.strtounix_sql"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.strtounix_sql-447"><a href="#Presto.Generator.strtounix_sql-447"><span class="linenos">447</span></a> <span class="k">def</span> <span class="nf">strtounix_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator.strtounix_sql-448"><a href="#Presto.Generator.strtounix_sql-448"><span class="linenos">448</span></a> <span class="c1"># Since `TO_UNIXTIME` requires a `TIMESTAMP`, we need to parse the argument into one.</span>
-</span><span id="Presto.Generator.strtounix_sql-449"><a href="#Presto.Generator.strtounix_sql-449"><span class="linenos">449</span></a> <span class="c1"># To do this, we first try to `DATE_PARSE` it, but since this can fail when there&#39;s a</span>
-</span><span id="Presto.Generator.strtounix_sql-450"><a href="#Presto.Generator.strtounix_sql-450"><span class="linenos">450</span></a> <span class="c1"># timezone involved, we wrap it in a `TRY` call and use `PARSE_DATETIME` as a fallback,</span>
-</span><span id="Presto.Generator.strtounix_sql-451"><a href="#Presto.Generator.strtounix_sql-451"><span class="linenos">451</span></a> <span class="c1"># which seems to be using the same time mapping as Hive, as per:</span>
-</span><span id="Presto.Generator.strtounix_sql-452"><a href="#Presto.Generator.strtounix_sql-452"><span class="linenos">452</span></a> <span class="c1"># https://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html</span>
-</span><span id="Presto.Generator.strtounix_sql-453"><a href="#Presto.Generator.strtounix_sql-453"><span class="linenos">453</span></a> <span class="n">value_as_text</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">)</span>
-</span><span id="Presto.Generator.strtounix_sql-454"><a href="#Presto.Generator.strtounix_sql-454"><span class="linenos">454</span></a> <span class="n">parse_without_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;DATE_PARSE&quot;</span><span class="p">,</span> <span class="n">value_as_text</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span>
-</span><span id="Presto.Generator.strtounix_sql-455"><a href="#Presto.Generator.strtounix_sql-455"><span class="linenos">455</span></a> <span class="n">parse_with_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
-</span><span id="Presto.Generator.strtounix_sql-456"><a href="#Presto.Generator.strtounix_sql-456"><span class="linenos">456</span></a> <span class="s2">&quot;PARSE_DATETIME&quot;</span><span class="p">,</span>
-</span><span id="Presto.Generator.strtounix_sql-457"><a href="#Presto.Generator.strtounix_sql-457"><span class="linenos">457</span></a> <span class="n">value_as_text</span><span class="p">,</span>
-</span><span id="Presto.Generator.strtounix_sql-458"><a href="#Presto.Generator.strtounix_sql-458"><span class="linenos">458</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_MAPPING</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_TRIE</span><span class="p">),</span>
-</span><span id="Presto.Generator.strtounix_sql-459"><a href="#Presto.Generator.strtounix_sql-459"><span class="linenos">459</span></a> <span class="p">)</span>
-</span><span id="Presto.Generator.strtounix_sql-460"><a href="#Presto.Generator.strtounix_sql-460"><span class="linenos">460</span></a> <span class="n">coalesced</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;COALESCE&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TRY&quot;</span><span class="p">,</span> <span class="n">parse_without_tz</span><span class="p">),</span> <span class="n">parse_with_tz</span><span class="p">)</span>
-</span><span id="Presto.Generator.strtounix_sql-461"><a href="#Presto.Generator.strtounix_sql-461"><span class="linenos">461</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TO_UNIXTIME&quot;</span><span class="p">,</span> <span class="n">coalesced</span><span class="p">)</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.strtounix_sql-508"><a href="#Presto.Generator.strtounix_sql-508"><span class="linenos">508</span></a> <span class="k">def</span> <span class="nf">strtounix_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator.strtounix_sql-509"><a href="#Presto.Generator.strtounix_sql-509"><span class="linenos">509</span></a> <span class="c1"># Since `TO_UNIXTIME` requires a `TIMESTAMP`, we need to parse the argument into one.</span>
+</span><span id="Presto.Generator.strtounix_sql-510"><a href="#Presto.Generator.strtounix_sql-510"><span class="linenos">510</span></a> <span class="c1"># To do this, we first try to `DATE_PARSE` it, but since this can fail when there&#39;s a</span>
+</span><span id="Presto.Generator.strtounix_sql-511"><a href="#Presto.Generator.strtounix_sql-511"><span class="linenos">511</span></a> <span class="c1"># timezone involved, we wrap it in a `TRY` call and use `PARSE_DATETIME` as a fallback,</span>
+</span><span id="Presto.Generator.strtounix_sql-512"><a href="#Presto.Generator.strtounix_sql-512"><span class="linenos">512</span></a> <span class="c1"># which seems to be using the same time mapping as Hive, as per:</span>
+</span><span id="Presto.Generator.strtounix_sql-513"><a href="#Presto.Generator.strtounix_sql-513"><span class="linenos">513</span></a> <span class="c1"># https://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html</span>
+</span><span id="Presto.Generator.strtounix_sql-514"><a href="#Presto.Generator.strtounix_sql-514"><span class="linenos">514</span></a> <span class="n">value_as_text</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">)</span>
+</span><span id="Presto.Generator.strtounix_sql-515"><a href="#Presto.Generator.strtounix_sql-515"><span class="linenos">515</span></a> <span class="n">parse_without_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;DATE_PARSE&quot;</span><span class="p">,</span> <span class="n">value_as_text</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span>
+</span><span id="Presto.Generator.strtounix_sql-516"><a href="#Presto.Generator.strtounix_sql-516"><span class="linenos">516</span></a> <span class="n">parse_with_tz</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
+</span><span id="Presto.Generator.strtounix_sql-517"><a href="#Presto.Generator.strtounix_sql-517"><span class="linenos">517</span></a> <span class="s2">&quot;PARSE_DATETIME&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator.strtounix_sql-518"><a href="#Presto.Generator.strtounix_sql-518"><span class="linenos">518</span></a> <span class="n">value_as_text</span><span class="p">,</span>
+</span><span id="Presto.Generator.strtounix_sql-519"><a href="#Presto.Generator.strtounix_sql-519"><span class="linenos">519</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_MAPPING</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">INVERSE_TIME_TRIE</span><span class="p">),</span>
+</span><span id="Presto.Generator.strtounix_sql-520"><a href="#Presto.Generator.strtounix_sql-520"><span class="linenos">520</span></a> <span class="p">)</span>
+</span><span id="Presto.Generator.strtounix_sql-521"><a href="#Presto.Generator.strtounix_sql-521"><span class="linenos">521</span></a> <span class="n">coalesced</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;COALESCE&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TRY&quot;</span><span class="p">,</span> <span class="n">parse_without_tz</span><span class="p">),</span> <span class="n">parse_with_tz</span><span class="p">)</span>
+</span><span id="Presto.Generator.strtounix_sql-522"><a href="#Presto.Generator.strtounix_sql-522"><span class="linenos">522</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;TO_UNIXTIME&quot;</span><span class="p">,</span> <span class="n">coalesced</span><span class="p">)</span>
</span></pre></div>
@@ -2562,21 +2762,21 @@ Default: True</li>
</div>
<a class="headerlink" href="#Presto.Generator.bracket_sql"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.bracket_sql-463"><a href="#Presto.Generator.bracket_sql-463"><span class="linenos">463</span></a> <span class="k">def</span> <span class="nf">bracket_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator.bracket_sql-464"><a href="#Presto.Generator.bracket_sql-464"><span class="linenos">464</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;safe&quot;</span><span class="p">):</span>
-</span><span id="Presto.Generator.bracket_sql-465"><a href="#Presto.Generator.bracket_sql-465"><span class="linenos">465</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
-</span><span id="Presto.Generator.bracket_sql-466"><a href="#Presto.Generator.bracket_sql-466"><span class="linenos">466</span></a> <span class="s2">&quot;ELEMENT_AT&quot;</span><span class="p">,</span>
-</span><span id="Presto.Generator.bracket_sql-467"><a href="#Presto.Generator.bracket_sql-467"><span class="linenos">467</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
-</span><span id="Presto.Generator.bracket_sql-468"><a href="#Presto.Generator.bracket_sql-468"><span class="linenos">468</span></a> <span class="n">seq_get</span><span class="p">(</span>
-</span><span id="Presto.Generator.bracket_sql-469"><a href="#Presto.Generator.bracket_sql-469"><span class="linenos">469</span></a> <span class="n">apply_index_offset</span><span class="p">(</span>
-</span><span id="Presto.Generator.bracket_sql-470"><a href="#Presto.Generator.bracket_sql-470"><span class="linenos">470</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
-</span><span id="Presto.Generator.bracket_sql-471"><a href="#Presto.Generator.bracket_sql-471"><span class="linenos">471</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span>
-</span><span id="Presto.Generator.bracket_sql-472"><a href="#Presto.Generator.bracket_sql-472"><span class="linenos">472</span></a> <span class="mi">1</span> <span class="o">-</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;offset&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
-</span><span id="Presto.Generator.bracket_sql-473"><a href="#Presto.Generator.bracket_sql-473"><span class="linenos">473</span></a> <span class="p">),</span>
-</span><span id="Presto.Generator.bracket_sql-474"><a href="#Presto.Generator.bracket_sql-474"><span class="linenos">474</span></a> <span class="mi">0</span><span class="p">,</span>
-</span><span id="Presto.Generator.bracket_sql-475"><a href="#Presto.Generator.bracket_sql-475"><span class="linenos">475</span></a> <span class="p">),</span>
-</span><span id="Presto.Generator.bracket_sql-476"><a href="#Presto.Generator.bracket_sql-476"><span class="linenos">476</span></a> <span class="p">)</span>
-</span><span id="Presto.Generator.bracket_sql-477"><a href="#Presto.Generator.bracket_sql-477"><span class="linenos">477</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">bracket_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.bracket_sql-524"><a href="#Presto.Generator.bracket_sql-524"><span class="linenos">524</span></a> <span class="k">def</span> <span class="nf">bracket_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator.bracket_sql-525"><a href="#Presto.Generator.bracket_sql-525"><span class="linenos">525</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;safe&quot;</span><span class="p">):</span>
+</span><span id="Presto.Generator.bracket_sql-526"><a href="#Presto.Generator.bracket_sql-526"><span class="linenos">526</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span>
+</span><span id="Presto.Generator.bracket_sql-527"><a href="#Presto.Generator.bracket_sql-527"><span class="linenos">527</span></a> <span class="s2">&quot;ELEMENT_AT&quot;</span><span class="p">,</span>
+</span><span id="Presto.Generator.bracket_sql-528"><a href="#Presto.Generator.bracket_sql-528"><span class="linenos">528</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
+</span><span id="Presto.Generator.bracket_sql-529"><a href="#Presto.Generator.bracket_sql-529"><span class="linenos">529</span></a> <span class="n">seq_get</span><span class="p">(</span>
+</span><span id="Presto.Generator.bracket_sql-530"><a href="#Presto.Generator.bracket_sql-530"><span class="linenos">530</span></a> <span class="n">apply_index_offset</span><span class="p">(</span>
+</span><span id="Presto.Generator.bracket_sql-531"><a href="#Presto.Generator.bracket_sql-531"><span class="linenos">531</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span>
+</span><span id="Presto.Generator.bracket_sql-532"><a href="#Presto.Generator.bracket_sql-532"><span class="linenos">532</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span>
+</span><span id="Presto.Generator.bracket_sql-533"><a href="#Presto.Generator.bracket_sql-533"><span class="linenos">533</span></a> <span class="mi">1</span> <span class="o">-</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;offset&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
+</span><span id="Presto.Generator.bracket_sql-534"><a href="#Presto.Generator.bracket_sql-534"><span class="linenos">534</span></a> <span class="p">),</span>
+</span><span id="Presto.Generator.bracket_sql-535"><a href="#Presto.Generator.bracket_sql-535"><span class="linenos">535</span></a> <span class="mi">0</span><span class="p">,</span>
+</span><span id="Presto.Generator.bracket_sql-536"><a href="#Presto.Generator.bracket_sql-536"><span class="linenos">536</span></a> <span class="p">),</span>
+</span><span id="Presto.Generator.bracket_sql-537"><a href="#Presto.Generator.bracket_sql-537"><span class="linenos">537</span></a> <span class="p">)</span>
+</span><span id="Presto.Generator.bracket_sql-538"><a href="#Presto.Generator.bracket_sql-538"><span class="linenos">538</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">bracket_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
</span></pre></div>
@@ -2594,33 +2794,33 @@ Default: True</li>
</div>
<a class="headerlink" href="#Presto.Generator.struct_sql"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.struct_sql-479"><a href="#Presto.Generator.struct_sql-479"><span class="linenos">479</span></a> <span class="k">def</span> <span class="nf">struct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator.struct_sql-480"><a href="#Presto.Generator.struct_sql-480"><span class="linenos">480</span></a> <span class="kn">from</span> <span class="nn">sqlglot.optimizer.annotate_types</span> <span class="kn">import</span> <span class="n">annotate_types</span>
-</span><span id="Presto.Generator.struct_sql-481"><a href="#Presto.Generator.struct_sql-481"><span class="linenos">481</span></a>
-</span><span id="Presto.Generator.struct_sql-482"><a href="#Presto.Generator.struct_sql-482"><span class="linenos">482</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">annotate_types</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="Presto.Generator.struct_sql-483"><a href="#Presto.Generator.struct_sql-483"><span class="linenos">483</span></a> <span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
-</span><span id="Presto.Generator.struct_sql-484"><a href="#Presto.Generator.struct_sql-484"><span class="linenos">484</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
-</span><span id="Presto.Generator.struct_sql-485"><a href="#Presto.Generator.struct_sql-485"><span class="linenos">485</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">False</span>
-</span><span id="Presto.Generator.struct_sql-486"><a href="#Presto.Generator.struct_sql-486"><span class="linenos">486</span></a>
-</span><span id="Presto.Generator.struct_sql-487"><a href="#Presto.Generator.struct_sql-487"><span class="linenos">487</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
-</span><span id="Presto.Generator.struct_sql-488"><a href="#Presto.Generator.struct_sql-488"><span class="linenos">488</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">PropertyEQ</span><span class="p">):</span>
-</span><span id="Presto.Generator.struct_sql-489"><a href="#Presto.Generator.struct_sql-489"><span class="linenos">489</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span> <span class="ow">and</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">):</span>
-</span><span id="Presto.Generator.struct_sql-490"><a href="#Presto.Generator.struct_sql-490"><span class="linenos">490</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">True</span>
-</span><span id="Presto.Generator.struct_sql-491"><a href="#Presto.Generator.struct_sql-491"><span class="linenos">491</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Presto.Generator.struct_sql-492"><a href="#Presto.Generator.struct_sql-492"><span class="linenos">492</span></a> <span class="n">schema</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
-</span><span id="Presto.Generator.struct_sql-493"><a href="#Presto.Generator.struct_sql-493"><span class="linenos">493</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">&quot;expression&quot;</span><span class="p">))</span>
-</span><span id="Presto.Generator.struct_sql-494"><a href="#Presto.Generator.struct_sql-494"><span class="linenos">494</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Presto.Generator.struct_sql-495"><a href="#Presto.Generator.struct_sql-495"><span class="linenos">495</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
-</span><span id="Presto.Generator.struct_sql-496"><a href="#Presto.Generator.struct_sql-496"><span class="linenos">496</span></a>
-</span><span id="Presto.Generator.struct_sql-497"><a href="#Presto.Generator.struct_sql-497"><span class="linenos">497</span></a> <span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span>
-</span><span id="Presto.Generator.struct_sql-498"><a href="#Presto.Generator.struct_sql-498"><span class="linenos">498</span></a>
-</span><span id="Presto.Generator.struct_sql-499"><a href="#Presto.Generator.struct_sql-499"><span class="linenos">499</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">size</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> <span class="o">!=</span> <span class="n">size</span><span class="p">:</span>
-</span><span id="Presto.Generator.struct_sql-500"><a href="#Presto.Generator.struct_sql-500"><span class="linenos">500</span></a> <span class="k">if</span> <span class="n">unknown_type</span><span class="p">:</span>
-</span><span id="Presto.Generator.struct_sql-501"><a href="#Presto.Generator.struct_sql-501"><span class="linenos">501</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span>
-</span><span id="Presto.Generator.struct_sql-502"><a href="#Presto.Generator.struct_sql-502"><span class="linenos">502</span></a> <span class="s2">&quot;Cannot convert untyped key-value definitions (try annotate_types).&quot;</span>
-</span><span id="Presto.Generator.struct_sql-503"><a href="#Presto.Generator.struct_sql-503"><span class="linenos">503</span></a> <span class="p">)</span>
-</span><span id="Presto.Generator.struct_sql-504"><a href="#Presto.Generator.struct_sql-504"><span class="linenos">504</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;ROW&quot;</span><span class="p">,</span> <span class="o">*</span><span class="n">values</span><span class="p">)</span>
-</span><span id="Presto.Generator.struct_sql-505"><a href="#Presto.Generator.struct_sql-505"><span class="linenos">505</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;CAST(ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">values</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span><span class="si">}</span><span class="s2">))&quot;</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.struct_sql-540"><a href="#Presto.Generator.struct_sql-540"><span class="linenos">540</span></a> <span class="k">def</span> <span class="nf">struct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator.struct_sql-541"><a href="#Presto.Generator.struct_sql-541"><span class="linenos">541</span></a> <span class="kn">from</span> <span class="nn">sqlglot.optimizer.annotate_types</span> <span class="kn">import</span> <span class="n">annotate_types</span>
+</span><span id="Presto.Generator.struct_sql-542"><a href="#Presto.Generator.struct_sql-542"><span class="linenos">542</span></a>
+</span><span id="Presto.Generator.struct_sql-543"><a href="#Presto.Generator.struct_sql-543"><span class="linenos">543</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">annotate_types</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="Presto.Generator.struct_sql-544"><a href="#Presto.Generator.struct_sql-544"><span class="linenos">544</span></a> <span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+</span><span id="Presto.Generator.struct_sql-545"><a href="#Presto.Generator.struct_sql-545"><span class="linenos">545</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+</span><span id="Presto.Generator.struct_sql-546"><a href="#Presto.Generator.struct_sql-546"><span class="linenos">546</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">False</span>
+</span><span id="Presto.Generator.struct_sql-547"><a href="#Presto.Generator.struct_sql-547"><span class="linenos">547</span></a>
+</span><span id="Presto.Generator.struct_sql-548"><a href="#Presto.Generator.struct_sql-548"><span class="linenos">548</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
+</span><span id="Presto.Generator.struct_sql-549"><a href="#Presto.Generator.struct_sql-549"><span class="linenos">549</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">PropertyEQ</span><span class="p">):</span>
+</span><span id="Presto.Generator.struct_sql-550"><a href="#Presto.Generator.struct_sql-550"><span class="linenos">550</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span> <span class="ow">and</span> <span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">):</span>
+</span><span id="Presto.Generator.struct_sql-551"><a href="#Presto.Generator.struct_sql-551"><span class="linenos">551</span></a> <span class="n">unknown_type</span> <span class="o">=</span> <span class="kc">True</span>
+</span><span id="Presto.Generator.struct_sql-552"><a href="#Presto.Generator.struct_sql-552"><span class="linenos">552</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Presto.Generator.struct_sql-553"><a href="#Presto.Generator.struct_sql-553"><span class="linenos">553</span></a> <span class="n">schema</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">type</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
+</span><span id="Presto.Generator.struct_sql-554"><a href="#Presto.Generator.struct_sql-554"><span class="linenos">554</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">&quot;expression&quot;</span><span class="p">))</span>
+</span><span id="Presto.Generator.struct_sql-555"><a href="#Presto.Generator.struct_sql-555"><span class="linenos">555</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Presto.Generator.struct_sql-556"><a href="#Presto.Generator.struct_sql-556"><span class="linenos">556</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
+</span><span id="Presto.Generator.struct_sql-557"><a href="#Presto.Generator.struct_sql-557"><span class="linenos">557</span></a>
+</span><span id="Presto.Generator.struct_sql-558"><a href="#Presto.Generator.struct_sql-558"><span class="linenos">558</span></a> <span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span>
+</span><span id="Presto.Generator.struct_sql-559"><a href="#Presto.Generator.struct_sql-559"><span class="linenos">559</span></a>
+</span><span id="Presto.Generator.struct_sql-560"><a href="#Presto.Generator.struct_sql-560"><span class="linenos">560</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">size</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> <span class="o">!=</span> <span class="n">size</span><span class="p">:</span>
+</span><span id="Presto.Generator.struct_sql-561"><a href="#Presto.Generator.struct_sql-561"><span class="linenos">561</span></a> <span class="k">if</span> <span class="n">unknown_type</span><span class="p">:</span>
+</span><span id="Presto.Generator.struct_sql-562"><a href="#Presto.Generator.struct_sql-562"><span class="linenos">562</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span>
+</span><span id="Presto.Generator.struct_sql-563"><a href="#Presto.Generator.struct_sql-563"><span class="linenos">563</span></a> <span class="s2">&quot;Cannot convert untyped key-value definitions (try annotate_types).&quot;</span>
+</span><span id="Presto.Generator.struct_sql-564"><a href="#Presto.Generator.struct_sql-564"><span class="linenos">564</span></a> <span class="p">)</span>
+</span><span id="Presto.Generator.struct_sql-565"><a href="#Presto.Generator.struct_sql-565"><span class="linenos">565</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;ROW&quot;</span><span class="p">,</span> <span class="o">*</span><span class="n">values</span><span class="p">)</span>
+</span><span id="Presto.Generator.struct_sql-566"><a href="#Presto.Generator.struct_sql-566"><span class="linenos">566</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;CAST(ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">values</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS ROW(</span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span><span class="si">}</span><span class="s2">))&quot;</span>
</span></pre></div>
@@ -2638,10 +2838,10 @@ Default: True</li>
</div>
<a class="headerlink" href="#Presto.Generator.interval_sql"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.interval_sql-507"><a href="#Presto.Generator.interval_sql-507"><span class="linenos">507</span></a> <span class="k">def</span> <span class="nf">interval_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator.interval_sql-508"><a href="#Presto.Generator.interval_sql-508"><span class="linenos">508</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">&quot;unit&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;WEEK&quot;</span><span class="p">):</span>
-</span><span id="Presto.Generator.interval_sql-509"><a href="#Presto.Generator.interval_sql-509"><span class="linenos">509</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;(</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> * INTERVAL &#39;7&#39; DAY)&quot;</span>
-</span><span id="Presto.Generator.interval_sql-510"><a href="#Presto.Generator.interval_sql-510"><span class="linenos">510</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">interval_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.interval_sql-568"><a href="#Presto.Generator.interval_sql-568"><span class="linenos">568</span></a> <span class="k">def</span> <span class="nf">interval_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator.interval_sql-569"><a href="#Presto.Generator.interval_sql-569"><span class="linenos">569</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">&quot;unit&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;WEEK&quot;</span><span class="p">):</span>
+</span><span id="Presto.Generator.interval_sql-570"><a href="#Presto.Generator.interval_sql-570"><span class="linenos">570</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;(</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> * INTERVAL &#39;7&#39; DAY)&quot;</span>
+</span><span id="Presto.Generator.interval_sql-571"><a href="#Presto.Generator.interval_sql-571"><span class="linenos">571</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">interval_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
</span></pre></div>
@@ -2659,10 +2859,10 @@ Default: True</li>
</div>
<a class="headerlink" href="#Presto.Generator.transaction_sql"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.transaction_sql-512"><a href="#Presto.Generator.transaction_sql-512"><span class="linenos">512</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Transaction</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator.transaction_sql-513"><a href="#Presto.Generator.transaction_sql-513"><span class="linenos">513</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;modes&quot;</span><span class="p">)</span>
-</span><span id="Presto.Generator.transaction_sql-514"><a href="#Presto.Generator.transaction_sql-514"><span class="linenos">514</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; </span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">modes</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
-</span><span id="Presto.Generator.transaction_sql-515"><a href="#Presto.Generator.transaction_sql-515"><span class="linenos">515</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">&quot;</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.transaction_sql-573"><a href="#Presto.Generator.transaction_sql-573"><span class="linenos">573</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Transaction</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator.transaction_sql-574"><a href="#Presto.Generator.transaction_sql-574"><span class="linenos">574</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;modes&quot;</span><span class="p">)</span>
+</span><span id="Presto.Generator.transaction_sql-575"><a href="#Presto.Generator.transaction_sql-575"><span class="linenos">575</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; </span><span class="si">{</span><span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">modes</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
+</span><span id="Presto.Generator.transaction_sql-576"><a href="#Presto.Generator.transaction_sql-576"><span class="linenos">576</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">&quot;</span>
</span></pre></div>
@@ -2680,25 +2880,25 @@ Default: True</li>
</div>
<a class="headerlink" href="#Presto.Generator.generateseries_sql"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.generateseries_sql-517"><a href="#Presto.Generator.generateseries_sql-517"><span class="linenos">517</span></a> <span class="k">def</span> <span class="nf">generateseries_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator.generateseries_sql-518"><a href="#Presto.Generator.generateseries_sql-518"><span class="linenos">518</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;start&quot;</span><span class="p">]</span>
-</span><span id="Presto.Generator.generateseries_sql-519"><a href="#Presto.Generator.generateseries_sql-519"><span class="linenos">519</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;end&quot;</span><span class="p">]</span>
-</span><span id="Presto.Generator.generateseries_sql-520"><a href="#Presto.Generator.generateseries_sql-520"><span class="linenos">520</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;step&quot;</span><span class="p">)</span>
-</span><span id="Presto.Generator.generateseries_sql-521"><a href="#Presto.Generator.generateseries_sql-521"><span class="linenos">521</span></a>
-</span><span id="Presto.Generator.generateseries_sql-522"><a href="#Presto.Generator.generateseries_sql-522"><span class="linenos">522</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
-</span><span id="Presto.Generator.generateseries_sql-523"><a href="#Presto.Generator.generateseries_sql-523"><span class="linenos">523</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span>
-</span><span id="Presto.Generator.generateseries_sql-524"><a href="#Presto.Generator.generateseries_sql-524"><span class="linenos">524</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
-</span><span id="Presto.Generator.generateseries_sql-525"><a href="#Presto.Generator.generateseries_sql-525"><span class="linenos">525</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">end</span><span class="o">.</span><span class="n">to</span>
-</span><span id="Presto.Generator.generateseries_sql-526"><a href="#Presto.Generator.generateseries_sql-526"><span class="linenos">526</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Presto.Generator.generateseries_sql-527"><a href="#Presto.Generator.generateseries_sql-527"><span class="linenos">527</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span>
-</span><span id="Presto.Generator.generateseries_sql-528"><a href="#Presto.Generator.generateseries_sql-528"><span class="linenos">528</span></a>
-</span><span id="Presto.Generator.generateseries_sql-529"><a href="#Presto.Generator.generateseries_sql-529"><span class="linenos">529</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">and</span> <span class="n">target_type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">&quot;timestamp&quot;</span><span class="p">):</span>
-</span><span id="Presto.Generator.generateseries_sql-530"><a href="#Presto.Generator.generateseries_sql-530"><span class="linenos">530</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">is</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span><span class="p">:</span>
-</span><span id="Presto.Generator.generateseries_sql-531"><a href="#Presto.Generator.generateseries_sql-531"><span class="linenos">531</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
-</span><span id="Presto.Generator.generateseries_sql-532"><a href="#Presto.Generator.generateseries_sql-532"><span class="linenos">532</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Presto.Generator.generateseries_sql-533"><a href="#Presto.Generator.generateseries_sql-533"><span class="linenos">533</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
-</span><span id="Presto.Generator.generateseries_sql-534"><a href="#Presto.Generator.generateseries_sql-534"><span class="linenos">534</span></a>
-</span><span id="Presto.Generator.generateseries_sql-535"><a href="#Presto.Generator.generateseries_sql-535"><span class="linenos">535</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;SEQUENCE&quot;</span><span class="p">,</span> <span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">,</span> <span class="n">step</span><span class="p">)</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.generateseries_sql-578"><a href="#Presto.Generator.generateseries_sql-578"><span class="linenos">578</span></a> <span class="k">def</span> <span class="nf">generateseries_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator.generateseries_sql-579"><a href="#Presto.Generator.generateseries_sql-579"><span class="linenos">579</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;start&quot;</span><span class="p">]</span>
+</span><span id="Presto.Generator.generateseries_sql-580"><a href="#Presto.Generator.generateseries_sql-580"><span class="linenos">580</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;end&quot;</span><span class="p">]</span>
+</span><span id="Presto.Generator.generateseries_sql-581"><a href="#Presto.Generator.generateseries_sql-581"><span class="linenos">581</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;step&quot;</span><span class="p">)</span>
+</span><span id="Presto.Generator.generateseries_sql-582"><a href="#Presto.Generator.generateseries_sql-582"><span class="linenos">582</span></a>
+</span><span id="Presto.Generator.generateseries_sql-583"><a href="#Presto.Generator.generateseries_sql-583"><span class="linenos">583</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
+</span><span id="Presto.Generator.generateseries_sql-584"><a href="#Presto.Generator.generateseries_sql-584"><span class="linenos">584</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span>
+</span><span id="Presto.Generator.generateseries_sql-585"><a href="#Presto.Generator.generateseries_sql-585"><span class="linenos">585</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span>
+</span><span id="Presto.Generator.generateseries_sql-586"><a href="#Presto.Generator.generateseries_sql-586"><span class="linenos">586</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">end</span><span class="o">.</span><span class="n">to</span>
+</span><span id="Presto.Generator.generateseries_sql-587"><a href="#Presto.Generator.generateseries_sql-587"><span class="linenos">587</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Presto.Generator.generateseries_sql-588"><a href="#Presto.Generator.generateseries_sql-588"><span class="linenos">588</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span>
+</span><span id="Presto.Generator.generateseries_sql-589"><a href="#Presto.Generator.generateseries_sql-589"><span class="linenos">589</span></a>
+</span><span id="Presto.Generator.generateseries_sql-590"><a href="#Presto.Generator.generateseries_sql-590"><span class="linenos">590</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">and</span> <span class="n">target_type</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">&quot;timestamp&quot;</span><span class="p">):</span>
+</span><span id="Presto.Generator.generateseries_sql-591"><a href="#Presto.Generator.generateseries_sql-591"><span class="linenos">591</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">is</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span><span class="p">:</span>
+</span><span id="Presto.Generator.generateseries_sql-592"><a href="#Presto.Generator.generateseries_sql-592"><span class="linenos">592</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
+</span><span id="Presto.Generator.generateseries_sql-593"><a href="#Presto.Generator.generateseries_sql-593"><span class="linenos">593</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Presto.Generator.generateseries_sql-594"><a href="#Presto.Generator.generateseries_sql-594"><span class="linenos">594</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">target_type</span><span class="p">)</span>
+</span><span id="Presto.Generator.generateseries_sql-595"><a href="#Presto.Generator.generateseries_sql-595"><span class="linenos">595</span></a>
+</span><span id="Presto.Generator.generateseries_sql-596"><a href="#Presto.Generator.generateseries_sql-596"><span class="linenos">596</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">&quot;SEQUENCE&quot;</span><span class="p">,</span> <span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">,</span> <span class="n">step</span><span class="p">)</span>
</span></pre></div>
@@ -2716,13 +2916,13 @@ Default: True</li>
</div>
<a class="headerlink" href="#Presto.Generator.offset_limit_modifiers"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.offset_limit_modifiers-537"><a href="#Presto.Generator.offset_limit_modifiers-537"><span class="linenos">537</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span>
-</span><span id="Presto.Generator.offset_limit_modifiers-538"><a href="#Presto.Generator.offset_limit_modifiers-538"><span class="linenos">538</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">fetch</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">limit</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">]</span>
-</span><span id="Presto.Generator.offset_limit_modifiers-539"><a href="#Presto.Generator.offset_limit_modifiers-539"><span class="linenos">539</span></a> <span class="p">)</span> <span class="o">-&gt;</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span>
-</span><span id="Presto.Generator.offset_limit_modifiers-540"><a href="#Presto.Generator.offset_limit_modifiers-540"><span class="linenos">540</span></a> <span class="k">return</span> <span class="p">[</span>
-</span><span id="Presto.Generator.offset_limit_modifiers-541"><a href="#Presto.Generator.offset_limit_modifiers-541"><span class="linenos">541</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;offset&quot;</span><span class="p">),</span>
-</span><span id="Presto.Generator.offset_limit_modifiers-542"><a href="#Presto.Generator.offset_limit_modifiers-542"><span class="linenos">542</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">limit</span><span class="p">),</span>
-</span><span id="Presto.Generator.offset_limit_modifiers-543"><a href="#Presto.Generator.offset_limit_modifiers-543"><span class="linenos">543</span></a> <span class="p">]</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.offset_limit_modifiers-598"><a href="#Presto.Generator.offset_limit_modifiers-598"><span class="linenos">598</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span>
+</span><span id="Presto.Generator.offset_limit_modifiers-599"><a href="#Presto.Generator.offset_limit_modifiers-599"><span class="linenos">599</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">fetch</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">limit</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">]</span>
+</span><span id="Presto.Generator.offset_limit_modifiers-600"><a href="#Presto.Generator.offset_limit_modifiers-600"><span class="linenos">600</span></a> <span class="p">)</span> <span class="o">-&gt;</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span>
+</span><span id="Presto.Generator.offset_limit_modifiers-601"><a href="#Presto.Generator.offset_limit_modifiers-601"><span class="linenos">601</span></a> <span class="k">return</span> <span class="p">[</span>
+</span><span id="Presto.Generator.offset_limit_modifiers-602"><a href="#Presto.Generator.offset_limit_modifiers-602"><span class="linenos">602</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;offset&quot;</span><span class="p">),</span>
+</span><span id="Presto.Generator.offset_limit_modifiers-603"><a href="#Presto.Generator.offset_limit_modifiers-603"><span class="linenos">603</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">limit</span><span class="p">),</span>
+</span><span id="Presto.Generator.offset_limit_modifiers-604"><a href="#Presto.Generator.offset_limit_modifiers-604"><span class="linenos">604</span></a> <span class="p">]</span>
</span></pre></div>
@@ -2740,16 +2940,16 @@ Default: True</li>
</div>
<a class="headerlink" href="#Presto.Generator.create_sql"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.create_sql-545"><a href="#Presto.Generator.create_sql-545"><span class="linenos">545</span></a> <span class="k">def</span> <span class="nf">create_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Presto.Generator.create_sql-546"><a href="#Presto.Generator.create_sql-546"><span class="linenos">546</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
-</span><span id="Presto.Generator.create_sql-547"><a href="#Presto.Generator.create_sql-547"><span class="linenos">547</span></a><span class="sd"> Presto doesn&#39;t support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span>
-</span><span id="Presto.Generator.create_sql-548"><a href="#Presto.Generator.create_sql-548"><span class="linenos">548</span></a><span class="sd"> so we need to remove them</span>
-</span><span id="Presto.Generator.create_sql-549"><a href="#Presto.Generator.create_sql-549"><span class="linenos">549</span></a><span class="sd"> &quot;&quot;&quot;</span>
-</span><span id="Presto.Generator.create_sql-550"><a href="#Presto.Generator.create_sql-550"><span class="linenos">550</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;kind&quot;</span><span class="p">]</span>
-</span><span id="Presto.Generator.create_sql-551"><a href="#Presto.Generator.create_sql-551"><span class="linenos">551</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span>
-</span><span id="Presto.Generator.create_sql-552"><a href="#Presto.Generator.create_sql-552"><span class="linenos">552</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">&quot;VIEW&quot;</span> <span class="ow">and</span> <span class="n">schema</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
-</span><span id="Presto.Generator.create_sql-553"><a href="#Presto.Generator.create_sql-553"><span class="linenos">553</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">&quot;expressions&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
-</span><span id="Presto.Generator.create_sql-554"><a href="#Presto.Generator.create_sql-554"><span class="linenos">554</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">create_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.create_sql-606"><a href="#Presto.Generator.create_sql-606"><span class="linenos">606</span></a> <span class="k">def</span> <span class="nf">create_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Presto.Generator.create_sql-607"><a href="#Presto.Generator.create_sql-607"><span class="linenos">607</span></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
+</span><span id="Presto.Generator.create_sql-608"><a href="#Presto.Generator.create_sql-608"><span class="linenos">608</span></a><span class="sd"> Presto doesn&#39;t support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span>
+</span><span id="Presto.Generator.create_sql-609"><a href="#Presto.Generator.create_sql-609"><span class="linenos">609</span></a><span class="sd"> so we need to remove them</span>
+</span><span id="Presto.Generator.create_sql-610"><a href="#Presto.Generator.create_sql-610"><span class="linenos">610</span></a><span class="sd"> &quot;&quot;&quot;</span>
+</span><span id="Presto.Generator.create_sql-611"><a href="#Presto.Generator.create_sql-611"><span class="linenos">611</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">&quot;kind&quot;</span><span class="p">]</span>
+</span><span id="Presto.Generator.create_sql-612"><a href="#Presto.Generator.create_sql-612"><span class="linenos">612</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span>
+</span><span id="Presto.Generator.create_sql-613"><a href="#Presto.Generator.create_sql-613"><span class="linenos">613</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">&quot;VIEW&quot;</span> <span class="ow">and</span> <span class="n">schema</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span>
+</span><span id="Presto.Generator.create_sql-614"><a href="#Presto.Generator.create_sql-614"><span class="linenos">614</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">&quot;expressions&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
+</span><span id="Presto.Generator.create_sql-615"><a href="#Presto.Generator.create_sql-615"><span class="linenos">615</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">create_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
</span></pre></div>
@@ -2841,7 +3041,6 @@ so we need to remove them</p>
<dd id="Presto.Generator.TOKEN_MAPPING" class="variable"><a href="../generator.html#Generator.TOKEN_MAPPING">TOKEN_MAPPING</a></dd>
<dd id="Presto.Generator.PARAMETER_TOKEN" class="variable"><a href="../generator.html#Generator.PARAMETER_TOKEN">PARAMETER_TOKEN</a></dd>
<dd id="Presto.Generator.NAMED_PLACEHOLDER_TOKEN" class="variable"><a href="../generator.html#Generator.NAMED_PLACEHOLDER_TOKEN">NAMED_PLACEHOLDER_TOKEN</a></dd>
- <dd id="Presto.Generator.RESERVED_KEYWORDS" class="variable"><a href="../generator.html#Generator.RESERVED_KEYWORDS">RESERVED_KEYWORDS</a></dd>
<dd id="Presto.Generator.WITH_SEPARATED_COMMENTS" class="variable"><a href="../generator.html#Generator.WITH_SEPARATED_COMMENTS">WITH_SEPARATED_COMMENTS</a></dd>
<dd id="Presto.Generator.EXCLUDE_COMMENTS" class="variable"><a href="../generator.html#Generator.EXCLUDE_COMMENTS">EXCLUDE_COMMENTS</a></dd>
<dd id="Presto.Generator.UNWRAPPED_INTERVAL_VALUES" class="variable"><a href="../generator.html#Generator.UNWRAPPED_INTERVAL_VALUES">UNWRAPPED_INTERVAL_VALUES</a></dd>
@@ -2875,6 +3074,7 @@ so we need to remove them</p>
<dd id="Presto.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd>
<dd id="Presto.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd>
<dd id="Presto.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd>
+ <dd id="Presto.Generator.column_parts" class="function"><a href="../generator.html#Generator.column_parts">column_parts</a></dd>
<dd id="Presto.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd>
<dd id="Presto.Generator.columnposition_sql" class="function"><a href="../generator.html#Generator.columnposition_sql">columnposition_sql</a></dd>
<dd id="Presto.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd>
@@ -3124,7 +3324,7 @@ so we need to remove them</p>
<dd id="Presto.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd>
<dd id="Presto.Generator.func" class="function"><a href="../generator.html#Generator.func">func</a></dd>
<dd id="Presto.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd>
- <dd id="Presto.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd>
+ <dd id="Presto.Generator.too_wide" class="function"><a href="../generator.html#Generator.too_wide">too_wide</a></dd>
<dd id="Presto.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd>
<dd id="Presto.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd>
<dd id="Presto.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd>