diff options
Diffstat (limited to 'docs/sqlglot/dialects/presto.html')
-rw-r--r-- | docs/sqlglot/dialects/presto.html | 2005 |
1 files changed, 1005 insertions, 1000 deletions
diff --git a/docs/sqlglot/dialects/presto.html b/docs/sqlglot/dialects/presto.html index e09fe1d..de57f32 100644 --- a/docs/sqlglot/dialects/presto.html +++ b/docs/sqlglot/dialects/presto.html @@ -3,7 +3,7 @@ <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="generator" content="pdoc 14.3.0"/> + <meta name="generator" content="pdoc 14.4.0"/> <title>sqlglot.dialects.presto API documentation</title> <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> @@ -389,372 +389,361 @@ </span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> </span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> </span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> -</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a><span class="k">def</span> <span class="nf">_parse_element_at</span><span class="p">(</span><span class="n">args</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="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">:</span> -</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> -</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="n">index</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</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="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> -</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">index</span><span class="p">],</span> <span class="n">offset</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">safe</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> -</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> -</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> -</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a><span class="k">def</span> <span class="nf">_unnest_sequence</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="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> -</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="k">if</span> <span class="nb">isinstance</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">Table</span><span class="p">):</span> -</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="k">if</span> <span class="nb">isinstance</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">GenerateSeries</span><span class="p">):</span> -</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">unnest</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">])</span> -</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> -</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> -</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">unnest</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="s2">"_u"</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="p">[</span><span class="n">expression</span><span class="o">.</span><span class="n">alias</span><span class="p">],</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> -</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="k">return</span> <span class="n">unnest</span> -</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a><span class="k">def</span> <span class="nf">_unnest_sequence</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="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="k">if</span> <span class="nb">isinstance</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">Table</span><span class="p">):</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="k">if</span> <span class="nb">isinstance</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">GenerateSeries</span><span class="p">):</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">unnest</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">])</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">unnest</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="s2">"_u"</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="p">[</span><span class="n">expression</span><span class="o">.</span><span class="n">alias</span><span class="p">],</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="k">return</span> <span class="n">unnest</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a><span class="k">def</span> <span class="nf">_first_last_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Presto</span><span class="o">.</span><span class="n">Generator</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">First</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Last</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a><span class="sd"> Trino doesn't support FIRST / LAST as functions, but they're valid in the context</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a><span class="sd"> of MATCH_RECOGNIZE, so we need to preserve them in that case. In all other cases</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a><span class="sd"> they're converted into an ARBITRARY call.</span> </span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> -</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> -</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a><span class="k">def</span> <span class="nf">_first_last_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Presto</span><span class="o">.</span><span class="n">Generator</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">First</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Last</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a><span class="w"> </span><span class="sd">"""</span> -</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a><span class="sd"> Trino doesn't support FIRST / LAST as functions, but they're valid in the context</span> -</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a><span class="sd"> of MATCH_RECOGNIZE, so we need to preserve them in that case. In all other cases</span> -</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a><span class="sd"> they're converted into an ARBITRARY call.</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a><span class="sd"> Reference: https://trino.io/docs/current/sql/match-recognize.html#logical-navigation-functions</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a><span class="sd"> """</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">MatchRecognize</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">MatchRecognize</span><span class="p">):</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="k">return</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARBITRARY"</span><span class="p">)(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> </span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> -</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a><span class="sd"> Reference: https://trino.io/docs/current/sql/match-recognize.html#logical-navigation-functions</span> -</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a><span class="sd"> """</span> -</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">MatchRecognize</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">MatchRecognize</span><span class="p">):</span> -</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> -</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> -</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="k">return</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARBITRARY"</span><span class="p">)(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a><span class="k">def</span> <span class="nf">_unix_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Presto</span><span class="o">.</span><span class="n">Generator</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">UnixToTime</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="n">scale</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">"scale"</span><span class="p">)</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="n">timestamp</span> <span class="o">=</span> <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">"this"</span><span class="p">)</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="k">if</span> <span class="n">scale</span> <span class="ow">in</span> <span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">SECONDS</span><span class="p">):</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="k">return</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">)(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> </span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> -</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> -</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a><span class="k">def</span> <span class="nf">_unix_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Presto</span><span class="o">.</span><span class="n">Generator</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">UnixToTime</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="n">scale</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">"scale"</span><span class="p">)</span> -</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="n">timestamp</span> <span class="o">=</span> <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">"this"</span><span class="p">)</span> -</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="k">if</span> <span class="n">scale</span> <span class="ow">in</span> <span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">SECONDS</span><span class="p">):</span> -</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="k">return</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">)(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> -</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="k">if</span> <span class="n">scale</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">MILLIS</span><span class="p">:</span> -</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FROM_UNIXTIME(CAST(</span><span class="si">{</span><span class="n">timestamp</span><span class="si">}</span><span class="s2"> AS DOUBLE) / 1000)"</span> -</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="k">if</span> <span class="n">scale</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">MICROS</span><span class="p">:</span> -</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FROM_UNIXTIME(CAST(</span><span class="si">{</span><span class="n">timestamp</span><span class="si">}</span><span class="s2"> AS DOUBLE) / 1000000)"</span> -</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="k">if</span> <span class="n">scale</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">NANOS</span><span class="p">:</span> -</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FROM_UNIXTIME(CAST(</span><span class="si">{</span><span class="n">timestamp</span><span class="si">}</span><span class="s2"> AS DOUBLE) / 1000000000)"</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FROM_UNIXTIME(CAST(</span><span class="si">{</span><span class="n">timestamp</span><span class="si">}</span><span class="s2"> AS DOUBLE) / POW(10, </span><span class="si">{</span><span class="n">scale</span><span class="si">}</span><span class="s2">))"</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a><span class="k">def</span> <span class="nf">_to_int</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="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="p">:</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</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-179"><a href="#L-179"><span class="linenos">179</span></a> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="n">annotate_types</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">INTEGER_TYPES</span><span class="p">:</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="k">return</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="p">,</span> <span class="n">to</span><span class="o">=</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">BIGINT</span><span class="p">)</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> </span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> -</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported scale for timestamp: </span><span class="si">{</span><span class="n">scale</span><span class="si">}</span><span class="s2">."</span><span class="p">)</span> -</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="k">return</span> <span class="s2">""</span> -</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> -</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> -</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a><span class="k">def</span> <span class="nf">_to_int</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="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> -</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="p">:</span> -</span><span id="L-192"><a href="#L-192"><span class="linenos">192</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-193"><a href="#L-193"><span class="linenos">193</span></a> -</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="n">annotate_types</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> -</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">INTEGER_TYPES</span><span class="p">:</span> -</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="k">return</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="p">,</span> <span class="n">to</span><span class="o">=</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">BIGINT</span><span class="p">)</span> -</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="k">return</span> <span class="n">expression</span> -</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> -</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> -</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a><span class="k">def</span> <span class="nf">_parse_to_char</span><span class="p">(</span><span class="n">args</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="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> -</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="n">fmt</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> -</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">fmt</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">):</span> -</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="c1"># We uppercase this to match Teradata's format mapping keys</span> -</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">fmt</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">fmt</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> -</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> -</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="c1"># We use "teradata" on purpose here, because the time formats are different in Presto.</span> -</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="c1"># See https://prestodb.io/docs/current/functions/teradata.html?highlight=to_char#to_char</span> -</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="k">return</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"teradata"</span><span class="p">)(</span><span class="n">args</span><span class="p">)</span> -</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> -</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> -</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a><span class="k">class</span> <span class="nc">Presto</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> -</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="n">INDEX_OFFSET</span> <span class="o">=</span> <span class="mi">1</span> -</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="n">NULL_ORDERING</span> <span class="o">=</span> <span class="s2">"nulls_are_last"</span> -</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="n">TIME_FORMAT</span> <span class="o">=</span> <span class="n">MySQL</span><span class="o">.</span><span class="n">TIME_FORMAT</span> -</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="n">TIME_MAPPING</span> <span class="o">=</span> <span class="n">MySQL</span><span class="o">.</span><span class="n">TIME_MAPPING</span> -</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="n">STRICT_STRING_CONCAT</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="n">SUPPORTS_SEMI_ANTI_JOIN</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="n">TYPED_DIVISION</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="n">TABLESAMPLE_SIZE_IS_PERCENT</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> -</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="c1"># https://github.com/trinodb/trino/issues/17</span> -</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="c1"># https://github.com/trinodb/trino/issues/12289</span> -</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="c1"># https://github.com/prestodb/presto/issues/2863</span> -</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="n">NORMALIZATION_STRATEGY</span> <span class="o">=</span> <span class="n">NormalizationStrategy</span><span class="o">.</span><span class="n">CASE_INSENSITIVE</span> -</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> -</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> -</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="n">UNICODE_STRINGS</span> <span class="o">=</span> <span class="p">[</span> -</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="p">(</span><span class="n">prefix</span> <span class="o">+</span> <span class="n">q</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span> -</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="k">for</span> <span class="n">q</span> <span class="ow">in</span> <span class="n">t</span><span class="o">.</span><span class="n">cast</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="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">QUOTES</span><span class="p">)</span> -</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="k">for</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"U&"</span><span class="p">,</span> <span class="s2">"u&"</span><span class="p">)</span> -</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="p">]</span> -</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> -</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> -</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> -</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="s2">"MATCH_RECOGNIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">,</span> -</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> -</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="s2">"IPADDRESS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IPADDRESS</span><span class="p">,</span> -</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="s2">"IPPREFIX"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IPPREFIX</span><span class="p">,</span> -</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="p">}</span> -</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> -</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> -</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> -</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="s2">"ARBITRARY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="s2">"APPROX_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="s2">"APPROX_PERCENTILE"</span><span class="p">:</span> <span class="n">_approx_percentile</span><span class="p">,</span> -</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="s2">"BITWISE_AND"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">),</span> -</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="s2">"BITWISE_NOT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> -</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="s2">"BITWISE_OR"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">),</span> -</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="s2">"BITWISE_XOR"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">),</span> -</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="s2">"CARDINALITY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="s2">"CONTAINS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">(</span> -</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a><span class="k">def</span> <span class="nf">_parse_to_char</span><span class="p">(</span><span class="n">args</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="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="n">fmt</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">fmt</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">):</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="c1"># We uppercase this to match Teradata's format mapping keys</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="n">fmt</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">fmt</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="c1"># We use "teradata" on purpose here, because the time formats are different in Presto.</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="c1"># See https://prestodb.io/docs/current/functions/teradata.html?highlight=to_char#to_char</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="k">return</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"teradata"</span><span class="p">)(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a><span class="k">class</span> <span class="nc">Presto</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="n">INDEX_OFFSET</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="n">NULL_ORDERING</span> <span class="o">=</span> <span class="s2">"nulls_are_last"</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="n">TIME_FORMAT</span> <span class="o">=</span> <span class="n">MySQL</span><span class="o">.</span><span class="n">TIME_FORMAT</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="n">TIME_MAPPING</span> <span class="o">=</span> <span class="n">MySQL</span><span class="o">.</span><span class="n">TIME_MAPPING</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="n">STRICT_STRING_CONCAT</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="n">SUPPORTS_SEMI_ANTI_JOIN</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">TYPED_DIVISION</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="n">TABLESAMPLE_SIZE_IS_PERCENT</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="c1"># https://github.com/trinodb/trino/issues/17</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="c1"># https://github.com/trinodb/trino/issues/12289</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="c1"># https://github.com/prestodb/presto/issues/2863</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="n">NORMALIZATION_STRATEGY</span> <span class="o">=</span> <span class="n">NormalizationStrategy</span><span class="o">.</span><span class="n">CASE_INSENSITIVE</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="n">UNICODE_STRINGS</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="p">(</span><span class="n">prefix</span> <span class="o">+</span> <span class="n">q</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="k">for</span> <span class="n">q</span> <span class="ow">in</span> <span class="n">t</span><span class="o">.</span><span class="n">cast</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="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">QUOTES</span><span class="p">)</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="k">for</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"U&"</span><span class="p">,</span> <span class="s2">"u&"</span><span class="p">)</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="p">]</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="s2">"MATCH_RECOGNIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">,</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="s2">"IPADDRESS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IPADDRESS</span><span class="p">,</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="s2">"IPPREFIX"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IPPREFIX</span><span class="p">,</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="p">}</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="s2">"ARBITRARY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="s2">"APPROX_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="s2">"APPROX_PERCENTILE"</span><span class="p">:</span> <span class="n">_approx_percentile</span><span class="p">,</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="s2">"BITWISE_AND"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">),</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="s2">"BITWISE_NOT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="s2">"BITWISE_OR"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">),</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="s2">"BITWISE_XOR"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">),</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="s2">"CARDINALITY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="s2">"CONTAINS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">(</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="p">),</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">(</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="p">),</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="s2">"DATE_FORMAT"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="s2">"DATE_PARSE"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="s2">"DATE_TRUNC"</span><span class="p">:</span> <span class="n">date_trunc_to_time</span><span class="p">,</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">(</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)],</span> <span class="n">offset</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">safe</span><span class="o">=</span><span class="kc">True</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="p">),</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="s2">"FROM_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="s2">"FROM_UNIXTIME"</span><span class="p">:</span> <span class="n">_from_unixtime</span><span class="p">,</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="s2">"FROM_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">(</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">replace</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> </span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="p">),</span> -</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">(</span> -</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> -</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="p">),</span> -</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="s2">"DATE_FORMAT"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> -</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="s2">"DATE_PARSE"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> -</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="s2">"DATE_TRUNC"</span><span class="p">:</span> <span class="n">date_trunc_to_time</span><span class="p">,</span> -</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">:</span> <span class="n">_parse_element_at</span><span class="p">,</span> -</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="s2">"FROM_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="s2">"FROM_UNIXTIME"</span><span class="p">:</span> <span class="n">_from_unixtime</span><span class="p">,</span> -</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="s2">"FROM_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">(</span> -</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">replace</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> -</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="p">),</span> -</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="s2">"NOW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="s2">"REGEXP_EXTRACT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpExtract</span><span class="p">(</span> -</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">group</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="s2">"NOW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="s2">"REGEXP_EXTRACT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpExtract</span><span class="p">(</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">group</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="p">),</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="s2">"REGEXP_REPLACE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpReplace</span><span class="p">(</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="n">replacement</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">""</span><span class="p">),</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="p">),</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="s2">"SEQUENCE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="s2">"SET_AGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayUniqueAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="s2">"SPLIT_TO_MAP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToMap</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="s2">"STRPOS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">instance</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> </span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="p">),</span> -</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="s2">"REGEXP_REPLACE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpReplace</span><span class="p">(</span> -</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> -</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> -</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="n">replacement</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">""</span><span class="p">),</span> -</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="p">),</span> -</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="s2">"SEQUENCE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="s2">"SET_AGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayUniqueAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="s2">"SPLIT_TO_MAP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToMap</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="s2">"STRPOS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> -</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">instance</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> -</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="p">),</span> -</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="s2">"TO_CHAR"</span><span class="p">:</span> <span class="n">_parse_to_char</span><span class="p">,</span> -</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="s2">"TO_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="s2">"TO_UNIXTIME"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="s2">"TO_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">(</span> -</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> -</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="p">),</span> -</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="p">}</span> -</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> -</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> -</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="s2">"TO_CHAR"</span><span class="p">:</span> <span class="n">_parse_to_char</span><span class="p">,</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="s2">"TO_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="s2">"TO_UNIXTIME"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="s2">"TO_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">(</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="p">),</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="p">}</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="n">INTERVAL_ALLOWS_PLURAL_FORM</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="n">QUERY_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="n">IS_BOOL_ALLOWED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="n">TZ_TO_WITH_TIME_ZONE</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="n">NVL2_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="n">LIMIT_ONLY_LITERALS</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="n">SUPPORTS_SINGLE_ARG_CONCAT</span> <span class="o">=</span> <span class="kc">False</span> </span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> -</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> -</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="n">INTERVAL_ALLOWS_PLURAL_FORM</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="n">QUERY_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="n">IS_BOOL_ALLOWED</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="n">TZ_TO_WITH_TIME_ZONE</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="n">NVL2_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> -</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="n">LIMIT_ONLY_LITERALS</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="n">SUPPORTS_SINGLE_ARG_CONCAT</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> -</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> -</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> -</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatileProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> -</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <span class="p">}</span> -</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> -</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> -</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <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">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> -</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <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">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> -</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <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">BINARY</span><span class="p">:</span> <span class="s2">"VARBINARY"</span><span class="p">,</span> -</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <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 class="s2">"VARCHAR"</span><span class="p">,</span> -</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <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">TIMETZ</span><span class="p">:</span> <span class="s2">"TIME"</span><span class="p">,</span> -</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <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">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> -</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <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">STRUCT</span><span class="p">:</span> <span class="s2">"ROW"</span><span class="p">,</span> -</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <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">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> -</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <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">DATETIME64</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> -</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="p">}</span> -</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> -</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> -</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARBITRARY"</span><span class="p">),</span> -</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">_approx_distinct_sql</span><span class="p">,</span> -</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"APPROX_PERCENTILE"</span><span class="p">),</span> -</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArgMax</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MAX_BY"</span><span class="p">),</span> -</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArgMin</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MIN_BY"</span><span class="p">),</span> -</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"ARRAY[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> -</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONCAT"</span><span class="p">),</span> -</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONTAINS"</span><span class="p">),</span> -</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CARDINALITY"</span><span class="p">),</span> -</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayUniqueAgg</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SET_AGG"</span><span class="p">),</span> -</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_AND(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_LEFT(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_NOT(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_OR(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_RIGHT(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_XOR(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">epoch_cast_to_ts</span><span class="p">]),</span> -</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> -</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> -</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> <span class="s2">"DATE_ADD"</span><span class="p">,</span> -</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> -</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a> <span class="n">_to_int</span><span class="p">(</span> -</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a> <span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> -</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> <span class="p">),</span> -</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> -</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> <span class="p">),</span> -</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> -</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> <span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span> -</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> <span class="p">),</span> -</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> -</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_FORMAT(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">DATEINT_FORMAT</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> -</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> -</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> <span class="s2">"DATE_ADD"</span><span class="p">,</span> -</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> -</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a> <span class="n">_to_int</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expression</span> <span class="o">*</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span> -</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> -</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> <span class="p">),</span> -</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">encode_decode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"FROM_UTF8"</span><span class="p">),</span> -</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_PARSE(CAST(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">DATEINT_FORMAT</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> -</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">encode_decode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"TO_UTF8"</span><span class="p">),</span> -</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FORMAT='</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">'"</span><span class="p">,</span> -</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">First</span><span class="p">:</span> <span class="n">_first_last_sql</span><span class="p">,</span> -</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GetPath</span><span class="p">:</span> <span class="n">path_to_jsonpath</span><span class="p">(),</span> -</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">unalias_group</span><span class="p">]),</span> -</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> -</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a> <span class="s2">"ARRAY_JOIN"</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">"ARRAY_AGG"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> <span class="n">e</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">"separator"</span><span class="p">)</span> -</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a> <span class="p">),</span> -</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_HEX"</span><span class="p">),</span> -</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">(),</span> -</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> -</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Initcap</span><span class="p">:</span> <span class="n">_initcap_sql</span><span class="p">,</span> -</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ParseJSON</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"JSON_PARSE"</span><span class="p">),</span> -</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Last</span><span class="p">:</span> <span class="n">_first_last_sql</span><span class="p">,</span> -</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LastDay</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</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">"LAST_DAY_OF_MONTH"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> -</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">:</span> <span class="n">_explode_to_unnest_sql</span><span class="p">,</span> -</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Left</span><span class="p">:</span> <span class="n">left_to_substring_sql</span><span class="p">,</span> -</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LEVENSHTEIN_DISTANCE"</span><span class="p">),</span> -</span><span id="L-386"><a href="#L-386"><span class="linenos">386</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalAnd</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_AND"</span><span class="p">),</span> -</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> -</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">:</span> <span class="n">no_pivot_sql</span><span class="p">,</span> -</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="n">_quantile_sql</span><span class="p">,</span> -</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpExtract</span><span class="p">:</span> <span class="n">regexp_extract_sql</span><span class="p">,</span> -</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Right</span><span class="p">:</span> <span class="n">right_to_substring_sql</span><span class="p">,</span> -</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> -</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">:</span> <span class="n">_schema_sql</span><span class="p">,</span> -</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SchemaCommentProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> -</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> -</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> <span class="p">[</span> -</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_qualify</span><span class="p">,</span> -</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">,</span> -</span><span id="L-399"><a href="#L-399"><span class="linenos">399</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">explode_to_unnest</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> -</span><span id="L-400"><a href="#L-400"><span class="linenos">400</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_semi_and_anti_joins</span><span class="p">,</span> -</span><span id="L-401"><a href="#L-401"><span class="linenos">401</span></a> <span class="p">]</span> -</span><span id="L-402"><a href="#L-402"><span class="linenos">402</span></a> <span class="p">),</span> -</span><span id="L-403"><a href="#L-403"><span class="linenos">403</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="p">:</span> <span class="n">_no_sort_array</span><span class="p">,</span> -</span><span id="L-404"><a href="#L-404"><span class="linenos">404</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRPOS"</span><span class="p">),</span> -</span><span id="L-405"><a href="#L-405"><span class="linenos">405</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> -</span><span id="L-406"><a href="#L-406"><span class="linenos">406</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToMap</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SPLIT_TO_MAP"</span><span class="p">),</span> -</span><span id="L-407"><a href="#L-407"><span class="linenos">407</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time_sql</span><span class="p">,</span> -</span><span id="L-408"><a href="#L-408"><span class="linenos">408</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> -</span><span id="L-409"><a href="#L-409"><span class="linenos">409</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">:</span> <span class="n">struct_extract_sql</span><span class="p">,</span> -</span><span id="L-410"><a href="#L-410"><span class="linenos">410</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">_unnest_sequence</span><span class="p">]),</span> -</span><span id="L-411"><a href="#L-411"><span class="linenos">411</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Timestamp</span><span class="p">:</span> <span class="n">no_timestamp_sql</span><span class="p">,</span> -</span><span id="L-412"><a href="#L-412"><span class="linenos">412</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampTrunc</span><span class="p">:</span> <span class="n">timestamptrunc_sql</span><span class="p">,</span> -</span><span id="L-413"><a href="#L-413"><span class="linenos">413</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> -</span><span id="L-414"><a href="#L-414"><span class="linenos">414</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> -</span><span id="L-415"><a href="#L-415"><span class="linenos">415</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">TIME_FORMAT</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> -</span><span id="L-416"><a href="#L-416"><span class="linenos">416</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="L-417"><a href="#L-417"><span class="linenos">417</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_UNIXTIME"</span><span class="p">),</span> -</span><span id="L-418"><a href="#L-418"><span class="linenos">418</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ToChar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="L-419"><a href="#L-419"><span class="linenos">419</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">epoch_cast_to_ts</span><span class="p">]),</span> -</span><span id="L-420"><a href="#L-420"><span class="linenos">420</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> -</span><span id="L-421"><a href="#L-421"><span class="linenos">421</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">_ts_or_ds_add_sql</span><span class="p">,</span> -</span><span id="L-422"><a href="#L-422"><span class="linenos">422</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">:</span> <span class="n">_ts_or_ds_diff_sql</span><span class="p">,</span> -</span><span id="L-423"><a href="#L-423"><span class="linenos">423</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> -</span><span id="L-424"><a href="#L-424"><span class="linenos">424</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_HEX"</span><span class="p">),</span> -</span><span id="L-425"><a href="#L-425"><span class="linenos">425</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(FROM_UNIXTIME(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="L-426"><a href="#L-426"><span class="linenos">426</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">_unix_to_time_sql</span><span class="p">,</span> -</span><span id="L-427"><a href="#L-427"><span class="linenos">427</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(FROM_UNIXTIME(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS VARCHAR)"</span><span class="p">,</span> -</span><span id="L-428"><a href="#L-428"><span class="linenos">428</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> -</span><span id="L-429"><a href="#L-429"><span class="linenos">429</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">add_recursive_cte_column_names</span><span class="p">]),</span> -</span><span id="L-430"><a href="#L-430"><span class="linenos">430</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WithinGroup</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> -</span><span id="L-431"><a href="#L-431"><span class="linenos">431</span></a> <span class="p">[</span><span class="n">transforms</span><span class="o">.</span><span class="n">remove_within_group_for_percentiles</span><span class="p">]</span> -</span><span id="L-432"><a href="#L-432"><span class="linenos">432</span></a> <span class="p">),</span> -</span><span id="L-433"><a href="#L-433"><span class="linenos">433</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-434"><a href="#L-434"><span class="linenos">434</span></a> <span class="p">}</span> -</span><span id="L-435"><a href="#L-435"><span class="linenos">435</span></a> -</span><span id="L-436"><a href="#L-436"><span class="linenos">436</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-437"><a href="#L-437"><span class="linenos">437</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">"safe"</span><span class="p">):</span> -</span><span id="L-438"><a href="#L-438"><span class="linenos">438</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-439"><a href="#L-439"><span class="linenos">439</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">,</span> -</span><span id="L-440"><a href="#L-440"><span class="linenos">440</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> -</span><span id="L-441"><a href="#L-441"><span class="linenos">441</span></a> <span class="n">seq_get</span><span class="p">(</span> -</span><span id="L-442"><a href="#L-442"><span class="linenos">442</span></a> <span class="n">apply_index_offset</span><span class="p">(</span> -</span><span id="L-443"><a href="#L-443"><span class="linenos">443</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> -</span><span id="L-444"><a href="#L-444"><span class="linenos">444</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> -</span><span id="L-445"><a href="#L-445"><span class="linenos">445</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">"offset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> -</span><span id="L-446"><a href="#L-446"><span class="linenos">446</span></a> <span class="p">),</span> -</span><span id="L-447"><a href="#L-447"><span class="linenos">447</span></a> <span class="mi">0</span><span class="p">,</span> -</span><span id="L-448"><a href="#L-448"><span class="linenos">448</span></a> <span class="p">),</span> -</span><span id="L-449"><a href="#L-449"><span class="linenos">449</span></a> <span class="p">)</span> -</span><span id="L-450"><a href="#L-450"><span class="linenos">450</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-451"><a href="#L-451"><span class="linenos">451</span></a> -</span><span id="L-452"><a href="#L-452"><span class="linenos">452</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-453"><a href="#L-453"><span class="linenos">453</span></a> <span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEY_VALUE_DEFINITIONS</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</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-454"><a href="#L-454"><span class="linenos">454</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Struct with key-value definitions is unsupported."</span><span class="p">)</span> -</span><span id="L-455"><a href="#L-455"><span class="linenos">455</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> -</span><span id="L-456"><a href="#L-456"><span class="linenos">456</span></a> -</span><span id="L-457"><a href="#L-457"><span class="linenos">457</span></a> <span class="k">return</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ROW"</span><span class="p">)(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatileProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="p">}</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <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">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <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">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <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">BINARY</span><span class="p">:</span> <span class="s2">"VARBINARY"</span><span class="p">,</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> <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 class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <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">TIMETZ</span><span class="p">:</span> <span class="s2">"TIME"</span><span class="p">,</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <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">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <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">STRUCT</span><span class="p">:</span> <span class="s2">"ROW"</span><span class="p">,</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <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">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <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">DATETIME64</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="p">}</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARBITRARY"</span><span class="p">),</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">_approx_distinct_sql</span><span class="p">,</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"APPROX_PERCENTILE"</span><span class="p">),</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArgMax</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MAX_BY"</span><span class="p">),</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArgMin</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MIN_BY"</span><span class="p">),</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"ARRAY[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONCAT"</span><span class="p">),</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONTAINS"</span><span class="p">),</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CARDINALITY"</span><span class="p">),</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayUniqueAgg</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SET_AGG"</span><span class="p">),</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_AND(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_LEFT(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_NOT(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_OR(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_RIGHT(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_XOR(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">epoch_cast_to_ts</span><span class="p">]),</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a> <span class="s2">"DATE_ADD"</span><span class="p">,</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="n">_to_int</span><span class="p">(</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="p">),</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="p">),</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> <span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="p">),</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_FORMAT(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">DATEINT_FORMAT</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a> <span class="s2">"DATE_ADD"</span><span class="p">,</span> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a> <span class="n">_to_int</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expression</span> <span class="o">*</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a> <span class="p">),</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">encode_decode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"FROM_UTF8"</span><span class="p">),</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_PARSE(CAST(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">DATEINT_FORMAT</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">encode_decode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"TO_UTF8"</span><span class="p">),</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FORMAT='</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">'"</span><span class="p">,</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">First</span><span class="p">:</span> <span class="n">_first_last_sql</span><span class="p">,</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FromTimeZone</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"WITH_TIMEZONE(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'zone'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AT TIME ZONE 'UTC'"</span><span class="p">,</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GetPath</span><span class="p">:</span> <span class="n">path_to_jsonpath</span><span class="p">(),</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">unalias_group</span><span class="p">]),</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a> <span class="s2">"ARRAY_JOIN"</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">"ARRAY_AGG"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> <span class="n">e</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">"separator"</span><span class="p">)</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> <span class="p">),</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_HEX"</span><span class="p">),</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">(),</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Initcap</span><span class="p">:</span> <span class="n">_initcap_sql</span><span class="p">,</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ParseJSON</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"JSON_PARSE"</span><span class="p">),</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Last</span><span class="p">:</span> <span class="n">_first_last_sql</span><span class="p">,</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LastDay</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</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">"LAST_DAY_OF_MONTH"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">:</span> <span class="n">_explode_to_unnest_sql</span><span class="p">,</span> +</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Left</span><span class="p">:</span> <span class="n">left_to_substring_sql</span><span class="p">,</span> +</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LEVENSHTEIN_DISTANCE"</span><span class="p">),</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalAnd</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_AND"</span><span class="p">),</span> +</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">:</span> <span class="n">no_pivot_sql</span><span class="p">,</span> +</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="n">_quantile_sql</span><span class="p">,</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpExtract</span><span class="p">:</span> <span class="n">regexp_extract_sql</span><span class="p">,</span> +</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Right</span><span class="p">:</span> <span class="n">right_to_substring_sql</span><span class="p">,</span> +</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">:</span> <span class="n">_schema_sql</span><span class="p">,</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SchemaCommentProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a> <span class="p">[</span> +</span><span id="L-386"><a href="#L-386"><span class="linenos">386</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_qualify</span><span class="p">,</span> +</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">,</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">explode_to_unnest</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_semi_and_anti_joins</span><span class="p">,</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a> <span class="p">]</span> +</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a> <span class="p">),</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="p">:</span> <span class="n">_no_sort_array</span><span class="p">,</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRPOS"</span><span class="p">),</span> +</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToMap</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SPLIT_TO_MAP"</span><span class="p">),</span> +</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time_sql</span><span class="p">,</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">:</span> <span class="n">struct_extract_sql</span><span class="p">,</span> +</span><span id="L-399"><a href="#L-399"><span class="linenos">399</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">_unnest_sequence</span><span class="p">]),</span> +</span><span id="L-400"><a href="#L-400"><span class="linenos">400</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Timestamp</span><span class="p">:</span> <span class="n">no_timestamp_sql</span><span class="p">,</span> +</span><span id="L-401"><a href="#L-401"><span class="linenos">401</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampTrunc</span><span class="p">:</span> <span class="n">timestamptrunc_sql</span><span class="p">,</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos">402</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-403"><a href="#L-403"><span class="linenos">403</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-404"><a href="#L-404"><span class="linenos">404</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">TIME_FORMAT</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos">405</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-406"><a href="#L-406"><span class="linenos">406</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_UNIXTIME"</span><span class="p">),</span> +</span><span id="L-407"><a href="#L-407"><span class="linenos">407</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ToChar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-408"><a href="#L-408"><span class="linenos">408</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">epoch_cast_to_ts</span><span class="p">]),</span> +</span><span id="L-409"><a href="#L-409"><span class="linenos">409</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="L-410"><a href="#L-410"><span class="linenos">410</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">_ts_or_ds_add_sql</span><span class="p">,</span> +</span><span id="L-411"><a href="#L-411"><span class="linenos">411</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">:</span> <span class="n">_ts_or_ds_diff_sql</span><span class="p">,</span> +</span><span id="L-412"><a href="#L-412"><span class="linenos">412</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> +</span><span id="L-413"><a href="#L-413"><span class="linenos">413</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_HEX"</span><span class="p">),</span> +</span><span id="L-414"><a href="#L-414"><span class="linenos">414</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(FROM_UNIXTIME(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-415"><a href="#L-415"><span class="linenos">415</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">_unix_to_time_sql</span><span class="p">,</span> +</span><span id="L-416"><a href="#L-416"><span class="linenos">416</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(FROM_UNIXTIME(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS VARCHAR)"</span><span class="p">,</span> +</span><span id="L-417"><a href="#L-417"><span class="linenos">417</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> +</span><span id="L-418"><a href="#L-418"><span class="linenos">418</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">add_recursive_cte_column_names</span><span class="p">]),</span> +</span><span id="L-419"><a href="#L-419"><span class="linenos">419</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WithinGroup</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> +</span><span id="L-420"><a href="#L-420"><span class="linenos">420</span></a> <span class="p">[</span><span class="n">transforms</span><span class="o">.</span><span class="n">remove_within_group_for_percentiles</span><span class="p">]</span> +</span><span id="L-421"><a href="#L-421"><span class="linenos">421</span></a> <span class="p">),</span> +</span><span id="L-422"><a href="#L-422"><span class="linenos">422</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-423"><a href="#L-423"><span class="linenos">423</span></a> <span class="p">}</span> +</span><span id="L-424"><a href="#L-424"><span class="linenos">424</span></a> +</span><span id="L-425"><a href="#L-425"><span class="linenos">425</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-426"><a href="#L-426"><span class="linenos">426</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">"safe"</span><span class="p">):</span> +</span><span id="L-427"><a href="#L-427"><span class="linenos">427</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-428"><a href="#L-428"><span class="linenos">428</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">,</span> +</span><span id="L-429"><a href="#L-429"><span class="linenos">429</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-430"><a href="#L-430"><span class="linenos">430</span></a> <span class="n">seq_get</span><span class="p">(</span> +</span><span id="L-431"><a href="#L-431"><span class="linenos">431</span></a> <span class="n">apply_index_offset</span><span class="p">(</span> +</span><span id="L-432"><a href="#L-432"><span class="linenos">432</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-433"><a href="#L-433"><span class="linenos">433</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-434"><a href="#L-434"><span class="linenos">434</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">"offset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-435"><a href="#L-435"><span class="linenos">435</span></a> <span class="p">),</span> +</span><span id="L-436"><a href="#L-436"><span class="linenos">436</span></a> <span class="mi">0</span><span class="p">,</span> +</span><span id="L-437"><a href="#L-437"><span class="linenos">437</span></a> <span class="p">),</span> +</span><span id="L-438"><a href="#L-438"><span class="linenos">438</span></a> <span class="p">)</span> +</span><span id="L-439"><a href="#L-439"><span class="linenos">439</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-440"><a href="#L-440"><span class="linenos">440</span></a> +</span><span id="L-441"><a href="#L-441"><span class="linenos">441</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-442"><a href="#L-442"><span class="linenos">442</span></a> <span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEY_VALUE_DEFINITIONS</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</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-443"><a href="#L-443"><span class="linenos">443</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Struct with key-value definitions is unsupported."</span><span class="p">)</span> +</span><span id="L-444"><a href="#L-444"><span class="linenos">444</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><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">return</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ROW"</span><span class="p">)(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-447"><a href="#L-447"><span class="linenos">447</span></a> +</span><span id="L-448"><a href="#L-448"><span class="linenos">448</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-449"><a href="#L-449"><span class="linenos">449</span></a> <span class="n">unit</span> <span class="o">=</span> <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">"unit"</span><span class="p">)</span> +</span><span id="L-450"><a href="#L-450"><span class="linenos">450</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">unit</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"WEEK"</span><span class="p">):</span> +</span><span id="L-451"><a href="#L-451"><span class="linenos">451</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</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 '7' DAY)"</span> +</span><span id="L-452"><a href="#L-452"><span class="linenos">452</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-453"><a href="#L-453"><span class="linenos">453</span></a> +</span><span id="L-454"><a href="#L-454"><span class="linenos">454</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-455"><a href="#L-455"><span class="linenos">455</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">"modes"</span><span class="p">)</span> +</span><span id="L-456"><a href="#L-456"><span class="linenos">456</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="s1">', '</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">"</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-457"><a href="#L-457"><span class="linenos">457</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">"</span> </span><span id="L-458"><a href="#L-458"><span class="linenos">458</span></a> -</span><span id="L-459"><a href="#L-459"><span class="linenos">459</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-460"><a href="#L-460"><span class="linenos">460</span></a> <span class="n">unit</span> <span class="o">=</span> <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">"unit"</span><span class="p">)</span> -</span><span id="L-461"><a href="#L-461"><span class="linenos">461</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">unit</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"WEEK"</span><span class="p">):</span> -</span><span id="L-462"><a href="#L-462"><span class="linenos">462</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</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 '7' DAY)"</span> -</span><span id="L-463"><a href="#L-463"><span class="linenos">463</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-464"><a href="#L-464"><span class="linenos">464</span></a> -</span><span id="L-465"><a href="#L-465"><span class="linenos">465</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-466"><a href="#L-466"><span class="linenos">466</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">"modes"</span><span class="p">)</span> -</span><span id="L-467"><a href="#L-467"><span class="linenos">467</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="s1">', '</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">"</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">""</span> -</span><span id="L-468"><a href="#L-468"><span class="linenos">468</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">"</span> -</span><span id="L-469"><a href="#L-469"><span class="linenos">469</span></a> -</span><span id="L-470"><a href="#L-470"><span class="linenos">470</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-471"><a href="#L-471"><span class="linenos">471</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">"start"</span><span class="p">]</span> -</span><span id="L-472"><a href="#L-472"><span class="linenos">472</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">"end"</span><span class="p">]</span> -</span><span id="L-473"><a href="#L-473"><span class="linenos">473</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">"step"</span><span class="p">)</span> -</span><span id="L-474"><a href="#L-474"><span class="linenos">474</span></a> -</span><span id="L-475"><a href="#L-475"><span class="linenos">475</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-476"><a href="#L-476"><span class="linenos">476</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-477"><a href="#L-477"><span class="linenos">477</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-478"><a href="#L-478"><span class="linenos">478</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-479"><a href="#L-479"><span class="linenos">479</span></a> <span class="k">else</span><span class="p">:</span> -</span><span id="L-480"><a href="#L-480"><span class="linenos">480</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="L-481"><a href="#L-481"><span class="linenos">481</span></a> -</span><span id="L-482"><a href="#L-482"><span class="linenos">482</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">"timestamp"</span><span class="p">):</span> -</span><span id="L-483"><a href="#L-483"><span class="linenos">483</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-484"><a href="#L-484"><span class="linenos">484</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-485"><a href="#L-485"><span class="linenos">485</span></a> <span class="k">else</span><span class="p">:</span> -</span><span id="L-486"><a href="#L-486"><span class="linenos">486</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-487"><a href="#L-487"><span class="linenos">487</span></a> -</span><span id="L-488"><a href="#L-488"><span class="linenos">488</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">"SEQUENCE"</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-489"><a href="#L-489"><span class="linenos">489</span></a> -</span><span id="L-490"><a href="#L-490"><span class="linenos">490</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span> -</span><span id="L-491"><a href="#L-491"><span class="linenos">491</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-492"><a href="#L-492"><span class="linenos">492</span></a> <span class="p">)</span> <span class="o">-></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-493"><a href="#L-493"><span class="linenos">493</span></a> <span class="k">return</span> <span class="p">[</span> -</span><span id="L-494"><a href="#L-494"><span class="linenos">494</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">"offset"</span><span class="p">),</span> -</span><span id="L-495"><a href="#L-495"><span class="linenos">495</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-496"><a href="#L-496"><span class="linenos">496</span></a> <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">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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-499"><a href="#L-499"><span class="linenos">499</span></a><span class="w"> </span><span class="sd">"""</span> -</span><span id="L-500"><a href="#L-500"><span class="linenos">500</span></a><span class="sd"> Presto doesn't support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span> -</span><span id="L-501"><a href="#L-501"><span class="linenos">501</span></a><span class="sd"> so we need to remove them</span> -</span><span id="L-502"><a href="#L-502"><span class="linenos">502</span></a><span class="sd"> """</span> -</span><span id="L-503"><a href="#L-503"><span class="linenos">503</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">"kind"</span><span class="p">]</span> -</span><span id="L-504"><a href="#L-504"><span class="linenos">504</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-505"><a href="#L-505"><span class="linenos">505</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"VIEW"</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-506"><a href="#L-506"><span class="linenos">506</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">"expressions"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> -</span><span id="L-507"><a href="#L-507"><span class="linenos">507</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-459"><a href="#L-459"><span class="linenos">459</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-460"><a href="#L-460"><span class="linenos">460</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">"start"</span><span class="p">]</span> +</span><span id="L-461"><a href="#L-461"><span class="linenos">461</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">"end"</span><span class="p">]</span> +</span><span id="L-462"><a href="#L-462"><span class="linenos">462</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">"step"</span><span class="p">)</span> +</span><span id="L-463"><a href="#L-463"><span class="linenos">463</span></a> +</span><span id="L-464"><a href="#L-464"><span class="linenos">464</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-465"><a href="#L-465"><span class="linenos">465</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-466"><a href="#L-466"><span class="linenos">466</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-467"><a href="#L-467"><span class="linenos">467</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-468"><a href="#L-468"><span class="linenos">468</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-469"><a href="#L-469"><span class="linenos">469</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-470"><a href="#L-470"><span class="linenos">470</span></a> +</span><span id="L-471"><a href="#L-471"><span class="linenos">471</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">"timestamp"</span><span class="p">):</span> +</span><span id="L-472"><a href="#L-472"><span class="linenos">472</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-473"><a href="#L-473"><span class="linenos">473</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-474"><a href="#L-474"><span class="linenos">474</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-475"><a href="#L-475"><span class="linenos">475</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-476"><a href="#L-476"><span class="linenos">476</span></a> +</span><span id="L-477"><a href="#L-477"><span class="linenos">477</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">"SEQUENCE"</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-478"><a href="#L-478"><span class="linenos">478</span></a> +</span><span id="L-479"><a href="#L-479"><span class="linenos">479</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span> +</span><span id="L-480"><a href="#L-480"><span class="linenos">480</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-481"><a href="#L-481"><span class="linenos">481</span></a> <span class="p">)</span> <span class="o">-></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-482"><a href="#L-482"><span class="linenos">482</span></a> <span class="k">return</span> <span class="p">[</span> +</span><span id="L-483"><a href="#L-483"><span class="linenos">483</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">"offset"</span><span class="p">),</span> +</span><span id="L-484"><a href="#L-484"><span class="linenos">484</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-485"><a href="#L-485"><span class="linenos">485</span></a> <span class="p">]</span> +</span><span id="L-486"><a href="#L-486"><span class="linenos">486</span></a> +</span><span id="L-487"><a href="#L-487"><span class="linenos">487</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-488"><a href="#L-488"><span class="linenos">488</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-489"><a href="#L-489"><span class="linenos">489</span></a><span class="sd"> Presto doesn't support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span> +</span><span id="L-490"><a href="#L-490"><span class="linenos">490</span></a><span class="sd"> so we need to remove them</span> +</span><span id="L-491"><a href="#L-491"><span class="linenos">491</span></a><span class="sd"> """</span> +</span><span id="L-492"><a href="#L-492"><span class="linenos">492</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">"kind"</span><span class="p">]</span> +</span><span id="L-493"><a href="#L-493"><span class="linenos">493</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-494"><a href="#L-494"><span class="linenos">494</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"VIEW"</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-495"><a href="#L-495"><span class="linenos">495</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">"expressions"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-496"><a href="#L-496"><span class="linenos">496</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> @@ -770,303 +759,306 @@ </div> <a class="headerlink" href="#Presto"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Presto-212"><a href="#Presto-212"><span class="linenos">212</span></a><span class="k">class</span> <span class="nc">Presto</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> -</span><span id="Presto-213"><a href="#Presto-213"><span class="linenos">213</span></a> <span class="n">INDEX_OFFSET</span> <span class="o">=</span> <span class="mi">1</span> -</span><span id="Presto-214"><a href="#Presto-214"><span class="linenos">214</span></a> <span class="n">NULL_ORDERING</span> <span class="o">=</span> <span class="s2">"nulls_are_last"</span> -</span><span id="Presto-215"><a href="#Presto-215"><span class="linenos">215</span></a> <span class="n">TIME_FORMAT</span> <span class="o">=</span> <span class="n">MySQL</span><span class="o">.</span><span class="n">TIME_FORMAT</span> -</span><span id="Presto-216"><a href="#Presto-216"><span class="linenos">216</span></a> <span class="n">TIME_MAPPING</span> <span class="o">=</span> <span class="n">MySQL</span><span class="o">.</span><span class="n">TIME_MAPPING</span> -</span><span id="Presto-217"><a href="#Presto-217"><span class="linenos">217</span></a> <span class="n">STRICT_STRING_CONCAT</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Presto-218"><a href="#Presto-218"><span class="linenos">218</span></a> <span class="n">SUPPORTS_SEMI_ANTI_JOIN</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto-219"><a href="#Presto-219"><span class="linenos">219</span></a> <span class="n">TYPED_DIVISION</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Presto-220"><a href="#Presto-220"><span class="linenos">220</span></a> <span class="n">TABLESAMPLE_SIZE_IS_PERCENT</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Presto-221"><a href="#Presto-221"><span class="linenos">221</span></a> -</span><span id="Presto-222"><a href="#Presto-222"><span class="linenos">222</span></a> <span class="c1"># https://github.com/trinodb/trino/issues/17</span> -</span><span id="Presto-223"><a href="#Presto-223"><span class="linenos">223</span></a> <span class="c1"># https://github.com/trinodb/trino/issues/12289</span> -</span><span id="Presto-224"><a href="#Presto-224"><span class="linenos">224</span></a> <span class="c1"># https://github.com/prestodb/presto/issues/2863</span> -</span><span id="Presto-225"><a href="#Presto-225"><span class="linenos">225</span></a> <span class="n">NORMALIZATION_STRATEGY</span> <span class="o">=</span> <span class="n">NormalizationStrategy</span><span class="o">.</span><span class="n">CASE_INSENSITIVE</span> -</span><span id="Presto-226"><a href="#Presto-226"><span class="linenos">226</span></a> -</span><span id="Presto-227"><a href="#Presto-227"><span class="linenos">227</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> -</span><span id="Presto-228"><a href="#Presto-228"><span class="linenos">228</span></a> <span class="n">UNICODE_STRINGS</span> <span class="o">=</span> <span class="p">[</span> -</span><span id="Presto-229"><a href="#Presto-229"><span class="linenos">229</span></a> <span class="p">(</span><span class="n">prefix</span> <span class="o">+</span> <span class="n">q</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span> -</span><span id="Presto-230"><a href="#Presto-230"><span class="linenos">230</span></a> <span class="k">for</span> <span class="n">q</span> <span class="ow">in</span> <span class="n">t</span><span class="o">.</span><span class="n">cast</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="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">QUOTES</span><span class="p">)</span> -</span><span id="Presto-231"><a href="#Presto-231"><span class="linenos">231</span></a> <span class="k">for</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"U&"</span><span class="p">,</span> <span class="s2">"u&"</span><span class="p">)</span> -</span><span id="Presto-232"><a href="#Presto-232"><span class="linenos">232</span></a> <span class="p">]</span> -</span><span id="Presto-233"><a href="#Presto-233"><span class="linenos">233</span></a> -</span><span id="Presto-234"><a href="#Presto-234"><span class="linenos">234</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Presto-235"><a href="#Presto-235"><span class="linenos">235</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> -</span><span id="Presto-236"><a href="#Presto-236"><span class="linenos">236</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> -</span><span id="Presto-237"><a href="#Presto-237"><span class="linenos">237</span></a> <span class="s2">"MATCH_RECOGNIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">,</span> -</span><span id="Presto-238"><a href="#Presto-238"><span class="linenos">238</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> -</span><span id="Presto-239"><a href="#Presto-239"><span class="linenos">239</span></a> <span class="s2">"IPADDRESS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IPADDRESS</span><span class="p">,</span> -</span><span id="Presto-240"><a href="#Presto-240"><span class="linenos">240</span></a> <span class="s2">"IPPREFIX"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IPPREFIX</span><span class="p">,</span> -</span><span id="Presto-241"><a href="#Presto-241"><span class="linenos">241</span></a> <span class="p">}</span> -</span><span id="Presto-242"><a href="#Presto-242"><span class="linenos">242</span></a> -</span><span id="Presto-243"><a href="#Presto-243"><span class="linenos">243</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> -</span><span id="Presto-244"><a href="#Presto-244"><span class="linenos">244</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Presto-245"><a href="#Presto-245"><span class="linenos">245</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> -</span><span id="Presto-246"><a href="#Presto-246"><span class="linenos">246</span></a> <span class="s2">"ARBITRARY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto-247"><a href="#Presto-247"><span class="linenos">247</span></a> <span class="s2">"APPROX_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto-248"><a href="#Presto-248"><span class="linenos">248</span></a> <span class="s2">"APPROX_PERCENTILE"</span><span class="p">:</span> <span class="n">_approx_percentile</span><span class="p">,</span> -</span><span id="Presto-249"><a href="#Presto-249"><span class="linenos">249</span></a> <span class="s2">"BITWISE_AND"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">),</span> -</span><span id="Presto-250"><a href="#Presto-250"><span class="linenos">250</span></a> <span class="s2">"BITWISE_NOT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> -</span><span id="Presto-251"><a href="#Presto-251"><span class="linenos">251</span></a> <span class="s2">"BITWISE_OR"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">),</span> -</span><span id="Presto-252"><a href="#Presto-252"><span class="linenos">252</span></a> <span class="s2">"BITWISE_XOR"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">),</span> -</span><span id="Presto-253"><a href="#Presto-253"><span class="linenos">253</span></a> <span class="s2">"CARDINALITY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto-254"><a href="#Presto-254"><span class="linenos">254</span></a> <span class="s2">"CONTAINS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto-255"><a href="#Presto-255"><span class="linenos">255</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">(</span> -</span><span id="Presto-256"><a href="#Presto-256"><span class="linenos">256</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Presto-198"><a href="#Presto-198"><span class="linenos">198</span></a><span class="k">class</span> <span class="nc">Presto</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="Presto-199"><a href="#Presto-199"><span class="linenos">199</span></a> <span class="n">INDEX_OFFSET</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="Presto-200"><a href="#Presto-200"><span class="linenos">200</span></a> <span class="n">NULL_ORDERING</span> <span class="o">=</span> <span class="s2">"nulls_are_last"</span> +</span><span id="Presto-201"><a href="#Presto-201"><span class="linenos">201</span></a> <span class="n">TIME_FORMAT</span> <span class="o">=</span> <span class="n">MySQL</span><span class="o">.</span><span class="n">TIME_FORMAT</span> +</span><span id="Presto-202"><a href="#Presto-202"><span class="linenos">202</span></a> <span class="n">TIME_MAPPING</span> <span class="o">=</span> <span class="n">MySQL</span><span class="o">.</span><span class="n">TIME_MAPPING</span> +</span><span id="Presto-203"><a href="#Presto-203"><span class="linenos">203</span></a> <span class="n">STRICT_STRING_CONCAT</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Presto-204"><a href="#Presto-204"><span class="linenos">204</span></a> <span class="n">SUPPORTS_SEMI_ANTI_JOIN</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto-205"><a href="#Presto-205"><span class="linenos">205</span></a> <span class="n">TYPED_DIVISION</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Presto-206"><a href="#Presto-206"><span class="linenos">206</span></a> <span class="n">TABLESAMPLE_SIZE_IS_PERCENT</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Presto-207"><a href="#Presto-207"><span class="linenos">207</span></a> +</span><span id="Presto-208"><a href="#Presto-208"><span class="linenos">208</span></a> <span class="c1"># https://github.com/trinodb/trino/issues/17</span> +</span><span id="Presto-209"><a href="#Presto-209"><span class="linenos">209</span></a> <span class="c1"># https://github.com/trinodb/trino/issues/12289</span> +</span><span id="Presto-210"><a href="#Presto-210"><span class="linenos">210</span></a> <span class="c1"># https://github.com/prestodb/presto/issues/2863</span> +</span><span id="Presto-211"><a href="#Presto-211"><span class="linenos">211</span></a> <span class="n">NORMALIZATION_STRATEGY</span> <span class="o">=</span> <span class="n">NormalizationStrategy</span><span class="o">.</span><span class="n">CASE_INSENSITIVE</span> +</span><span id="Presto-212"><a href="#Presto-212"><span class="linenos">212</span></a> +</span><span id="Presto-213"><a href="#Presto-213"><span class="linenos">213</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Presto-214"><a href="#Presto-214"><span class="linenos">214</span></a> <span class="n">UNICODE_STRINGS</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="Presto-215"><a href="#Presto-215"><span class="linenos">215</span></a> <span class="p">(</span><span class="n">prefix</span> <span class="o">+</span> <span class="n">q</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span> +</span><span id="Presto-216"><a href="#Presto-216"><span class="linenos">216</span></a> <span class="k">for</span> <span class="n">q</span> <span class="ow">in</span> <span class="n">t</span><span class="o">.</span><span class="n">cast</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="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">QUOTES</span><span class="p">)</span> +</span><span id="Presto-217"><a href="#Presto-217"><span class="linenos">217</span></a> <span class="k">for</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"U&"</span><span class="p">,</span> <span class="s2">"u&"</span><span class="p">)</span> +</span><span id="Presto-218"><a href="#Presto-218"><span class="linenos">218</span></a> <span class="p">]</span> +</span><span id="Presto-219"><a href="#Presto-219"><span class="linenos">219</span></a> +</span><span id="Presto-220"><a href="#Presto-220"><span class="linenos">220</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto-221"><a href="#Presto-221"><span class="linenos">221</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="Presto-222"><a href="#Presto-222"><span class="linenos">222</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="Presto-223"><a href="#Presto-223"><span class="linenos">223</span></a> <span class="s2">"MATCH_RECOGNIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">,</span> +</span><span id="Presto-224"><a href="#Presto-224"><span class="linenos">224</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> +</span><span id="Presto-225"><a href="#Presto-225"><span class="linenos">225</span></a> <span class="s2">"IPADDRESS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IPADDRESS</span><span class="p">,</span> +</span><span id="Presto-226"><a href="#Presto-226"><span class="linenos">226</span></a> <span class="s2">"IPPREFIX"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IPPREFIX</span><span class="p">,</span> +</span><span id="Presto-227"><a href="#Presto-227"><span class="linenos">227</span></a> <span class="p">}</span> +</span><span id="Presto-228"><a href="#Presto-228"><span class="linenos">228</span></a> +</span><span id="Presto-229"><a href="#Presto-229"><span class="linenos">229</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Presto-230"><a href="#Presto-230"><span class="linenos">230</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto-231"><a href="#Presto-231"><span class="linenos">231</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="Presto-232"><a href="#Presto-232"><span class="linenos">232</span></a> <span class="s2">"ARBITRARY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-233"><a href="#Presto-233"><span class="linenos">233</span></a> <span class="s2">"APPROX_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-234"><a href="#Presto-234"><span class="linenos">234</span></a> <span class="s2">"APPROX_PERCENTILE"</span><span class="p">:</span> <span class="n">_approx_percentile</span><span class="p">,</span> +</span><span id="Presto-235"><a href="#Presto-235"><span class="linenos">235</span></a> <span class="s2">"BITWISE_AND"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">),</span> +</span><span id="Presto-236"><a href="#Presto-236"><span class="linenos">236</span></a> <span class="s2">"BITWISE_NOT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Presto-237"><a href="#Presto-237"><span class="linenos">237</span></a> <span class="s2">"BITWISE_OR"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">),</span> +</span><span id="Presto-238"><a href="#Presto-238"><span class="linenos">238</span></a> <span class="s2">"BITWISE_XOR"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">),</span> +</span><span id="Presto-239"><a href="#Presto-239"><span class="linenos">239</span></a> <span class="s2">"CARDINALITY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-240"><a href="#Presto-240"><span class="linenos">240</span></a> <span class="s2">"CONTAINS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-241"><a href="#Presto-241"><span class="linenos">241</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">(</span> +</span><span id="Presto-242"><a href="#Presto-242"><span class="linenos">242</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="Presto-243"><a href="#Presto-243"><span class="linenos">243</span></a> <span class="p">),</span> +</span><span id="Presto-244"><a href="#Presto-244"><span class="linenos">244</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">(</span> +</span><span id="Presto-245"><a href="#Presto-245"><span class="linenos">245</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="Presto-246"><a href="#Presto-246"><span class="linenos">246</span></a> <span class="p">),</span> +</span><span id="Presto-247"><a href="#Presto-247"><span class="linenos">247</span></a> <span class="s2">"DATE_FORMAT"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> +</span><span id="Presto-248"><a href="#Presto-248"><span class="linenos">248</span></a> <span class="s2">"DATE_PARSE"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> +</span><span id="Presto-249"><a href="#Presto-249"><span class="linenos">249</span></a> <span class="s2">"DATE_TRUNC"</span><span class="p">:</span> <span class="n">date_trunc_to_time</span><span class="p">,</span> +</span><span id="Presto-250"><a href="#Presto-250"><span class="linenos">250</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">(</span> +</span><span id="Presto-251"><a href="#Presto-251"><span class="linenos">251</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)],</span> <span class="n">offset</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">safe</span><span class="o">=</span><span class="kc">True</span> +</span><span id="Presto-252"><a href="#Presto-252"><span class="linenos">252</span></a> <span class="p">),</span> +</span><span id="Presto-253"><a href="#Presto-253"><span class="linenos">253</span></a> <span class="s2">"FROM_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-254"><a href="#Presto-254"><span class="linenos">254</span></a> <span class="s2">"FROM_UNIXTIME"</span><span class="p">:</span> <span class="n">_from_unixtime</span><span class="p">,</span> +</span><span id="Presto-255"><a href="#Presto-255"><span class="linenos">255</span></a> <span class="s2">"FROM_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">(</span> +</span><span id="Presto-256"><a href="#Presto-256"><span class="linenos">256</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">replace</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> </span><span id="Presto-257"><a href="#Presto-257"><span class="linenos">257</span></a> <span class="p">),</span> -</span><span id="Presto-258"><a href="#Presto-258"><span class="linenos">258</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">(</span> -</span><span id="Presto-259"><a href="#Presto-259"><span class="linenos">259</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> -</span><span id="Presto-260"><a href="#Presto-260"><span class="linenos">260</span></a> <span class="p">),</span> -</span><span id="Presto-261"><a href="#Presto-261"><span class="linenos">261</span></a> <span class="s2">"DATE_FORMAT"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> -</span><span id="Presto-262"><a href="#Presto-262"><span class="linenos">262</span></a> <span class="s2">"DATE_PARSE"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> -</span><span id="Presto-263"><a href="#Presto-263"><span class="linenos">263</span></a> <span class="s2">"DATE_TRUNC"</span><span class="p">:</span> <span class="n">date_trunc_to_time</span><span class="p">,</span> -</span><span id="Presto-264"><a href="#Presto-264"><span class="linenos">264</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">:</span> <span class="n">_parse_element_at</span><span class="p">,</span> -</span><span id="Presto-265"><a href="#Presto-265"><span class="linenos">265</span></a> <span class="s2">"FROM_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto-266"><a href="#Presto-266"><span class="linenos">266</span></a> <span class="s2">"FROM_UNIXTIME"</span><span class="p">:</span> <span class="n">_from_unixtime</span><span class="p">,</span> -</span><span id="Presto-267"><a href="#Presto-267"><span class="linenos">267</span></a> <span class="s2">"FROM_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">(</span> -</span><span id="Presto-268"><a href="#Presto-268"><span class="linenos">268</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">replace</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> -</span><span id="Presto-269"><a href="#Presto-269"><span class="linenos">269</span></a> <span class="p">),</span> -</span><span id="Presto-270"><a href="#Presto-270"><span class="linenos">270</span></a> <span class="s2">"NOW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto-271"><a href="#Presto-271"><span class="linenos">271</span></a> <span class="s2">"REGEXP_EXTRACT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpExtract</span><span class="p">(</span> -</span><span id="Presto-272"><a href="#Presto-272"><span class="linenos">272</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">group</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> +</span><span id="Presto-258"><a href="#Presto-258"><span class="linenos">258</span></a> <span class="s2">"NOW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-259"><a href="#Presto-259"><span class="linenos">259</span></a> <span class="s2">"REGEXP_EXTRACT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpExtract</span><span class="p">(</span> +</span><span id="Presto-260"><a href="#Presto-260"><span class="linenos">260</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">group</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> +</span><span id="Presto-261"><a href="#Presto-261"><span class="linenos">261</span></a> <span class="p">),</span> +</span><span id="Presto-262"><a href="#Presto-262"><span class="linenos">262</span></a> <span class="s2">"REGEXP_REPLACE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpReplace</span><span class="p">(</span> +</span><span id="Presto-263"><a href="#Presto-263"><span class="linenos">263</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Presto-264"><a href="#Presto-264"><span class="linenos">264</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Presto-265"><a href="#Presto-265"><span class="linenos">265</span></a> <span class="n">replacement</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">""</span><span class="p">),</span> +</span><span id="Presto-266"><a href="#Presto-266"><span class="linenos">266</span></a> <span class="p">),</span> +</span><span id="Presto-267"><a href="#Presto-267"><span class="linenos">267</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-268"><a href="#Presto-268"><span class="linenos">268</span></a> <span class="s2">"SEQUENCE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-269"><a href="#Presto-269"><span class="linenos">269</span></a> <span class="s2">"SET_AGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayUniqueAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-270"><a href="#Presto-270"><span class="linenos">270</span></a> <span class="s2">"SPLIT_TO_MAP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToMap</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-271"><a href="#Presto-271"><span class="linenos">271</span></a> <span class="s2">"STRPOS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> +</span><span id="Presto-272"><a href="#Presto-272"><span class="linenos">272</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">instance</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> </span><span id="Presto-273"><a href="#Presto-273"><span class="linenos">273</span></a> <span class="p">),</span> -</span><span id="Presto-274"><a href="#Presto-274"><span class="linenos">274</span></a> <span class="s2">"REGEXP_REPLACE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpReplace</span><span class="p">(</span> -</span><span id="Presto-275"><a href="#Presto-275"><span class="linenos">275</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> -</span><span id="Presto-276"><a href="#Presto-276"><span class="linenos">276</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> -</span><span id="Presto-277"><a href="#Presto-277"><span class="linenos">277</span></a> <span class="n">replacement</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">""</span><span class="p">),</span> -</span><span id="Presto-278"><a href="#Presto-278"><span class="linenos">278</span></a> <span class="p">),</span> -</span><span id="Presto-279"><a href="#Presto-279"><span class="linenos">279</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto-280"><a href="#Presto-280"><span class="linenos">280</span></a> <span class="s2">"SEQUENCE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto-281"><a href="#Presto-281"><span class="linenos">281</span></a> <span class="s2">"SET_AGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayUniqueAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto-282"><a href="#Presto-282"><span class="linenos">282</span></a> <span class="s2">"SPLIT_TO_MAP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToMap</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto-283"><a href="#Presto-283"><span class="linenos">283</span></a> <span class="s2">"STRPOS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> -</span><span id="Presto-284"><a href="#Presto-284"><span class="linenos">284</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">instance</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> -</span><span id="Presto-285"><a href="#Presto-285"><span class="linenos">285</span></a> <span class="p">),</span> -</span><span id="Presto-286"><a href="#Presto-286"><span class="linenos">286</span></a> <span class="s2">"TO_CHAR"</span><span class="p">:</span> <span class="n">_parse_to_char</span><span class="p">,</span> -</span><span id="Presto-287"><a href="#Presto-287"><span class="linenos">287</span></a> <span class="s2">"TO_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto-288"><a href="#Presto-288"><span class="linenos">288</span></a> <span class="s2">"TO_UNIXTIME"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto-289"><a href="#Presto-289"><span class="linenos">289</span></a> <span class="s2">"TO_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">(</span> -</span><span id="Presto-290"><a href="#Presto-290"><span class="linenos">290</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> -</span><span id="Presto-291"><a href="#Presto-291"><span class="linenos">291</span></a> <span class="p">),</span> -</span><span id="Presto-292"><a href="#Presto-292"><span class="linenos">292</span></a> <span class="p">}</span> -</span><span id="Presto-293"><a href="#Presto-293"><span class="linenos">293</span></a> -</span><span id="Presto-294"><a href="#Presto-294"><span class="linenos">294</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> -</span><span id="Presto-295"><a href="#Presto-295"><span class="linenos">295</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span><span id="Presto-274"><a href="#Presto-274"><span class="linenos">274</span></a> <span class="s2">"TO_CHAR"</span><span class="p">:</span> <span class="n">_parse_to_char</span><span class="p">,</span> +</span><span id="Presto-275"><a href="#Presto-275"><span class="linenos">275</span></a> <span class="s2">"TO_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-276"><a href="#Presto-276"><span class="linenos">276</span></a> <span class="s2">"TO_UNIXTIME"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-277"><a href="#Presto-277"><span class="linenos">277</span></a> <span class="s2">"TO_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">(</span> +</span><span id="Presto-278"><a href="#Presto-278"><span class="linenos">278</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> +</span><span id="Presto-279"><a href="#Presto-279"><span class="linenos">279</span></a> <span class="p">),</span> +</span><span id="Presto-280"><a href="#Presto-280"><span class="linenos">280</span></a> <span class="p">}</span> +</span><span id="Presto-281"><a href="#Presto-281"><span class="linenos">281</span></a> +</span><span id="Presto-282"><a href="#Presto-282"><span class="linenos">282</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Presto-283"><a href="#Presto-283"><span class="linenos">283</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span><span id="Presto-284"><a href="#Presto-284"><span class="linenos">284</span></a> +</span><span id="Presto-285"><a href="#Presto-285"><span class="linenos">285</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Presto-286"><a href="#Presto-286"><span class="linenos">286</span></a> <span class="n">INTERVAL_ALLOWS_PLURAL_FORM</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto-287"><a href="#Presto-287"><span class="linenos">287</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto-288"><a href="#Presto-288"><span class="linenos">288</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto-289"><a href="#Presto-289"><span class="linenos">289</span></a> <span class="n">QUERY_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto-290"><a href="#Presto-290"><span class="linenos">290</span></a> <span class="n">IS_BOOL_ALLOWED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto-291"><a href="#Presto-291"><span class="linenos">291</span></a> <span class="n">TZ_TO_WITH_TIME_ZONE</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Presto-292"><a href="#Presto-292"><span class="linenos">292</span></a> <span class="n">NVL2_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto-293"><a href="#Presto-293"><span class="linenos">293</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="Presto-294"><a href="#Presto-294"><span class="linenos">294</span></a> <span class="n">LIMIT_ONLY_LITERALS</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Presto-295"><a href="#Presto-295"><span class="linenos">295</span></a> <span class="n">SUPPORTS_SINGLE_ARG_CONCAT</span> <span class="o">=</span> <span class="kc">False</span> </span><span id="Presto-296"><a href="#Presto-296"><span class="linenos">296</span></a> -</span><span id="Presto-297"><a href="#Presto-297"><span class="linenos">297</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> -</span><span id="Presto-298"><a href="#Presto-298"><span class="linenos">298</span></a> <span class="n">INTERVAL_ALLOWS_PLURAL_FORM</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto-299"><a href="#Presto-299"><span class="linenos">299</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto-300"><a href="#Presto-300"><span class="linenos">300</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto-301"><a href="#Presto-301"><span class="linenos">301</span></a> <span class="n">QUERY_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto-302"><a href="#Presto-302"><span class="linenos">302</span></a> <span class="n">IS_BOOL_ALLOWED</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto-303"><a href="#Presto-303"><span class="linenos">303</span></a> <span class="n">TZ_TO_WITH_TIME_ZONE</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Presto-304"><a href="#Presto-304"><span class="linenos">304</span></a> <span class="n">NVL2_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto-305"><a href="#Presto-305"><span class="linenos">305</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> -</span><span id="Presto-306"><a href="#Presto-306"><span class="linenos">306</span></a> <span class="n">LIMIT_ONLY_LITERALS</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Presto-307"><a href="#Presto-307"><span class="linenos">307</span></a> <span class="n">SUPPORTS_SINGLE_ARG_CONCAT</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto-308"><a href="#Presto-308"><span class="linenos">308</span></a> -</span><span id="Presto-309"><a href="#Presto-309"><span class="linenos">309</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Presto-310"><a href="#Presto-310"><span class="linenos">310</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> -</span><span id="Presto-311"><a href="#Presto-311"><span class="linenos">311</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> -</span><span id="Presto-312"><a href="#Presto-312"><span class="linenos">312</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatileProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> -</span><span id="Presto-313"><a href="#Presto-313"><span class="linenos">313</span></a> <span class="p">}</span> -</span><span id="Presto-314"><a href="#Presto-314"><span class="linenos">314</span></a> -</span><span id="Presto-315"><a href="#Presto-315"><span class="linenos">315</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Presto-316"><a href="#Presto-316"><span class="linenos">316</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> -</span><span id="Presto-317"><a href="#Presto-317"><span class="linenos">317</span></a> <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">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> -</span><span id="Presto-318"><a href="#Presto-318"><span class="linenos">318</span></a> <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">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> -</span><span id="Presto-319"><a href="#Presto-319"><span class="linenos">319</span></a> <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">BINARY</span><span class="p">:</span> <span class="s2">"VARBINARY"</span><span class="p">,</span> -</span><span id="Presto-320"><a href="#Presto-320"><span class="linenos">320</span></a> <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 class="s2">"VARCHAR"</span><span class="p">,</span> -</span><span id="Presto-321"><a href="#Presto-321"><span class="linenos">321</span></a> <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">TIMETZ</span><span class="p">:</span> <span class="s2">"TIME"</span><span class="p">,</span> -</span><span id="Presto-322"><a href="#Presto-322"><span class="linenos">322</span></a> <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">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> -</span><span id="Presto-323"><a href="#Presto-323"><span class="linenos">323</span></a> <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">STRUCT</span><span class="p">:</span> <span class="s2">"ROW"</span><span class="p">,</span> -</span><span id="Presto-324"><a href="#Presto-324"><span class="linenos">324</span></a> <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">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> -</span><span id="Presto-325"><a href="#Presto-325"><span class="linenos">325</span></a> <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">DATETIME64</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> -</span><span id="Presto-326"><a href="#Presto-326"><span class="linenos">326</span></a> <span class="p">}</span> -</span><span id="Presto-327"><a href="#Presto-327"><span class="linenos">327</span></a> -</span><span id="Presto-328"><a href="#Presto-328"><span class="linenos">328</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Presto-329"><a href="#Presto-329"><span class="linenos">329</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> -</span><span id="Presto-330"><a href="#Presto-330"><span class="linenos">330</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARBITRARY"</span><span class="p">),</span> -</span><span id="Presto-331"><a href="#Presto-331"><span class="linenos">331</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">_approx_distinct_sql</span><span class="p">,</span> -</span><span id="Presto-332"><a href="#Presto-332"><span class="linenos">332</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"APPROX_PERCENTILE"</span><span class="p">),</span> -</span><span id="Presto-333"><a href="#Presto-333"><span class="linenos">333</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArgMax</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MAX_BY"</span><span class="p">),</span> -</span><span id="Presto-334"><a href="#Presto-334"><span class="linenos">334</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArgMin</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MIN_BY"</span><span class="p">),</span> -</span><span id="Presto-335"><a href="#Presto-335"><span class="linenos">335</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"ARRAY[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> -</span><span id="Presto-336"><a href="#Presto-336"><span class="linenos">336</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONCAT"</span><span class="p">),</span> -</span><span id="Presto-337"><a href="#Presto-337"><span class="linenos">337</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONTAINS"</span><span class="p">),</span> -</span><span id="Presto-338"><a href="#Presto-338"><span class="linenos">338</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CARDINALITY"</span><span class="p">),</span> -</span><span id="Presto-339"><a href="#Presto-339"><span class="linenos">339</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayUniqueAgg</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SET_AGG"</span><span class="p">),</span> -</span><span id="Presto-340"><a href="#Presto-340"><span class="linenos">340</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_AND(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto-341"><a href="#Presto-341"><span class="linenos">341</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_LEFT(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto-342"><a href="#Presto-342"><span class="linenos">342</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_NOT(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto-343"><a href="#Presto-343"><span class="linenos">343</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_OR(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto-344"><a href="#Presto-344"><span class="linenos">344</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_RIGHT(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto-345"><a href="#Presto-345"><span class="linenos">345</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_XOR(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto-346"><a href="#Presto-346"><span class="linenos">346</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">epoch_cast_to_ts</span><span class="p">]),</span> -</span><span id="Presto-347"><a href="#Presto-347"><span class="linenos">347</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> -</span><span id="Presto-348"><a href="#Presto-348"><span class="linenos">348</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> -</span><span id="Presto-349"><a href="#Presto-349"><span class="linenos">349</span></a> <span class="s2">"DATE_ADD"</span><span class="p">,</span> -</span><span id="Presto-350"><a href="#Presto-350"><span class="linenos">350</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> -</span><span id="Presto-351"><a href="#Presto-351"><span class="linenos">351</span></a> <span class="n">_to_int</span><span class="p">(</span> -</span><span id="Presto-352"><a href="#Presto-352"><span class="linenos">352</span></a> <span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> -</span><span id="Presto-353"><a href="#Presto-353"><span class="linenos">353</span></a> <span class="p">),</span> -</span><span id="Presto-354"><a href="#Presto-354"><span class="linenos">354</span></a> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> -</span><span id="Presto-355"><a href="#Presto-355"><span class="linenos">355</span></a> <span class="p">),</span> -</span><span id="Presto-356"><a href="#Presto-356"><span class="linenos">356</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> -</span><span id="Presto-357"><a href="#Presto-357"><span class="linenos">357</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> <span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span> -</span><span id="Presto-358"><a href="#Presto-358"><span class="linenos">358</span></a> <span class="p">),</span> -</span><span id="Presto-359"><a href="#Presto-359"><span class="linenos">359</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> -</span><span id="Presto-360"><a href="#Presto-360"><span class="linenos">360</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_FORMAT(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">DATEINT_FORMAT</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> -</span><span id="Presto-361"><a href="#Presto-361"><span class="linenos">361</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> -</span><span id="Presto-362"><a href="#Presto-362"><span class="linenos">362</span></a> <span class="s2">"DATE_ADD"</span><span class="p">,</span> -</span><span id="Presto-363"><a href="#Presto-363"><span class="linenos">363</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> -</span><span id="Presto-364"><a href="#Presto-364"><span class="linenos">364</span></a> <span class="n">_to_int</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expression</span> <span class="o">*</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span> -</span><span id="Presto-365"><a href="#Presto-365"><span class="linenos">365</span></a> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> -</span><span id="Presto-366"><a href="#Presto-366"><span class="linenos">366</span></a> <span class="p">),</span> -</span><span id="Presto-367"><a href="#Presto-367"><span class="linenos">367</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">encode_decode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"FROM_UTF8"</span><span class="p">),</span> -</span><span id="Presto-368"><a href="#Presto-368"><span class="linenos">368</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_PARSE(CAST(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">DATEINT_FORMAT</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> -</span><span id="Presto-369"><a href="#Presto-369"><span class="linenos">369</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">encode_decode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"TO_UTF8"</span><span class="p">),</span> -</span><span id="Presto-370"><a href="#Presto-370"><span class="linenos">370</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FORMAT='</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">'"</span><span class="p">,</span> -</span><span id="Presto-371"><a href="#Presto-371"><span class="linenos">371</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">First</span><span class="p">:</span> <span class="n">_first_last_sql</span><span class="p">,</span> -</span><span id="Presto-372"><a href="#Presto-372"><span class="linenos">372</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GetPath</span><span class="p">:</span> <span class="n">path_to_jsonpath</span><span class="p">(),</span> -</span><span id="Presto-373"><a href="#Presto-373"><span class="linenos">373</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">unalias_group</span><span class="p">]),</span> -</span><span id="Presto-374"><a href="#Presto-374"><span class="linenos">374</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> -</span><span id="Presto-375"><a href="#Presto-375"><span class="linenos">375</span></a> <span class="s2">"ARRAY_JOIN"</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">"ARRAY_AGG"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> <span class="n">e</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">"separator"</span><span class="p">)</span> -</span><span id="Presto-376"><a href="#Presto-376"><span class="linenos">376</span></a> <span class="p">),</span> -</span><span id="Presto-377"><a href="#Presto-377"><span class="linenos">377</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_HEX"</span><span class="p">),</span> -</span><span id="Presto-378"><a href="#Presto-378"><span class="linenos">378</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">(),</span> -</span><span id="Presto-379"><a href="#Presto-379"><span class="linenos">379</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> -</span><span id="Presto-380"><a href="#Presto-380"><span class="linenos">380</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Initcap</span><span class="p">:</span> <span class="n">_initcap_sql</span><span class="p">,</span> -</span><span id="Presto-381"><a href="#Presto-381"><span class="linenos">381</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ParseJSON</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"JSON_PARSE"</span><span class="p">),</span> -</span><span id="Presto-382"><a href="#Presto-382"><span class="linenos">382</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Last</span><span class="p">:</span> <span class="n">_first_last_sql</span><span class="p">,</span> -</span><span id="Presto-383"><a href="#Presto-383"><span class="linenos">383</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LastDay</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</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">"LAST_DAY_OF_MONTH"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> -</span><span id="Presto-384"><a href="#Presto-384"><span class="linenos">384</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">:</span> <span class="n">_explode_to_unnest_sql</span><span class="p">,</span> -</span><span id="Presto-385"><a href="#Presto-385"><span class="linenos">385</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Left</span><span class="p">:</span> <span class="n">left_to_substring_sql</span><span class="p">,</span> -</span><span id="Presto-386"><a href="#Presto-386"><span class="linenos">386</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LEVENSHTEIN_DISTANCE"</span><span class="p">),</span> -</span><span id="Presto-387"><a href="#Presto-387"><span class="linenos">387</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalAnd</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_AND"</span><span class="p">),</span> -</span><span id="Presto-388"><a href="#Presto-388"><span class="linenos">388</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> -</span><span id="Presto-389"><a href="#Presto-389"><span class="linenos">389</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">:</span> <span class="n">no_pivot_sql</span><span class="p">,</span> -</span><span id="Presto-390"><a href="#Presto-390"><span class="linenos">390</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="n">_quantile_sql</span><span class="p">,</span> -</span><span id="Presto-391"><a href="#Presto-391"><span class="linenos">391</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpExtract</span><span class="p">:</span> <span class="n">regexp_extract_sql</span><span class="p">,</span> -</span><span id="Presto-392"><a href="#Presto-392"><span class="linenos">392</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Right</span><span class="p">:</span> <span class="n">right_to_substring_sql</span><span class="p">,</span> -</span><span id="Presto-393"><a href="#Presto-393"><span class="linenos">393</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> -</span><span id="Presto-394"><a href="#Presto-394"><span class="linenos">394</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">:</span> <span class="n">_schema_sql</span><span class="p">,</span> -</span><span id="Presto-395"><a href="#Presto-395"><span class="linenos">395</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SchemaCommentProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> -</span><span id="Presto-396"><a href="#Presto-396"><span class="linenos">396</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> -</span><span id="Presto-397"><a href="#Presto-397"><span class="linenos">397</span></a> <span class="p">[</span> -</span><span id="Presto-398"><a href="#Presto-398"><span class="linenos">398</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_qualify</span><span class="p">,</span> -</span><span id="Presto-399"><a href="#Presto-399"><span class="linenos">399</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">,</span> -</span><span id="Presto-400"><a href="#Presto-400"><span class="linenos">400</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">explode_to_unnest</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> -</span><span id="Presto-401"><a href="#Presto-401"><span class="linenos">401</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_semi_and_anti_joins</span><span class="p">,</span> -</span><span id="Presto-402"><a href="#Presto-402"><span class="linenos">402</span></a> <span class="p">]</span> -</span><span id="Presto-403"><a href="#Presto-403"><span class="linenos">403</span></a> <span class="p">),</span> -</span><span id="Presto-404"><a href="#Presto-404"><span class="linenos">404</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="p">:</span> <span class="n">_no_sort_array</span><span class="p">,</span> -</span><span id="Presto-405"><a href="#Presto-405"><span class="linenos">405</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRPOS"</span><span class="p">),</span> -</span><span id="Presto-406"><a href="#Presto-406"><span class="linenos">406</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> -</span><span id="Presto-407"><a href="#Presto-407"><span class="linenos">407</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToMap</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SPLIT_TO_MAP"</span><span class="p">),</span> -</span><span id="Presto-408"><a href="#Presto-408"><span class="linenos">408</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time_sql</span><span class="p">,</span> -</span><span id="Presto-409"><a href="#Presto-409"><span class="linenos">409</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> -</span><span id="Presto-410"><a href="#Presto-410"><span class="linenos">410</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">:</span> <span class="n">struct_extract_sql</span><span class="p">,</span> -</span><span id="Presto-411"><a href="#Presto-411"><span class="linenos">411</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">_unnest_sequence</span><span class="p">]),</span> -</span><span id="Presto-412"><a href="#Presto-412"><span class="linenos">412</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Timestamp</span><span class="p">:</span> <span class="n">no_timestamp_sql</span><span class="p">,</span> -</span><span id="Presto-413"><a href="#Presto-413"><span class="linenos">413</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampTrunc</span><span class="p">:</span> <span class="n">timestamptrunc_sql</span><span class="p">,</span> -</span><span id="Presto-414"><a href="#Presto-414"><span class="linenos">414</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> -</span><span id="Presto-415"><a href="#Presto-415"><span class="linenos">415</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> -</span><span id="Presto-416"><a href="#Presto-416"><span class="linenos">416</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">TIME_FORMAT</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> -</span><span id="Presto-417"><a href="#Presto-417"><span class="linenos">417</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto-418"><a href="#Presto-418"><span class="linenos">418</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_UNIXTIME"</span><span class="p">),</span> -</span><span id="Presto-419"><a href="#Presto-419"><span class="linenos">419</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ToChar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto-420"><a href="#Presto-420"><span class="linenos">420</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">epoch_cast_to_ts</span><span class="p">]),</span> -</span><span id="Presto-421"><a href="#Presto-421"><span class="linenos">421</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> -</span><span id="Presto-422"><a href="#Presto-422"><span class="linenos">422</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">_ts_or_ds_add_sql</span><span class="p">,</span> -</span><span id="Presto-423"><a href="#Presto-423"><span class="linenos">423</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">:</span> <span class="n">_ts_or_ds_diff_sql</span><span class="p">,</span> -</span><span id="Presto-424"><a href="#Presto-424"><span class="linenos">424</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> -</span><span id="Presto-425"><a href="#Presto-425"><span class="linenos">425</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_HEX"</span><span class="p">),</span> -</span><span id="Presto-426"><a href="#Presto-426"><span class="linenos">426</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(FROM_UNIXTIME(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto-427"><a href="#Presto-427"><span class="linenos">427</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">_unix_to_time_sql</span><span class="p">,</span> -</span><span id="Presto-428"><a href="#Presto-428"><span class="linenos">428</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(FROM_UNIXTIME(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS VARCHAR)"</span><span class="p">,</span> -</span><span id="Presto-429"><a href="#Presto-429"><span class="linenos">429</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> -</span><span id="Presto-430"><a href="#Presto-430"><span class="linenos">430</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">add_recursive_cte_column_names</span><span class="p">]),</span> -</span><span id="Presto-431"><a href="#Presto-431"><span class="linenos">431</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WithinGroup</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> -</span><span id="Presto-432"><a href="#Presto-432"><span class="linenos">432</span></a> <span class="p">[</span><span class="n">transforms</span><span class="o">.</span><span class="n">remove_within_group_for_percentiles</span><span class="p">]</span> -</span><span id="Presto-433"><a href="#Presto-433"><span class="linenos">433</span></a> <span class="p">),</span> -</span><span id="Presto-434"><a href="#Presto-434"><span class="linenos">434</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-435"><a href="#Presto-435"><span class="linenos">435</span></a> <span class="p">}</span> -</span><span id="Presto-436"><a href="#Presto-436"><span class="linenos">436</span></a> -</span><span id="Presto-437"><a href="#Presto-437"><span class="linenos">437</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto-438"><a href="#Presto-438"><span class="linenos">438</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">"safe"</span><span class="p">):</span> -</span><span id="Presto-439"><a href="#Presto-439"><span class="linenos">439</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-440"><a href="#Presto-440"><span class="linenos">440</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">,</span> -</span><span id="Presto-441"><a href="#Presto-441"><span class="linenos">441</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> -</span><span id="Presto-442"><a href="#Presto-442"><span class="linenos">442</span></a> <span class="n">seq_get</span><span class="p">(</span> -</span><span id="Presto-443"><a href="#Presto-443"><span class="linenos">443</span></a> <span class="n">apply_index_offset</span><span class="p">(</span> -</span><span id="Presto-444"><a href="#Presto-444"><span class="linenos">444</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> -</span><span id="Presto-445"><a href="#Presto-445"><span class="linenos">445</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> -</span><span id="Presto-446"><a href="#Presto-446"><span class="linenos">446</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">"offset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> -</span><span id="Presto-447"><a href="#Presto-447"><span class="linenos">447</span></a> <span class="p">),</span> -</span><span id="Presto-448"><a href="#Presto-448"><span class="linenos">448</span></a> <span class="mi">0</span><span class="p">,</span> -</span><span id="Presto-449"><a href="#Presto-449"><span class="linenos">449</span></a> <span class="p">),</span> -</span><span id="Presto-450"><a href="#Presto-450"><span class="linenos">450</span></a> <span class="p">)</span> -</span><span id="Presto-451"><a href="#Presto-451"><span class="linenos">451</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-452"><a href="#Presto-452"><span class="linenos">452</span></a> -</span><span id="Presto-453"><a href="#Presto-453"><span class="linenos">453</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto-454"><a href="#Presto-454"><span class="linenos">454</span></a> <span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEY_VALUE_DEFINITIONS</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</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-455"><a href="#Presto-455"><span class="linenos">455</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Struct with key-value definitions is unsupported."</span><span class="p">)</span> -</span><span id="Presto-456"><a href="#Presto-456"><span class="linenos">456</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> -</span><span id="Presto-457"><a href="#Presto-457"><span class="linenos">457</span></a> -</span><span id="Presto-458"><a href="#Presto-458"><span class="linenos">458</span></a> <span class="k">return</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ROW"</span><span class="p">)(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="Presto-297"><a href="#Presto-297"><span class="linenos">297</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto-298"><a href="#Presto-298"><span class="linenos">298</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> +</span><span id="Presto-299"><a href="#Presto-299"><span class="linenos">299</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Presto-300"><a href="#Presto-300"><span class="linenos">300</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatileProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Presto-301"><a href="#Presto-301"><span class="linenos">301</span></a> <span class="p">}</span> +</span><span id="Presto-302"><a href="#Presto-302"><span class="linenos">302</span></a> +</span><span id="Presto-303"><a href="#Presto-303"><span class="linenos">303</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto-304"><a href="#Presto-304"><span class="linenos">304</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> +</span><span id="Presto-305"><a href="#Presto-305"><span class="linenos">305</span></a> <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">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Presto-306"><a href="#Presto-306"><span class="linenos">306</span></a> <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">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="Presto-307"><a href="#Presto-307"><span class="linenos">307</span></a> <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">BINARY</span><span class="p">:</span> <span class="s2">"VARBINARY"</span><span class="p">,</span> +</span><span id="Presto-308"><a href="#Presto-308"><span class="linenos">308</span></a> <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 class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="Presto-309"><a href="#Presto-309"><span class="linenos">309</span></a> <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">TIMETZ</span><span class="p">:</span> <span class="s2">"TIME"</span><span class="p">,</span> +</span><span id="Presto-310"><a href="#Presto-310"><span class="linenos">310</span></a> <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">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Presto-311"><a href="#Presto-311"><span class="linenos">311</span></a> <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">STRUCT</span><span class="p">:</span> <span class="s2">"ROW"</span><span class="p">,</span> +</span><span id="Presto-312"><a href="#Presto-312"><span class="linenos">312</span></a> <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">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Presto-313"><a href="#Presto-313"><span class="linenos">313</span></a> <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">DATETIME64</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Presto-314"><a href="#Presto-314"><span class="linenos">314</span></a> <span class="p">}</span> +</span><span id="Presto-315"><a href="#Presto-315"><span class="linenos">315</span></a> +</span><span id="Presto-316"><a href="#Presto-316"><span class="linenos">316</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto-317"><a href="#Presto-317"><span class="linenos">317</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> +</span><span id="Presto-318"><a href="#Presto-318"><span class="linenos">318</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARBITRARY"</span><span class="p">),</span> +</span><span id="Presto-319"><a href="#Presto-319"><span class="linenos">319</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">_approx_distinct_sql</span><span class="p">,</span> +</span><span id="Presto-320"><a href="#Presto-320"><span class="linenos">320</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"APPROX_PERCENTILE"</span><span class="p">),</span> +</span><span id="Presto-321"><a href="#Presto-321"><span class="linenos">321</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArgMax</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MAX_BY"</span><span class="p">),</span> +</span><span id="Presto-322"><a href="#Presto-322"><span class="linenos">322</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArgMin</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MIN_BY"</span><span class="p">),</span> +</span><span id="Presto-323"><a href="#Presto-323"><span class="linenos">323</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"ARRAY[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> +</span><span id="Presto-324"><a href="#Presto-324"><span class="linenos">324</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONCAT"</span><span class="p">),</span> +</span><span id="Presto-325"><a href="#Presto-325"><span class="linenos">325</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONTAINS"</span><span class="p">),</span> +</span><span id="Presto-326"><a href="#Presto-326"><span class="linenos">326</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CARDINALITY"</span><span class="p">),</span> +</span><span id="Presto-327"><a href="#Presto-327"><span class="linenos">327</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayUniqueAgg</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SET_AGG"</span><span class="p">),</span> +</span><span id="Presto-328"><a href="#Presto-328"><span class="linenos">328</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_AND(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-329"><a href="#Presto-329"><span class="linenos">329</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_LEFT(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-330"><a href="#Presto-330"><span class="linenos">330</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_NOT(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-331"><a href="#Presto-331"><span class="linenos">331</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_OR(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-332"><a href="#Presto-332"><span class="linenos">332</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_RIGHT(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-333"><a href="#Presto-333"><span class="linenos">333</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_XOR(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-334"><a href="#Presto-334"><span class="linenos">334</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">epoch_cast_to_ts</span><span class="p">]),</span> +</span><span id="Presto-335"><a href="#Presto-335"><span class="linenos">335</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="Presto-336"><a href="#Presto-336"><span class="linenos">336</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> +</span><span id="Presto-337"><a href="#Presto-337"><span class="linenos">337</span></a> <span class="s2">"DATE_ADD"</span><span class="p">,</span> +</span><span id="Presto-338"><a href="#Presto-338"><span class="linenos">338</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> +</span><span id="Presto-339"><a href="#Presto-339"><span class="linenos">339</span></a> <span class="n">_to_int</span><span class="p">(</span> +</span><span id="Presto-340"><a href="#Presto-340"><span class="linenos">340</span></a> <span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="Presto-341"><a href="#Presto-341"><span class="linenos">341</span></a> <span class="p">),</span> +</span><span id="Presto-342"><a href="#Presto-342"><span class="linenos">342</span></a> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="Presto-343"><a href="#Presto-343"><span class="linenos">343</span></a> <span class="p">),</span> +</span><span id="Presto-344"><a href="#Presto-344"><span class="linenos">344</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> +</span><span id="Presto-345"><a href="#Presto-345"><span class="linenos">345</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> <span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span> +</span><span id="Presto-346"><a href="#Presto-346"><span class="linenos">346</span></a> <span class="p">),</span> +</span><span id="Presto-347"><a href="#Presto-347"><span class="linenos">347</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="Presto-348"><a href="#Presto-348"><span class="linenos">348</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_FORMAT(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">DATEINT_FORMAT</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="Presto-349"><a href="#Presto-349"><span class="linenos">349</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> +</span><span id="Presto-350"><a href="#Presto-350"><span class="linenos">350</span></a> <span class="s2">"DATE_ADD"</span><span class="p">,</span> +</span><span id="Presto-351"><a href="#Presto-351"><span class="linenos">351</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> +</span><span id="Presto-352"><a href="#Presto-352"><span class="linenos">352</span></a> <span class="n">_to_int</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expression</span> <span class="o">*</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span> +</span><span id="Presto-353"><a href="#Presto-353"><span class="linenos">353</span></a> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="Presto-354"><a href="#Presto-354"><span class="linenos">354</span></a> <span class="p">),</span> +</span><span id="Presto-355"><a href="#Presto-355"><span class="linenos">355</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">encode_decode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"FROM_UTF8"</span><span class="p">),</span> +</span><span id="Presto-356"><a href="#Presto-356"><span class="linenos">356</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_PARSE(CAST(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">DATEINT_FORMAT</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> +</span><span id="Presto-357"><a href="#Presto-357"><span class="linenos">357</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">encode_decode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"TO_UTF8"</span><span class="p">),</span> +</span><span id="Presto-358"><a href="#Presto-358"><span class="linenos">358</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FORMAT='</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">'"</span><span class="p">,</span> +</span><span id="Presto-359"><a href="#Presto-359"><span class="linenos">359</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">First</span><span class="p">:</span> <span class="n">_first_last_sql</span><span class="p">,</span> +</span><span id="Presto-360"><a href="#Presto-360"><span class="linenos">360</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FromTimeZone</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"WITH_TIMEZONE(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'zone'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AT TIME ZONE 'UTC'"</span><span class="p">,</span> +</span><span id="Presto-361"><a href="#Presto-361"><span class="linenos">361</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GetPath</span><span class="p">:</span> <span class="n">path_to_jsonpath</span><span class="p">(),</span> +</span><span id="Presto-362"><a href="#Presto-362"><span class="linenos">362</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">unalias_group</span><span class="p">]),</span> +</span><span id="Presto-363"><a href="#Presto-363"><span class="linenos">363</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> +</span><span id="Presto-364"><a href="#Presto-364"><span class="linenos">364</span></a> <span class="s2">"ARRAY_JOIN"</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">"ARRAY_AGG"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> <span class="n">e</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">"separator"</span><span class="p">)</span> +</span><span id="Presto-365"><a href="#Presto-365"><span class="linenos">365</span></a> <span class="p">),</span> +</span><span id="Presto-366"><a href="#Presto-366"><span class="linenos">366</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_HEX"</span><span class="p">),</span> +</span><span id="Presto-367"><a href="#Presto-367"><span class="linenos">367</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">(),</span> +</span><span id="Presto-368"><a href="#Presto-368"><span class="linenos">368</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="Presto-369"><a href="#Presto-369"><span class="linenos">369</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Initcap</span><span class="p">:</span> <span class="n">_initcap_sql</span><span class="p">,</span> +</span><span id="Presto-370"><a href="#Presto-370"><span class="linenos">370</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ParseJSON</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"JSON_PARSE"</span><span class="p">),</span> +</span><span id="Presto-371"><a href="#Presto-371"><span class="linenos">371</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Last</span><span class="p">:</span> <span class="n">_first_last_sql</span><span class="p">,</span> +</span><span id="Presto-372"><a href="#Presto-372"><span class="linenos">372</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LastDay</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</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">"LAST_DAY_OF_MONTH"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> +</span><span id="Presto-373"><a href="#Presto-373"><span class="linenos">373</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">:</span> <span class="n">_explode_to_unnest_sql</span><span class="p">,</span> +</span><span id="Presto-374"><a href="#Presto-374"><span class="linenos">374</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Left</span><span class="p">:</span> <span class="n">left_to_substring_sql</span><span class="p">,</span> +</span><span id="Presto-375"><a href="#Presto-375"><span class="linenos">375</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LEVENSHTEIN_DISTANCE"</span><span class="p">),</span> +</span><span id="Presto-376"><a href="#Presto-376"><span class="linenos">376</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalAnd</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_AND"</span><span class="p">),</span> +</span><span id="Presto-377"><a href="#Presto-377"><span class="linenos">377</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="Presto-378"><a href="#Presto-378"><span class="linenos">378</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">:</span> <span class="n">no_pivot_sql</span><span class="p">,</span> +</span><span id="Presto-379"><a href="#Presto-379"><span class="linenos">379</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="n">_quantile_sql</span><span class="p">,</span> +</span><span id="Presto-380"><a href="#Presto-380"><span class="linenos">380</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpExtract</span><span class="p">:</span> <span class="n">regexp_extract_sql</span><span class="p">,</span> +</span><span id="Presto-381"><a href="#Presto-381"><span class="linenos">381</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Right</span><span class="p">:</span> <span class="n">right_to_substring_sql</span><span class="p">,</span> +</span><span id="Presto-382"><a href="#Presto-382"><span class="linenos">382</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="Presto-383"><a href="#Presto-383"><span class="linenos">383</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">:</span> <span class="n">_schema_sql</span><span class="p">,</span> +</span><span id="Presto-384"><a href="#Presto-384"><span class="linenos">384</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SchemaCommentProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="Presto-385"><a href="#Presto-385"><span class="linenos">385</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> +</span><span id="Presto-386"><a href="#Presto-386"><span class="linenos">386</span></a> <span class="p">[</span> +</span><span id="Presto-387"><a href="#Presto-387"><span class="linenos">387</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_qualify</span><span class="p">,</span> +</span><span id="Presto-388"><a href="#Presto-388"><span class="linenos">388</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">,</span> +</span><span id="Presto-389"><a href="#Presto-389"><span class="linenos">389</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">explode_to_unnest</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> +</span><span id="Presto-390"><a href="#Presto-390"><span class="linenos">390</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_semi_and_anti_joins</span><span class="p">,</span> +</span><span id="Presto-391"><a href="#Presto-391"><span class="linenos">391</span></a> <span class="p">]</span> +</span><span id="Presto-392"><a href="#Presto-392"><span class="linenos">392</span></a> <span class="p">),</span> +</span><span id="Presto-393"><a href="#Presto-393"><span class="linenos">393</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="p">:</span> <span class="n">_no_sort_array</span><span class="p">,</span> +</span><span id="Presto-394"><a href="#Presto-394"><span class="linenos">394</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRPOS"</span><span class="p">),</span> +</span><span id="Presto-395"><a href="#Presto-395"><span class="linenos">395</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="Presto-396"><a href="#Presto-396"><span class="linenos">396</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToMap</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SPLIT_TO_MAP"</span><span class="p">),</span> +</span><span id="Presto-397"><a href="#Presto-397"><span class="linenos">397</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time_sql</span><span class="p">,</span> +</span><span id="Presto-398"><a href="#Presto-398"><span class="linenos">398</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="Presto-399"><a href="#Presto-399"><span class="linenos">399</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">:</span> <span class="n">struct_extract_sql</span><span class="p">,</span> +</span><span id="Presto-400"><a href="#Presto-400"><span class="linenos">400</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">_unnest_sequence</span><span class="p">]),</span> +</span><span id="Presto-401"><a href="#Presto-401"><span class="linenos">401</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Timestamp</span><span class="p">:</span> <span class="n">no_timestamp_sql</span><span class="p">,</span> +</span><span id="Presto-402"><a href="#Presto-402"><span class="linenos">402</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampTrunc</span><span class="p">:</span> <span class="n">timestamptrunc_sql</span><span class="p">,</span> +</span><span id="Presto-403"><a href="#Presto-403"><span class="linenos">403</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Presto-404"><a href="#Presto-404"><span class="linenos">404</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Presto-405"><a href="#Presto-405"><span class="linenos">405</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">TIME_FORMAT</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="Presto-406"><a href="#Presto-406"><span class="linenos">406</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-407"><a href="#Presto-407"><span class="linenos">407</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_UNIXTIME"</span><span class="p">),</span> +</span><span id="Presto-408"><a href="#Presto-408"><span class="linenos">408</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ToChar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-409"><a href="#Presto-409"><span class="linenos">409</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">epoch_cast_to_ts</span><span class="p">]),</span> +</span><span id="Presto-410"><a href="#Presto-410"><span class="linenos">410</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="Presto-411"><a href="#Presto-411"><span class="linenos">411</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">_ts_or_ds_add_sql</span><span class="p">,</span> +</span><span id="Presto-412"><a href="#Presto-412"><span class="linenos">412</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">:</span> <span class="n">_ts_or_ds_diff_sql</span><span class="p">,</span> +</span><span id="Presto-413"><a href="#Presto-413"><span class="linenos">413</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> +</span><span id="Presto-414"><a href="#Presto-414"><span class="linenos">414</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_HEX"</span><span class="p">),</span> +</span><span id="Presto-415"><a href="#Presto-415"><span class="linenos">415</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(FROM_UNIXTIME(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-416"><a href="#Presto-416"><span class="linenos">416</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">_unix_to_time_sql</span><span class="p">,</span> +</span><span id="Presto-417"><a href="#Presto-417"><span class="linenos">417</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(FROM_UNIXTIME(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS VARCHAR)"</span><span class="p">,</span> +</span><span id="Presto-418"><a href="#Presto-418"><span class="linenos">418</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> +</span><span id="Presto-419"><a href="#Presto-419"><span class="linenos">419</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">add_recursive_cte_column_names</span><span class="p">]),</span> +</span><span id="Presto-420"><a href="#Presto-420"><span class="linenos">420</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WithinGroup</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> +</span><span id="Presto-421"><a href="#Presto-421"><span class="linenos">421</span></a> <span class="p">[</span><span class="n">transforms</span><span class="o">.</span><span class="n">remove_within_group_for_percentiles</span><span class="p">]</span> +</span><span id="Presto-422"><a href="#Presto-422"><span class="linenos">422</span></a> <span class="p">),</span> +</span><span id="Presto-423"><a href="#Presto-423"><span class="linenos">423</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-424"><a href="#Presto-424"><span class="linenos">424</span></a> <span class="p">}</span> +</span><span id="Presto-425"><a href="#Presto-425"><span class="linenos">425</span></a> +</span><span id="Presto-426"><a href="#Presto-426"><span class="linenos">426</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto-427"><a href="#Presto-427"><span class="linenos">427</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">"safe"</span><span class="p">):</span> +</span><span id="Presto-428"><a href="#Presto-428"><span class="linenos">428</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-429"><a href="#Presto-429"><span class="linenos">429</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">,</span> +</span><span id="Presto-430"><a href="#Presto-430"><span class="linenos">430</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="Presto-431"><a href="#Presto-431"><span class="linenos">431</span></a> <span class="n">seq_get</span><span class="p">(</span> +</span><span id="Presto-432"><a href="#Presto-432"><span class="linenos">432</span></a> <span class="n">apply_index_offset</span><span class="p">(</span> +</span><span id="Presto-433"><a href="#Presto-433"><span class="linenos">433</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="Presto-434"><a href="#Presto-434"><span class="linenos">434</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Presto-435"><a href="#Presto-435"><span class="linenos">435</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">"offset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Presto-436"><a href="#Presto-436"><span class="linenos">436</span></a> <span class="p">),</span> +</span><span id="Presto-437"><a href="#Presto-437"><span class="linenos">437</span></a> <span class="mi">0</span><span class="p">,</span> +</span><span id="Presto-438"><a href="#Presto-438"><span class="linenos">438</span></a> <span class="p">),</span> +</span><span id="Presto-439"><a href="#Presto-439"><span class="linenos">439</span></a> <span class="p">)</span> +</span><span id="Presto-440"><a href="#Presto-440"><span class="linenos">440</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-441"><a href="#Presto-441"><span class="linenos">441</span></a> +</span><span id="Presto-442"><a href="#Presto-442"><span class="linenos">442</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto-443"><a href="#Presto-443"><span class="linenos">443</span></a> <span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEY_VALUE_DEFINITIONS</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</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-444"><a href="#Presto-444"><span class="linenos">444</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Struct with key-value definitions is unsupported."</span><span class="p">)</span> +</span><span id="Presto-445"><a href="#Presto-445"><span class="linenos">445</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><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">return</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ROW"</span><span class="p">)(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="Presto-448"><a href="#Presto-448"><span class="linenos">448</span></a> +</span><span id="Presto-449"><a href="#Presto-449"><span class="linenos">449</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto-450"><a href="#Presto-450"><span class="linenos">450</span></a> <span class="n">unit</span> <span class="o">=</span> <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">"unit"</span><span class="p">)</span> +</span><span id="Presto-451"><a href="#Presto-451"><span class="linenos">451</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">unit</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"WEEK"</span><span class="p">):</span> +</span><span id="Presto-452"><a href="#Presto-452"><span class="linenos">452</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</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 '7' DAY)"</span> +</span><span id="Presto-453"><a href="#Presto-453"><span class="linenos">453</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-454"><a href="#Presto-454"><span class="linenos">454</span></a> +</span><span id="Presto-455"><a href="#Presto-455"><span class="linenos">455</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto-456"><a href="#Presto-456"><span class="linenos">456</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">"modes"</span><span class="p">)</span> +</span><span id="Presto-457"><a href="#Presto-457"><span class="linenos">457</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="s1">', '</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">"</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Presto-458"><a href="#Presto-458"><span class="linenos">458</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">"</span> </span><span id="Presto-459"><a href="#Presto-459"><span class="linenos">459</span></a> -</span><span id="Presto-460"><a href="#Presto-460"><span class="linenos">460</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto-461"><a href="#Presto-461"><span class="linenos">461</span></a> <span class="n">unit</span> <span class="o">=</span> <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">"unit"</span><span class="p">)</span> -</span><span id="Presto-462"><a href="#Presto-462"><span class="linenos">462</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">unit</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"WEEK"</span><span class="p">):</span> -</span><span id="Presto-463"><a href="#Presto-463"><span class="linenos">463</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</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 '7' DAY)"</span> -</span><span id="Presto-464"><a href="#Presto-464"><span class="linenos">464</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-465"><a href="#Presto-465"><span class="linenos">465</span></a> -</span><span id="Presto-466"><a href="#Presto-466"><span class="linenos">466</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto-467"><a href="#Presto-467"><span class="linenos">467</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">"modes"</span><span class="p">)</span> -</span><span id="Presto-468"><a href="#Presto-468"><span class="linenos">468</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="s1">', '</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">"</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">""</span> -</span><span id="Presto-469"><a href="#Presto-469"><span class="linenos">469</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">"</span> -</span><span id="Presto-470"><a href="#Presto-470"><span class="linenos">470</span></a> -</span><span id="Presto-471"><a href="#Presto-471"><span class="linenos">471</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto-472"><a href="#Presto-472"><span class="linenos">472</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">"start"</span><span class="p">]</span> -</span><span id="Presto-473"><a href="#Presto-473"><span class="linenos">473</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">"end"</span><span class="p">]</span> -</span><span id="Presto-474"><a href="#Presto-474"><span class="linenos">474</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">"step"</span><span class="p">)</span> -</span><span id="Presto-475"><a href="#Presto-475"><span class="linenos">475</span></a> -</span><span id="Presto-476"><a href="#Presto-476"><span class="linenos">476</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-477"><a href="#Presto-477"><span class="linenos">477</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-478"><a href="#Presto-478"><span class="linenos">478</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-479"><a href="#Presto-479"><span class="linenos">479</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-480"><a href="#Presto-480"><span class="linenos">480</span></a> <span class="k">else</span><span class="p">:</span> -</span><span id="Presto-481"><a href="#Presto-481"><span class="linenos">481</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="Presto-482"><a href="#Presto-482"><span class="linenos">482</span></a> -</span><span id="Presto-483"><a href="#Presto-483"><span class="linenos">483</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">"timestamp"</span><span class="p">):</span> -</span><span id="Presto-484"><a href="#Presto-484"><span class="linenos">484</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-485"><a href="#Presto-485"><span class="linenos">485</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-486"><a href="#Presto-486"><span class="linenos">486</span></a> <span class="k">else</span><span class="p">:</span> -</span><span id="Presto-487"><a href="#Presto-487"><span class="linenos">487</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-488"><a href="#Presto-488"><span class="linenos">488</span></a> -</span><span id="Presto-489"><a href="#Presto-489"><span class="linenos">489</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">"SEQUENCE"</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-490"><a href="#Presto-490"><span class="linenos">490</span></a> -</span><span id="Presto-491"><a href="#Presto-491"><span class="linenos">491</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span> -</span><span id="Presto-492"><a href="#Presto-492"><span class="linenos">492</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-493"><a href="#Presto-493"><span class="linenos">493</span></a> <span class="p">)</span> <span class="o">-></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-494"><a href="#Presto-494"><span class="linenos">494</span></a> <span class="k">return</span> <span class="p">[</span> -</span><span id="Presto-495"><a href="#Presto-495"><span class="linenos">495</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">"offset"</span><span class="p">),</span> -</span><span id="Presto-496"><a href="#Presto-496"><span class="linenos">496</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-497"><a href="#Presto-497"><span class="linenos">497</span></a> <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">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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto-500"><a href="#Presto-500"><span class="linenos">500</span></a><span class="w"> </span><span class="sd">"""</span> -</span><span id="Presto-501"><a href="#Presto-501"><span class="linenos">501</span></a><span class="sd"> Presto doesn't support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span> -</span><span id="Presto-502"><a href="#Presto-502"><span class="linenos">502</span></a><span class="sd"> so we need to remove them</span> -</span><span id="Presto-503"><a href="#Presto-503"><span class="linenos">503</span></a><span class="sd"> """</span> -</span><span id="Presto-504"><a href="#Presto-504"><span class="linenos">504</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">"kind"</span><span class="p">]</span> -</span><span id="Presto-505"><a href="#Presto-505"><span class="linenos">505</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-506"><a href="#Presto-506"><span class="linenos">506</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"VIEW"</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-507"><a href="#Presto-507"><span class="linenos">507</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">"expressions"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> -</span><span id="Presto-508"><a href="#Presto-508"><span class="linenos">508</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-460"><a href="#Presto-460"><span class="linenos">460</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto-461"><a href="#Presto-461"><span class="linenos">461</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">"start"</span><span class="p">]</span> +</span><span id="Presto-462"><a href="#Presto-462"><span class="linenos">462</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">"end"</span><span class="p">]</span> +</span><span id="Presto-463"><a href="#Presto-463"><span class="linenos">463</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">"step"</span><span class="p">)</span> +</span><span id="Presto-464"><a href="#Presto-464"><span class="linenos">464</span></a> +</span><span id="Presto-465"><a href="#Presto-465"><span class="linenos">465</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-466"><a href="#Presto-466"><span class="linenos">466</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-467"><a href="#Presto-467"><span class="linenos">467</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-468"><a href="#Presto-468"><span class="linenos">468</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-469"><a href="#Presto-469"><span class="linenos">469</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Presto-470"><a href="#Presto-470"><span class="linenos">470</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Presto-471"><a href="#Presto-471"><span class="linenos">471</span></a> +</span><span id="Presto-472"><a href="#Presto-472"><span class="linenos">472</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">"timestamp"</span><span class="p">):</span> +</span><span id="Presto-473"><a href="#Presto-473"><span class="linenos">473</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-474"><a href="#Presto-474"><span class="linenos">474</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-475"><a href="#Presto-475"><span class="linenos">475</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Presto-476"><a href="#Presto-476"><span class="linenos">476</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-477"><a href="#Presto-477"><span class="linenos">477</span></a> +</span><span id="Presto-478"><a href="#Presto-478"><span class="linenos">478</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">"SEQUENCE"</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-479"><a href="#Presto-479"><span class="linenos">479</span></a> +</span><span id="Presto-480"><a href="#Presto-480"><span class="linenos">480</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span> +</span><span id="Presto-481"><a href="#Presto-481"><span class="linenos">481</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-482"><a href="#Presto-482"><span class="linenos">482</span></a> <span class="p">)</span> <span class="o">-></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-483"><a href="#Presto-483"><span class="linenos">483</span></a> <span class="k">return</span> <span class="p">[</span> +</span><span id="Presto-484"><a href="#Presto-484"><span class="linenos">484</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">"offset"</span><span class="p">),</span> +</span><span id="Presto-485"><a href="#Presto-485"><span class="linenos">485</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-486"><a href="#Presto-486"><span class="linenos">486</span></a> <span class="p">]</span> +</span><span id="Presto-487"><a href="#Presto-487"><span class="linenos">487</span></a> +</span><span id="Presto-488"><a href="#Presto-488"><span class="linenos">488</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto-489"><a href="#Presto-489"><span class="linenos">489</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Presto-490"><a href="#Presto-490"><span class="linenos">490</span></a><span class="sd"> Presto doesn't support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span> +</span><span id="Presto-491"><a href="#Presto-491"><span class="linenos">491</span></a><span class="sd"> so we need to remove them</span> +</span><span id="Presto-492"><a href="#Presto-492"><span class="linenos">492</span></a><span class="sd"> """</span> +</span><span id="Presto-493"><a href="#Presto-493"><span class="linenos">493</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">"kind"</span><span class="p">]</span> +</span><span id="Presto-494"><a href="#Presto-494"><span class="linenos">494</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-495"><a href="#Presto-495"><span class="linenos">495</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"VIEW"</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-496"><a href="#Presto-496"><span class="linenos">496</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">"expressions"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Presto-497"><a href="#Presto-497"><span class="linenos">497</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> @@ -1495,21 +1487,21 @@ True means <code>a / b</code> is integer division if both <code>a</code> and <co </div> <a class="headerlink" href="#Presto.Tokenizer"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Tokenizer-227"><a href="#Presto.Tokenizer-227"><span class="linenos">227</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> -</span><span id="Presto.Tokenizer-228"><a href="#Presto.Tokenizer-228"><span class="linenos">228</span></a> <span class="n">UNICODE_STRINGS</span> <span class="o">=</span> <span class="p">[</span> -</span><span id="Presto.Tokenizer-229"><a href="#Presto.Tokenizer-229"><span class="linenos">229</span></a> <span class="p">(</span><span class="n">prefix</span> <span class="o">+</span> <span class="n">q</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span> -</span><span id="Presto.Tokenizer-230"><a href="#Presto.Tokenizer-230"><span class="linenos">230</span></a> <span class="k">for</span> <span class="n">q</span> <span class="ow">in</span> <span class="n">t</span><span class="o">.</span><span class="n">cast</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="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">QUOTES</span><span class="p">)</span> -</span><span id="Presto.Tokenizer-231"><a href="#Presto.Tokenizer-231"><span class="linenos">231</span></a> <span class="k">for</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"U&"</span><span class="p">,</span> <span class="s2">"u&"</span><span class="p">)</span> -</span><span id="Presto.Tokenizer-232"><a href="#Presto.Tokenizer-232"><span class="linenos">232</span></a> <span class="p">]</span> -</span><span id="Presto.Tokenizer-233"><a href="#Presto.Tokenizer-233"><span class="linenos">233</span></a> -</span><span id="Presto.Tokenizer-234"><a href="#Presto.Tokenizer-234"><span class="linenos">234</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Presto.Tokenizer-235"><a href="#Presto.Tokenizer-235"><span class="linenos">235</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> -</span><span id="Presto.Tokenizer-236"><a href="#Presto.Tokenizer-236"><span class="linenos">236</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> -</span><span id="Presto.Tokenizer-237"><a href="#Presto.Tokenizer-237"><span class="linenos">237</span></a> <span class="s2">"MATCH_RECOGNIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">,</span> -</span><span id="Presto.Tokenizer-238"><a href="#Presto.Tokenizer-238"><span class="linenos">238</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> -</span><span id="Presto.Tokenizer-239"><a href="#Presto.Tokenizer-239"><span class="linenos">239</span></a> <span class="s2">"IPADDRESS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IPADDRESS</span><span class="p">,</span> -</span><span id="Presto.Tokenizer-240"><a href="#Presto.Tokenizer-240"><span class="linenos">240</span></a> <span class="s2">"IPPREFIX"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IPPREFIX</span><span class="p">,</span> -</span><span id="Presto.Tokenizer-241"><a href="#Presto.Tokenizer-241"><span class="linenos">241</span></a> <span class="p">}</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Tokenizer-213"><a href="#Presto.Tokenizer-213"><span class="linenos">213</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Presto.Tokenizer-214"><a href="#Presto.Tokenizer-214"><span class="linenos">214</span></a> <span class="n">UNICODE_STRINGS</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="Presto.Tokenizer-215"><a href="#Presto.Tokenizer-215"><span class="linenos">215</span></a> <span class="p">(</span><span class="n">prefix</span> <span class="o">+</span> <span class="n">q</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span> +</span><span id="Presto.Tokenizer-216"><a href="#Presto.Tokenizer-216"><span class="linenos">216</span></a> <span class="k">for</span> <span class="n">q</span> <span class="ow">in</span> <span class="n">t</span><span class="o">.</span><span class="n">cast</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="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">QUOTES</span><span class="p">)</span> +</span><span id="Presto.Tokenizer-217"><a href="#Presto.Tokenizer-217"><span class="linenos">217</span></a> <span class="k">for</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"U&"</span><span class="p">,</span> <span class="s2">"u&"</span><span class="p">)</span> +</span><span id="Presto.Tokenizer-218"><a href="#Presto.Tokenizer-218"><span class="linenos">218</span></a> <span class="p">]</span> +</span><span id="Presto.Tokenizer-219"><a href="#Presto.Tokenizer-219"><span class="linenos">219</span></a> +</span><span id="Presto.Tokenizer-220"><a href="#Presto.Tokenizer-220"><span class="linenos">220</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto.Tokenizer-221"><a href="#Presto.Tokenizer-221"><span class="linenos">221</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="Presto.Tokenizer-222"><a href="#Presto.Tokenizer-222"><span class="linenos">222</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="Presto.Tokenizer-223"><a href="#Presto.Tokenizer-223"><span class="linenos">223</span></a> <span class="s2">"MATCH_RECOGNIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">,</span> +</span><span id="Presto.Tokenizer-224"><a href="#Presto.Tokenizer-224"><span class="linenos">224</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> +</span><span id="Presto.Tokenizer-225"><a href="#Presto.Tokenizer-225"><span class="linenos">225</span></a> <span class="s2">"IPADDRESS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IPADDRESS</span><span class="p">,</span> +</span><span id="Presto.Tokenizer-226"><a href="#Presto.Tokenizer-226"><span class="linenos">226</span></a> <span class="s2">"IPPREFIX"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IPPREFIX</span><span class="p">,</span> +</span><span id="Presto.Tokenizer-227"><a href="#Presto.Tokenizer-227"><span class="linenos">227</span></a> <span class="p">}</span> </span></pre></div> @@ -1585,59 +1577,61 @@ True means <code>a / b</code> is integer division if both <code>a</code> and <co </div> <a class="headerlink" href="#Presto.Parser"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Parser-243"><a href="#Presto.Parser-243"><span class="linenos">243</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> -</span><span id="Presto.Parser-244"><a href="#Presto.Parser-244"><span class="linenos">244</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Presto.Parser-245"><a href="#Presto.Parser-245"><span class="linenos">245</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> -</span><span id="Presto.Parser-246"><a href="#Presto.Parser-246"><span class="linenos">246</span></a> <span class="s2">"ARBITRARY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto.Parser-247"><a href="#Presto.Parser-247"><span class="linenos">247</span></a> <span class="s2">"APPROX_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto.Parser-248"><a href="#Presto.Parser-248"><span class="linenos">248</span></a> <span class="s2">"APPROX_PERCENTILE"</span><span class="p">:</span> <span class="n">_approx_percentile</span><span class="p">,</span> -</span><span id="Presto.Parser-249"><a href="#Presto.Parser-249"><span class="linenos">249</span></a> <span class="s2">"BITWISE_AND"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">),</span> -</span><span id="Presto.Parser-250"><a href="#Presto.Parser-250"><span class="linenos">250</span></a> <span class="s2">"BITWISE_NOT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> -</span><span id="Presto.Parser-251"><a href="#Presto.Parser-251"><span class="linenos">251</span></a> <span class="s2">"BITWISE_OR"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">),</span> -</span><span id="Presto.Parser-252"><a href="#Presto.Parser-252"><span class="linenos">252</span></a> <span class="s2">"BITWISE_XOR"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">),</span> -</span><span id="Presto.Parser-253"><a href="#Presto.Parser-253"><span class="linenos">253</span></a> <span class="s2">"CARDINALITY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto.Parser-254"><a href="#Presto.Parser-254"><span class="linenos">254</span></a> <span class="s2">"CONTAINS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto.Parser-255"><a href="#Presto.Parser-255"><span class="linenos">255</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">(</span> -</span><span id="Presto.Parser-256"><a href="#Presto.Parser-256"><span class="linenos">256</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Parser-229"><a href="#Presto.Parser-229"><span class="linenos">229</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Presto.Parser-230"><a href="#Presto.Parser-230"><span class="linenos">230</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto.Parser-231"><a href="#Presto.Parser-231"><span class="linenos">231</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="Presto.Parser-232"><a href="#Presto.Parser-232"><span class="linenos">232</span></a> <span class="s2">"ARBITRARY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-233"><a href="#Presto.Parser-233"><span class="linenos">233</span></a> <span class="s2">"APPROX_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-234"><a href="#Presto.Parser-234"><span class="linenos">234</span></a> <span class="s2">"APPROX_PERCENTILE"</span><span class="p">:</span> <span class="n">_approx_percentile</span><span class="p">,</span> +</span><span id="Presto.Parser-235"><a href="#Presto.Parser-235"><span class="linenos">235</span></a> <span class="s2">"BITWISE_AND"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">),</span> +</span><span id="Presto.Parser-236"><a href="#Presto.Parser-236"><span class="linenos">236</span></a> <span class="s2">"BITWISE_NOT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Presto.Parser-237"><a href="#Presto.Parser-237"><span class="linenos">237</span></a> <span class="s2">"BITWISE_OR"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">),</span> +</span><span id="Presto.Parser-238"><a href="#Presto.Parser-238"><span class="linenos">238</span></a> <span class="s2">"BITWISE_XOR"</span><span class="p">:</span> <span class="n">binary_from_function</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">),</span> +</span><span id="Presto.Parser-239"><a href="#Presto.Parser-239"><span class="linenos">239</span></a> <span class="s2">"CARDINALITY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-240"><a href="#Presto.Parser-240"><span class="linenos">240</span></a> <span class="s2">"CONTAINS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-241"><a href="#Presto.Parser-241"><span class="linenos">241</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">(</span> +</span><span id="Presto.Parser-242"><a href="#Presto.Parser-242"><span class="linenos">242</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="Presto.Parser-243"><a href="#Presto.Parser-243"><span class="linenos">243</span></a> <span class="p">),</span> +</span><span id="Presto.Parser-244"><a href="#Presto.Parser-244"><span class="linenos">244</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">(</span> +</span><span id="Presto.Parser-245"><a href="#Presto.Parser-245"><span class="linenos">245</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="Presto.Parser-246"><a href="#Presto.Parser-246"><span class="linenos">246</span></a> <span class="p">),</span> +</span><span id="Presto.Parser-247"><a href="#Presto.Parser-247"><span class="linenos">247</span></a> <span class="s2">"DATE_FORMAT"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> +</span><span id="Presto.Parser-248"><a href="#Presto.Parser-248"><span class="linenos">248</span></a> <span class="s2">"DATE_PARSE"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> +</span><span id="Presto.Parser-249"><a href="#Presto.Parser-249"><span class="linenos">249</span></a> <span class="s2">"DATE_TRUNC"</span><span class="p">:</span> <span class="n">date_trunc_to_time</span><span class="p">,</span> +</span><span id="Presto.Parser-250"><a href="#Presto.Parser-250"><span class="linenos">250</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">(</span> +</span><span id="Presto.Parser-251"><a href="#Presto.Parser-251"><span class="linenos">251</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)],</span> <span class="n">offset</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">safe</span><span class="o">=</span><span class="kc">True</span> +</span><span id="Presto.Parser-252"><a href="#Presto.Parser-252"><span class="linenos">252</span></a> <span class="p">),</span> +</span><span id="Presto.Parser-253"><a href="#Presto.Parser-253"><span class="linenos">253</span></a> <span class="s2">"FROM_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-254"><a href="#Presto.Parser-254"><span class="linenos">254</span></a> <span class="s2">"FROM_UNIXTIME"</span><span class="p">:</span> <span class="n">_from_unixtime</span><span class="p">,</span> +</span><span id="Presto.Parser-255"><a href="#Presto.Parser-255"><span class="linenos">255</span></a> <span class="s2">"FROM_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">(</span> +</span><span id="Presto.Parser-256"><a href="#Presto.Parser-256"><span class="linenos">256</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">replace</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> </span><span id="Presto.Parser-257"><a href="#Presto.Parser-257"><span class="linenos">257</span></a> <span class="p">),</span> -</span><span id="Presto.Parser-258"><a href="#Presto.Parser-258"><span class="linenos">258</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">(</span> -</span><span id="Presto.Parser-259"><a href="#Presto.Parser-259"><span class="linenos">259</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> -</span><span id="Presto.Parser-260"><a href="#Presto.Parser-260"><span class="linenos">260</span></a> <span class="p">),</span> -</span><span id="Presto.Parser-261"><a href="#Presto.Parser-261"><span class="linenos">261</span></a> <span class="s2">"DATE_FORMAT"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> -</span><span id="Presto.Parser-262"><a href="#Presto.Parser-262"><span class="linenos">262</span></a> <span class="s2">"DATE_PARSE"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> -</span><span id="Presto.Parser-263"><a href="#Presto.Parser-263"><span class="linenos">263</span></a> <span class="s2">"DATE_TRUNC"</span><span class="p">:</span> <span class="n">date_trunc_to_time</span><span class="p">,</span> -</span><span id="Presto.Parser-264"><a href="#Presto.Parser-264"><span class="linenos">264</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">:</span> <span class="n">_parse_element_at</span><span class="p">,</span> -</span><span id="Presto.Parser-265"><a href="#Presto.Parser-265"><span class="linenos">265</span></a> <span class="s2">"FROM_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto.Parser-266"><a href="#Presto.Parser-266"><span class="linenos">266</span></a> <span class="s2">"FROM_UNIXTIME"</span><span class="p">:</span> <span class="n">_from_unixtime</span><span class="p">,</span> -</span><span id="Presto.Parser-267"><a href="#Presto.Parser-267"><span class="linenos">267</span></a> <span class="s2">"FROM_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">(</span> -</span><span id="Presto.Parser-268"><a href="#Presto.Parser-268"><span class="linenos">268</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">replace</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> -</span><span id="Presto.Parser-269"><a href="#Presto.Parser-269"><span class="linenos">269</span></a> <span class="p">),</span> -</span><span id="Presto.Parser-270"><a href="#Presto.Parser-270"><span class="linenos">270</span></a> <span class="s2">"NOW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto.Parser-271"><a href="#Presto.Parser-271"><span class="linenos">271</span></a> <span class="s2">"REGEXP_EXTRACT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpExtract</span><span class="p">(</span> -</span><span id="Presto.Parser-272"><a href="#Presto.Parser-272"><span class="linenos">272</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">group</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> +</span><span id="Presto.Parser-258"><a href="#Presto.Parser-258"><span class="linenos">258</span></a> <span class="s2">"NOW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-259"><a href="#Presto.Parser-259"><span class="linenos">259</span></a> <span class="s2">"REGEXP_EXTRACT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpExtract</span><span class="p">(</span> +</span><span id="Presto.Parser-260"><a href="#Presto.Parser-260"><span class="linenos">260</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">group</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> +</span><span id="Presto.Parser-261"><a href="#Presto.Parser-261"><span class="linenos">261</span></a> <span class="p">),</span> +</span><span id="Presto.Parser-262"><a href="#Presto.Parser-262"><span class="linenos">262</span></a> <span class="s2">"REGEXP_REPLACE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpReplace</span><span class="p">(</span> +</span><span id="Presto.Parser-263"><a href="#Presto.Parser-263"><span class="linenos">263</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Presto.Parser-264"><a href="#Presto.Parser-264"><span class="linenos">264</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Presto.Parser-265"><a href="#Presto.Parser-265"><span class="linenos">265</span></a> <span class="n">replacement</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">""</span><span class="p">),</span> +</span><span id="Presto.Parser-266"><a href="#Presto.Parser-266"><span class="linenos">266</span></a> <span class="p">),</span> +</span><span id="Presto.Parser-267"><a href="#Presto.Parser-267"><span class="linenos">267</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-268"><a href="#Presto.Parser-268"><span class="linenos">268</span></a> <span class="s2">"SEQUENCE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-269"><a href="#Presto.Parser-269"><span class="linenos">269</span></a> <span class="s2">"SET_AGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayUniqueAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-270"><a href="#Presto.Parser-270"><span class="linenos">270</span></a> <span class="s2">"SPLIT_TO_MAP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToMap</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-271"><a href="#Presto.Parser-271"><span class="linenos">271</span></a> <span class="s2">"STRPOS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> +</span><span id="Presto.Parser-272"><a href="#Presto.Parser-272"><span class="linenos">272</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">instance</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> </span><span id="Presto.Parser-273"><a href="#Presto.Parser-273"><span class="linenos">273</span></a> <span class="p">),</span> -</span><span id="Presto.Parser-274"><a href="#Presto.Parser-274"><span class="linenos">274</span></a> <span class="s2">"REGEXP_REPLACE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpReplace</span><span class="p">(</span> -</span><span id="Presto.Parser-275"><a href="#Presto.Parser-275"><span class="linenos">275</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> -</span><span id="Presto.Parser-276"><a href="#Presto.Parser-276"><span class="linenos">276</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> -</span><span id="Presto.Parser-277"><a href="#Presto.Parser-277"><span class="linenos">277</span></a> <span class="n">replacement</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">""</span><span class="p">),</span> -</span><span id="Presto.Parser-278"><a href="#Presto.Parser-278"><span class="linenos">278</span></a> <span class="p">),</span> -</span><span id="Presto.Parser-279"><a href="#Presto.Parser-279"><span class="linenos">279</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto.Parser-280"><a href="#Presto.Parser-280"><span class="linenos">280</span></a> <span class="s2">"SEQUENCE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto.Parser-281"><a href="#Presto.Parser-281"><span class="linenos">281</span></a> <span class="s2">"SET_AGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayUniqueAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto.Parser-282"><a href="#Presto.Parser-282"><span class="linenos">282</span></a> <span class="s2">"SPLIT_TO_MAP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToMap</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto.Parser-283"><a href="#Presto.Parser-283"><span class="linenos">283</span></a> <span class="s2">"STRPOS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> -</span><span id="Presto.Parser-284"><a href="#Presto.Parser-284"><span class="linenos">284</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">instance</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> -</span><span id="Presto.Parser-285"><a href="#Presto.Parser-285"><span class="linenos">285</span></a> <span class="p">),</span> -</span><span id="Presto.Parser-286"><a href="#Presto.Parser-286"><span class="linenos">286</span></a> <span class="s2">"TO_CHAR"</span><span class="p">:</span> <span class="n">_parse_to_char</span><span class="p">,</span> -</span><span id="Presto.Parser-287"><a href="#Presto.Parser-287"><span class="linenos">287</span></a> <span class="s2">"TO_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto.Parser-288"><a href="#Presto.Parser-288"><span class="linenos">288</span></a> <span class="s2">"TO_UNIXTIME"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Presto.Parser-289"><a href="#Presto.Parser-289"><span class="linenos">289</span></a> <span class="s2">"TO_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">(</span> -</span><span id="Presto.Parser-290"><a href="#Presto.Parser-290"><span class="linenos">290</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> -</span><span id="Presto.Parser-291"><a href="#Presto.Parser-291"><span class="linenos">291</span></a> <span class="p">),</span> -</span><span id="Presto.Parser-292"><a href="#Presto.Parser-292"><span class="linenos">292</span></a> <span class="p">}</span> -</span><span id="Presto.Parser-293"><a href="#Presto.Parser-293"><span class="linenos">293</span></a> -</span><span id="Presto.Parser-294"><a href="#Presto.Parser-294"><span class="linenos">294</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> -</span><span id="Presto.Parser-295"><a href="#Presto.Parser-295"><span class="linenos">295</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span><span id="Presto.Parser-274"><a href="#Presto.Parser-274"><span class="linenos">274</span></a> <span class="s2">"TO_CHAR"</span><span class="p">:</span> <span class="n">_parse_to_char</span><span class="p">,</span> +</span><span id="Presto.Parser-275"><a href="#Presto.Parser-275"><span class="linenos">275</span></a> <span class="s2">"TO_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-276"><a href="#Presto.Parser-276"><span class="linenos">276</span></a> <span class="s2">"TO_UNIXTIME"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-277"><a href="#Presto.Parser-277"><span class="linenos">277</span></a> <span class="s2">"TO_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">(</span> +</span><span id="Presto.Parser-278"><a href="#Presto.Parser-278"><span class="linenos">278</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> +</span><span id="Presto.Parser-279"><a href="#Presto.Parser-279"><span class="linenos">279</span></a> <span class="p">),</span> +</span><span id="Presto.Parser-280"><a href="#Presto.Parser-280"><span class="linenos">280</span></a> <span class="p">}</span> +</span><span id="Presto.Parser-281"><a href="#Presto.Parser-281"><span class="linenos">281</span></a> +</span><span id="Presto.Parser-282"><a href="#Presto.Parser-282"><span class="linenos">282</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Presto.Parser-283"><a href="#Presto.Parser-283"><span class="linenos">283</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> </span></pre></div> @@ -1662,7 +1656,7 @@ Default: 3</li> <div class="attr variable"> <span class="name">FUNCTIONS</span> = <input id="Presto.Parser.FUNCTIONS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> - <label class="view-value-button pdoc-button" for="Presto.Parser.FUNCTIONS-view-value"></label><span class="default_value">{'ABS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Abs">sqlglot.expressions.Abs</a>'>>, 'ANONYMOUS_AGG_FUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#AnonymousAggFunc">sqlglot.expressions.AnonymousAggFunc</a>'>>, 'ANY_VALUE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#AnyValue">sqlglot.expressions.AnyValue</a>'>>, 'APPROX_DISTINCT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxDistinct">sqlglot.expressions.ApproxDistinct</a>'>>, 'APPROX_COUNT_DISTINCT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxDistinct">sqlglot.expressions.ApproxDistinct</a>'>>, 'APPROX_QUANTILE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxQuantile">sqlglot.expressions.ApproxQuantile</a>'>>, 'APPROX_TOP_K': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxTopK">sqlglot.expressions.ApproxTopK</a>'>>, 'ARG_MAX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>>, 'ARGMAX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>>, 'MAX_BY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>>, 'ARG_MIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>>, 'ARGMIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>>, 'MIN_BY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>>, 'ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Array">sqlglot.expressions.Array</a>'>>, 'ARRAY_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayAgg">sqlglot.expressions.ArrayAgg</a>'>>, 'ARRAY_ALL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayAll">sqlglot.expressions.ArrayAll</a>'>>, 'ARRAY_ANY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayAny">sqlglot.expressions.ArrayAny</a>'>>, 'ARRAY_CONCAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayConcat">sqlglot.expressions.ArrayConcat</a>'>>, 'ARRAY_CAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayConcat">sqlglot.expressions.ArrayConcat</a>'>>, 'ARRAY_CONTAINS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayContains">sqlglot.expressions.ArrayContains</a>'>>, 'FILTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayFilter">sqlglot.expressions.ArrayFilter</a>'>>, 'ARRAY_FILTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayFilter">sqlglot.expressions.ArrayFilter</a>'>>, 'ARRAY_JOIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayJoin">sqlglot.expressions.ArrayJoin</a>'>>, 'ARRAY_SIZE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySize">sqlglot.expressions.ArraySize</a>'>>, 'ARRAY_SORT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySort">sqlglot.expressions.ArraySort</a>'>>, 'ARRAY_SUM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySum">sqlglot.expressions.ArraySum</a>'>>, 'ARRAY_UNION_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayUnionAgg">sqlglot.expressions.ArrayUnionAgg</a>'>>, 'ARRAY_UNIQUE_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayUniqueAgg">sqlglot.expressions.ArrayUniqueAgg</a>'>>, 'AVG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Avg">sqlglot.expressions.Avg</a>'>>, 'CASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Case">sqlglot.expressions.Case</a>'>>, 'CAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Cast">sqlglot.expressions.Cast</a>'>>, 'CAST_TO_STR_TYPE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CastToStrType">sqlglot.expressions.CastToStrType</a>'>>, 'CEIL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Ceil">sqlglot.expressions.Ceil</a>'>>, 'CEILING': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Ceil">sqlglot.expressions.Ceil</a>'>>, 'CHR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Chr">sqlglot.expressions.Chr</a>'>>, 'CHAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Chr">sqlglot.expressions.Chr</a>'>>, 'COALESCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Coalesce">sqlglot.expressions.Coalesce</a>'>>, 'IFNULL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Coalesce">sqlglot.expressions.Coalesce</a>'>>, 'NVL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Coalesce">sqlglot.expressions.Coalesce</a>'>>, 'COLLATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Collate">sqlglot.expressions.Collate</a>'>>, 'COMBINED_AGG_FUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CombinedAggFunc">sqlglot.expressions.CombinedAggFunc</a>'>>, 'COMBINED_PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CombinedParameterizedAgg">sqlglot.expressions.CombinedParameterizedAgg</a>'>>, 'CONCAT': <function Parser.<lambda>>, 'CONCAT_WS': <function Parser.<lambda>>, 'COUNT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Count">sqlglot.expressions.Count</a>'>>, 'COUNT_IF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CountIf">sqlglot.expressions.CountIf</a>'>>, 'COUNTIF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CountIf">sqlglot.expressions.CountIf</a>'>>, 'CURRENT_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentDate">sqlglot.expressions.CurrentDate</a>'>>, 'CURRENT_DATETIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentDatetime">sqlglot.expressions.CurrentDatetime</a>'>>, 'CURRENT_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTime">sqlglot.expressions.CurrentTime</a>'>>, 'CURRENT_TIMESTAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>>, 'CURRENT_USER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentUser">sqlglot.expressions.CurrentUser</a>'>>, 'DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Date">sqlglot.expressions.Date</a>'>>, 'DATE_ADD': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'DATEDIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateDiff">sqlglot.expressions.DateDiff</a>'>>, 'DATE_DIFF': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'DATE_FROM_PARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateFromParts">sqlglot.expressions.DateFromParts</a>'>>, 'DATEFROMPARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateFromParts">sqlglot.expressions.DateFromParts</a>'>>, 'DATE_STR_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateStrToDate">sqlglot.expressions.DateStrToDate</a>'>>, 'DATE_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateSub">sqlglot.expressions.DateSub</a>'>>, 'DATE_TO_DATE_STR': <function Parser.<lambda>>, 'DATE_TO_DI': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateToDi">sqlglot.expressions.DateToDi</a>'>>, 'DATE_TRUNC': <function date_trunc_to_time>, 'DATETIME_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeAdd">sqlglot.expressions.DatetimeAdd</a>'>>, 'DATETIME_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeDiff">sqlglot.expressions.DatetimeDiff</a>'>>, 'DATETIME_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeSub">sqlglot.expressions.DatetimeSub</a>'>>, 'DATETIME_TRUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeTrunc">sqlglot.expressions.DatetimeTrunc</a>'>>, 'DAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Day">sqlglot.expressions.Day</a>'>>, 'DAY_OF_MONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfMonth">sqlglot.expressions.DayOfMonth</a>'>>, 'DAYOFMONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfMonth">sqlglot.expressions.DayOfMonth</a>'>>, 'DAY_OF_WEEK': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfWeek">sqlglot.expressions.DayOfWeek</a>'>>, 'DAYOFWEEK': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfWeek">sqlglot.expressions.DayOfWeek</a>'>>, 'DAY_OF_YEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfYear">sqlglot.expressions.DayOfYear</a>'>>, 'DAYOFYEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfYear">sqlglot.expressions.DayOfYear</a>'>>, 'DECODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Decode">sqlglot.expressions.Decode</a>'>>, 'DI_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DiToDate">sqlglot.expressions.DiToDate</a>'>>, 'ENCODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Encode">sqlglot.expressions.Encode</a>'>>, 'EXP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Exp">sqlglot.expressions.Exp</a>'>>, 'EXPLODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Explode">sqlglot.expressions.Explode</a>'>>, 'EXPLODE_OUTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ExplodeOuter">sqlglot.expressions.ExplodeOuter</a>'>>, 'EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Extract">sqlglot.expressions.Extract</a>'>>, 'FIRST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#First">sqlglot.expressions.First</a>'>>, 'FLATTEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Flatten">sqlglot.expressions.Flatten</a>'>>, 'FLOOR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Floor">sqlglot.expressions.Floor</a>'>>, 'FROM_BASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#FromBase">sqlglot.expressions.FromBase</a>'>>, 'FROM_BASE64': <bound method Func.from_arg_list of <class '<a href="../expressions.html#FromBase64">sqlglot.expressions.FromBase64</a>'>>, 'GENERATE_SERIES': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GenerateSeries">sqlglot.expressions.GenerateSeries</a>'>>, 'GET_PATH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GetPath">sqlglot.expressions.GetPath</a>'>>, 'GREATEST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Greatest">sqlglot.expressions.Greatest</a>'>>, 'GROUP_CONCAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GroupConcat">sqlglot.expressions.GroupConcat</a>'>>, 'HEX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Hex">sqlglot.expressions.Hex</a>'>>, 'HLL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Hll">sqlglot.expressions.Hll</a>'>>, 'IF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#If">sqlglot.expressions.If</a>'>>, 'INITCAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Initcap">sqlglot.expressions.Initcap</a>'>>, 'IS_INF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsInf">sqlglot.expressions.IsInf</a>'>>, 'ISINF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsInf">sqlglot.expressions.IsInf</a>'>>, 'IS_NAN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsNan">sqlglot.expressions.IsNan</a>'>>, 'ISNAN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsNan">sqlglot.expressions.IsNan</a>'>>, 'J_S_O_N_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONArray">sqlglot.expressions.JSONArray</a>'>>, 'J_S_O_N_ARRAY_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONArrayAgg">sqlglot.expressions.JSONArrayAgg</a>'>>, 'JSON_ARRAY_CONTAINS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONArrayContains">sqlglot.expressions.JSONArrayContains</a>'>>, 'JSONB_EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONBExtract">sqlglot.expressions.JSONBExtract</a>'>>, 'JSONB_EXTRACT_SCALAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONBExtractScalar">sqlglot.expressions.JSONBExtractScalar</a>'>>, 'JSON_EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONExtract">sqlglot.expressions.JSONExtract</a>'>>, 'JSON_EXTRACT_SCALAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONExtractScalar">sqlglot.expressions.JSONExtractScalar</a>'>>, 'JSON_FORMAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONFormat">sqlglot.expressions.JSONFormat</a>'>>, 'J_S_O_N_OBJECT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONObject">sqlglot.expressions.JSONObject</a>'>>, 'J_S_O_N_TABLE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONTable">sqlglot.expressions.JSONTable</a>'>>, 'LAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Last">sqlglot.expressions.Last</a>'>>, 'LAST_DAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LastDay">sqlglot.expressions.LastDay</a>'>>, 'LAST_DAY_OF_MONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LastDay">sqlglot.expressions.LastDay</a>'>>, 'LEAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Least">sqlglot.expressions.Least</a>'>>, 'LEFT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Left">sqlglot.expressions.Left</a>'>>, 'LENGTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Length">sqlglot.expressions.Length</a>'>>, 'LEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Length">sqlglot.expressions.Length</a>'>>, 'LEVENSHTEIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Levenshtein">sqlglot.expressions.Levenshtein</a>'>>, 'LN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Ln">sqlglot.expressions.Ln</a>'>>, 'LOG': <function parse_logarithm>, 'LOG10': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Log10">sqlglot.expressions.Log10</a>'>>, 'LOG2': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Log2">sqlglot.expressions.Log2</a>'>>, 'LOGICAL_AND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>>, 'BOOL_AND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>>, 'BOOLAND_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>>, 'LOGICAL_OR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>>, 'BOOL_OR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>>, 'BOOLOR_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>>, 'LOWER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Lower">sqlglot.expressions.Lower</a>'>>, 'LCASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Lower">sqlglot.expressions.Lower</a>'>>, 'MD5': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MD5">sqlglot.expressions.MD5</a>'>>, 'MD5_DIGEST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MD5Digest">sqlglot.expressions.MD5Digest</a>'>>, 'MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Map">sqlglot.expressions.Map</a>'>>, 'MAP_FROM_ENTRIES': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MapFromEntries">sqlglot.expressions.MapFromEntries</a>'>>, 'MATCH_AGAINST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MatchAgainst">sqlglot.expressions.MatchAgainst</a>'>>, 'MAX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Max">sqlglot.expressions.Max</a>'>>, 'MIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Min">sqlglot.expressions.Min</a>'>>, 'MONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Month">sqlglot.expressions.Month</a>'>>, 'MONTHS_BETWEEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MonthsBetween">sqlglot.expressions.MonthsBetween</a>'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#NextValueFor">sqlglot.expressions.NextValueFor</a>'>>, 'NULLIF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Nullif">sqlglot.expressions.Nullif</a>'>>, 'NUMBER_TO_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#NumberToStr">sqlglot.expressions.NumberToStr</a>'>>, 'NVL2': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Nvl2">sqlglot.expressions.Nvl2</a>'>>, 'OPEN_J_S_O_N': <bound method Func.from_arg_list of <class '<a href="../expressions.html#OpenJSON">sqlglot.expressions.OpenJSON</a>'>>, 'PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ParameterizedAgg">sqlglot.expressions.ParameterizedAgg</a>'>>, 'PARSE_JSON': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ParseJSON">sqlglot.expressions.ParseJSON</a>'>>, 'JSON_PARSE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ParseJSON">sqlglot.expressions.ParseJSON</a>'>>, 'PERCENTILE_CONT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#PercentileCont">sqlglot.expressions.PercentileCont</a>'>>, 'PERCENTILE_DISC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#PercentileDisc">sqlglot.expressions.PercentileDisc</a>'>>, 'POSEXPLODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Posexplode">sqlglot.expressions.Posexplode</a>'>>, 'POSEXPLODE_OUTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#PosexplodeOuter">sqlglot.expressions.PosexplodeOuter</a>'>>, 'POWER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Pow">sqlglot.expressions.Pow</a>'>>, 'POW': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Pow">sqlglot.expressions.Pow</a>'>>, 'PREDICT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Predict">sqlglot.expressions.Predict</a>'>>, 'QUANTILE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Quantile">sqlglot.expressions.Quantile</a>'>>, 'RAND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Rand">sqlglot.expressions.Rand</a>'>>, 'RANDOM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Rand">sqlglot.expressions.Rand</a>'>>, 'RANDN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Randn">sqlglot.expressions.Randn</a>'>>, 'RANGE_N': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RangeN">sqlglot.expressions.RangeN</a>'>>, 'READ_CSV': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ReadCSV">sqlglot.expressions.ReadCSV</a>'>>, 'REDUCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Reduce">sqlglot.expressions.Reduce</a>'>>, 'REGEXP_EXTRACT': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'REGEXP_I_LIKE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpILike">sqlglot.expressions.RegexpILike</a>'>>, 'REGEXP_LIKE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpLike">sqlglot.expressions.RegexpLike</a>'>>, 'REGEXP_REPLACE': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'REGEXP_SPLIT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpSplit">sqlglot.expressions.RegexpSplit</a>'>>, 'REPEAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Repeat">sqlglot.expressions.Repeat</a>'>>, 'RIGHT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Right">sqlglot.expressions.Right</a>'>>, 'ROUND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Round">sqlglot.expressions.Round</a>'>>, 'ROW_NUMBER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RowNumber">sqlglot.expressions.RowNumber</a>'>>, 'SHA': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SHA">sqlglot.expressions.SHA</a>'>>, 'SHA1': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SHA">sqlglot.expressions.SHA</a>'>>, 'SHA2': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SHA2">sqlglot.expressions.SHA2</a>'>>, 'SAFE_DIVIDE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SafeDivide">sqlglot.expressions.SafeDivide</a>'>>, 'SORT_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SortArray">sqlglot.expressions.SortArray</a>'>>, 'SPLIT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Split">sqlglot.expressions.Split</a>'>>, 'SQRT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Sqrt">sqlglot.expressions.Sqrt</a>'>>, 'STANDARD_HASH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StandardHash">sqlglot.expressions.StandardHash</a>'>>, 'STAR_MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StarMap">sqlglot.expressions.StarMap</a>'>>, 'STARTS_WITH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StartsWith">sqlglot.expressions.StartsWith</a>'>>, 'STARTSWITH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StartsWith">sqlglot.expressions.StartsWith</a>'>>, 'STDDEV': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Stddev">sqlglot.expressions.Stddev</a>'>>, 'STDDEV_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StddevPop">sqlglot.expressions.StddevPop</a>'>>, 'STDDEV_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StddevSamp">sqlglot.expressions.StddevSamp</a>'>>, 'STR_POSITION': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrPosition">sqlglot.expressions.StrPosition</a>'>>, 'STR_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToDate">sqlglot.expressions.StrToDate</a>'>>, 'STR_TO_MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToMap">sqlglot.expressions.StrToMap</a>'>>, 'STR_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToTime">sqlglot.expressions.StrToTime</a>'>>, 'STR_TO_UNIX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToUnix">sqlglot.expressions.StrToUnix</a>'>>, 'STRUCT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Struct">sqlglot.expressions.Struct</a>'>>, 'STRUCT_EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StructExtract">sqlglot.expressions.StructExtract</a>'>>, 'STUFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Stuff">sqlglot.expressions.Stuff</a>'>>, 'INSERT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Stuff">sqlglot.expressions.Stuff</a>'>>, 'SUBSTRING': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Substring">sqlglot.expressions.Substring</a>'>>, 'SUM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Sum">sqlglot.expressions.Sum</a>'>>, 'TIME_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeAdd">sqlglot.expressions.TimeAdd</a>'>>, 'TIME_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeDiff">sqlglot.expressions.TimeDiff</a>'>>, 'TIME_FROM_PARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeFromParts">sqlglot.expressions.TimeFromParts</a>'>>, 'TIMEFROMPARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeFromParts">sqlglot.expressions.TimeFromParts</a>'>>, 'TIME_STR_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeStrToDate">sqlglot.expressions.TimeStrToDate</a>'>>, 'TIME_STR_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeStrToTime">sqlglot.expressions.TimeStrToTime</a>'>>, 'TIME_STR_TO_UNIX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeStrToUnix">sqlglot.expressions.TimeStrToUnix</a>'>>, 'TIME_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeSub">sqlglot.expressions.TimeSub</a>'>>, 'TIME_TO_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeToStr">sqlglot.expressions.TimeToStr</a>'>>, 'TIME_TO_TIME_STR': <function Parser.<lambda>>, 'TIME_TO_UNIX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeToUnix">sqlglot.expressions.TimeToUnix</a>'>>, 'TIME_TRUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeTrunc">sqlglot.expressions.TimeTrunc</a>'>>, 'TIMESTAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Timestamp">sqlglot.expressions.Timestamp</a>'>>, 'TIMESTAMP_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampAdd">sqlglot.expressions.TimestampAdd</a>'>>, 'TIMESTAMP_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampDiff">sqlglot.expressions.TimestampDiff</a>'>>, 'TIMESTAMP_FROM_PARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampFromParts">sqlglot.expressions.TimestampFromParts</a>'>>, 'TIMESTAMPFROMPARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampFromParts">sqlglot.expressions.TimestampFromParts</a>'>>, 'TIMESTAMP_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampSub">sqlglot.expressions.TimestampSub</a>'>>, 'TIMESTAMP_TRUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampTrunc">sqlglot.expressions.TimestampTrunc</a>'>>, 'TO_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToArray">sqlglot.expressions.ToArray</a>'>>, 'TO_BASE64': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToBase64">sqlglot.expressions.ToBase64</a>'>>, 'TO_CHAR': <function _parse_to_char>, 'TO_DAYS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToDays">sqlglot.expressions.ToDays</a>'>>, 'TRANSFORM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Transform">sqlglot.expressions.Transform</a>'>>, 'TRIM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Trim">sqlglot.expressions.Trim</a>'>>, 'TRY_CAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TryCast">sqlglot.expressions.TryCast</a>'>>, 'TS_OR_DI_TO_DI': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDiToDi">sqlglot.expressions.TsOrDiToDi</a>'>>, 'TS_OR_DS_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsAdd">sqlglot.expressions.TsOrDsAdd</a>'>>, 'TS_OR_DS_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsDiff">sqlglot.expressions.TsOrDsDiff</a>'>>, 'TS_OR_DS_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsToDate">sqlglot.expressions.TsOrDsToDate</a>'>>, 'TS_OR_DS_TO_DATE_STR': <function Parser.<lambda>>, 'TS_OR_DS_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsToTime">sqlglot.expressions.TsOrDsToTime</a>'>>, 'UNHEX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Unhex">sqlglot.expressions.Unhex</a>'>>, 'UNIX_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixDate">sqlglot.expressions.UnixDate</a>'>>, 'UNIX_TO_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixToStr">sqlglot.expressions.UnixToStr</a>'>>, 'UNIX_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixToTime">sqlglot.expressions.UnixToTime</a>'>>, 'UNIX_TO_TIME_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixToTimeStr">sqlglot.expressions.UnixToTimeStr</a>'>>, 'UPPER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Upper">sqlglot.expressions.Upper</a>'>>, 'UCASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Upper">sqlglot.expressions.Upper</a>'>>, 'VAR_MAP': <function parse_var_map>, 'VARIANCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>>, 'VARIANCE_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>>, 'VAR_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>>, 'VARIANCE_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#VariancePop">sqlglot.expressions.VariancePop</a>'>>, 'VAR_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#VariancePop">sqlglot.expressions.VariancePop</a>'>>, 'WEEK': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Week">sqlglot.expressions.Week</a>'>>, 'WEEK_OF_YEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#WeekOfYear">sqlglot.expressions.WeekOfYear</a>'>>, 'WEEKOFYEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#WeekOfYear">sqlglot.expressions.WeekOfYear</a>'>>, 'WHEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#When">sqlglot.expressions.When</a>'>>, 'X_M_L_TABLE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#XMLTable">sqlglot.expressions.XMLTable</a>'>>, 'XOR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Xor">sqlglot.expressions.Xor</a>'>>, 'YEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Year">sqlglot.expressions.Year</a>'>>, 'GLOB': <function Parser.<lambda>>, 'LIKE': <function parse_like>, 'ARBITRARY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#AnyValue">sqlglot.expressions.AnyValue</a>'>>, 'APPROX_PERCENTILE': <function _approx_percentile>, 'BITWISE_AND': <function binary_from_function.<locals>.<lambda>>, 'BITWISE_NOT': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'BITWISE_OR': <function binary_from_function.<locals>.<lambda>>, 'BITWISE_XOR': <function binary_from_function.<locals>.<lambda>>, 'CARDINALITY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySize">sqlglot.expressions.ArraySize</a>'>>, 'CONTAINS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayContains">sqlglot.expressions.ArrayContains</a>'>>, 'DATE_FORMAT': <function format_time_lambda.<locals>._format_time>, 'DATE_PARSE': <function format_time_lambda.<locals>._format_time>, 'ELEMENT_AT': <function _parse_element_at>, 'FROM_HEX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Unhex">sqlglot.expressions.Unhex</a>'>>, 'FROM_UNIXTIME': <function _from_unixtime>, 'FROM_UTF8': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'NOW': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>>, 'ROW': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Struct">sqlglot.expressions.Struct</a>'>>, 'SEQUENCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GenerateSeries">sqlglot.expressions.GenerateSeries</a>'>>, 'SET_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayUniqueAgg">sqlglot.expressions.ArrayUniqueAgg</a>'>>, 'SPLIT_TO_MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToMap">sqlglot.expressions.StrToMap</a>'>>, 'STRPOS': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'TO_HEX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Hex">sqlglot.expressions.Hex</a>'>>, 'TO_UNIXTIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeToUnix">sqlglot.expressions.TimeToUnix</a>'>>, 'TO_UTF8': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>}</span> + <label class="view-value-button pdoc-button" for="Presto.Parser.FUNCTIONS-view-value"></label><span class="default_value">{'ABS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Abs">sqlglot.expressions.Abs</a>'>>, 'ANONYMOUS_AGG_FUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#AnonymousAggFunc">sqlglot.expressions.AnonymousAggFunc</a>'>>, 'ANY_VALUE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#AnyValue">sqlglot.expressions.AnyValue</a>'>>, 'APPROX_DISTINCT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxDistinct">sqlglot.expressions.ApproxDistinct</a>'>>, 'APPROX_COUNT_DISTINCT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxDistinct">sqlglot.expressions.ApproxDistinct</a>'>>, 'APPROX_QUANTILE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxQuantile">sqlglot.expressions.ApproxQuantile</a>'>>, 'APPROX_TOP_K': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxTopK">sqlglot.expressions.ApproxTopK</a>'>>, 'ARG_MAX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>>, 'ARGMAX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>>, 'MAX_BY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>>, 'ARG_MIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>>, 'ARGMIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>>, 'MIN_BY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>>, 'ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Array">sqlglot.expressions.Array</a>'>>, 'ARRAY_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayAgg">sqlglot.expressions.ArrayAgg</a>'>>, 'ARRAY_ALL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayAll">sqlglot.expressions.ArrayAll</a>'>>, 'ARRAY_ANY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayAny">sqlglot.expressions.ArrayAny</a>'>>, 'ARRAY_CONCAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayConcat">sqlglot.expressions.ArrayConcat</a>'>>, 'ARRAY_CAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayConcat">sqlglot.expressions.ArrayConcat</a>'>>, 'ARRAY_CONTAINS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayContains">sqlglot.expressions.ArrayContains</a>'>>, 'FILTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayFilter">sqlglot.expressions.ArrayFilter</a>'>>, 'ARRAY_FILTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayFilter">sqlglot.expressions.ArrayFilter</a>'>>, 'ARRAY_JOIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayJoin">sqlglot.expressions.ArrayJoin</a>'>>, 'ARRAY_SIZE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySize">sqlglot.expressions.ArraySize</a>'>>, 'ARRAY_SORT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySort">sqlglot.expressions.ArraySort</a>'>>, 'ARRAY_SUM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySum">sqlglot.expressions.ArraySum</a>'>>, 'ARRAY_UNION_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayUnionAgg">sqlglot.expressions.ArrayUnionAgg</a>'>>, 'ARRAY_UNIQUE_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayUniqueAgg">sqlglot.expressions.ArrayUniqueAgg</a>'>>, 'AVG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Avg">sqlglot.expressions.Avg</a>'>>, 'CASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Case">sqlglot.expressions.Case</a>'>>, 'CAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Cast">sqlglot.expressions.Cast</a>'>>, 'CAST_TO_STR_TYPE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CastToStrType">sqlglot.expressions.CastToStrType</a>'>>, 'CEIL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Ceil">sqlglot.expressions.Ceil</a>'>>, 'CEILING': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Ceil">sqlglot.expressions.Ceil</a>'>>, 'CHR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Chr">sqlglot.expressions.Chr</a>'>>, 'CHAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Chr">sqlglot.expressions.Chr</a>'>>, 'COALESCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Coalesce">sqlglot.expressions.Coalesce</a>'>>, 'IFNULL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Coalesce">sqlglot.expressions.Coalesce</a>'>>, 'NVL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Coalesce">sqlglot.expressions.Coalesce</a>'>>, 'COLLATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Collate">sqlglot.expressions.Collate</a>'>>, 'COMBINED_AGG_FUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CombinedAggFunc">sqlglot.expressions.CombinedAggFunc</a>'>>, 'COMBINED_PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CombinedParameterizedAgg">sqlglot.expressions.CombinedParameterizedAgg</a>'>>, 'CONCAT': <function Parser.<lambda>>, 'CONCAT_WS': <function Parser.<lambda>>, 'COUNT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Count">sqlglot.expressions.Count</a>'>>, 'COUNT_IF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CountIf">sqlglot.expressions.CountIf</a>'>>, 'COUNTIF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CountIf">sqlglot.expressions.CountIf</a>'>>, 'CURRENT_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentDate">sqlglot.expressions.CurrentDate</a>'>>, 'CURRENT_DATETIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentDatetime">sqlglot.expressions.CurrentDatetime</a>'>>, 'CURRENT_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTime">sqlglot.expressions.CurrentTime</a>'>>, 'CURRENT_TIMESTAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>>, 'CURRENT_USER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentUser">sqlglot.expressions.CurrentUser</a>'>>, 'DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Date">sqlglot.expressions.Date</a>'>>, 'DATE_ADD': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'DATEDIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateDiff">sqlglot.expressions.DateDiff</a>'>>, 'DATE_DIFF': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'DATE_FROM_PARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateFromParts">sqlglot.expressions.DateFromParts</a>'>>, 'DATEFROMPARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateFromParts">sqlglot.expressions.DateFromParts</a>'>>, 'DATE_STR_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateStrToDate">sqlglot.expressions.DateStrToDate</a>'>>, 'DATE_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateSub">sqlglot.expressions.DateSub</a>'>>, 'DATE_TO_DATE_STR': <function Parser.<lambda>>, 'DATE_TO_DI': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateToDi">sqlglot.expressions.DateToDi</a>'>>, 'DATE_TRUNC': <function date_trunc_to_time>, 'DATETIME_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeAdd">sqlglot.expressions.DatetimeAdd</a>'>>, 'DATETIME_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeDiff">sqlglot.expressions.DatetimeDiff</a>'>>, 'DATETIME_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeSub">sqlglot.expressions.DatetimeSub</a>'>>, 'DATETIME_TRUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeTrunc">sqlglot.expressions.DatetimeTrunc</a>'>>, 'DAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Day">sqlglot.expressions.Day</a>'>>, 'DAY_OF_MONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfMonth">sqlglot.expressions.DayOfMonth</a>'>>, 'DAYOFMONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfMonth">sqlglot.expressions.DayOfMonth</a>'>>, 'DAY_OF_WEEK': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfWeek">sqlglot.expressions.DayOfWeek</a>'>>, 'DAYOFWEEK': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfWeek">sqlglot.expressions.DayOfWeek</a>'>>, 'DAY_OF_YEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfYear">sqlglot.expressions.DayOfYear</a>'>>, 'DAYOFYEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfYear">sqlglot.expressions.DayOfYear</a>'>>, 'DECODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Decode">sqlglot.expressions.Decode</a>'>>, 'DI_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DiToDate">sqlglot.expressions.DiToDate</a>'>>, 'ENCODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Encode">sqlglot.expressions.Encode</a>'>>, 'EXP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Exp">sqlglot.expressions.Exp</a>'>>, 'EXPLODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Explode">sqlglot.expressions.Explode</a>'>>, 'EXPLODE_OUTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ExplodeOuter">sqlglot.expressions.ExplodeOuter</a>'>>, 'EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Extract">sqlglot.expressions.Extract</a>'>>, 'FIRST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#First">sqlglot.expressions.First</a>'>>, 'FLATTEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Flatten">sqlglot.expressions.Flatten</a>'>>, 'FLOOR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Floor">sqlglot.expressions.Floor</a>'>>, 'FROM_BASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#FromBase">sqlglot.expressions.FromBase</a>'>>, 'FROM_BASE64': <bound method Func.from_arg_list of <class '<a href="../expressions.html#FromBase64">sqlglot.expressions.FromBase64</a>'>>, 'GENERATE_SERIES': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GenerateSeries">sqlglot.expressions.GenerateSeries</a>'>>, 'GET_PATH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GetPath">sqlglot.expressions.GetPath</a>'>>, 'GREATEST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Greatest">sqlglot.expressions.Greatest</a>'>>, 'GROUP_CONCAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GroupConcat">sqlglot.expressions.GroupConcat</a>'>>, 'HEX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Hex">sqlglot.expressions.Hex</a>'>>, 'HLL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Hll">sqlglot.expressions.Hll</a>'>>, 'IF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#If">sqlglot.expressions.If</a>'>>, 'INITCAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Initcap">sqlglot.expressions.Initcap</a>'>>, 'IS_INF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsInf">sqlglot.expressions.IsInf</a>'>>, 'ISINF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsInf">sqlglot.expressions.IsInf</a>'>>, 'IS_NAN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsNan">sqlglot.expressions.IsNan</a>'>>, 'ISNAN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsNan">sqlglot.expressions.IsNan</a>'>>, 'J_S_O_N_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONArray">sqlglot.expressions.JSONArray</a>'>>, 'J_S_O_N_ARRAY_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONArrayAgg">sqlglot.expressions.JSONArrayAgg</a>'>>, 'JSON_ARRAY_CONTAINS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONArrayContains">sqlglot.expressions.JSONArrayContains</a>'>>, 'JSONB_EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONBExtract">sqlglot.expressions.JSONBExtract</a>'>>, 'JSONB_EXTRACT_SCALAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONBExtractScalar">sqlglot.expressions.JSONBExtractScalar</a>'>>, 'JSON_EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONExtract">sqlglot.expressions.JSONExtract</a>'>>, 'JSON_EXTRACT_SCALAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONExtractScalar">sqlglot.expressions.JSONExtractScalar</a>'>>, 'JSON_FORMAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONFormat">sqlglot.expressions.JSONFormat</a>'>>, 'J_S_O_N_OBJECT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONObject">sqlglot.expressions.JSONObject</a>'>>, 'J_S_O_N_OBJECT_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONObjectAgg">sqlglot.expressions.JSONObjectAgg</a>'>>, 'J_S_O_N_TABLE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONTable">sqlglot.expressions.JSONTable</a>'>>, 'LAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Last">sqlglot.expressions.Last</a>'>>, 'LAST_DAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LastDay">sqlglot.expressions.LastDay</a>'>>, 'LAST_DAY_OF_MONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LastDay">sqlglot.expressions.LastDay</a>'>>, 'LEAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Least">sqlglot.expressions.Least</a>'>>, 'LEFT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Left">sqlglot.expressions.Left</a>'>>, 'LENGTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Length">sqlglot.expressions.Length</a>'>>, 'LEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Length">sqlglot.expressions.Length</a>'>>, 'LEVENSHTEIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Levenshtein">sqlglot.expressions.Levenshtein</a>'>>, 'LN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Ln">sqlglot.expressions.Ln</a>'>>, 'LOG': <function parse_logarithm>, 'LOG10': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Log10">sqlglot.expressions.Log10</a>'>>, 'LOG2': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Log2">sqlglot.expressions.Log2</a>'>>, 'LOGICAL_AND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>>, 'BOOL_AND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>>, 'BOOLAND_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>>, 'LOGICAL_OR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>>, 'BOOL_OR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>>, 'BOOLOR_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>>, 'LOWER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Lower">sqlglot.expressions.Lower</a>'>>, 'LCASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Lower">sqlglot.expressions.Lower</a>'>>, 'MD5': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MD5">sqlglot.expressions.MD5</a>'>>, 'MD5_DIGEST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MD5Digest">sqlglot.expressions.MD5Digest</a>'>>, 'MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Map">sqlglot.expressions.Map</a>'>>, 'MAP_FROM_ENTRIES': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MapFromEntries">sqlglot.expressions.MapFromEntries</a>'>>, 'MATCH_AGAINST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MatchAgainst">sqlglot.expressions.MatchAgainst</a>'>>, 'MAX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Max">sqlglot.expressions.Max</a>'>>, 'MIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Min">sqlglot.expressions.Min</a>'>>, 'MONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Month">sqlglot.expressions.Month</a>'>>, 'MONTHS_BETWEEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MonthsBetween">sqlglot.expressions.MonthsBetween</a>'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#NextValueFor">sqlglot.expressions.NextValueFor</a>'>>, 'NULLIF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Nullif">sqlglot.expressions.Nullif</a>'>>, 'NUMBER_TO_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#NumberToStr">sqlglot.expressions.NumberToStr</a>'>>, 'NVL2': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Nvl2">sqlglot.expressions.Nvl2</a>'>>, 'OPEN_J_S_O_N': <bound method Func.from_arg_list of <class '<a href="../expressions.html#OpenJSON">sqlglot.expressions.OpenJSON</a>'>>, 'PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ParameterizedAgg">sqlglot.expressions.ParameterizedAgg</a>'>>, 'PARSE_JSON': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ParseJSON">sqlglot.expressions.ParseJSON</a>'>>, 'JSON_PARSE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ParseJSON">sqlglot.expressions.ParseJSON</a>'>>, 'PERCENTILE_CONT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#PercentileCont">sqlglot.expressions.PercentileCont</a>'>>, 'PERCENTILE_DISC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#PercentileDisc">sqlglot.expressions.PercentileDisc</a>'>>, 'POSEXPLODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Posexplode">sqlglot.expressions.Posexplode</a>'>>, 'POSEXPLODE_OUTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#PosexplodeOuter">sqlglot.expressions.PosexplodeOuter</a>'>>, 'POWER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Pow">sqlglot.expressions.Pow</a>'>>, 'POW': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Pow">sqlglot.expressions.Pow</a>'>>, 'PREDICT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Predict">sqlglot.expressions.Predict</a>'>>, 'QUANTILE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Quantile">sqlglot.expressions.Quantile</a>'>>, 'RAND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Rand">sqlglot.expressions.Rand</a>'>>, 'RANDOM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Rand">sqlglot.expressions.Rand</a>'>>, 'RANDN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Randn">sqlglot.expressions.Randn</a>'>>, 'RANGE_N': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RangeN">sqlglot.expressions.RangeN</a>'>>, 'READ_CSV': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ReadCSV">sqlglot.expressions.ReadCSV</a>'>>, 'REDUCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Reduce">sqlglot.expressions.Reduce</a>'>>, 'REGEXP_EXTRACT': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'REGEXP_I_LIKE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpILike">sqlglot.expressions.RegexpILike</a>'>>, 'REGEXP_LIKE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpLike">sqlglot.expressions.RegexpLike</a>'>>, 'REGEXP_REPLACE': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'REGEXP_SPLIT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpSplit">sqlglot.expressions.RegexpSplit</a>'>>, 'REPEAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Repeat">sqlglot.expressions.Repeat</a>'>>, 'RIGHT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Right">sqlglot.expressions.Right</a>'>>, 'ROUND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Round">sqlglot.expressions.Round</a>'>>, 'ROW_NUMBER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RowNumber">sqlglot.expressions.RowNumber</a>'>>, 'SHA': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SHA">sqlglot.expressions.SHA</a>'>>, 'SHA1': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SHA">sqlglot.expressions.SHA</a>'>>, 'SHA2': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SHA2">sqlglot.expressions.SHA2</a>'>>, 'SAFE_DIVIDE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SafeDivide">sqlglot.expressions.SafeDivide</a>'>>, 'SORT_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SortArray">sqlglot.expressions.SortArray</a>'>>, 'SPLIT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Split">sqlglot.expressions.Split</a>'>>, 'SQRT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Sqrt">sqlglot.expressions.Sqrt</a>'>>, 'STANDARD_HASH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StandardHash">sqlglot.expressions.StandardHash</a>'>>, 'STAR_MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StarMap">sqlglot.expressions.StarMap</a>'>>, 'STARTS_WITH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StartsWith">sqlglot.expressions.StartsWith</a>'>>, 'STARTSWITH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StartsWith">sqlglot.expressions.StartsWith</a>'>>, 'STDDEV': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Stddev">sqlglot.expressions.Stddev</a>'>>, 'STDDEV_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StddevPop">sqlglot.expressions.StddevPop</a>'>>, 'STDDEV_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StddevSamp">sqlglot.expressions.StddevSamp</a>'>>, 'STR_POSITION': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrPosition">sqlglot.expressions.StrPosition</a>'>>, 'STR_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToDate">sqlglot.expressions.StrToDate</a>'>>, 'STR_TO_MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToMap">sqlglot.expressions.StrToMap</a>'>>, 'STR_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToTime">sqlglot.expressions.StrToTime</a>'>>, 'STR_TO_UNIX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToUnix">sqlglot.expressions.StrToUnix</a>'>>, 'STRUCT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Struct">sqlglot.expressions.Struct</a>'>>, 'STRUCT_EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StructExtract">sqlglot.expressions.StructExtract</a>'>>, 'STUFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Stuff">sqlglot.expressions.Stuff</a>'>>, 'INSERT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Stuff">sqlglot.expressions.Stuff</a>'>>, 'SUBSTRING': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Substring">sqlglot.expressions.Substring</a>'>>, 'SUM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Sum">sqlglot.expressions.Sum</a>'>>, 'TIME_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeAdd">sqlglot.expressions.TimeAdd</a>'>>, 'TIME_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeDiff">sqlglot.expressions.TimeDiff</a>'>>, 'TIME_FROM_PARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeFromParts">sqlglot.expressions.TimeFromParts</a>'>>, 'TIMEFROMPARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeFromParts">sqlglot.expressions.TimeFromParts</a>'>>, 'TIME_STR_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeStrToDate">sqlglot.expressions.TimeStrToDate</a>'>>, 'TIME_STR_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeStrToTime">sqlglot.expressions.TimeStrToTime</a>'>>, 'TIME_STR_TO_UNIX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeStrToUnix">sqlglot.expressions.TimeStrToUnix</a>'>>, 'TIME_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeSub">sqlglot.expressions.TimeSub</a>'>>, 'TIME_TO_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeToStr">sqlglot.expressions.TimeToStr</a>'>>, 'TIME_TO_TIME_STR': <function Parser.<lambda>>, 'TIME_TO_UNIX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeToUnix">sqlglot.expressions.TimeToUnix</a>'>>, 'TIME_TRUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeTrunc">sqlglot.expressions.TimeTrunc</a>'>>, 'TIMESTAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Timestamp">sqlglot.expressions.Timestamp</a>'>>, 'TIMESTAMP_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampAdd">sqlglot.expressions.TimestampAdd</a>'>>, 'TIMESTAMP_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampDiff">sqlglot.expressions.TimestampDiff</a>'>>, 'TIMESTAMP_FROM_PARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampFromParts">sqlglot.expressions.TimestampFromParts</a>'>>, 'TIMESTAMPFROMPARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampFromParts">sqlglot.expressions.TimestampFromParts</a>'>>, 'TIMESTAMP_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampSub">sqlglot.expressions.TimestampSub</a>'>>, 'TIMESTAMP_TRUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampTrunc">sqlglot.expressions.TimestampTrunc</a>'>>, 'TO_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToArray">sqlglot.expressions.ToArray</a>'>>, 'TO_BASE64': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToBase64">sqlglot.expressions.ToBase64</a>'>>, 'TO_CHAR': <function _parse_to_char>, 'TO_DAYS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToDays">sqlglot.expressions.ToDays</a>'>>, 'TRANSFORM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Transform">sqlglot.expressions.Transform</a>'>>, 'TRIM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Trim">sqlglot.expressions.Trim</a>'>>, 'TRY_CAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TryCast">sqlglot.expressions.TryCast</a>'>>, 'TS_OR_DI_TO_DI': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDiToDi">sqlglot.expressions.TsOrDiToDi</a>'>>, 'TS_OR_DS_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsAdd">sqlglot.expressions.TsOrDsAdd</a>'>>, 'TS_OR_DS_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsDiff">sqlglot.expressions.TsOrDsDiff</a>'>>, 'TS_OR_DS_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsToDate">sqlglot.expressions.TsOrDsToDate</a>'>>, 'TS_OR_DS_TO_DATE_STR': <function Parser.<lambda>>, 'TS_OR_DS_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsToTime">sqlglot.expressions.TsOrDsToTime</a>'>>, 'UNHEX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Unhex">sqlglot.expressions.Unhex</a>'>>, 'UNIX_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixDate">sqlglot.expressions.UnixDate</a>'>>, 'UNIX_TO_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixToStr">sqlglot.expressions.UnixToStr</a>'>>, 'UNIX_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixToTime">sqlglot.expressions.UnixToTime</a>'>>, 'UNIX_TO_TIME_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixToTimeStr">sqlglot.expressions.UnixToTimeStr</a>'>>, 'UPPER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Upper">sqlglot.expressions.Upper</a>'>>, 'UCASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Upper">sqlglot.expressions.Upper</a>'>>, 'VAR_MAP': <function parse_var_map>, 'VARIANCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>>, 'VARIANCE_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>>, 'VAR_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>>, 'VARIANCE_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#VariancePop">sqlglot.expressions.VariancePop</a>'>>, 'VAR_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#VariancePop">sqlglot.expressions.VariancePop</a>'>>, 'WEEK': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Week">sqlglot.expressions.Week</a>'>>, 'WEEK_OF_YEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#WeekOfYear">sqlglot.expressions.WeekOfYear</a>'>>, 'WEEKOFYEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#WeekOfYear">sqlglot.expressions.WeekOfYear</a>'>>, 'WHEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#When">sqlglot.expressions.When</a>'>>, 'X_M_L_TABLE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#XMLTable">sqlglot.expressions.XMLTable</a>'>>, 'XOR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Xor">sqlglot.expressions.Xor</a>'>>, 'YEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Year">sqlglot.expressions.Year</a>'>>, 'GLOB': <function Parser.<lambda>>, 'LIKE': <function parse_like>, 'ARBITRARY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#AnyValue">sqlglot.expressions.AnyValue</a>'>>, 'APPROX_PERCENTILE': <function _approx_percentile>, 'BITWISE_AND': <function binary_from_function.<locals>.<lambda>>, 'BITWISE_NOT': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'BITWISE_OR': <function binary_from_function.<locals>.<lambda>>, 'BITWISE_XOR': <function binary_from_function.<locals>.<lambda>>, 'CARDINALITY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySize">sqlglot.expressions.ArraySize</a>'>>, 'CONTAINS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayContains">sqlglot.expressions.ArrayContains</a>'>>, 'DATE_FORMAT': <function format_time_lambda.<locals>._format_time>, 'DATE_PARSE': <function format_time_lambda.<locals>._format_time>, 'ELEMENT_AT': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'FROM_HEX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Unhex">sqlglot.expressions.Unhex</a>'>>, 'FROM_UNIXTIME': <function _from_unixtime>, 'FROM_UTF8': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'NOW': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>>, 'ROW': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Struct">sqlglot.expressions.Struct</a>'>>, 'SEQUENCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GenerateSeries">sqlglot.expressions.GenerateSeries</a>'>>, 'SET_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayUniqueAgg">sqlglot.expressions.ArrayUniqueAgg</a>'>>, 'SPLIT_TO_MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToMap">sqlglot.expressions.StrToMap</a>'>>, 'STRPOS': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>, 'TO_HEX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Hex">sqlglot.expressions.Hex</a>'>>, 'TO_UNIXTIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeToUnix">sqlglot.expressions.TimeToUnix</a>'>>, 'TO_UTF8': <function <a href="#Presto.Parser">Presto.Parser</a>.<lambda>>}</span> </div> @@ -1675,7 +1669,7 @@ Default: 3</li> <div class="attr variable"> <span class="name">FUNCTION_PARSERS</span> = <input id="Presto.Parser.FUNCTION_PARSERS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> - <label class="view-value-button pdoc-button" for="Presto.Parser.FUNCTION_PARSERS-view-value"></label><span class="default_value">{'ANY_VALUE': <function Parser.<lambda>>, 'CAST': <function Parser.<lambda>>, 'CONVERT': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'JSON_OBJECT': <function Parser.<lambda>>, 'JSON_TABLE': <function Parser.<lambda>>, 'MATCH': <function Parser.<lambda>>, 'OPENJSON': <function Parser.<lambda>>, 'POSITION': <function Parser.<lambda>>, 'PREDICT': <function Parser.<lambda>>, 'SAFE_CAST': <function Parser.<lambda>>, 'STRING_AGG': <function Parser.<lambda>>, 'SUBSTRING': <function Parser.<lambda>>, 'TRY_CAST': <function Parser.<lambda>>, 'TRY_CONVERT': <function Parser.<lambda>>}</span> + <label class="view-value-button pdoc-button" for="Presto.Parser.FUNCTION_PARSERS-view-value"></label><span class="default_value">{'ANY_VALUE': <function Parser.<lambda>>, 'CAST': <function Parser.<lambda>>, 'CONVERT': <function Parser.<lambda>>, 'DECODE': <function Parser.<lambda>>, 'EXTRACT': <function Parser.<lambda>>, 'JSON_OBJECT': <function Parser.<lambda>>, 'JSON_OBJECTAGG': <function Parser.<lambda>>, 'JSON_TABLE': <function Parser.<lambda>>, 'MATCH': <function Parser.<lambda>>, 'OPENJSON': <function Parser.<lambda>>, 'POSITION': <function Parser.<lambda>>, 'PREDICT': <function Parser.<lambda>>, 'SAFE_CAST': <function Parser.<lambda>>, 'STRING_AGG': <function Parser.<lambda>>, 'SUBSTRING': <function Parser.<lambda>>, 'TRY_CAST': <function Parser.<lambda>>, 'TRY_CONVERT': <function Parser.<lambda>>}</span> </div> @@ -1688,7 +1682,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">{<TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.INT256: 'INT256'>, <TokenType.TEXT: 'TEXT'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.SHOW: 'SHOW'>, <TokenType.MODEL: 'MODEL'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.ROWS: 'ROWS'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.ALL: 'ALL'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.BINARY: 'BINARY'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.DELETE: 'DELETE'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.UINT128: 'UINT128'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.YEAR: 'YEAR'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.BIT: 'BIT'>, <TokenType.FIRST: 'FIRST'>, <TokenType.ANY: 'ANY'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.NEXT: 'NEXT'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.LOAD: 'LOAD'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.JSONB: 'JSONB'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.CASE: 'CASE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.FALSE: 'FALSE'>, <TokenType.KILL: 'KILL'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.UUID: 'UUID'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.SET: 'SET'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.INET: 'INET'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.INT: 'INT'>, <TokenType.ROW: 'ROW'>, <TokenType.DATE: 'DATE'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.DIV: 'DIV'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.UINT: 'UINT'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.MERGE: 'MERGE'>, <TokenType.JSON: 'JSON'>, <TokenType.KEEP: 'KEEP'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.CACHE: 'CACHE'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.FINAL: 'FINAL'>, <TokenType.XML: 'XML'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.ENUM: 'ENUM'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.VAR: 'VAR'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.ANTI: 'ANTI'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.USE: 'USE'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.SOME: 'SOME'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.SEMI: 'SEMI'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.TABLE: 'TABLE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.FILTER: 'FILTER'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.ASC: 'ASC'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.MONEY: 'MONEY'>, <TokenType.INT128: 'INT128'>, <TokenType.UINT256: 'UINT256'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.IS: 'IS'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.END: 'END'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.NULL: 'NULL'>, <TokenType.MAP: 'MAP'>, <TokenType.TOP: 'TOP'>, <TokenType.VIEW: 'VIEW'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.RANGE: 'RANGE'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>, <TokenType.TRUE: 'TRUE'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.DESC: 'DESC'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.INDEX: 'INDEX'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.TIME: 'TIME'>, <TokenType.CHAR: 'CHAR'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.SUPER: 'SUPER'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>}</span> + <label class="view-value-button pdoc-button" for="Presto.Parser.TABLE_ALIAS_TOKENS-view-value"></label><span class="default_value">{<TokenType.ENUM: 'ENUM'>, <TokenType.OBJECT_IDENTIFIER: 'OBJECT_IDENTIFIER'>, <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>, <TokenType.TSTZRANGE: 'TSTZRANGE'>, <TokenType.JSON: 'JSON'>, <TokenType.DATERANGE: 'DATERANGE'>, <TokenType.TOP: 'TOP'>, <TokenType.LONGBLOB: 'LONGBLOB'>, <TokenType.LONGTEXT: 'LONGTEXT'>, <TokenType.ROW: 'ROW'>, <TokenType.DEFAULT: 'DEFAULT'>, <TokenType.JSONB: 'JSONB'>, <TokenType.ENUM8: 'ENUM8'>, <TokenType.TRUE: 'TRUE'>, <TokenType.IPV6: 'IPV6'>, <TokenType.TABLE: 'TABLE'>, <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>, <TokenType.INT256: 'INT256'>, <TokenType.UINT128: 'UINT128'>, <TokenType.REFRESH: 'REFRESH'>, <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>, <TokenType.INT128: 'INT128'>, <TokenType.UNIQUE: 'UNIQUE'>, <TokenType.REFERENCES: 'REFERENCES'>, <TokenType.MONEY: 'MONEY'>, <TokenType.PARTITION: 'PARTITION'>, <TokenType.COLUMN: 'COLUMN'>, <TokenType.UINT256: 'UINT256'>, <TokenType.LOAD: 'LOAD'>, <TokenType.BIGINT: 'BIGINT'>, <TokenType.ENUM16: 'ENUM16'>, <TokenType.TIMESTAMP_NS: 'TIMESTAMP_NS'>, <TokenType.CACHE: 'CACHE'>, <TokenType.DOUBLE: 'DOUBLE'>, <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>, <TokenType.ANTI: 'ANTI'>, <TokenType.END: 'END'>, <TokenType.INET: 'INET'>, <TokenType.USMALLINT: 'USMALLINT'>, <TokenType.LOWCARDINALITY: 'LOWCARDINALITY'>, <TokenType.NUMRANGE: 'NUMRANGE'>, <TokenType.CHAR: 'CHAR'>, <TokenType.AGGREGATEFUNCTION: 'AGGREGATEFUNCTION'>, <TokenType.ARRAY: 'ARRAY'>, <TokenType.SEMI: 'SEMI'>, <TokenType.DATABASE: 'DATABASE'>, <TokenType.FIRST: 'FIRST'>, <TokenType.HLLSKETCH: 'HLLSKETCH'>, <TokenType.TSRANGE: 'TSRANGE'>, <TokenType.COLLATE: 'COLLATE'>, <TokenType.USE: 'USE'>, <TokenType.VIEW: 'VIEW'>, <TokenType.TINYINT: 'TINYINT'>, <TokenType.TSMULTIRANGE: 'TSMULTIRANGE'>, <TokenType.TIMESTAMP_MS: 'TIMESTAMP_MS'>, <TokenType.HSTORE: 'HSTORE'>, <TokenType.UINT: 'UINT'>, <TokenType.EXISTS: 'EXISTS'>, <TokenType.TEMPORARY: 'TEMPORARY'>, <TokenType.BOOLEAN: 'BOOLEAN'>, <TokenType.FILTER: 'FILTER'>, <TokenType.BIT: 'BIT'>, <TokenType.TIMESTAMP_S: 'TIMESTAMP_S'>, <TokenType.DICTIONARY: 'DICTIONARY'>, <TokenType.SIMPLEAGGREGATEFUNCTION: 'SIMPLEAGGREGATEFUNCTION'>, <TokenType.DECIMAL: 'DECIMAL'>, <TokenType.GEOMETRY: 'GEOMETRY'>, <TokenType.TINYTEXT: 'TINYTEXT'>, <TokenType.DELETE: 'DELETE'>, <TokenType.BINARY: 'BINARY'>, <TokenType.CASE: 'CASE'>, <TokenType.CONSTRAINT: 'CONSTRAINT'>, <TokenType.DATETIME64: 'DATETIME64'>, <TokenType.PIVOT: 'PIVOT'>, <TokenType.SMALLSERIAL: 'SMALLSERIAL'>, <TokenType.NUMMULTIRANGE: 'NUMMULTIRANGE'>, <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>, <TokenType.TIME: 'TIME'>, <TokenType.REPLACE: 'REPLACE'>, <TokenType.NESTED: 'NESTED'>, <TokenType.DIV: 'DIV'>, <TokenType.FALSE: 'FALSE'>, <TokenType.SERIAL: 'SERIAL'>, <TokenType.UBIGINT: 'UBIGINT'>, <TokenType.IPPREFIX: 'IPPREFIX'>, <TokenType.UUID: 'UUID'>, <TokenType.IPV4: 'IPV4'>, <TokenType.INTERVAL: 'INTERVAL'>, <TokenType.ROWVERSION: 'ROWVERSION'>, <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>, <TokenType.SET: 'SET'>, <TokenType.DATEMULTIRANGE: 'DATEMULTIRANGE'>, <TokenType.SCHEMA: 'SCHEMA'>, <TokenType.MAP: 'MAP'>, <TokenType.ORDINALITY: 'ORDINALITY'>, <TokenType.COMMAND: 'COMMAND'>, <TokenType.DESCRIBE: 'DESCRIBE'>, <TokenType.TINYBLOB: 'TINYBLOB'>, <TokenType.PERCENT: 'PERCENT'>, <TokenType.SUPER: 'SUPER'>, <TokenType.CURRENT_DATE: 'CURRENT_DATE'>, <TokenType.DATETIME: 'DATETIME'>, <TokenType.PRAGMA: 'PRAGMA'>, <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>, <TokenType.OPERATOR: 'OPERATOR'>, <TokenType.COMMIT: 'COMMIT'>, <TokenType.CURRENT_USER: 'CURRENT_USER'>, <TokenType.UNPIVOT: 'UNPIVOT'>, <TokenType.NEXT: 'NEXT'>, <TokenType.XML: 'XML'>, <TokenType.USERDEFINED: 'USERDEFINED'>, <TokenType.SMALLINT: 'SMALLINT'>, <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>, <TokenType.DESC: 'DESC'>, <TokenType.ROWS: 'ROWS'>, <TokenType.ALL: 'ALL'>, <TokenType.ISNULL: 'ISNULL'>, <TokenType.VOLATILE: 'VOLATILE'>, <TokenType.BEGIN: 'BEGIN'>, <TokenType.ASC: 'ASC'>, <TokenType.YEAR: 'YEAR'>, <TokenType.EXECUTE: 'EXECUTE'>, <TokenType.BIGDECIMAL: 'BIGDECIMAL'>, <TokenType.TEXT: 'TEXT'>, <TokenType.VARIANT: 'VARIANT'>, <TokenType.STRUCT: 'STRUCT'>, <TokenType.INDEX: 'INDEX'>, <TokenType.UPDATE: 'UPDATE'>, <TokenType.MEDIUMINT: 'MEDIUMINT'>, <TokenType.IPADDRESS: 'IPADDRESS'>, <TokenType.CURRENT_TIME: 'CURRENT_TIME'>, <TokenType.OVERWRITE: 'OVERWRITE'>, <TokenType.UMEDIUMINT: 'UMEDIUMINT'>, <TokenType.FIXEDSTRING: 'FIXEDSTRING'>, <TokenType.VAR: 'VAR'>, <TokenType.OVERLAPS: 'OVERLAPS'>, <TokenType.IMAGE: 'IMAGE'>, <TokenType.FUNCTION: 'FUNCTION'>, <TokenType.KEEP: 'KEEP'>, <TokenType.NCHAR: 'NCHAR'>, <TokenType.RECURSIVE: 'RECURSIVE'>, <TokenType.INT4MULTIRANGE: 'INT4MULTIRANGE'>, <TokenType.INT8RANGE: 'INT8RANGE'>, <TokenType.NULL: 'NULL'>, <TokenType.ANY: 'ANY'>, <TokenType.INT: 'INT'>, <TokenType.ESCAPE: 'ESCAPE'>, <TokenType.UNKNOWN: 'UNKNOWN'>, <TokenType.VARCHAR: 'VARCHAR'>, <TokenType.INT4RANGE: 'INT4RANGE'>, <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>, <TokenType.GEOGRAPHY: 'GEOGRAPHY'>, <TokenType.VARBINARY: 'VARBINARY'>, <TokenType.BIGSERIAL: 'BIGSERIAL'>, <TokenType.FORMAT: 'FORMAT'>, <TokenType.IS: 'IS'>, <TokenType.DATE32: 'DATE32'>, <TokenType.OBJECT: 'OBJECT'>, <TokenType.MERGE: 'MERGE'>, <TokenType.SETTINGS: 'SETTINGS'>, <TokenType.UTINYINT: 'UTINYINT'>, <TokenType.INT8MULTIRANGE: 'INT8MULTIRANGE'>, <TokenType.PROCEDURE: 'PROCEDURE'>, <TokenType.FLOAT: 'FLOAT'>, <TokenType.KILL: 'KILL'>, <TokenType.RANGE: 'RANGE'>, <TokenType.SHOW: 'SHOW'>, <TokenType.UDECIMAL: 'UDECIMAL'>, <TokenType.DATE: 'DATE'>, <TokenType.TSTZMULTIRANGE: 'TSTZMULTIRANGE'>, <TokenType.SMALLMONEY: 'SMALLMONEY'>, <TokenType.SOME: 'SOME'>, <TokenType.NVARCHAR: 'NVARCHAR'>, <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>, <TokenType.NULLABLE: 'NULLABLE'>, <TokenType.TIMETZ: 'TIMETZ'>, <TokenType.COMMENT: 'COMMENT'>, <TokenType.MODEL: 'MODEL'>, <TokenType.FINAL: 'FINAL'>, <TokenType.TIMESTAMP: 'TIMESTAMP'>}</span> </div> @@ -1730,6 +1724,7 @@ Default: 3</li> <dd id="Presto.Parser.STRUCT_TYPE_TOKENS" class="variable"><a href="../parser.html#Parser.STRUCT_TYPE_TOKENS">STRUCT_TYPE_TOKENS</a></dd> <dd id="Presto.Parser.NESTED_TYPE_TOKENS" class="variable"><a href="../parser.html#Parser.NESTED_TYPE_TOKENS">NESTED_TYPE_TOKENS</a></dd> <dd id="Presto.Parser.ENUM_TYPE_TOKENS" class="variable"><a href="../parser.html#Parser.ENUM_TYPE_TOKENS">ENUM_TYPE_TOKENS</a></dd> + <dd id="Presto.Parser.AGGREGATE_TYPE_TOKENS" class="variable"><a href="../parser.html#Parser.AGGREGATE_TYPE_TOKENS">AGGREGATE_TYPE_TOKENS</a></dd> <dd id="Presto.Parser.TYPE_TOKENS" class="variable"><a href="../parser.html#Parser.TYPE_TOKENS">TYPE_TOKENS</a></dd> <dd id="Presto.Parser.SIGNED_TO_UNSIGNED_TYPE_TOKEN" class="variable"><a href="../parser.html#Parser.SIGNED_TO_UNSIGNED_TYPE_TOKEN">SIGNED_TO_UNSIGNED_TYPE_TOKEN</a></dd> <dd id="Presto.Parser.SUBQUERY_PREDICATES" class="variable"><a href="../parser.html#Parser.SUBQUERY_PREDICATES">SUBQUERY_PREDICATES</a></dd> @@ -1789,6 +1784,7 @@ Default: 3</li> <dd id="Presto.Parser.WINDOW_ALIAS_TOKENS" class="variable"><a href="../parser.html#Parser.WINDOW_ALIAS_TOKENS">WINDOW_ALIAS_TOKENS</a></dd> <dd id="Presto.Parser.WINDOW_BEFORE_PAREN_TOKENS" class="variable"><a href="../parser.html#Parser.WINDOW_BEFORE_PAREN_TOKENS">WINDOW_BEFORE_PAREN_TOKENS</a></dd> <dd id="Presto.Parser.WINDOW_SIDES" class="variable"><a href="../parser.html#Parser.WINDOW_SIDES">WINDOW_SIDES</a></dd> + <dd id="Presto.Parser.JSON_KEY_VALUE_SEPARATOR_TOKENS" class="variable"><a href="../parser.html#Parser.JSON_KEY_VALUE_SEPARATOR_TOKENS">JSON_KEY_VALUE_SEPARATOR_TOKENS</a></dd> <dd id="Presto.Parser.FETCH_TOKENS" class="variable"><a href="../parser.html#Parser.FETCH_TOKENS">FETCH_TOKENS</a></dd> <dd id="Presto.Parser.ADD_CONSTRAINT_TOKENS" class="variable"><a href="../parser.html#Parser.ADD_CONSTRAINT_TOKENS">ADD_CONSTRAINT_TOKENS</a></dd> <dd id="Presto.Parser.DISTINCT_TOKENS" class="variable"><a href="../parser.html#Parser.DISTINCT_TOKENS">DISTINCT_TOKENS</a></dd> @@ -1834,218 +1830,219 @@ Default: 3</li> </div> <a class="headerlink" href="#Presto.Generator"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator-297"><a href="#Presto.Generator-297"><span class="linenos">297</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> -</span><span id="Presto.Generator-298"><a href="#Presto.Generator-298"><span class="linenos">298</span></a> <span class="n">INTERVAL_ALLOWS_PLURAL_FORM</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto.Generator-299"><a href="#Presto.Generator-299"><span class="linenos">299</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto.Generator-300"><a href="#Presto.Generator-300"><span class="linenos">300</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto.Generator-301"><a href="#Presto.Generator-301"><span class="linenos">301</span></a> <span class="n">QUERY_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto.Generator-302"><a href="#Presto.Generator-302"><span class="linenos">302</span></a> <span class="n">IS_BOOL_ALLOWED</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto.Generator-303"><a href="#Presto.Generator-303"><span class="linenos">303</span></a> <span class="n">TZ_TO_WITH_TIME_ZONE</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Presto.Generator-304"><a href="#Presto.Generator-304"><span class="linenos">304</span></a> <span class="n">NVL2_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto.Generator-305"><a href="#Presto.Generator-305"><span class="linenos">305</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> -</span><span id="Presto.Generator-306"><a href="#Presto.Generator-306"><span class="linenos">306</span></a> <span class="n">LIMIT_ONLY_LITERALS</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Presto.Generator-307"><a href="#Presto.Generator-307"><span class="linenos">307</span></a> <span class="n">SUPPORTS_SINGLE_ARG_CONCAT</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Presto.Generator-308"><a href="#Presto.Generator-308"><span class="linenos">308</span></a> -</span><span id="Presto.Generator-309"><a href="#Presto.Generator-309"><span class="linenos">309</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Presto.Generator-310"><a href="#Presto.Generator-310"><span class="linenos">310</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> -</span><span id="Presto.Generator-311"><a href="#Presto.Generator-311"><span class="linenos">311</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> -</span><span id="Presto.Generator-312"><a href="#Presto.Generator-312"><span class="linenos">312</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatileProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> -</span><span id="Presto.Generator-313"><a href="#Presto.Generator-313"><span class="linenos">313</span></a> <span class="p">}</span> -</span><span id="Presto.Generator-314"><a href="#Presto.Generator-314"><span class="linenos">314</span></a> -</span><span id="Presto.Generator-315"><a href="#Presto.Generator-315"><span class="linenos">315</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Presto.Generator-316"><a href="#Presto.Generator-316"><span class="linenos">316</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> -</span><span id="Presto.Generator-317"><a href="#Presto.Generator-317"><span class="linenos">317</span></a> <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">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> -</span><span id="Presto.Generator-318"><a href="#Presto.Generator-318"><span class="linenos">318</span></a> <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">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> -</span><span id="Presto.Generator-319"><a href="#Presto.Generator-319"><span class="linenos">319</span></a> <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">BINARY</span><span class="p">:</span> <span class="s2">"VARBINARY"</span><span class="p">,</span> -</span><span id="Presto.Generator-320"><a href="#Presto.Generator-320"><span class="linenos">320</span></a> <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 class="s2">"VARCHAR"</span><span class="p">,</span> -</span><span id="Presto.Generator-321"><a href="#Presto.Generator-321"><span class="linenos">321</span></a> <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">TIMETZ</span><span class="p">:</span> <span class="s2">"TIME"</span><span class="p">,</span> -</span><span id="Presto.Generator-322"><a href="#Presto.Generator-322"><span class="linenos">322</span></a> <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">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> -</span><span id="Presto.Generator-323"><a href="#Presto.Generator-323"><span class="linenos">323</span></a> <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">STRUCT</span><span class="p">:</span> <span class="s2">"ROW"</span><span class="p">,</span> -</span><span id="Presto.Generator-324"><a href="#Presto.Generator-324"><span class="linenos">324</span></a> <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">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> -</span><span id="Presto.Generator-325"><a href="#Presto.Generator-325"><span class="linenos">325</span></a> <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">DATETIME64</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> -</span><span id="Presto.Generator-326"><a href="#Presto.Generator-326"><span class="linenos">326</span></a> <span class="p">}</span> -</span><span id="Presto.Generator-327"><a href="#Presto.Generator-327"><span class="linenos">327</span></a> -</span><span id="Presto.Generator-328"><a href="#Presto.Generator-328"><span class="linenos">328</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Presto.Generator-329"><a href="#Presto.Generator-329"><span class="linenos">329</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> -</span><span id="Presto.Generator-330"><a href="#Presto.Generator-330"><span class="linenos">330</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARBITRARY"</span><span class="p">),</span> -</span><span id="Presto.Generator-331"><a href="#Presto.Generator-331"><span class="linenos">331</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">_approx_distinct_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-332"><a href="#Presto.Generator-332"><span class="linenos">332</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"APPROX_PERCENTILE"</span><span class="p">),</span> -</span><span id="Presto.Generator-333"><a href="#Presto.Generator-333"><span class="linenos">333</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArgMax</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MAX_BY"</span><span class="p">),</span> -</span><span id="Presto.Generator-334"><a href="#Presto.Generator-334"><span class="linenos">334</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArgMin</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MIN_BY"</span><span class="p">),</span> -</span><span id="Presto.Generator-335"><a href="#Presto.Generator-335"><span class="linenos">335</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"ARRAY[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> -</span><span id="Presto.Generator-336"><a href="#Presto.Generator-336"><span class="linenos">336</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONCAT"</span><span class="p">),</span> -</span><span id="Presto.Generator-337"><a href="#Presto.Generator-337"><span class="linenos">337</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONTAINS"</span><span class="p">),</span> -</span><span id="Presto.Generator-338"><a href="#Presto.Generator-338"><span class="linenos">338</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CARDINALITY"</span><span class="p">),</span> -</span><span id="Presto.Generator-339"><a href="#Presto.Generator-339"><span class="linenos">339</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayUniqueAgg</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SET_AGG"</span><span class="p">),</span> -</span><span id="Presto.Generator-340"><a href="#Presto.Generator-340"><span class="linenos">340</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_AND(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto.Generator-341"><a href="#Presto.Generator-341"><span class="linenos">341</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_LEFT(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto.Generator-342"><a href="#Presto.Generator-342"><span class="linenos">342</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_NOT(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto.Generator-343"><a href="#Presto.Generator-343"><span class="linenos">343</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_OR(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto.Generator-344"><a href="#Presto.Generator-344"><span class="linenos">344</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_RIGHT(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto.Generator-345"><a href="#Presto.Generator-345"><span class="linenos">345</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_XOR(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto.Generator-346"><a href="#Presto.Generator-346"><span class="linenos">346</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">epoch_cast_to_ts</span><span class="p">]),</span> -</span><span id="Presto.Generator-347"><a href="#Presto.Generator-347"><span class="linenos">347</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> -</span><span id="Presto.Generator-348"><a href="#Presto.Generator-348"><span class="linenos">348</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> -</span><span id="Presto.Generator-349"><a href="#Presto.Generator-349"><span class="linenos">349</span></a> <span class="s2">"DATE_ADD"</span><span class="p">,</span> -</span><span id="Presto.Generator-350"><a href="#Presto.Generator-350"><span class="linenos">350</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> -</span><span id="Presto.Generator-351"><a href="#Presto.Generator-351"><span class="linenos">351</span></a> <span class="n">_to_int</span><span class="p">(</span> -</span><span id="Presto.Generator-352"><a href="#Presto.Generator-352"><span class="linenos">352</span></a> <span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> -</span><span id="Presto.Generator-353"><a href="#Presto.Generator-353"><span class="linenos">353</span></a> <span class="p">),</span> -</span><span id="Presto.Generator-354"><a href="#Presto.Generator-354"><span class="linenos">354</span></a> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> -</span><span id="Presto.Generator-355"><a href="#Presto.Generator-355"><span class="linenos">355</span></a> <span class="p">),</span> -</span><span id="Presto.Generator-356"><a href="#Presto.Generator-356"><span class="linenos">356</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> -</span><span id="Presto.Generator-357"><a href="#Presto.Generator-357"><span class="linenos">357</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> <span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span> -</span><span id="Presto.Generator-358"><a href="#Presto.Generator-358"><span class="linenos">358</span></a> <span class="p">),</span> -</span><span id="Presto.Generator-359"><a href="#Presto.Generator-359"><span class="linenos">359</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-360"><a href="#Presto.Generator-360"><span class="linenos">360</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_FORMAT(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">DATEINT_FORMAT</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> -</span><span id="Presto.Generator-361"><a href="#Presto.Generator-361"><span class="linenos">361</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> -</span><span id="Presto.Generator-362"><a href="#Presto.Generator-362"><span class="linenos">362</span></a> <span class="s2">"DATE_ADD"</span><span class="p">,</span> -</span><span id="Presto.Generator-363"><a href="#Presto.Generator-363"><span class="linenos">363</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> -</span><span id="Presto.Generator-364"><a href="#Presto.Generator-364"><span class="linenos">364</span></a> <span class="n">_to_int</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expression</span> <span class="o">*</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span> -</span><span id="Presto.Generator-365"><a href="#Presto.Generator-365"><span class="linenos">365</span></a> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> -</span><span id="Presto.Generator-366"><a href="#Presto.Generator-366"><span class="linenos">366</span></a> <span class="p">),</span> -</span><span id="Presto.Generator-367"><a href="#Presto.Generator-367"><span class="linenos">367</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">encode_decode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"FROM_UTF8"</span><span class="p">),</span> -</span><span id="Presto.Generator-368"><a href="#Presto.Generator-368"><span class="linenos">368</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_PARSE(CAST(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">DATEINT_FORMAT</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> -</span><span id="Presto.Generator-369"><a href="#Presto.Generator-369"><span class="linenos">369</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">encode_decode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"TO_UTF8"</span><span class="p">),</span> -</span><span id="Presto.Generator-370"><a href="#Presto.Generator-370"><span class="linenos">370</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FORMAT='</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">'"</span><span class="p">,</span> -</span><span id="Presto.Generator-371"><a href="#Presto.Generator-371"><span class="linenos">371</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">First</span><span class="p">:</span> <span class="n">_first_last_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-372"><a href="#Presto.Generator-372"><span class="linenos">372</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GetPath</span><span class="p">:</span> <span class="n">path_to_jsonpath</span><span class="p">(),</span> -</span><span id="Presto.Generator-373"><a href="#Presto.Generator-373"><span class="linenos">373</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">unalias_group</span><span class="p">]),</span> -</span><span id="Presto.Generator-374"><a href="#Presto.Generator-374"><span class="linenos">374</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> -</span><span id="Presto.Generator-375"><a href="#Presto.Generator-375"><span class="linenos">375</span></a> <span class="s2">"ARRAY_JOIN"</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">"ARRAY_AGG"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> <span class="n">e</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">"separator"</span><span class="p">)</span> -</span><span id="Presto.Generator-376"><a href="#Presto.Generator-376"><span class="linenos">376</span></a> <span class="p">),</span> -</span><span id="Presto.Generator-377"><a href="#Presto.Generator-377"><span class="linenos">377</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_HEX"</span><span class="p">),</span> -</span><span id="Presto.Generator-378"><a href="#Presto.Generator-378"><span class="linenos">378</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">(),</span> -</span><span id="Presto.Generator-379"><a href="#Presto.Generator-379"><span class="linenos">379</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-380"><a href="#Presto.Generator-380"><span class="linenos">380</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Initcap</span><span class="p">:</span> <span class="n">_initcap_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-381"><a href="#Presto.Generator-381"><span class="linenos">381</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ParseJSON</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"JSON_PARSE"</span><span class="p">),</span> -</span><span id="Presto.Generator-382"><a href="#Presto.Generator-382"><span class="linenos">382</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Last</span><span class="p">:</span> <span class="n">_first_last_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-383"><a href="#Presto.Generator-383"><span class="linenos">383</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LastDay</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</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">"LAST_DAY_OF_MONTH"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> -</span><span id="Presto.Generator-384"><a href="#Presto.Generator-384"><span class="linenos">384</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">:</span> <span class="n">_explode_to_unnest_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-385"><a href="#Presto.Generator-385"><span class="linenos">385</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Left</span><span class="p">:</span> <span class="n">left_to_substring_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-386"><a href="#Presto.Generator-386"><span class="linenos">386</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LEVENSHTEIN_DISTANCE"</span><span class="p">),</span> -</span><span id="Presto.Generator-387"><a href="#Presto.Generator-387"><span class="linenos">387</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalAnd</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_AND"</span><span class="p">),</span> -</span><span id="Presto.Generator-388"><a href="#Presto.Generator-388"><span class="linenos">388</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> -</span><span id="Presto.Generator-389"><a href="#Presto.Generator-389"><span class="linenos">389</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">:</span> <span class="n">no_pivot_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-390"><a href="#Presto.Generator-390"><span class="linenos">390</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="n">_quantile_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-391"><a href="#Presto.Generator-391"><span class="linenos">391</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpExtract</span><span class="p">:</span> <span class="n">regexp_extract_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-392"><a href="#Presto.Generator-392"><span class="linenos">392</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Right</span><span class="p">:</span> <span class="n">right_to_substring_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-393"><a href="#Presto.Generator-393"><span class="linenos">393</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-394"><a href="#Presto.Generator-394"><span class="linenos">394</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">:</span> <span class="n">_schema_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-395"><a href="#Presto.Generator-395"><span class="linenos">395</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SchemaCommentProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> -</span><span id="Presto.Generator-396"><a href="#Presto.Generator-396"><span class="linenos">396</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> -</span><span id="Presto.Generator-397"><a href="#Presto.Generator-397"><span class="linenos">397</span></a> <span class="p">[</span> -</span><span id="Presto.Generator-398"><a href="#Presto.Generator-398"><span class="linenos">398</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_qualify</span><span class="p">,</span> -</span><span id="Presto.Generator-399"><a href="#Presto.Generator-399"><span class="linenos">399</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">,</span> -</span><span id="Presto.Generator-400"><a href="#Presto.Generator-400"><span class="linenos">400</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">explode_to_unnest</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> -</span><span id="Presto.Generator-401"><a href="#Presto.Generator-401"><span class="linenos">401</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_semi_and_anti_joins</span><span class="p">,</span> -</span><span id="Presto.Generator-402"><a href="#Presto.Generator-402"><span class="linenos">402</span></a> <span class="p">]</span> -</span><span id="Presto.Generator-403"><a href="#Presto.Generator-403"><span class="linenos">403</span></a> <span class="p">),</span> -</span><span id="Presto.Generator-404"><a href="#Presto.Generator-404"><span class="linenos">404</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="p">:</span> <span class="n">_no_sort_array</span><span class="p">,</span> -</span><span id="Presto.Generator-405"><a href="#Presto.Generator-405"><span class="linenos">405</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRPOS"</span><span class="p">),</span> -</span><span id="Presto.Generator-406"><a href="#Presto.Generator-406"><span class="linenos">406</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> -</span><span id="Presto.Generator-407"><a href="#Presto.Generator-407"><span class="linenos">407</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToMap</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SPLIT_TO_MAP"</span><span class="p">),</span> -</span><span id="Presto.Generator-408"><a href="#Presto.Generator-408"><span class="linenos">408</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-409"><a href="#Presto.Generator-409"><span class="linenos">409</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> -</span><span id="Presto.Generator-410"><a href="#Presto.Generator-410"><span class="linenos">410</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">:</span> <span class="n">struct_extract_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-411"><a href="#Presto.Generator-411"><span class="linenos">411</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">_unnest_sequence</span><span class="p">]),</span> -</span><span id="Presto.Generator-412"><a href="#Presto.Generator-412"><span class="linenos">412</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Timestamp</span><span class="p">:</span> <span class="n">no_timestamp_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-413"><a href="#Presto.Generator-413"><span class="linenos">413</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampTrunc</span><span class="p">:</span> <span class="n">timestamptrunc_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-414"><a href="#Presto.Generator-414"><span class="linenos">414</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-415"><a href="#Presto.Generator-415"><span class="linenos">415</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-416"><a href="#Presto.Generator-416"><span class="linenos">416</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">TIME_FORMAT</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> -</span><span id="Presto.Generator-417"><a href="#Presto.Generator-417"><span class="linenos">417</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto.Generator-418"><a href="#Presto.Generator-418"><span class="linenos">418</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_UNIXTIME"</span><span class="p">),</span> -</span><span id="Presto.Generator-419"><a href="#Presto.Generator-419"><span class="linenos">419</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ToChar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto.Generator-420"><a href="#Presto.Generator-420"><span class="linenos">420</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">epoch_cast_to_ts</span><span class="p">]),</span> -</span><span id="Presto.Generator-421"><a href="#Presto.Generator-421"><span class="linenos">421</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> -</span><span id="Presto.Generator-422"><a href="#Presto.Generator-422"><span class="linenos">422</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">_ts_or_ds_add_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-423"><a href="#Presto.Generator-423"><span class="linenos">423</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">:</span> <span class="n">_ts_or_ds_diff_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-424"><a href="#Presto.Generator-424"><span class="linenos">424</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-425"><a href="#Presto.Generator-425"><span class="linenos">425</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_HEX"</span><span class="p">),</span> -</span><span id="Presto.Generator-426"><a href="#Presto.Generator-426"><span class="linenos">426</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(FROM_UNIXTIME(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Presto.Generator-427"><a href="#Presto.Generator-427"><span class="linenos">427</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">_unix_to_time_sql</span><span class="p">,</span> -</span><span id="Presto.Generator-428"><a href="#Presto.Generator-428"><span class="linenos">428</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(FROM_UNIXTIME(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS VARCHAR)"</span><span class="p">,</span> -</span><span id="Presto.Generator-429"><a href="#Presto.Generator-429"><span class="linenos">429</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> -</span><span id="Presto.Generator-430"><a href="#Presto.Generator-430"><span class="linenos">430</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">add_recursive_cte_column_names</span><span class="p">]),</span> -</span><span id="Presto.Generator-431"><a href="#Presto.Generator-431"><span class="linenos">431</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WithinGroup</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> -</span><span id="Presto.Generator-432"><a href="#Presto.Generator-432"><span class="linenos">432</span></a> <span class="p">[</span><span class="n">transforms</span><span class="o">.</span><span class="n">remove_within_group_for_percentiles</span><span class="p">]</span> -</span><span id="Presto.Generator-433"><a href="#Presto.Generator-433"><span class="linenos">433</span></a> <span class="p">),</span> -</span><span id="Presto.Generator-434"><a href="#Presto.Generator-434"><span class="linenos">434</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-435"><a href="#Presto.Generator-435"><span class="linenos">435</span></a> <span class="p">}</span> -</span><span id="Presto.Generator-436"><a href="#Presto.Generator-436"><span class="linenos">436</span></a> -</span><span id="Presto.Generator-437"><a href="#Presto.Generator-437"><span class="linenos">437</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto.Generator-438"><a href="#Presto.Generator-438"><span class="linenos">438</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">"safe"</span><span class="p">):</span> -</span><span id="Presto.Generator-439"><a href="#Presto.Generator-439"><span class="linenos">439</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-440"><a href="#Presto.Generator-440"><span class="linenos">440</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">,</span> -</span><span id="Presto.Generator-441"><a href="#Presto.Generator-441"><span class="linenos">441</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-442"><a href="#Presto.Generator-442"><span class="linenos">442</span></a> <span class="n">seq_get</span><span class="p">(</span> -</span><span id="Presto.Generator-443"><a href="#Presto.Generator-443"><span class="linenos">443</span></a> <span class="n">apply_index_offset</span><span class="p">(</span> -</span><span id="Presto.Generator-444"><a href="#Presto.Generator-444"><span class="linenos">444</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-445"><a href="#Presto.Generator-445"><span class="linenos">445</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-446"><a href="#Presto.Generator-446"><span class="linenos">446</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">"offset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> -</span><span id="Presto.Generator-447"><a href="#Presto.Generator-447"><span class="linenos">447</span></a> <span class="p">),</span> -</span><span id="Presto.Generator-448"><a href="#Presto.Generator-448"><span class="linenos">448</span></a> <span class="mi">0</span><span class="p">,</span> -</span><span id="Presto.Generator-449"><a href="#Presto.Generator-449"><span class="linenos">449</span></a> <span class="p">),</span> -</span><span id="Presto.Generator-450"><a href="#Presto.Generator-450"><span class="linenos">450</span></a> <span class="p">)</span> -</span><span id="Presto.Generator-451"><a href="#Presto.Generator-451"><span class="linenos">451</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-452"><a href="#Presto.Generator-452"><span class="linenos">452</span></a> -</span><span id="Presto.Generator-453"><a href="#Presto.Generator-453"><span class="linenos">453</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto.Generator-454"><a href="#Presto.Generator-454"><span class="linenos">454</span></a> <span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEY_VALUE_DEFINITIONS</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</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-455"><a href="#Presto.Generator-455"><span class="linenos">455</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Struct with key-value definitions is unsupported."</span><span class="p">)</span> -</span><span id="Presto.Generator-456"><a href="#Presto.Generator-456"><span class="linenos">456</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> -</span><span id="Presto.Generator-457"><a href="#Presto.Generator-457"><span class="linenos">457</span></a> -</span><span id="Presto.Generator-458"><a href="#Presto.Generator-458"><span class="linenos">458</span></a> <span class="k">return</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ROW"</span><span class="p">)(</span><span class="bp">self</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-285"><a href="#Presto.Generator-285"><span class="linenos">285</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Presto.Generator-286"><a href="#Presto.Generator-286"><span class="linenos">286</span></a> <span class="n">INTERVAL_ALLOWS_PLURAL_FORM</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto.Generator-287"><a href="#Presto.Generator-287"><span class="linenos">287</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto.Generator-288"><a href="#Presto.Generator-288"><span class="linenos">288</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto.Generator-289"><a href="#Presto.Generator-289"><span class="linenos">289</span></a> <span class="n">QUERY_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto.Generator-290"><a href="#Presto.Generator-290"><span class="linenos">290</span></a> <span class="n">IS_BOOL_ALLOWED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto.Generator-291"><a href="#Presto.Generator-291"><span class="linenos">291</span></a> <span class="n">TZ_TO_WITH_TIME_ZONE</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Presto.Generator-292"><a href="#Presto.Generator-292"><span class="linenos">292</span></a> <span class="n">NVL2_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto.Generator-293"><a href="#Presto.Generator-293"><span class="linenos">293</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="Presto.Generator-294"><a href="#Presto.Generator-294"><span class="linenos">294</span></a> <span class="n">LIMIT_ONLY_LITERALS</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Presto.Generator-295"><a href="#Presto.Generator-295"><span class="linenos">295</span></a> <span class="n">SUPPORTS_SINGLE_ARG_CONCAT</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Presto.Generator-296"><a href="#Presto.Generator-296"><span class="linenos">296</span></a> +</span><span id="Presto.Generator-297"><a href="#Presto.Generator-297"><span class="linenos">297</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto.Generator-298"><a href="#Presto.Generator-298"><span class="linenos">298</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> +</span><span id="Presto.Generator-299"><a href="#Presto.Generator-299"><span class="linenos">299</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Presto.Generator-300"><a href="#Presto.Generator-300"><span class="linenos">300</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatileProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Presto.Generator-301"><a href="#Presto.Generator-301"><span class="linenos">301</span></a> <span class="p">}</span> +</span><span id="Presto.Generator-302"><a href="#Presto.Generator-302"><span class="linenos">302</span></a> +</span><span id="Presto.Generator-303"><a href="#Presto.Generator-303"><span class="linenos">303</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto.Generator-304"><a href="#Presto.Generator-304"><span class="linenos">304</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> +</span><span id="Presto.Generator-305"><a href="#Presto.Generator-305"><span class="linenos">305</span></a> <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">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Presto.Generator-306"><a href="#Presto.Generator-306"><span class="linenos">306</span></a> <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">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="Presto.Generator-307"><a href="#Presto.Generator-307"><span class="linenos">307</span></a> <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">BINARY</span><span class="p">:</span> <span class="s2">"VARBINARY"</span><span class="p">,</span> +</span><span id="Presto.Generator-308"><a href="#Presto.Generator-308"><span class="linenos">308</span></a> <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 class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="Presto.Generator-309"><a href="#Presto.Generator-309"><span class="linenos">309</span></a> <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">TIMETZ</span><span class="p">:</span> <span class="s2">"TIME"</span><span class="p">,</span> +</span><span id="Presto.Generator-310"><a href="#Presto.Generator-310"><span class="linenos">310</span></a> <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">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Presto.Generator-311"><a href="#Presto.Generator-311"><span class="linenos">311</span></a> <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">STRUCT</span><span class="p">:</span> <span class="s2">"ROW"</span><span class="p">,</span> +</span><span id="Presto.Generator-312"><a href="#Presto.Generator-312"><span class="linenos">312</span></a> <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">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Presto.Generator-313"><a href="#Presto.Generator-313"><span class="linenos">313</span></a> <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">DATETIME64</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Presto.Generator-314"><a href="#Presto.Generator-314"><span class="linenos">314</span></a> <span class="p">}</span> +</span><span id="Presto.Generator-315"><a href="#Presto.Generator-315"><span class="linenos">315</span></a> +</span><span id="Presto.Generator-316"><a href="#Presto.Generator-316"><span class="linenos">316</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto.Generator-317"><a href="#Presto.Generator-317"><span class="linenos">317</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> +</span><span id="Presto.Generator-318"><a href="#Presto.Generator-318"><span class="linenos">318</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARBITRARY"</span><span class="p">),</span> +</span><span id="Presto.Generator-319"><a href="#Presto.Generator-319"><span class="linenos">319</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">_approx_distinct_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-320"><a href="#Presto.Generator-320"><span class="linenos">320</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"APPROX_PERCENTILE"</span><span class="p">),</span> +</span><span id="Presto.Generator-321"><a href="#Presto.Generator-321"><span class="linenos">321</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArgMax</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MAX_BY"</span><span class="p">),</span> +</span><span id="Presto.Generator-322"><a href="#Presto.Generator-322"><span class="linenos">322</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArgMin</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MIN_BY"</span><span class="p">),</span> +</span><span id="Presto.Generator-323"><a href="#Presto.Generator-323"><span class="linenos">323</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"ARRAY[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> +</span><span id="Presto.Generator-324"><a href="#Presto.Generator-324"><span class="linenos">324</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONCAT"</span><span class="p">),</span> +</span><span id="Presto.Generator-325"><a href="#Presto.Generator-325"><span class="linenos">325</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONTAINS"</span><span class="p">),</span> +</span><span id="Presto.Generator-326"><a href="#Presto.Generator-326"><span class="linenos">326</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CARDINALITY"</span><span class="p">),</span> +</span><span id="Presto.Generator-327"><a href="#Presto.Generator-327"><span class="linenos">327</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayUniqueAgg</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SET_AGG"</span><span class="p">),</span> +</span><span id="Presto.Generator-328"><a href="#Presto.Generator-328"><span class="linenos">328</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_AND(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-329"><a href="#Presto.Generator-329"><span class="linenos">329</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_LEFT(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-330"><a href="#Presto.Generator-330"><span class="linenos">330</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_NOT(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-331"><a href="#Presto.Generator-331"><span class="linenos">331</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_OR(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-332"><a href="#Presto.Generator-332"><span class="linenos">332</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_RIGHT(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-333"><a href="#Presto.Generator-333"><span class="linenos">333</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_XOR(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-334"><a href="#Presto.Generator-334"><span class="linenos">334</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">epoch_cast_to_ts</span><span class="p">]),</span> +</span><span id="Presto.Generator-335"><a href="#Presto.Generator-335"><span class="linenos">335</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="Presto.Generator-336"><a href="#Presto.Generator-336"><span class="linenos">336</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> +</span><span id="Presto.Generator-337"><a href="#Presto.Generator-337"><span class="linenos">337</span></a> <span class="s2">"DATE_ADD"</span><span class="p">,</span> +</span><span id="Presto.Generator-338"><a href="#Presto.Generator-338"><span class="linenos">338</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> +</span><span id="Presto.Generator-339"><a href="#Presto.Generator-339"><span class="linenos">339</span></a> <span class="n">_to_int</span><span class="p">(</span> +</span><span id="Presto.Generator-340"><a href="#Presto.Generator-340"><span class="linenos">340</span></a> <span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="Presto.Generator-341"><a href="#Presto.Generator-341"><span class="linenos">341</span></a> <span class="p">),</span> +</span><span id="Presto.Generator-342"><a href="#Presto.Generator-342"><span class="linenos">342</span></a> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="Presto.Generator-343"><a href="#Presto.Generator-343"><span class="linenos">343</span></a> <span class="p">),</span> +</span><span id="Presto.Generator-344"><a href="#Presto.Generator-344"><span class="linenos">344</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> +</span><span id="Presto.Generator-345"><a href="#Presto.Generator-345"><span class="linenos">345</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> <span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span> +</span><span id="Presto.Generator-346"><a href="#Presto.Generator-346"><span class="linenos">346</span></a> <span class="p">),</span> +</span><span id="Presto.Generator-347"><a href="#Presto.Generator-347"><span class="linenos">347</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-348"><a href="#Presto.Generator-348"><span class="linenos">348</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_FORMAT(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">DATEINT_FORMAT</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="Presto.Generator-349"><a href="#Presto.Generator-349"><span class="linenos">349</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> +</span><span id="Presto.Generator-350"><a href="#Presto.Generator-350"><span class="linenos">350</span></a> <span class="s2">"DATE_ADD"</span><span class="p">,</span> +</span><span id="Presto.Generator-351"><a href="#Presto.Generator-351"><span class="linenos">351</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">),</span> +</span><span id="Presto.Generator-352"><a href="#Presto.Generator-352"><span class="linenos">352</span></a> <span class="n">_to_int</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expression</span> <span class="o">*</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span> +</span><span id="Presto.Generator-353"><a href="#Presto.Generator-353"><span class="linenos">353</span></a> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="Presto.Generator-354"><a href="#Presto.Generator-354"><span class="linenos">354</span></a> <span class="p">),</span> +</span><span id="Presto.Generator-355"><a href="#Presto.Generator-355"><span class="linenos">355</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">encode_decode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"FROM_UTF8"</span><span class="p">),</span> +</span><span id="Presto.Generator-356"><a href="#Presto.Generator-356"><span class="linenos">356</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_PARSE(CAST(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">DATEINT_FORMAT</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> +</span><span id="Presto.Generator-357"><a href="#Presto.Generator-357"><span class="linenos">357</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">encode_decode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"TO_UTF8"</span><span class="p">),</span> +</span><span id="Presto.Generator-358"><a href="#Presto.Generator-358"><span class="linenos">358</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FORMAT='</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">'"</span><span class="p">,</span> +</span><span id="Presto.Generator-359"><a href="#Presto.Generator-359"><span class="linenos">359</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">First</span><span class="p">:</span> <span class="n">_first_last_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-360"><a href="#Presto.Generator-360"><span class="linenos">360</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FromTimeZone</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"WITH_TIMEZONE(</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">'this'</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="p">,</span><span class="w"> </span><span class="s1">'zone'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AT TIME ZONE 'UTC'"</span><span class="p">,</span> +</span><span id="Presto.Generator-361"><a href="#Presto.Generator-361"><span class="linenos">361</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GetPath</span><span class="p">:</span> <span class="n">path_to_jsonpath</span><span class="p">(),</span> +</span><span id="Presto.Generator-362"><a href="#Presto.Generator-362"><span class="linenos">362</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">unalias_group</span><span class="p">]),</span> +</span><span id="Presto.Generator-363"><a href="#Presto.Generator-363"><span class="linenos">363</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span> +</span><span id="Presto.Generator-364"><a href="#Presto.Generator-364"><span class="linenos">364</span></a> <span class="s2">"ARRAY_JOIN"</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">"ARRAY_AGG"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> <span class="n">e</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">"separator"</span><span class="p">)</span> +</span><span id="Presto.Generator-365"><a href="#Presto.Generator-365"><span class="linenos">365</span></a> <span class="p">),</span> +</span><span id="Presto.Generator-366"><a href="#Presto.Generator-366"><span class="linenos">366</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_HEX"</span><span class="p">),</span> +</span><span id="Presto.Generator-367"><a href="#Presto.Generator-367"><span class="linenos">367</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">(),</span> +</span><span id="Presto.Generator-368"><a href="#Presto.Generator-368"><span class="linenos">368</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-369"><a href="#Presto.Generator-369"><span class="linenos">369</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Initcap</span><span class="p">:</span> <span class="n">_initcap_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-370"><a href="#Presto.Generator-370"><span class="linenos">370</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ParseJSON</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"JSON_PARSE"</span><span class="p">),</span> +</span><span id="Presto.Generator-371"><a href="#Presto.Generator-371"><span class="linenos">371</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Last</span><span class="p">:</span> <span class="n">_first_last_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-372"><a href="#Presto.Generator-372"><span class="linenos">372</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LastDay</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</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">"LAST_DAY_OF_MONTH"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> +</span><span id="Presto.Generator-373"><a href="#Presto.Generator-373"><span class="linenos">373</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">:</span> <span class="n">_explode_to_unnest_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-374"><a href="#Presto.Generator-374"><span class="linenos">374</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Left</span><span class="p">:</span> <span class="n">left_to_substring_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-375"><a href="#Presto.Generator-375"><span class="linenos">375</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LEVENSHTEIN_DISTANCE"</span><span class="p">),</span> +</span><span id="Presto.Generator-376"><a href="#Presto.Generator-376"><span class="linenos">376</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalAnd</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_AND"</span><span class="p">),</span> +</span><span id="Presto.Generator-377"><a href="#Presto.Generator-377"><span class="linenos">377</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="Presto.Generator-378"><a href="#Presto.Generator-378"><span class="linenos">378</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">:</span> <span class="n">no_pivot_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-379"><a href="#Presto.Generator-379"><span class="linenos">379</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="n">_quantile_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-380"><a href="#Presto.Generator-380"><span class="linenos">380</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpExtract</span><span class="p">:</span> <span class="n">regexp_extract_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-381"><a href="#Presto.Generator-381"><span class="linenos">381</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Right</span><span class="p">:</span> <span class="n">right_to_substring_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-382"><a href="#Presto.Generator-382"><span class="linenos">382</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-383"><a href="#Presto.Generator-383"><span class="linenos">383</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">:</span> <span class="n">_schema_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-384"><a href="#Presto.Generator-384"><span class="linenos">384</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SchemaCommentProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="Presto.Generator-385"><a href="#Presto.Generator-385"><span class="linenos">385</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> +</span><span id="Presto.Generator-386"><a href="#Presto.Generator-386"><span class="linenos">386</span></a> <span class="p">[</span> +</span><span id="Presto.Generator-387"><a href="#Presto.Generator-387"><span class="linenos">387</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_qualify</span><span class="p">,</span> +</span><span id="Presto.Generator-388"><a href="#Presto.Generator-388"><span class="linenos">388</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">,</span> +</span><span id="Presto.Generator-389"><a href="#Presto.Generator-389"><span class="linenos">389</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">explode_to_unnest</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> +</span><span id="Presto.Generator-390"><a href="#Presto.Generator-390"><span class="linenos">390</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_semi_and_anti_joins</span><span class="p">,</span> +</span><span id="Presto.Generator-391"><a href="#Presto.Generator-391"><span class="linenos">391</span></a> <span class="p">]</span> +</span><span id="Presto.Generator-392"><a href="#Presto.Generator-392"><span class="linenos">392</span></a> <span class="p">),</span> +</span><span id="Presto.Generator-393"><a href="#Presto.Generator-393"><span class="linenos">393</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="p">:</span> <span class="n">_no_sort_array</span><span class="p">,</span> +</span><span id="Presto.Generator-394"><a href="#Presto.Generator-394"><span class="linenos">394</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRPOS"</span><span class="p">),</span> +</span><span id="Presto.Generator-395"><a href="#Presto.Generator-395"><span class="linenos">395</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="Presto.Generator-396"><a href="#Presto.Generator-396"><span class="linenos">396</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToMap</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SPLIT_TO_MAP"</span><span class="p">),</span> +</span><span id="Presto.Generator-397"><a href="#Presto.Generator-397"><span class="linenos">397</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-398"><a href="#Presto.Generator-398"><span class="linenos">398</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="Presto.Generator-399"><a href="#Presto.Generator-399"><span class="linenos">399</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">:</span> <span class="n">struct_extract_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-400"><a href="#Presto.Generator-400"><span class="linenos">400</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">_unnest_sequence</span><span class="p">]),</span> +</span><span id="Presto.Generator-401"><a href="#Presto.Generator-401"><span class="linenos">401</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Timestamp</span><span class="p">:</span> <span class="n">no_timestamp_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-402"><a href="#Presto.Generator-402"><span class="linenos">402</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampTrunc</span><span class="p">:</span> <span class="n">timestamptrunc_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-403"><a href="#Presto.Generator-403"><span class="linenos">403</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-404"><a href="#Presto.Generator-404"><span class="linenos">404</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-405"><a href="#Presto.Generator-405"><span class="linenos">405</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">TIME_FORMAT</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="Presto.Generator-406"><a href="#Presto.Generator-406"><span class="linenos">406</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-407"><a href="#Presto.Generator-407"><span class="linenos">407</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_UNIXTIME"</span><span class="p">),</span> +</span><span id="Presto.Generator-408"><a href="#Presto.Generator-408"><span class="linenos">408</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ToChar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-409"><a href="#Presto.Generator-409"><span class="linenos">409</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">epoch_cast_to_ts</span><span class="p">]),</span> +</span><span id="Presto.Generator-410"><a href="#Presto.Generator-410"><span class="linenos">410</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="Presto.Generator-411"><a href="#Presto.Generator-411"><span class="linenos">411</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">_ts_or_ds_add_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-412"><a href="#Presto.Generator-412"><span class="linenos">412</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">:</span> <span class="n">_ts_or_ds_diff_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-413"><a href="#Presto.Generator-413"><span class="linenos">413</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-414"><a href="#Presto.Generator-414"><span class="linenos">414</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_HEX"</span><span class="p">),</span> +</span><span id="Presto.Generator-415"><a href="#Presto.Generator-415"><span class="linenos">415</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(FROM_UNIXTIME(</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">'this'</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">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-416"><a href="#Presto.Generator-416"><span class="linenos">416</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">_unix_to_time_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-417"><a href="#Presto.Generator-417"><span class="linenos">417</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(FROM_UNIXTIME(</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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS VARCHAR)"</span><span class="p">,</span> +</span><span id="Presto.Generator-418"><a href="#Presto.Generator-418"><span class="linenos">418</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> +</span><span id="Presto.Generator-419"><a href="#Presto.Generator-419"><span class="linenos">419</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">add_recursive_cte_column_names</span><span class="p">]),</span> +</span><span id="Presto.Generator-420"><a href="#Presto.Generator-420"><span class="linenos">420</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WithinGroup</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> +</span><span id="Presto.Generator-421"><a href="#Presto.Generator-421"><span class="linenos">421</span></a> <span class="p">[</span><span class="n">transforms</span><span class="o">.</span><span class="n">remove_within_group_for_percentiles</span><span class="p">]</span> +</span><span id="Presto.Generator-422"><a href="#Presto.Generator-422"><span class="linenos">422</span></a> <span class="p">),</span> +</span><span id="Presto.Generator-423"><a href="#Presto.Generator-423"><span class="linenos">423</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-424"><a href="#Presto.Generator-424"><span class="linenos">424</span></a> <span class="p">}</span> +</span><span id="Presto.Generator-425"><a href="#Presto.Generator-425"><span class="linenos">425</span></a> +</span><span id="Presto.Generator-426"><a href="#Presto.Generator-426"><span class="linenos">426</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto.Generator-427"><a href="#Presto.Generator-427"><span class="linenos">427</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">"safe"</span><span class="p">):</span> +</span><span id="Presto.Generator-428"><a href="#Presto.Generator-428"><span class="linenos">428</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-429"><a href="#Presto.Generator-429"><span class="linenos">429</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">,</span> +</span><span id="Presto.Generator-430"><a href="#Presto.Generator-430"><span class="linenos">430</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-431"><a href="#Presto.Generator-431"><span class="linenos">431</span></a> <span class="n">seq_get</span><span class="p">(</span> +</span><span id="Presto.Generator-432"><a href="#Presto.Generator-432"><span class="linenos">432</span></a> <span class="n">apply_index_offset</span><span class="p">(</span> +</span><span id="Presto.Generator-433"><a href="#Presto.Generator-433"><span class="linenos">433</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-434"><a href="#Presto.Generator-434"><span class="linenos">434</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-435"><a href="#Presto.Generator-435"><span class="linenos">435</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">"offset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Presto.Generator-436"><a href="#Presto.Generator-436"><span class="linenos">436</span></a> <span class="p">),</span> +</span><span id="Presto.Generator-437"><a href="#Presto.Generator-437"><span class="linenos">437</span></a> <span class="mi">0</span><span class="p">,</span> +</span><span id="Presto.Generator-438"><a href="#Presto.Generator-438"><span class="linenos">438</span></a> <span class="p">),</span> +</span><span id="Presto.Generator-439"><a href="#Presto.Generator-439"><span class="linenos">439</span></a> <span class="p">)</span> +</span><span id="Presto.Generator-440"><a href="#Presto.Generator-440"><span class="linenos">440</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-441"><a href="#Presto.Generator-441"><span class="linenos">441</span></a> +</span><span id="Presto.Generator-442"><a href="#Presto.Generator-442"><span class="linenos">442</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto.Generator-443"><a href="#Presto.Generator-443"><span class="linenos">443</span></a> <span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEY_VALUE_DEFINITIONS</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</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-444"><a href="#Presto.Generator-444"><span class="linenos">444</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Struct with key-value definitions is unsupported."</span><span class="p">)</span> +</span><span id="Presto.Generator-445"><a href="#Presto.Generator-445"><span class="linenos">445</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><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">return</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ROW"</span><span class="p">)(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="Presto.Generator-448"><a href="#Presto.Generator-448"><span class="linenos">448</span></a> +</span><span id="Presto.Generator-449"><a href="#Presto.Generator-449"><span class="linenos">449</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto.Generator-450"><a href="#Presto.Generator-450"><span class="linenos">450</span></a> <span class="n">unit</span> <span class="o">=</span> <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">"unit"</span><span class="p">)</span> +</span><span id="Presto.Generator-451"><a href="#Presto.Generator-451"><span class="linenos">451</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">unit</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"WEEK"</span><span class="p">):</span> +</span><span id="Presto.Generator-452"><a href="#Presto.Generator-452"><span class="linenos">452</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</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 '7' DAY)"</span> +</span><span id="Presto.Generator-453"><a href="#Presto.Generator-453"><span class="linenos">453</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-454"><a href="#Presto.Generator-454"><span class="linenos">454</span></a> +</span><span id="Presto.Generator-455"><a href="#Presto.Generator-455"><span class="linenos">455</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto.Generator-456"><a href="#Presto.Generator-456"><span class="linenos">456</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">"modes"</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">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="s1">', '</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">"</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Presto.Generator-458"><a href="#Presto.Generator-458"><span class="linenos">458</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">"</span> </span><span id="Presto.Generator-459"><a href="#Presto.Generator-459"><span class="linenos">459</span></a> -</span><span id="Presto.Generator-460"><a href="#Presto.Generator-460"><span class="linenos">460</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto.Generator-461"><a href="#Presto.Generator-461"><span class="linenos">461</span></a> <span class="n">unit</span> <span class="o">=</span> <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">"unit"</span><span class="p">)</span> -</span><span id="Presto.Generator-462"><a href="#Presto.Generator-462"><span class="linenos">462</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">unit</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"WEEK"</span><span class="p">):</span> -</span><span id="Presto.Generator-463"><a href="#Presto.Generator-463"><span class="linenos">463</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</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 '7' DAY)"</span> -</span><span id="Presto.Generator-464"><a href="#Presto.Generator-464"><span class="linenos">464</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-465"><a href="#Presto.Generator-465"><span class="linenos">465</span></a> -</span><span id="Presto.Generator-466"><a href="#Presto.Generator-466"><span class="linenos">466</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">-></span> <span class="nb">str</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">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">"modes"</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">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="s1">', '</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">"</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">""</span> -</span><span id="Presto.Generator-469"><a href="#Presto.Generator-469"><span class="linenos">469</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">"</span> -</span><span id="Presto.Generator-470"><a href="#Presto.Generator-470"><span class="linenos">470</span></a> -</span><span id="Presto.Generator-471"><a href="#Presto.Generator-471"><span class="linenos">471</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto.Generator-472"><a href="#Presto.Generator-472"><span class="linenos">472</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">"start"</span><span class="p">]</span> -</span><span id="Presto.Generator-473"><a href="#Presto.Generator-473"><span class="linenos">473</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">"end"</span><span class="p">]</span> -</span><span id="Presto.Generator-474"><a href="#Presto.Generator-474"><span class="linenos">474</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">"step"</span><span class="p">)</span> -</span><span id="Presto.Generator-475"><a href="#Presto.Generator-475"><span class="linenos">475</span></a> -</span><span id="Presto.Generator-476"><a href="#Presto.Generator-476"><span class="linenos">476</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-477"><a href="#Presto.Generator-477"><span class="linenos">477</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-478"><a href="#Presto.Generator-478"><span class="linenos">478</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-479"><a href="#Presto.Generator-479"><span class="linenos">479</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-480"><a href="#Presto.Generator-480"><span class="linenos">480</span></a> <span class="k">else</span><span class="p">:</span> -</span><span id="Presto.Generator-481"><a href="#Presto.Generator-481"><span class="linenos">481</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="Presto.Generator-482"><a href="#Presto.Generator-482"><span class="linenos">482</span></a> -</span><span id="Presto.Generator-483"><a href="#Presto.Generator-483"><span class="linenos">483</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">"timestamp"</span><span class="p">):</span> -</span><span id="Presto.Generator-484"><a href="#Presto.Generator-484"><span class="linenos">484</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-485"><a href="#Presto.Generator-485"><span class="linenos">485</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-486"><a href="#Presto.Generator-486"><span class="linenos">486</span></a> <span class="k">else</span><span class="p">:</span> -</span><span id="Presto.Generator-487"><a href="#Presto.Generator-487"><span class="linenos">487</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-488"><a href="#Presto.Generator-488"><span class="linenos">488</span></a> -</span><span id="Presto.Generator-489"><a href="#Presto.Generator-489"><span class="linenos">489</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">"SEQUENCE"</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-490"><a href="#Presto.Generator-490"><span class="linenos">490</span></a> -</span><span id="Presto.Generator-491"><a href="#Presto.Generator-491"><span class="linenos">491</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span> -</span><span id="Presto.Generator-492"><a href="#Presto.Generator-492"><span class="linenos">492</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-493"><a href="#Presto.Generator-493"><span class="linenos">493</span></a> <span class="p">)</span> <span class="o">-></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-494"><a href="#Presto.Generator-494"><span class="linenos">494</span></a> <span class="k">return</span> <span class="p">[</span> -</span><span id="Presto.Generator-495"><a href="#Presto.Generator-495"><span class="linenos">495</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">"offset"</span><span class="p">),</span> -</span><span id="Presto.Generator-496"><a href="#Presto.Generator-496"><span class="linenos">496</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-497"><a href="#Presto.Generator-497"><span class="linenos">497</span></a> <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">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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto.Generator-500"><a href="#Presto.Generator-500"><span class="linenos">500</span></a><span class="w"> </span><span class="sd">"""</span> -</span><span id="Presto.Generator-501"><a href="#Presto.Generator-501"><span class="linenos">501</span></a><span class="sd"> Presto doesn't support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span> -</span><span id="Presto.Generator-502"><a href="#Presto.Generator-502"><span class="linenos">502</span></a><span class="sd"> so we need to remove them</span> -</span><span id="Presto.Generator-503"><a href="#Presto.Generator-503"><span class="linenos">503</span></a><span class="sd"> """</span> -</span><span id="Presto.Generator-504"><a href="#Presto.Generator-504"><span class="linenos">504</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">"kind"</span><span class="p">]</span> -</span><span id="Presto.Generator-505"><a href="#Presto.Generator-505"><span class="linenos">505</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-506"><a href="#Presto.Generator-506"><span class="linenos">506</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"VIEW"</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-507"><a href="#Presto.Generator-507"><span class="linenos">507</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">"expressions"</span><span class="p">,</span> <span class="kc">None</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">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-460"><a href="#Presto.Generator-460"><span class="linenos">460</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto.Generator-461"><a href="#Presto.Generator-461"><span class="linenos">461</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">"start"</span><span class="p">]</span> +</span><span id="Presto.Generator-462"><a href="#Presto.Generator-462"><span class="linenos">462</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">"end"</span><span class="p">]</span> +</span><span id="Presto.Generator-463"><a href="#Presto.Generator-463"><span class="linenos">463</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">"step"</span><span class="p">)</span> +</span><span id="Presto.Generator-464"><a href="#Presto.Generator-464"><span class="linenos">464</span></a> +</span><span id="Presto.Generator-465"><a href="#Presto.Generator-465"><span class="linenos">465</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-466"><a href="#Presto.Generator-466"><span class="linenos">466</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-467"><a href="#Presto.Generator-467"><span class="linenos">467</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-468"><a href="#Presto.Generator-468"><span class="linenos">468</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-469"><a href="#Presto.Generator-469"><span class="linenos">469</span></a> <span class="k">else</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">target_type</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Presto.Generator-471"><a href="#Presto.Generator-471"><span class="linenos">471</span></a> +</span><span id="Presto.Generator-472"><a href="#Presto.Generator-472"><span class="linenos">472</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">"timestamp"</span><span class="p">):</span> +</span><span id="Presto.Generator-473"><a href="#Presto.Generator-473"><span class="linenos">473</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-474"><a href="#Presto.Generator-474"><span class="linenos">474</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-475"><a href="#Presto.Generator-475"><span class="linenos">475</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Presto.Generator-476"><a href="#Presto.Generator-476"><span class="linenos">476</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-477"><a href="#Presto.Generator-477"><span class="linenos">477</span></a> +</span><span id="Presto.Generator-478"><a href="#Presto.Generator-478"><span class="linenos">478</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">"SEQUENCE"</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-479"><a href="#Presto.Generator-479"><span class="linenos">479</span></a> +</span><span id="Presto.Generator-480"><a href="#Presto.Generator-480"><span class="linenos">480</span></a> <span class="k">def</span> <span class="nf">offset_limit_modifiers</span><span class="p">(</span> +</span><span id="Presto.Generator-481"><a href="#Presto.Generator-481"><span class="linenos">481</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-482"><a href="#Presto.Generator-482"><span class="linenos">482</span></a> <span class="p">)</span> <span class="o">-></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-483"><a href="#Presto.Generator-483"><span class="linenos">483</span></a> <span class="k">return</span> <span class="p">[</span> +</span><span id="Presto.Generator-484"><a href="#Presto.Generator-484"><span class="linenos">484</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">"offset"</span><span class="p">),</span> +</span><span id="Presto.Generator-485"><a href="#Presto.Generator-485"><span class="linenos">485</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-486"><a href="#Presto.Generator-486"><span class="linenos">486</span></a> <span class="p">]</span> +</span><span id="Presto.Generator-487"><a href="#Presto.Generator-487"><span class="linenos">487</span></a> +</span><span id="Presto.Generator-488"><a href="#Presto.Generator-488"><span class="linenos">488</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto.Generator-489"><a href="#Presto.Generator-489"><span class="linenos">489</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Presto.Generator-490"><a href="#Presto.Generator-490"><span class="linenos">490</span></a><span class="sd"> Presto doesn't support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span> +</span><span id="Presto.Generator-491"><a href="#Presto.Generator-491"><span class="linenos">491</span></a><span class="sd"> so we need to remove them</span> +</span><span id="Presto.Generator-492"><a href="#Presto.Generator-492"><span class="linenos">492</span></a><span class="sd"> """</span> +</span><span id="Presto.Generator-493"><a href="#Presto.Generator-493"><span class="linenos">493</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">"kind"</span><span class="p">]</span> +</span><span id="Presto.Generator-494"><a href="#Presto.Generator-494"><span class="linenos">494</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-495"><a href="#Presto.Generator-495"><span class="linenos">495</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"VIEW"</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-496"><a href="#Presto.Generator-496"><span class="linenos">496</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">"expressions"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Presto.Generator-497"><a href="#Presto.Generator-497"><span class="linenos">497</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> @@ -2212,7 +2209,7 @@ Default: True</li> <div class="attr variable"> <span class="name">PROPERTIES_LOCATION</span> = <input id="Presto.Generator.PROPERTIES_LOCATION-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> - <label class="view-value-button pdoc-button" for="Presto.Generator.PROPERTIES_LOCATION-view-value"></label><span class="default_value">{<class '<a href="../expressions.html#AlgorithmProperty">sqlglot.expressions.AlgorithmProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#AutoIncrementProperty">sqlglot.expressions.AutoIncrementProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#AutoRefreshProperty">sqlglot.expressions.AutoRefreshProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#BlockCompressionProperty">sqlglot.expressions.BlockCompressionProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#CharacterSetProperty">sqlglot.expressions.CharacterSetProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#ChecksumProperty">sqlglot.expressions.ChecksumProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#CollateProperty">sqlglot.expressions.CollateProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#CopyGrantsProperty">sqlglot.expressions.CopyGrantsProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#Cluster">sqlglot.expressions.Cluster</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#ClusteredByProperty">sqlglot.expressions.ClusteredByProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#DataBlocksizeProperty">sqlglot.expressions.DataBlocksizeProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#DefinerProperty">sqlglot.expressions.DefinerProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#DictRange">sqlglot.expressions.DictRange</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#DictProperty">sqlglot.expressions.DictProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#DistKeyProperty">sqlglot.expressions.DistKeyProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#DistStyleProperty">sqlglot.expressions.DistStyleProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#EngineProperty">sqlglot.expressions.EngineProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#ExecuteAsProperty">sqlglot.expressions.ExecuteAsProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#ExternalProperty">sqlglot.expressions.ExternalProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#FallbackProperty">sqlglot.expressions.FallbackProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#FileFormatProperty">sqlglot.expressions.FileFormatProperty</a>'>: <Location.POST_WITH: 'POST_WITH'>, <class '<a href="../expressions.html#FreespaceProperty">sqlglot.expressions.FreespaceProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#HeapProperty">sqlglot.expressions.HeapProperty</a>'>: <Location.POST_WITH: 'POST_WITH'>, <class '<a href="../expressions.html#InputModelProperty">sqlglot.expressions.InputModelProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#IsolatedLoadingProperty">sqlglot.expressions.IsolatedLoadingProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#JournalProperty">sqlglot.expressions.JournalProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#LanguageProperty">sqlglot.expressions.LanguageProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#LikeProperty">sqlglot.expressions.LikeProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#LocationProperty">sqlglot.expressions.LocationProperty</a>'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <class '<a href="../expressions.html#LockingProperty">sqlglot.expressions.LockingProperty</a>'>: <Location.POST_ALIAS: 'POST_ALIAS'>, <class '<a href="../expressions.html#LogProperty">sqlglot.expressions.LogProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#MaterializedProperty">sqlglot.expressions.MaterializedProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#MergeBlockRatioProperty">sqlglot.expressions.MergeBlockRatioProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#NoPrimaryIndexProperty">sqlglot.expressions.NoPrimaryIndexProperty</a>'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class '<a href="../expressions.html#OnProperty">sqlglot.expressions.OnProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#OnCommitProperty">sqlglot.expressions.OnCommitProperty</a>'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class '<a href="../expressions.html#Order">sqlglot.expressions.Order</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#OutputModelProperty">sqlglot.expressions.OutputModelProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#PartitionedByProperty">sqlglot.expressions.PartitionedByProperty</a>'>: <Location.POST_WITH: 'POST_WITH'>, <class '<a href="../expressions.html#PartitionedOfProperty">sqlglot.expressions.PartitionedOfProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#PrimaryKey">sqlglot.expressions.PrimaryKey</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#Property">sqlglot.expressions.Property</a>'>: <Location.POST_WITH: 'POST_WITH'>, <class '<a href="../expressions.html#RemoteWithConnectionModelProperty">sqlglot.expressions.RemoteWithConnectionModelProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#ReturnsProperty">sqlglot.expressions.ReturnsProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#RowFormatProperty">sqlglot.expressions.RowFormatProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#RowFormatDelimitedProperty">sqlglot.expressions.RowFormatDelimitedProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#RowFormatSerdeProperty">sqlglot.expressions.RowFormatSerdeProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SampleProperty">sqlglot.expressions.SampleProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SchemaCommentProperty">sqlglot.expressions.SchemaCommentProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SerdeProperties">sqlglot.expressions.SerdeProperties</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#Set">sqlglot.expressions.Set</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SettingsProperty">sqlglot.expressions.SettingsProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SetProperty">sqlglot.expressions.SetProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#SortKeyProperty">sqlglot.expressions.SortKeyProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SqlReadWriteProperty">sqlglot.expressions.SqlReadWriteProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SqlSecurityProperty">sqlglot.expressions.SqlSecurityProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#StabilityProperty">sqlglot.expressions.StabilityProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#TemporaryProperty">sqlglot.expressions.TemporaryProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#ToTableProperty">sqlglot.expressions.ToTableProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#TransientProperty">sqlglot.expressions.TransientProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#TransformModelProperty">sqlglot.expressions.TransformModelProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#MergeTreeTTL">sqlglot.expressions.MergeTreeTTL</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#VolatileProperty">sqlglot.expressions.VolatileProperty</a>'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <class '<a href="../expressions.html#WithDataProperty">sqlglot.expressions.WithDataProperty</a>'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class '<a href="../expressions.html#WithJournalTableProperty">sqlglot.expressions.WithJournalTableProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#WithSystemVersioningProperty">sqlglot.expressions.WithSystemVersioningProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>}</span> + <label class="view-value-button pdoc-button" for="Presto.Generator.PROPERTIES_LOCATION-view-value"></label><span class="default_value">{<class '<a href="../expressions.html#AlgorithmProperty">sqlglot.expressions.AlgorithmProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#AutoIncrementProperty">sqlglot.expressions.AutoIncrementProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#AutoRefreshProperty">sqlglot.expressions.AutoRefreshProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#BlockCompressionProperty">sqlglot.expressions.BlockCompressionProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#CharacterSetProperty">sqlglot.expressions.CharacterSetProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#ChecksumProperty">sqlglot.expressions.ChecksumProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#CollateProperty">sqlglot.expressions.CollateProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#CopyGrantsProperty">sqlglot.expressions.CopyGrantsProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#Cluster">sqlglot.expressions.Cluster</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#ClusteredByProperty">sqlglot.expressions.ClusteredByProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#DataBlocksizeProperty">sqlglot.expressions.DataBlocksizeProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#DefinerProperty">sqlglot.expressions.DefinerProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#DictRange">sqlglot.expressions.DictRange</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#DictProperty">sqlglot.expressions.DictProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#DistKeyProperty">sqlglot.expressions.DistKeyProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#DistStyleProperty">sqlglot.expressions.DistStyleProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#EngineProperty">sqlglot.expressions.EngineProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#ExecuteAsProperty">sqlglot.expressions.ExecuteAsProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#ExternalProperty">sqlglot.expressions.ExternalProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#FallbackProperty">sqlglot.expressions.FallbackProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#FileFormatProperty">sqlglot.expressions.FileFormatProperty</a>'>: <Location.POST_WITH: 'POST_WITH'>, <class '<a href="../expressions.html#FreespaceProperty">sqlglot.expressions.FreespaceProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#HeapProperty">sqlglot.expressions.HeapProperty</a>'>: <Location.POST_WITH: 'POST_WITH'>, <class '<a href="../expressions.html#InheritsProperty">sqlglot.expressions.InheritsProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#InputModelProperty">sqlglot.expressions.InputModelProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#IsolatedLoadingProperty">sqlglot.expressions.IsolatedLoadingProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#JournalProperty">sqlglot.expressions.JournalProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#LanguageProperty">sqlglot.expressions.LanguageProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#LikeProperty">sqlglot.expressions.LikeProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#LocationProperty">sqlglot.expressions.LocationProperty</a>'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <class '<a href="../expressions.html#LockingProperty">sqlglot.expressions.LockingProperty</a>'>: <Location.POST_ALIAS: 'POST_ALIAS'>, <class '<a href="../expressions.html#LogProperty">sqlglot.expressions.LogProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#MaterializedProperty">sqlglot.expressions.MaterializedProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#MergeBlockRatioProperty">sqlglot.expressions.MergeBlockRatioProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#NoPrimaryIndexProperty">sqlglot.expressions.NoPrimaryIndexProperty</a>'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class '<a href="../expressions.html#OnProperty">sqlglot.expressions.OnProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#OnCommitProperty">sqlglot.expressions.OnCommitProperty</a>'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class '<a href="../expressions.html#Order">sqlglot.expressions.Order</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#OutputModelProperty">sqlglot.expressions.OutputModelProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#PartitionedByProperty">sqlglot.expressions.PartitionedByProperty</a>'>: <Location.POST_WITH: 'POST_WITH'>, <class '<a href="../expressions.html#PartitionedOfProperty">sqlglot.expressions.PartitionedOfProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#PrimaryKey">sqlglot.expressions.PrimaryKey</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#Property">sqlglot.expressions.Property</a>'>: <Location.POST_WITH: 'POST_WITH'>, <class '<a href="../expressions.html#RemoteWithConnectionModelProperty">sqlglot.expressions.RemoteWithConnectionModelProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#ReturnsProperty">sqlglot.expressions.ReturnsProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#RowFormatProperty">sqlglot.expressions.RowFormatProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#RowFormatDelimitedProperty">sqlglot.expressions.RowFormatDelimitedProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#RowFormatSerdeProperty">sqlglot.expressions.RowFormatSerdeProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SampleProperty">sqlglot.expressions.SampleProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SchemaCommentProperty">sqlglot.expressions.SchemaCommentProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SerdeProperties">sqlglot.expressions.SerdeProperties</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#Set">sqlglot.expressions.Set</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SettingsProperty">sqlglot.expressions.SettingsProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SetProperty">sqlglot.expressions.SetProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#SetConfigProperty">sqlglot.expressions.SetConfigProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SortKeyProperty">sqlglot.expressions.SortKeyProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SqlReadWriteProperty">sqlglot.expressions.SqlReadWriteProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#SqlSecurityProperty">sqlglot.expressions.SqlSecurityProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#StabilityProperty">sqlglot.expressions.StabilityProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#TemporaryProperty">sqlglot.expressions.TemporaryProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#ToTableProperty">sqlglot.expressions.ToTableProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#TransientProperty">sqlglot.expressions.TransientProperty</a>'>: <Location.POST_CREATE: 'POST_CREATE'>, <class '<a href="../expressions.html#TransformModelProperty">sqlglot.expressions.TransformModelProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#MergeTreeTTL">sqlglot.expressions.MergeTreeTTL</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>, <class '<a href="../expressions.html#VolatileProperty">sqlglot.expressions.VolatileProperty</a>'>: <Location.UNSUPPORTED: 'UNSUPPORTED'>, <class '<a href="../expressions.html#WithDataProperty">sqlglot.expressions.WithDataProperty</a>'>: <Location.POST_EXPRESSION: 'POST_EXPRESSION'>, <class '<a href="../expressions.html#WithJournalTableProperty">sqlglot.expressions.WithJournalTableProperty</a>'>: <Location.POST_NAME: 'POST_NAME'>, <class '<a href="../expressions.html#WithSystemVersioningProperty">sqlglot.expressions.WithSystemVersioningProperty</a>'>: <Location.POST_SCHEMA: 'POST_SCHEMA'>}</span> </div> @@ -2238,7 +2235,7 @@ Default: True</li> <div class="attr variable"> <span class="name">TRANSFORMS</span> = <input id="Presto.Generator.TRANSFORMS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> - <label class="view-value-button pdoc-button" for="Presto.Generator.TRANSFORMS-view-value"></label><span class="default_value">{<class '<a href="../expressions.html#DateAdd">sqlglot.expressions.DateAdd</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#CaseSpecificColumnConstraint">sqlglot.expressions.CaseSpecificColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CharacterSetColumnConstraint">sqlglot.expressions.CharacterSetColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CharacterSetProperty">sqlglot.expressions.CharacterSetProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CheckColumnConstraint">sqlglot.expressions.CheckColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ClusteredColumnConstraint">sqlglot.expressions.ClusteredColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CollateColumnConstraint">sqlglot.expressions.CollateColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#AutoRefreshProperty">sqlglot.expressions.AutoRefreshProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CopyGrantsProperty">sqlglot.expressions.CopyGrantsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CommentColumnConstraint">sqlglot.expressions.CommentColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#DateFormatColumnConstraint">sqlglot.expressions.DateFormatColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#DefaultColumnConstraint">sqlglot.expressions.DefaultColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#EncodeColumnConstraint">sqlglot.expressions.EncodeColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ExecuteAsProperty">sqlglot.expressions.ExecuteAsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ExternalProperty">sqlglot.expressions.ExternalProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#HeapProperty">sqlglot.expressions.HeapProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#InlineLengthColumnConstraint">sqlglot.expressions.InlineLengthColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#InputModelProperty">sqlglot.expressions.InputModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#IntervalSpan">sqlglot.expressions.IntervalSpan</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#LanguageProperty">sqlglot.expressions.LanguageProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#LocationProperty">sqlglot.expressions.LocationProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#LogProperty">sqlglot.expressions.LogProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#MaterializedProperty">sqlglot.expressions.MaterializedProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#NoPrimaryIndexProperty">sqlglot.expressions.NoPrimaryIndexProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#NonClusteredColumnConstraint">sqlglot.expressions.NonClusteredColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#NotForReplicationColumnConstraint">sqlglot.expressions.NotForReplicationColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OnCommitProperty">sqlglot.expressions.OnCommitProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OnProperty">sqlglot.expressions.OnProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OnUpdateColumnConstraint">sqlglot.expressions.OnUpdateColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OutputModelProperty">sqlglot.expressions.OutputModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#PathColumnConstraint">sqlglot.expressions.PathColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#RemoteWithConnectionModelProperty">sqlglot.expressions.RemoteWithConnectionModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ReturnsProperty">sqlglot.expressions.ReturnsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SampleProperty">sqlglot.expressions.SampleProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SetProperty">sqlglot.expressions.SetProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SettingsProperty">sqlglot.expressions.SettingsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SqlReadWriteProperty">sqlglot.expressions.SqlReadWriteProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SqlSecurityProperty">sqlglot.expressions.SqlSecurityProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#StabilityProperty">sqlglot.expressions.StabilityProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TemporaryProperty">sqlglot.expressions.TemporaryProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ToTableProperty">sqlglot.expressions.ToTableProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TransientProperty">sqlglot.expressions.TransientProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TransformModelProperty">sqlglot.expressions.TransformModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TitleColumnConstraint">sqlglot.expressions.TitleColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#UppercaseColumnConstraint">sqlglot.expressions.UppercaseColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#VarMap">sqlglot.expressions.VarMap</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#VolatileProperty">sqlglot.expressions.VolatileProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#WithJournalTableProperty">sqlglot.expressions.WithJournalTableProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#AnyValue">sqlglot.expressions.AnyValue</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ApproxDistinct">sqlglot.expressions.ApproxDistinct</a>'>: <function _approx_distinct_sql>, <class '<a href="../expressions.html#ApproxQuantile">sqlglot.expressions.ApproxQuantile</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#Array">sqlglot.expressions.Array</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#ArrayConcat">sqlglot.expressions.ArrayConcat</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ArrayContains">sqlglot.expressions.ArrayContains</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ArraySize">sqlglot.expressions.ArraySize</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ArrayUniqueAgg">sqlglot.expressions.ArrayUniqueAgg</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#BitwiseAnd">sqlglot.expressions.BitwiseAnd</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#BitwiseLeftShift">sqlglot.expressions.BitwiseLeftShift</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#BitwiseNot">sqlglot.expressions.BitwiseNot</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#BitwiseOr">sqlglot.expressions.BitwiseOr</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#BitwiseRightShift">sqlglot.expressions.BitwiseRightShift</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#BitwiseXor">sqlglot.expressions.BitwiseXor</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#Cast">sqlglot.expressions.Cast</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#DateDiff">sqlglot.expressions.DateDiff</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#DateStrToDate">sqlglot.expressions.DateStrToDate</a>'>: <function datestrtodate_sql>, <class '<a href="../expressions.html#DateToDi">sqlglot.expressions.DateToDi</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#DateSub">sqlglot.expressions.DateSub</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#Decode">sqlglot.expressions.Decode</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#DiToDate">sqlglot.expressions.DiToDate</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#Encode">sqlglot.expressions.Encode</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#FileFormatProperty">sqlglot.expressions.FileFormatProperty</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#First">sqlglot.expressions.First</a>'>: <function _first_last_sql>, <class '<a href="../expressions.html#GetPath">sqlglot.expressions.GetPath</a>'>: <function path_to_jsonpath.<locals>._transform>, <class '<a href="../expressions.html#Group">sqlglot.expressions.Group</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#GroupConcat">sqlglot.expressions.GroupConcat</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#Hex">sqlglot.expressions.Hex</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#If">sqlglot.expressions.If</a>'>: <function if_sql.<locals>._if_sql>, <class '<a href="../expressions.html#ILike">sqlglot.expressions.ILike</a>'>: <function no_ilike_sql>, <class '<a href="../expressions.html#Initcap">sqlglot.expressions.Initcap</a>'>: <function _initcap_sql>, <class '<a href="../expressions.html#ParseJSON">sqlglot.expressions.ParseJSON</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#Last">sqlglot.expressions.Last</a>'>: <function _first_last_sql>, <class '<a href="../expressions.html#LastDay">sqlglot.expressions.LastDay</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#Lateral">sqlglot.expressions.Lateral</a>'>: <function _explode_to_unnest_sql>, <class '<a href="../expressions.html#Left">sqlglot.expressions.Left</a>'>: <function left_to_substring_sql>, <class '<a href="../expressions.html#Levenshtein">sqlglot.expressions.Levenshtein</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#Pivot">sqlglot.expressions.Pivot</a>'>: <function no_pivot_sql>, <class '<a href="../expressions.html#Quantile">sqlglot.expressions.Quantile</a>'>: <function _quantile_sql>, <class '<a href="../expressions.html#RegexpExtract">sqlglot.expressions.RegexpExtract</a>'>: <function regexp_extract_sql>, <class '<a href="../expressions.html#Right">sqlglot.expressions.Right</a>'>: <function right_to_substring_sql>, <class '<a href="../expressions.html#SafeDivide">sqlglot.expressions.SafeDivide</a>'>: <function no_safe_divide_sql>, <class '<a href="../expressions.html#Schema">sqlglot.expressions.Schema</a>'>: <function _schema_sql>, <class '<a href="../expressions.html#SchemaCommentProperty">sqlglot.expressions.SchemaCommentProperty</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#Select">sqlglot.expressions.Select</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#SortArray">sqlglot.expressions.SortArray</a>'>: <function _no_sort_array>, <class '<a href="../expressions.html#StrPosition">sqlglot.expressions.StrPosition</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#StrToDate">sqlglot.expressions.StrToDate</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#StrToMap">sqlglot.expressions.StrToMap</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#StrToTime">sqlglot.expressions.StrToTime</a>'>: <function _str_to_time_sql>, <class '<a href="../expressions.html#StrToUnix">sqlglot.expressions.StrToUnix</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#StructExtract">sqlglot.expressions.StructExtract</a>'>: <function struct_extract_sql>, <class '<a href="../expressions.html#Table">sqlglot.expressions.Table</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#Timestamp">sqlglot.expressions.Timestamp</a>'>: <function no_timestamp_sql>, <class '<a href="../expressions.html#TimestampTrunc">sqlglot.expressions.TimestampTrunc</a>'>: <function timestamptrunc_sql>, <class '<a href="../expressions.html#TimeStrToDate">sqlglot.expressions.TimeStrToDate</a>'>: <function timestrtotime_sql>, <class '<a href="../expressions.html#TimeStrToTime">sqlglot.expressions.TimeStrToTime</a>'>: <function timestrtotime_sql>, <class '<a href="../expressions.html#TimeStrToUnix">sqlglot.expressions.TimeStrToUnix</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#TimeToStr">sqlglot.expressions.TimeToStr</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#TimeToUnix">sqlglot.expressions.TimeToUnix</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ToChar">sqlglot.expressions.ToChar</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#TryCast">sqlglot.expressions.TryCast</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#TsOrDiToDi">sqlglot.expressions.TsOrDiToDi</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#TsOrDsAdd">sqlglot.expressions.TsOrDsAdd</a>'>: <function _ts_or_ds_add_sql>, <class '<a href="../expressions.html#TsOrDsDiff">sqlglot.expressions.TsOrDsDiff</a>'>: <function _ts_or_ds_diff_sql>, <class '<a href="../expressions.html#TsOrDsToDate">sqlglot.expressions.TsOrDsToDate</a>'>: <function _ts_or_ds_to_date_sql>, <class '<a href="../expressions.html#Unhex">sqlglot.expressions.Unhex</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#UnixToStr">sqlglot.expressions.UnixToStr</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#UnixToTime">sqlglot.expressions.UnixToTime</a>'>: <function _unix_to_time_sql>, <class '<a href="../expressions.html#UnixToTimeStr">sqlglot.expressions.UnixToTimeStr</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#VariancePop">sqlglot.expressions.VariancePop</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#With">sqlglot.expressions.With</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#WithinGroup">sqlglot.expressions.WithinGroup</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#Xor">sqlglot.expressions.Xor</a>'>: <function bool_xor_sql>}</span> + <label class="view-value-button pdoc-button" for="Presto.Generator.TRANSFORMS-view-value"></label><span class="default_value">{<class '<a href="../expressions.html#DateAdd">sqlglot.expressions.DateAdd</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#CaseSpecificColumnConstraint">sqlglot.expressions.CaseSpecificColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CharacterSetColumnConstraint">sqlglot.expressions.CharacterSetColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CharacterSetProperty">sqlglot.expressions.CharacterSetProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CheckColumnConstraint">sqlglot.expressions.CheckColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ClusteredColumnConstraint">sqlglot.expressions.ClusteredColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CollateColumnConstraint">sqlglot.expressions.CollateColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#AutoRefreshProperty">sqlglot.expressions.AutoRefreshProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CopyGrantsProperty">sqlglot.expressions.CopyGrantsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CommentColumnConstraint">sqlglot.expressions.CommentColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#DateFormatColumnConstraint">sqlglot.expressions.DateFormatColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#DefaultColumnConstraint">sqlglot.expressions.DefaultColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#EncodeColumnConstraint">sqlglot.expressions.EncodeColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ExecuteAsProperty">sqlglot.expressions.ExecuteAsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ExternalProperty">sqlglot.expressions.ExternalProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#HeapProperty">sqlglot.expressions.HeapProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#InheritsProperty">sqlglot.expressions.InheritsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#InlineLengthColumnConstraint">sqlglot.expressions.InlineLengthColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#InputModelProperty">sqlglot.expressions.InputModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#IntervalSpan">sqlglot.expressions.IntervalSpan</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#LanguageProperty">sqlglot.expressions.LanguageProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#LocationProperty">sqlglot.expressions.LocationProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#LogProperty">sqlglot.expressions.LogProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#MaterializedProperty">sqlglot.expressions.MaterializedProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#NoPrimaryIndexProperty">sqlglot.expressions.NoPrimaryIndexProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#NonClusteredColumnConstraint">sqlglot.expressions.NonClusteredColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#NotForReplicationColumnConstraint">sqlglot.expressions.NotForReplicationColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OnCommitProperty">sqlglot.expressions.OnCommitProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OnProperty">sqlglot.expressions.OnProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OnUpdateColumnConstraint">sqlglot.expressions.OnUpdateColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OutputModelProperty">sqlglot.expressions.OutputModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#PathColumnConstraint">sqlglot.expressions.PathColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#RemoteWithConnectionModelProperty">sqlglot.expressions.RemoteWithConnectionModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ReturnsProperty">sqlglot.expressions.ReturnsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SampleProperty">sqlglot.expressions.SampleProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SetProperty">sqlglot.expressions.SetProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SetConfigProperty">sqlglot.expressions.SetConfigProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SettingsProperty">sqlglot.expressions.SettingsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SqlReadWriteProperty">sqlglot.expressions.SqlReadWriteProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SqlSecurityProperty">sqlglot.expressions.SqlSecurityProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#StabilityProperty">sqlglot.expressions.StabilityProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TemporaryProperty">sqlglot.expressions.TemporaryProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ToTableProperty">sqlglot.expressions.ToTableProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TransientProperty">sqlglot.expressions.TransientProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TransformModelProperty">sqlglot.expressions.TransformModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TitleColumnConstraint">sqlglot.expressions.TitleColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#UppercaseColumnConstraint">sqlglot.expressions.UppercaseColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#VarMap">sqlglot.expressions.VarMap</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#VolatileProperty">sqlglot.expressions.VolatileProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#WithJournalTableProperty">sqlglot.expressions.WithJournalTableProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#AnyValue">sqlglot.expressions.AnyValue</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ApproxDistinct">sqlglot.expressions.ApproxDistinct</a>'>: <function _approx_distinct_sql>, <class '<a href="../expressions.html#ApproxQuantile">sqlglot.expressions.ApproxQuantile</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#Array">sqlglot.expressions.Array</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#ArrayConcat">sqlglot.expressions.ArrayConcat</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ArrayContains">sqlglot.expressions.ArrayContains</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ArraySize">sqlglot.expressions.ArraySize</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ArrayUniqueAgg">sqlglot.expressions.ArrayUniqueAgg</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#BitwiseAnd">sqlglot.expressions.BitwiseAnd</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#BitwiseLeftShift">sqlglot.expressions.BitwiseLeftShift</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#BitwiseNot">sqlglot.expressions.BitwiseNot</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#BitwiseOr">sqlglot.expressions.BitwiseOr</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#BitwiseRightShift">sqlglot.expressions.BitwiseRightShift</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#BitwiseXor">sqlglot.expressions.BitwiseXor</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#Cast">sqlglot.expressions.Cast</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#DateDiff">sqlglot.expressions.DateDiff</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#DateStrToDate">sqlglot.expressions.DateStrToDate</a>'>: <function datestrtodate_sql>, <class '<a href="../expressions.html#DateToDi">sqlglot.expressions.DateToDi</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#DateSub">sqlglot.expressions.DateSub</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#Decode">sqlglot.expressions.Decode</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#DiToDate">sqlglot.expressions.DiToDate</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#Encode">sqlglot.expressions.Encode</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#FileFormatProperty">sqlglot.expressions.FileFormatProperty</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#First">sqlglot.expressions.First</a>'>: <function _first_last_sql>, <class '<a href="../expressions.html#FromTimeZone">sqlglot.expressions.FromTimeZone</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#GetPath">sqlglot.expressions.GetPath</a>'>: <function path_to_jsonpath.<locals>._transform>, <class '<a href="../expressions.html#Group">sqlglot.expressions.Group</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#GroupConcat">sqlglot.expressions.GroupConcat</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#Hex">sqlglot.expressions.Hex</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#If">sqlglot.expressions.If</a>'>: <function if_sql.<locals>._if_sql>, <class '<a href="../expressions.html#ILike">sqlglot.expressions.ILike</a>'>: <function no_ilike_sql>, <class '<a href="../expressions.html#Initcap">sqlglot.expressions.Initcap</a>'>: <function _initcap_sql>, <class '<a href="../expressions.html#ParseJSON">sqlglot.expressions.ParseJSON</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#Last">sqlglot.expressions.Last</a>'>: <function _first_last_sql>, <class '<a href="../expressions.html#LastDay">sqlglot.expressions.LastDay</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#Lateral">sqlglot.expressions.Lateral</a>'>: <function _explode_to_unnest_sql>, <class '<a href="../expressions.html#Left">sqlglot.expressions.Left</a>'>: <function left_to_substring_sql>, <class '<a href="../expressions.html#Levenshtein">sqlglot.expressions.Levenshtein</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#Pivot">sqlglot.expressions.Pivot</a>'>: <function no_pivot_sql>, <class '<a href="../expressions.html#Quantile">sqlglot.expressions.Quantile</a>'>: <function _quantile_sql>, <class '<a href="../expressions.html#RegexpExtract">sqlglot.expressions.RegexpExtract</a>'>: <function regexp_extract_sql>, <class '<a href="../expressions.html#Right">sqlglot.expressions.Right</a>'>: <function right_to_substring_sql>, <class '<a href="../expressions.html#SafeDivide">sqlglot.expressions.SafeDivide</a>'>: <function no_safe_divide_sql>, <class '<a href="../expressions.html#Schema">sqlglot.expressions.Schema</a>'>: <function _schema_sql>, <class '<a href="../expressions.html#SchemaCommentProperty">sqlglot.expressions.SchemaCommentProperty</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#Select">sqlglot.expressions.Select</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#SortArray">sqlglot.expressions.SortArray</a>'>: <function _no_sort_array>, <class '<a href="../expressions.html#StrPosition">sqlglot.expressions.StrPosition</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#StrToDate">sqlglot.expressions.StrToDate</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#StrToMap">sqlglot.expressions.StrToMap</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#StrToTime">sqlglot.expressions.StrToTime</a>'>: <function _str_to_time_sql>, <class '<a href="../expressions.html#StrToUnix">sqlglot.expressions.StrToUnix</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#StructExtract">sqlglot.expressions.StructExtract</a>'>: <function struct_extract_sql>, <class '<a href="../expressions.html#Table">sqlglot.expressions.Table</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#Timestamp">sqlglot.expressions.Timestamp</a>'>: <function no_timestamp_sql>, <class '<a href="../expressions.html#TimestampTrunc">sqlglot.expressions.TimestampTrunc</a>'>: <function timestamptrunc_sql>, <class '<a href="../expressions.html#TimeStrToDate">sqlglot.expressions.TimeStrToDate</a>'>: <function timestrtotime_sql>, <class '<a href="../expressions.html#TimeStrToTime">sqlglot.expressions.TimeStrToTime</a>'>: <function timestrtotime_sql>, <class '<a href="../expressions.html#TimeStrToUnix">sqlglot.expressions.TimeStrToUnix</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#TimeToStr">sqlglot.expressions.TimeToStr</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#TimeToUnix">sqlglot.expressions.TimeToUnix</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ToChar">sqlglot.expressions.ToChar</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#TryCast">sqlglot.expressions.TryCast</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#TsOrDiToDi">sqlglot.expressions.TsOrDiToDi</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#TsOrDsAdd">sqlglot.expressions.TsOrDsAdd</a>'>: <function _ts_or_ds_add_sql>, <class '<a href="../expressions.html#TsOrDsDiff">sqlglot.expressions.TsOrDsDiff</a>'>: <function _ts_or_ds_diff_sql>, <class '<a href="../expressions.html#TsOrDsToDate">sqlglot.expressions.TsOrDsToDate</a>'>: <function _ts_or_ds_to_date_sql>, <class '<a href="../expressions.html#Unhex">sqlglot.expressions.Unhex</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#UnixToStr">sqlglot.expressions.UnixToStr</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#UnixToTime">sqlglot.expressions.UnixToTime</a>'>: <function _unix_to_time_sql>, <class '<a href="../expressions.html#UnixToTimeStr">sqlglot.expressions.UnixToTimeStr</a>'>: <function <a href="#Presto.Generator">Presto.Generator</a>.<lambda>>, <class '<a href="../expressions.html#VariancePop">sqlglot.expressions.VariancePop</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#With">sqlglot.expressions.With</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#WithinGroup">sqlglot.expressions.WithinGroup</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#Xor">sqlglot.expressions.Xor</a>'>: <function bool_xor_sql>}</span> </div> @@ -2258,21 +2255,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-437"><a href="#Presto.Generator.bracket_sql-437"><span class="linenos">437</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto.Generator.bracket_sql-438"><a href="#Presto.Generator.bracket_sql-438"><span class="linenos">438</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">"safe"</span><span class="p">):</span> -</span><span id="Presto.Generator.bracket_sql-439"><a href="#Presto.Generator.bracket_sql-439"><span class="linenos">439</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-440"><a href="#Presto.Generator.bracket_sql-440"><span class="linenos">440</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">,</span> -</span><span id="Presto.Generator.bracket_sql-441"><a href="#Presto.Generator.bracket_sql-441"><span class="linenos">441</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-442"><a href="#Presto.Generator.bracket_sql-442"><span class="linenos">442</span></a> <span class="n">seq_get</span><span class="p">(</span> -</span><span id="Presto.Generator.bracket_sql-443"><a href="#Presto.Generator.bracket_sql-443"><span class="linenos">443</span></a> <span class="n">apply_index_offset</span><span class="p">(</span> -</span><span id="Presto.Generator.bracket_sql-444"><a href="#Presto.Generator.bracket_sql-444"><span class="linenos">444</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-445"><a href="#Presto.Generator.bracket_sql-445"><span class="linenos">445</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-446"><a href="#Presto.Generator.bracket_sql-446"><span class="linenos">446</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">"offset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> -</span><span id="Presto.Generator.bracket_sql-447"><a href="#Presto.Generator.bracket_sql-447"><span class="linenos">447</span></a> <span class="p">),</span> -</span><span id="Presto.Generator.bracket_sql-448"><a href="#Presto.Generator.bracket_sql-448"><span class="linenos">448</span></a> <span class="mi">0</span><span class="p">,</span> -</span><span id="Presto.Generator.bracket_sql-449"><a href="#Presto.Generator.bracket_sql-449"><span class="linenos">449</span></a> <span class="p">),</span> -</span><span id="Presto.Generator.bracket_sql-450"><a href="#Presto.Generator.bracket_sql-450"><span class="linenos">450</span></a> <span class="p">)</span> -</span><span id="Presto.Generator.bracket_sql-451"><a href="#Presto.Generator.bracket_sql-451"><span class="linenos">451</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-426"><a href="#Presto.Generator.bracket_sql-426"><span class="linenos">426</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto.Generator.bracket_sql-427"><a href="#Presto.Generator.bracket_sql-427"><span class="linenos">427</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">"safe"</span><span class="p">):</span> +</span><span id="Presto.Generator.bracket_sql-428"><a href="#Presto.Generator.bracket_sql-428"><span class="linenos">428</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-429"><a href="#Presto.Generator.bracket_sql-429"><span class="linenos">429</span></a> <span class="s2">"ELEMENT_AT"</span><span class="p">,</span> +</span><span id="Presto.Generator.bracket_sql-430"><a href="#Presto.Generator.bracket_sql-430"><span class="linenos">430</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-431"><a href="#Presto.Generator.bracket_sql-431"><span class="linenos">431</span></a> <span class="n">seq_get</span><span class="p">(</span> +</span><span id="Presto.Generator.bracket_sql-432"><a href="#Presto.Generator.bracket_sql-432"><span class="linenos">432</span></a> <span class="n">apply_index_offset</span><span class="p">(</span> +</span><span id="Presto.Generator.bracket_sql-433"><a href="#Presto.Generator.bracket_sql-433"><span class="linenos">433</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-434"><a href="#Presto.Generator.bracket_sql-434"><span class="linenos">434</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-435"><a href="#Presto.Generator.bracket_sql-435"><span class="linenos">435</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">"offset"</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Presto.Generator.bracket_sql-436"><a href="#Presto.Generator.bracket_sql-436"><span class="linenos">436</span></a> <span class="p">),</span> +</span><span id="Presto.Generator.bracket_sql-437"><a href="#Presto.Generator.bracket_sql-437"><span class="linenos">437</span></a> <span class="mi">0</span><span class="p">,</span> +</span><span id="Presto.Generator.bracket_sql-438"><a href="#Presto.Generator.bracket_sql-438"><span class="linenos">438</span></a> <span class="p">),</span> +</span><span id="Presto.Generator.bracket_sql-439"><a href="#Presto.Generator.bracket_sql-439"><span class="linenos">439</span></a> <span class="p">)</span> +</span><span id="Presto.Generator.bracket_sql-440"><a href="#Presto.Generator.bracket_sql-440"><span class="linenos">440</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> @@ -2290,12 +2287,12 @@ 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-453"><a href="#Presto.Generator.struct_sql-453"><span class="linenos">453</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto.Generator.struct_sql-454"><a href="#Presto.Generator.struct_sql-454"><span class="linenos">454</span></a> <span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEY_VALUE_DEFINITIONS</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</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-455"><a href="#Presto.Generator.struct_sql-455"><span class="linenos">455</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Struct with key-value definitions is unsupported."</span><span class="p">)</span> -</span><span id="Presto.Generator.struct_sql-456"><a href="#Presto.Generator.struct_sql-456"><span class="linenos">456</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> -</span><span id="Presto.Generator.struct_sql-457"><a href="#Presto.Generator.struct_sql-457"><span class="linenos">457</span></a> -</span><span id="Presto.Generator.struct_sql-458"><a href="#Presto.Generator.struct_sql-458"><span class="linenos">458</span></a> <span class="k">return</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ROW"</span><span class="p">)(</span><span class="bp">self</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.struct_sql-442"><a href="#Presto.Generator.struct_sql-442"><span class="linenos">442</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto.Generator.struct_sql-443"><a href="#Presto.Generator.struct_sql-443"><span class="linenos">443</span></a> <span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEY_VALUE_DEFINITIONS</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</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-444"><a href="#Presto.Generator.struct_sql-444"><span class="linenos">444</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Struct with key-value definitions is unsupported."</span><span class="p">)</span> +</span><span id="Presto.Generator.struct_sql-445"><a href="#Presto.Generator.struct_sql-445"><span class="linenos">445</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Presto.Generator.struct_sql-446"><a href="#Presto.Generator.struct_sql-446"><span class="linenos">446</span></a> +</span><span id="Presto.Generator.struct_sql-447"><a href="#Presto.Generator.struct_sql-447"><span class="linenos">447</span></a> <span class="k">return</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ROW"</span><span class="p">)(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> </span></pre></div> @@ -2313,11 +2310,11 @@ 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-460"><a href="#Presto.Generator.interval_sql-460"><span class="linenos">460</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto.Generator.interval_sql-461"><a href="#Presto.Generator.interval_sql-461"><span class="linenos">461</span></a> <span class="n">unit</span> <span class="o">=</span> <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">"unit"</span><span class="p">)</span> -</span><span id="Presto.Generator.interval_sql-462"><a href="#Presto.Generator.interval_sql-462"><span class="linenos">462</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">unit</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"WEEK"</span><span class="p">):</span> -</span><span id="Presto.Generator.interval_sql-463"><a href="#Presto.Generator.interval_sql-463"><span class="linenos">463</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</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 '7' DAY)"</span> -</span><span id="Presto.Generator.interval_sql-464"><a href="#Presto.Generator.interval_sql-464"><span class="linenos">464</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-449"><a href="#Presto.Generator.interval_sql-449"><span class="linenos">449</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto.Generator.interval_sql-450"><a href="#Presto.Generator.interval_sql-450"><span class="linenos">450</span></a> <span class="n">unit</span> <span class="o">=</span> <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">"unit"</span><span class="p">)</span> +</span><span id="Presto.Generator.interval_sql-451"><a href="#Presto.Generator.interval_sql-451"><span class="linenos">451</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">unit</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"WEEK"</span><span class="p">):</span> +</span><span id="Presto.Generator.interval_sql-452"><a href="#Presto.Generator.interval_sql-452"><span class="linenos">452</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</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 '7' DAY)"</span> +</span><span id="Presto.Generator.interval_sql-453"><a href="#Presto.Generator.interval_sql-453"><span class="linenos">453</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> @@ -2335,10 +2332,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-466"><a href="#Presto.Generator.transaction_sql-466"><span class="linenos">466</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto.Generator.transaction_sql-467"><a href="#Presto.Generator.transaction_sql-467"><span class="linenos">467</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">"modes"</span><span class="p">)</span> -</span><span id="Presto.Generator.transaction_sql-468"><a href="#Presto.Generator.transaction_sql-468"><span class="linenos">468</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="s1">', '</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">"</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">""</span> -</span><span id="Presto.Generator.transaction_sql-469"><a href="#Presto.Generator.transaction_sql-469"><span class="linenos">469</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">"</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.transaction_sql-455"><a href="#Presto.Generator.transaction_sql-455"><span class="linenos">455</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto.Generator.transaction_sql-456"><a href="#Presto.Generator.transaction_sql-456"><span class="linenos">456</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">"modes"</span><span class="p">)</span> +</span><span id="Presto.Generator.transaction_sql-457"><a href="#Presto.Generator.transaction_sql-457"><span class="linenos">457</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="s1">', '</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">"</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Presto.Generator.transaction_sql-458"><a href="#Presto.Generator.transaction_sql-458"><span class="linenos">458</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">"</span> </span></pre></div> @@ -2356,25 +2353,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-471"><a href="#Presto.Generator.generateseries_sql-471"><span class="linenos">471</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto.Generator.generateseries_sql-472"><a href="#Presto.Generator.generateseries_sql-472"><span class="linenos">472</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">"start"</span><span class="p">]</span> -</span><span id="Presto.Generator.generateseries_sql-473"><a href="#Presto.Generator.generateseries_sql-473"><span class="linenos">473</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">"end"</span><span class="p">]</span> -</span><span id="Presto.Generator.generateseries_sql-474"><a href="#Presto.Generator.generateseries_sql-474"><span class="linenos">474</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">"step"</span><span class="p">)</span> -</span><span id="Presto.Generator.generateseries_sql-475"><a href="#Presto.Generator.generateseries_sql-475"><span class="linenos">475</span></a> -</span><span id="Presto.Generator.generateseries_sql-476"><a href="#Presto.Generator.generateseries_sql-476"><span class="linenos">476</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-477"><a href="#Presto.Generator.generateseries_sql-477"><span class="linenos">477</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-478"><a href="#Presto.Generator.generateseries_sql-478"><span class="linenos">478</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-479"><a href="#Presto.Generator.generateseries_sql-479"><span class="linenos">479</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-480"><a href="#Presto.Generator.generateseries_sql-480"><span class="linenos">480</span></a> <span class="k">else</span><span class="p">:</span> -</span><span id="Presto.Generator.generateseries_sql-481"><a href="#Presto.Generator.generateseries_sql-481"><span class="linenos">481</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="Presto.Generator.generateseries_sql-482"><a href="#Presto.Generator.generateseries_sql-482"><span class="linenos">482</span></a> -</span><span id="Presto.Generator.generateseries_sql-483"><a href="#Presto.Generator.generateseries_sql-483"><span class="linenos">483</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">"timestamp"</span><span class="p">):</span> -</span><span id="Presto.Generator.generateseries_sql-484"><a href="#Presto.Generator.generateseries_sql-484"><span class="linenos">484</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-485"><a href="#Presto.Generator.generateseries_sql-485"><span class="linenos">485</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-486"><a href="#Presto.Generator.generateseries_sql-486"><span class="linenos">486</span></a> <span class="k">else</span><span class="p">:</span> -</span><span id="Presto.Generator.generateseries_sql-487"><a href="#Presto.Generator.generateseries_sql-487"><span class="linenos">487</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-488"><a href="#Presto.Generator.generateseries_sql-488"><span class="linenos">488</span></a> -</span><span id="Presto.Generator.generateseries_sql-489"><a href="#Presto.Generator.generateseries_sql-489"><span class="linenos">489</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">"SEQUENCE"</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-460"><a href="#Presto.Generator.generateseries_sql-460"><span class="linenos">460</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto.Generator.generateseries_sql-461"><a href="#Presto.Generator.generateseries_sql-461"><span class="linenos">461</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">"start"</span><span class="p">]</span> +</span><span id="Presto.Generator.generateseries_sql-462"><a href="#Presto.Generator.generateseries_sql-462"><span class="linenos">462</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">"end"</span><span class="p">]</span> +</span><span id="Presto.Generator.generateseries_sql-463"><a href="#Presto.Generator.generateseries_sql-463"><span class="linenos">463</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">"step"</span><span class="p">)</span> +</span><span id="Presto.Generator.generateseries_sql-464"><a href="#Presto.Generator.generateseries_sql-464"><span class="linenos">464</span></a> +</span><span id="Presto.Generator.generateseries_sql-465"><a href="#Presto.Generator.generateseries_sql-465"><span class="linenos">465</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-466"><a href="#Presto.Generator.generateseries_sql-466"><span class="linenos">466</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-467"><a href="#Presto.Generator.generateseries_sql-467"><span class="linenos">467</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-468"><a href="#Presto.Generator.generateseries_sql-468"><span class="linenos">468</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-469"><a href="#Presto.Generator.generateseries_sql-469"><span class="linenos">469</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Presto.Generator.generateseries_sql-470"><a href="#Presto.Generator.generateseries_sql-470"><span class="linenos">470</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Presto.Generator.generateseries_sql-471"><a href="#Presto.Generator.generateseries_sql-471"><span class="linenos">471</span></a> +</span><span id="Presto.Generator.generateseries_sql-472"><a href="#Presto.Generator.generateseries_sql-472"><span class="linenos">472</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">"timestamp"</span><span class="p">):</span> +</span><span id="Presto.Generator.generateseries_sql-473"><a href="#Presto.Generator.generateseries_sql-473"><span class="linenos">473</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-474"><a href="#Presto.Generator.generateseries_sql-474"><span class="linenos">474</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-475"><a href="#Presto.Generator.generateseries_sql-475"><span class="linenos">475</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Presto.Generator.generateseries_sql-476"><a href="#Presto.Generator.generateseries_sql-476"><span class="linenos">476</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-477"><a href="#Presto.Generator.generateseries_sql-477"><span class="linenos">477</span></a> +</span><span id="Presto.Generator.generateseries_sql-478"><a href="#Presto.Generator.generateseries_sql-478"><span class="linenos">478</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">"SEQUENCE"</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> @@ -2392,13 +2389,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-491"><a href="#Presto.Generator.offset_limit_modifiers-491"><span class="linenos">491</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-492"><a href="#Presto.Generator.offset_limit_modifiers-492"><span class="linenos">492</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-493"><a href="#Presto.Generator.offset_limit_modifiers-493"><span class="linenos">493</span></a> <span class="p">)</span> <span class="o">-></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-494"><a href="#Presto.Generator.offset_limit_modifiers-494"><span class="linenos">494</span></a> <span class="k">return</span> <span class="p">[</span> -</span><span id="Presto.Generator.offset_limit_modifiers-495"><a href="#Presto.Generator.offset_limit_modifiers-495"><span class="linenos">495</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">"offset"</span><span class="p">),</span> -</span><span id="Presto.Generator.offset_limit_modifiers-496"><a href="#Presto.Generator.offset_limit_modifiers-496"><span class="linenos">496</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-497"><a href="#Presto.Generator.offset_limit_modifiers-497"><span class="linenos">497</span></a> <span class="p">]</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.offset_limit_modifiers-480"><a href="#Presto.Generator.offset_limit_modifiers-480"><span class="linenos">480</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-481"><a href="#Presto.Generator.offset_limit_modifiers-481"><span class="linenos">481</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-482"><a href="#Presto.Generator.offset_limit_modifiers-482"><span class="linenos">482</span></a> <span class="p">)</span> <span class="o">-></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-483"><a href="#Presto.Generator.offset_limit_modifiers-483"><span class="linenos">483</span></a> <span class="k">return</span> <span class="p">[</span> +</span><span id="Presto.Generator.offset_limit_modifiers-484"><a href="#Presto.Generator.offset_limit_modifiers-484"><span class="linenos">484</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">"offset"</span><span class="p">),</span> +</span><span id="Presto.Generator.offset_limit_modifiers-485"><a href="#Presto.Generator.offset_limit_modifiers-485"><span class="linenos">485</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-486"><a href="#Presto.Generator.offset_limit_modifiers-486"><span class="linenos">486</span></a> <span class="p">]</span> </span></pre></div> @@ -2416,16 +2413,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-499"><a href="#Presto.Generator.create_sql-499"><span class="linenos">499</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Presto.Generator.create_sql-500"><a href="#Presto.Generator.create_sql-500"><span class="linenos">500</span></a><span class="w"> </span><span class="sd">"""</span> -</span><span id="Presto.Generator.create_sql-501"><a href="#Presto.Generator.create_sql-501"><span class="linenos">501</span></a><span class="sd"> Presto doesn't support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span> -</span><span id="Presto.Generator.create_sql-502"><a href="#Presto.Generator.create_sql-502"><span class="linenos">502</span></a><span class="sd"> so we need to remove them</span> -</span><span id="Presto.Generator.create_sql-503"><a href="#Presto.Generator.create_sql-503"><span class="linenos">503</span></a><span class="sd"> """</span> -</span><span id="Presto.Generator.create_sql-504"><a href="#Presto.Generator.create_sql-504"><span class="linenos">504</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">"kind"</span><span class="p">]</span> -</span><span id="Presto.Generator.create_sql-505"><a href="#Presto.Generator.create_sql-505"><span class="linenos">505</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-506"><a href="#Presto.Generator.create_sql-506"><span class="linenos">506</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"VIEW"</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-507"><a href="#Presto.Generator.create_sql-507"><span class="linenos">507</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">"expressions"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> -</span><span id="Presto.Generator.create_sql-508"><a href="#Presto.Generator.create_sql-508"><span class="linenos">508</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-488"><a href="#Presto.Generator.create_sql-488"><span class="linenos">488</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Presto.Generator.create_sql-489"><a href="#Presto.Generator.create_sql-489"><span class="linenos">489</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Presto.Generator.create_sql-490"><a href="#Presto.Generator.create_sql-490"><span class="linenos">490</span></a><span class="sd"> Presto doesn't support CREATE VIEW with expressions (ex: `CREATE VIEW x (cola)` then `(cola)` is the expression),</span> +</span><span id="Presto.Generator.create_sql-491"><a href="#Presto.Generator.create_sql-491"><span class="linenos">491</span></a><span class="sd"> so we need to remove them</span> +</span><span id="Presto.Generator.create_sql-492"><a href="#Presto.Generator.create_sql-492"><span class="linenos">492</span></a><span class="sd"> """</span> +</span><span id="Presto.Generator.create_sql-493"><a href="#Presto.Generator.create_sql-493"><span class="linenos">493</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">"kind"</span><span class="p">]</span> +</span><span id="Presto.Generator.create_sql-494"><a href="#Presto.Generator.create_sql-494"><span class="linenos">494</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-495"><a href="#Presto.Generator.create_sql-495"><span class="linenos">495</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"VIEW"</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-496"><a href="#Presto.Generator.create_sql-496"><span class="linenos">496</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">"expressions"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Presto.Generator.create_sql-497"><a href="#Presto.Generator.create_sql-497"><span class="linenos">497</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> @@ -2488,6 +2485,10 @@ so we need to remove them</p> <dd id="Presto.Generator.LAST_DAY_SUPPORTS_DATE_PART" class="variable"><a href="../generator.html#Generator.LAST_DAY_SUPPORTS_DATE_PART">LAST_DAY_SUPPORTS_DATE_PART</a></dd> <dd id="Presto.Generator.SUPPORTS_TABLE_ALIAS_COLUMNS" class="variable"><a href="../generator.html#Generator.SUPPORTS_TABLE_ALIAS_COLUMNS">SUPPORTS_TABLE_ALIAS_COLUMNS</a></dd> <dd id="Presto.Generator.UNPIVOT_ALIASES_ARE_IDENTIFIERS" class="variable"><a href="../generator.html#Generator.UNPIVOT_ALIASES_ARE_IDENTIFIERS">UNPIVOT_ALIASES_ARE_IDENTIFIERS</a></dd> + <dd id="Presto.Generator.JSON_KEY_VALUE_PAIR_SEP" class="variable"><a href="../generator.html#Generator.JSON_KEY_VALUE_PAIR_SEP">JSON_KEY_VALUE_PAIR_SEP</a></dd> + <dd id="Presto.Generator.INSERT_OVERWRITE" class="variable"><a href="../generator.html#Generator.INSERT_OVERWRITE">INSERT_OVERWRITE</a></dd> + <dd id="Presto.Generator.SUPPORTS_SELECT_INTO" class="variable"><a href="../generator.html#Generator.SUPPORTS_SELECT_INTO">SUPPORTS_SELECT_INTO</a></dd> + <dd id="Presto.Generator.SUPPORTS_UNLOGGED_TABLES" class="variable"><a href="../generator.html#Generator.SUPPORTS_UNLOGGED_TABLES">SUPPORTS_UNLOGGED_TABLES</a></dd> <dd id="Presto.Generator.STAR_MAPPING" class="variable"><a href="../generator.html#Generator.STAR_MAPPING">STAR_MAPPING</a></dd> <dd id="Presto.Generator.TIME_PART_SINGULARS" class="variable"><a href="../generator.html#Generator.TIME_PART_SINGULARS">TIME_PART_SINGULARS</a></dd> <dd id="Presto.Generator.TOKEN_MAPPING" class="variable"><a href="../generator.html#Generator.TOKEN_MAPPING">TOKEN_MAPPING</a></dd> @@ -2543,6 +2544,7 @@ so we need to remove them</p> <dd id="Presto.Generator.createable_sql" class="function"><a href="../generator.html#Generator.createable_sql">createable_sql</a></dd> <dd id="Presto.Generator.clone_sql" class="function"><a href="../generator.html#Generator.clone_sql">clone_sql</a></dd> <dd id="Presto.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="Presto.Generator.heredoc_sql" class="function"><a href="../generator.html#Generator.heredoc_sql">heredoc_sql</a></dd> <dd id="Presto.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> <dd id="Presto.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> <dd id="Presto.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> @@ -2677,6 +2679,7 @@ so we need to remove them</p> <dd id="Presto.Generator.jsonkeyvalue_sql" class="function"><a href="../generator.html#Generator.jsonkeyvalue_sql">jsonkeyvalue_sql</a></dd> <dd id="Presto.Generator.formatjson_sql" class="function"><a href="../generator.html#Generator.formatjson_sql">formatjson_sql</a></dd> <dd id="Presto.Generator.jsonobject_sql" class="function"><a href="../generator.html#Generator.jsonobject_sql">jsonobject_sql</a></dd> + <dd id="Presto.Generator.jsonobjectagg_sql" class="function"><a href="../generator.html#Generator.jsonobjectagg_sql">jsonobjectagg_sql</a></dd> <dd id="Presto.Generator.jsonarray_sql" class="function"><a href="../generator.html#Generator.jsonarray_sql">jsonarray_sql</a></dd> <dd id="Presto.Generator.jsonarrayagg_sql" class="function"><a href="../generator.html#Generator.jsonarrayagg_sql">jsonarrayagg_sql</a></dd> <dd id="Presto.Generator.jsoncolumndef_sql" class="function"><a href="../generator.html#Generator.jsoncolumndef_sql">jsoncolumndef_sql</a></dd> @@ -2697,6 +2700,7 @@ so we need to remove them</p> <dd id="Presto.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> <dd id="Presto.Generator.atindex_sql" class="function"><a href="../generator.html#Generator.atindex_sql">atindex_sql</a></dd> <dd id="Presto.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Presto.Generator.fromtimezone_sql" class="function"><a href="../generator.html#Generator.fromtimezone_sql">fromtimezone_sql</a></dd> <dd id="Presto.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> <dd id="Presto.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> <dd id="Presto.Generator.xor_sql" class="function"><a href="../generator.html#Generator.xor_sql">xor_sql</a></dd> @@ -2718,6 +2722,7 @@ so we need to remove them</p> <dd id="Presto.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> <dd id="Presto.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> <dd id="Presto.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="Presto.Generator.renamecolumn_sql" class="function"><a href="../generator.html#Generator.renamecolumn_sql">renamecolumn_sql</a></dd> <dd id="Presto.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> <dd id="Presto.Generator.add_column_sql" class="function"><a href="../generator.html#Generator.add_column_sql">add_column_sql</a></dd> <dd id="Presto.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> |