diff options
Diffstat (limited to '')
-rw-r--r-- | docs/sqlglot/dialects/clickhouse.html | 592 |
1 files changed, 301 insertions, 291 deletions
diff --git a/docs/sqlglot/dialects/clickhouse.html b/docs/sqlglot/dialects/clickhouse.html index 529646d..7bd3cf0 100644 --- a/docs/sqlglot/dialects/clickhouse.html +++ b/docs/sqlglot/dialects/clickhouse.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 13.0.1"/> + <meta name="generator" content="pdoc 13.1.0"/> <title>sqlglot.dialects.clickhouse 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> @@ -150,104 +150,106 @@ </span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> </span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">TABLE_ALIAS_TOKENS</span> <span class="o">=</span> <span class="p">{</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">TABLE_ALIAS_TOKENS</span><span class="p">}</span> <span class="o">-</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ANY</span><span class="p">}</span> <span class="c1"># type: ignore</span> </span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> -</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="k">def</span> <span class="nf">_parse_in</span><span class="p">(</span> -</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</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">Expression</span><span class="p">],</span> <span class="n">is_global</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <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-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> -</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"is_global"</span><span class="p">,</span> <span class="n">is_global</span><span class="p">)</span> -</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="k">return</span> <span class="n">this</span> -</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> -</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> -</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">alias_tokens</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">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="p">)</span> <span class="o">-></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">Expression</span><span class="p">]:</span> -</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">)</span> -</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> -</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FINAL</span><span class="p">):</span> -</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Final</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> -</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> -</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="n">LOG_DEFAULTS_TO_LN</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="k">def</span> <span class="nf">_parse_in</span><span class="p">(</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</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">Expression</span><span class="p">],</span> <span class="n">is_global</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <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-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"is_global"</span><span class="p">,</span> <span class="n">is_global</span><span class="p">)</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">alias_tokens</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">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="p">)</span> <span class="o">-></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">Expression</span><span class="p">]:</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">)</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FINAL</span><span class="p">):</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Final</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> </span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> -</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="k">def</span> <span class="nf">_parse_position</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">haystack_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</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-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_position</span><span class="p">(</span><span class="n">haystack_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> -</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> -</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="c1"># https://clickhouse.com/docs/en/sql-reference/statements/select/with/</span> -</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="k">def</span> <span class="nf">_parse_cte</span><span class="p">(</span><span class="bp">self</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-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> -</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="k">try</span><span class="p">:</span> -</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="c1"># WITH <identifier> AS <subquery expression></span> -</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_cte</span><span class="p">()</span> -</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="k">except</span> <span class="n">ParseError</span><span class="p">:</span> -</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="c1"># WITH <expression> AS <identifier></span> -</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> -</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="n">statement</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> -</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> -</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="k">if</span> <span class="n">statement</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">statement</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">Alias</span><span class="p">):</span> -</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected CTE to have alias"</span><span class="p">)</span> -</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> -</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">statement</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">statement</span> <span class="ow">and</span> <span class="n">statement</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="k">def</span> <span class="nf">_parse_position</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">haystack_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</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-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_position</span><span class="p">(</span><span class="n">haystack_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="c1"># https://clickhouse.com/docs/en/sql-reference/statements/select/with/</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="k">def</span> <span class="nf">_parse_cte</span><span class="p">(</span><span class="bp">self</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-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="c1"># WITH <identifier> AS <subquery expression></span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_cte</span><span class="p">()</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="k">except</span> <span class="n">ParseError</span><span class="p">:</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="c1"># WITH <expression> AS <identifier></span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="n">statement</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">if</span> <span class="n">statement</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">statement</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">Alias</span><span class="p">):</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected CTE to have alias"</span><span class="p">)</span> </span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> -</span><span id="L-107"><a href="#L-107"><span class="linenos">107</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-108"><a href="#L-108"><span class="linenos">108</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-109"><a href="#L-109"><span class="linenos">109</span></a> -</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-111"><a href="#L-111"><span class="linenos">111</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 class="c1"># type: ignore</span> -</span><span id="L-112"><a href="#L-112"><span class="linenos">112</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">NULLABLE</span><span class="p">:</span> <span class="s2">"Nullable"</span><span class="p">,</span> -</span><span id="L-113"><a href="#L-113"><span class="linenos">113</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">"DateTime64"</span><span class="p">,</span> -</span><span id="L-114"><a href="#L-114"><span class="linenos">114</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">MAP</span><span class="p">:</span> <span class="s2">"Map"</span><span class="p">,</span> -</span><span id="L-115"><a href="#L-115"><span class="linenos">115</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">ARRAY</span><span class="p">:</span> <span class="s2">"Array"</span><span class="p">,</span> -</span><span id="L-116"><a href="#L-116"><span class="linenos">116</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">"Tuple"</span><span class="p">,</span> -</span><span id="L-117"><a href="#L-117"><span class="linenos">117</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">TINYINT</span><span class="p">:</span> <span class="s2">"Int8"</span><span class="p">,</span> -</span><span id="L-118"><a href="#L-118"><span class="linenos">118</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">SMALLINT</span><span class="p">:</span> <span class="s2">"Int16"</span><span class="p">,</span> -</span><span id="L-119"><a href="#L-119"><span class="linenos">119</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">"Int32"</span><span class="p">,</span> -</span><span id="L-120"><a href="#L-120"><span class="linenos">120</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">BIGINT</span><span class="p">:</span> <span class="s2">"Int64"</span><span class="p">,</span> -</span><span id="L-121"><a href="#L-121"><span class="linenos">121</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">"Float32"</span><span class="p">,</span> -</span><span id="L-122"><a href="#L-122"><span class="linenos">122</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">DOUBLE</span><span class="p">:</span> <span class="s2">"Float64"</span><span class="p">,</span> -</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="p">}</span> -</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> -</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-126"><a href="#L-126"><span class="linenos">126</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 class="c1"># type: ignore</span> -</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> -</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ExponentialTimeDecayedAvg</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">"exponentialTimeDecayedAvg</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'decay'</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="s1">'this'</span><span class="p">,</span><span class="w"> </span><span class="s1">'time'</span><span class="p">])</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> -</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Final</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">"</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"> FINAL"</span><span class="p">,</span> -</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupUniqArray</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">"groupUniqArray</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'size'</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-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Histogram</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">"histogram</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'bins'</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-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</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">_lower_func</span><span class="p">(</span><span class="n">var_map_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><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</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">"quantile</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'quantile'</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-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantiles</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">"quantiles</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> -</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">QuantileIf</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">"quantileIf</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> -</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</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">"position(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</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="w"> </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="s1">'substr'</span><span class="p">),</span><span class="w"> </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="s1">'position'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</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">_lower_func</span><span class="p">(</span><span class="n">var_map_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><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="p">}</span> -</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> -</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">statement</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">statement</span> <span class="ow">and</span> <span class="n">statement</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</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-110"><a href="#L-110"><span class="linenos">110</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-111"><a href="#L-111"><span class="linenos">111</span></a> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</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 class="c1"># type: ignore</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</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">NULLABLE</span><span class="p">:</span> <span class="s2">"Nullable"</span><span class="p">,</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</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">"DateTime64"</span><span class="p">,</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</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">MAP</span><span class="p">:</span> <span class="s2">"Map"</span><span class="p">,</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</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">ARRAY</span><span class="p">:</span> <span class="s2">"Array"</span><span class="p">,</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</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">"Tuple"</span><span class="p">,</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</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">TINYINT</span><span class="p">:</span> <span class="s2">"Int8"</span><span class="p">,</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</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">SMALLINT</span><span class="p">:</span> <span class="s2">"Int16"</span><span class="p">,</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</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">"Int32"</span><span class="p">,</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</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">BIGINT</span><span class="p">:</span> <span class="s2">"Int64"</span><span class="p">,</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</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">"Float32"</span><span class="p">,</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</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">DOUBLE</span><span class="p">:</span> <span class="s2">"Float64"</span><span class="p">,</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="p">}</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</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 class="c1"># type: ignore</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ExponentialTimeDecayedAvg</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">"exponentialTimeDecayedAvg</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'decay'</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="s1">'this'</span><span class="p">,</span><span class="w"> </span><span class="s1">'time'</span><span class="p">])</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Final</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">"</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"> FINAL"</span><span class="p">,</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupUniqArray</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">"groupUniqArray</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'size'</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-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Histogram</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">"histogram</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'bins'</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-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</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">_lower_func</span><span class="p">(</span><span class="n">var_map_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><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</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">"quantile</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'quantile'</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-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantiles</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">"quantiles</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">QuantileIf</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">"quantileIf</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</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">"position(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</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="w"> </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="s1">'substr'</span><span class="p">),</span><span class="w"> </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="s1">'position'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</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">_lower_func</span><span class="p">(</span><span class="n">var_map_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><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="p">}</span> </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">_param_args_sql</span><span class="p">(</span> -</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="bp">self</span><span class="p">,</span> -</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <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><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">param_names</span><span class="p">:</span> <span class="nb">str</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-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">arg_names</span><span class="p">:</span> <span class="nb">str</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-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="n">params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> -</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="o">*</span><span class="p">(</span> -</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="n">arg</span> -</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">param_names</span><span class="p">)</span> -</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</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="n">name</span><span class="p">))</span> -</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="p">)</span> -</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="p">)</span> -</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> -</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="o">*</span><span class="p">(</span> -</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="n">arg</span> -</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">arg_names</span><span class="p">)</span> -</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</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="n">name</span><span class="p">))</span> -</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="p">)</span> -</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <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="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">params</span><span class="si">}</span><span class="s2">)(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</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">def</span> <span class="nf">cte_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">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-165"><a href="#L-165"><span class="linenos">165</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">Alias</span><span class="p">):</span> -</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="k">return</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-167"><a href="#L-167"><span class="linenos">167</span></a> -</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cte_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="k">def</span> <span class="nf">_param_args_sql</span><span class="p">(</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <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><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="n">param_names</span><span class="p">:</span> <span class="nb">str</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-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="n">arg_names</span><span class="p">:</span> <span class="nb">str</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-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="n">params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="o">*</span><span class="p">(</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">arg</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">param_names</span><span class="p">)</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</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="n">name</span><span class="p">))</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="p">)</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="p">)</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="o">*</span><span class="p">(</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="n">arg</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">arg_names</span><span class="p">)</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</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="n">name</span><span class="p">))</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="p">)</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="p">)</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">params</span><span class="si">}</span><span class="s2">)(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</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="k">def</span> <span class="nf">cte_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">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</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">Alias</span><span class="p">):</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="k">return</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-169"><a href="#L-169"><span class="linenos">169</span></a> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cte_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> </span></pre></div> @@ -316,104 +318,106 @@ </span><span id="ClickHouse-69"><a href="#ClickHouse-69"><span class="linenos"> 69</span></a> </span><span id="ClickHouse-70"><a href="#ClickHouse-70"><span class="linenos"> 70</span></a> <span class="n">TABLE_ALIAS_TOKENS</span> <span class="o">=</span> <span class="p">{</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">TABLE_ALIAS_TOKENS</span><span class="p">}</span> <span class="o">-</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ANY</span><span class="p">}</span> <span class="c1"># type: ignore</span> </span><span id="ClickHouse-71"><a href="#ClickHouse-71"><span class="linenos"> 71</span></a> -</span><span id="ClickHouse-72"><a href="#ClickHouse-72"><span class="linenos"> 72</span></a> <span class="k">def</span> <span class="nf">_parse_in</span><span class="p">(</span> -</span><span id="ClickHouse-73"><a href="#ClickHouse-73"><span class="linenos"> 73</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</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">Expression</span><span class="p">],</span> <span class="n">is_global</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="ClickHouse-74"><a href="#ClickHouse-74"><span class="linenos"> 74</span></a> <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="ClickHouse-75"><a href="#ClickHouse-75"><span class="linenos"> 75</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> -</span><span id="ClickHouse-76"><a href="#ClickHouse-76"><span class="linenos"> 76</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"is_global"</span><span class="p">,</span> <span class="n">is_global</span><span class="p">)</span> -</span><span id="ClickHouse-77"><a href="#ClickHouse-77"><span class="linenos"> 77</span></a> <span class="k">return</span> <span class="n">this</span> -</span><span id="ClickHouse-78"><a href="#ClickHouse-78"><span class="linenos"> 78</span></a> -</span><span id="ClickHouse-79"><a href="#ClickHouse-79"><span class="linenos"> 79</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> -</span><span id="ClickHouse-80"><a href="#ClickHouse-80"><span class="linenos"> 80</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">alias_tokens</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">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="ClickHouse-81"><a href="#ClickHouse-81"><span class="linenos"> 81</span></a> <span class="p">)</span> <span class="o">-></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">Expression</span><span class="p">]:</span> -</span><span id="ClickHouse-82"><a href="#ClickHouse-82"><span class="linenos"> 82</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">)</span> -</span><span id="ClickHouse-83"><a href="#ClickHouse-83"><span class="linenos"> 83</span></a> -</span><span id="ClickHouse-84"><a href="#ClickHouse-84"><span class="linenos"> 84</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FINAL</span><span class="p">):</span> -</span><span id="ClickHouse-85"><a href="#ClickHouse-85"><span class="linenos"> 85</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Final</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> -</span><span id="ClickHouse-86"><a href="#ClickHouse-86"><span class="linenos"> 86</span></a> -</span><span id="ClickHouse-87"><a href="#ClickHouse-87"><span class="linenos"> 87</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="ClickHouse-72"><a href="#ClickHouse-72"><span class="linenos"> 72</span></a> <span class="n">LOG_DEFAULTS_TO_LN</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="ClickHouse-73"><a href="#ClickHouse-73"><span class="linenos"> 73</span></a> +</span><span id="ClickHouse-74"><a href="#ClickHouse-74"><span class="linenos"> 74</span></a> <span class="k">def</span> <span class="nf">_parse_in</span><span class="p">(</span> +</span><span id="ClickHouse-75"><a href="#ClickHouse-75"><span class="linenos"> 75</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</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">Expression</span><span class="p">],</span> <span class="n">is_global</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="ClickHouse-76"><a href="#ClickHouse-76"><span class="linenos"> 76</span></a> <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="ClickHouse-77"><a href="#ClickHouse-77"><span class="linenos"> 77</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="ClickHouse-78"><a href="#ClickHouse-78"><span class="linenos"> 78</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"is_global"</span><span class="p">,</span> <span class="n">is_global</span><span class="p">)</span> +</span><span id="ClickHouse-79"><a href="#ClickHouse-79"><span class="linenos"> 79</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="ClickHouse-80"><a href="#ClickHouse-80"><span class="linenos"> 80</span></a> +</span><span id="ClickHouse-81"><a href="#ClickHouse-81"><span class="linenos"> 81</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> +</span><span id="ClickHouse-82"><a href="#ClickHouse-82"><span class="linenos"> 82</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">alias_tokens</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">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="ClickHouse-83"><a href="#ClickHouse-83"><span class="linenos"> 83</span></a> <span class="p">)</span> <span class="o">-></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">Expression</span><span class="p">]:</span> +</span><span id="ClickHouse-84"><a href="#ClickHouse-84"><span class="linenos"> 84</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">)</span> +</span><span id="ClickHouse-85"><a href="#ClickHouse-85"><span class="linenos"> 85</span></a> +</span><span id="ClickHouse-86"><a href="#ClickHouse-86"><span class="linenos"> 86</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FINAL</span><span class="p">):</span> +</span><span id="ClickHouse-87"><a href="#ClickHouse-87"><span class="linenos"> 87</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Final</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> </span><span id="ClickHouse-88"><a href="#ClickHouse-88"><span class="linenos"> 88</span></a> -</span><span id="ClickHouse-89"><a href="#ClickHouse-89"><span class="linenos"> 89</span></a> <span class="k">def</span> <span class="nf">_parse_position</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">haystack_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</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="ClickHouse-90"><a href="#ClickHouse-90"><span class="linenos"> 90</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_position</span><span class="p">(</span><span class="n">haystack_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> -</span><span id="ClickHouse-91"><a href="#ClickHouse-91"><span class="linenos"> 91</span></a> -</span><span id="ClickHouse-92"><a href="#ClickHouse-92"><span class="linenos"> 92</span></a> <span class="c1"># https://clickhouse.com/docs/en/sql-reference/statements/select/with/</span> -</span><span id="ClickHouse-93"><a href="#ClickHouse-93"><span class="linenos"> 93</span></a> <span class="k">def</span> <span class="nf">_parse_cte</span><span class="p">(</span><span class="bp">self</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="ClickHouse-94"><a href="#ClickHouse-94"><span class="linenos"> 94</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> -</span><span id="ClickHouse-95"><a href="#ClickHouse-95"><span class="linenos"> 95</span></a> <span class="k">try</span><span class="p">:</span> -</span><span id="ClickHouse-96"><a href="#ClickHouse-96"><span class="linenos"> 96</span></a> <span class="c1"># WITH <identifier> AS <subquery expression></span> -</span><span id="ClickHouse-97"><a href="#ClickHouse-97"><span class="linenos"> 97</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_cte</span><span class="p">()</span> -</span><span id="ClickHouse-98"><a href="#ClickHouse-98"><span class="linenos"> 98</span></a> <span class="k">except</span> <span class="n">ParseError</span><span class="p">:</span> -</span><span id="ClickHouse-99"><a href="#ClickHouse-99"><span class="linenos"> 99</span></a> <span class="c1"># WITH <expression> AS <identifier></span> -</span><span id="ClickHouse-100"><a href="#ClickHouse-100"><span class="linenos">100</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> -</span><span id="ClickHouse-101"><a href="#ClickHouse-101"><span class="linenos">101</span></a> <span class="n">statement</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> -</span><span id="ClickHouse-102"><a href="#ClickHouse-102"><span class="linenos">102</span></a> -</span><span id="ClickHouse-103"><a href="#ClickHouse-103"><span class="linenos">103</span></a> <span class="k">if</span> <span class="n">statement</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">statement</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">Alias</span><span class="p">):</span> -</span><span id="ClickHouse-104"><a href="#ClickHouse-104"><span class="linenos">104</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected CTE to have alias"</span><span class="p">)</span> -</span><span id="ClickHouse-105"><a href="#ClickHouse-105"><span class="linenos">105</span></a> -</span><span id="ClickHouse-106"><a href="#ClickHouse-106"><span class="linenos">106</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">statement</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">statement</span> <span class="ow">and</span> <span class="n">statement</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="ClickHouse-89"><a href="#ClickHouse-89"><span class="linenos"> 89</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="ClickHouse-90"><a href="#ClickHouse-90"><span class="linenos"> 90</span></a> +</span><span id="ClickHouse-91"><a href="#ClickHouse-91"><span class="linenos"> 91</span></a> <span class="k">def</span> <span class="nf">_parse_position</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">haystack_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</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="ClickHouse-92"><a href="#ClickHouse-92"><span class="linenos"> 92</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_position</span><span class="p">(</span><span class="n">haystack_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="ClickHouse-93"><a href="#ClickHouse-93"><span class="linenos"> 93</span></a> +</span><span id="ClickHouse-94"><a href="#ClickHouse-94"><span class="linenos"> 94</span></a> <span class="c1"># https://clickhouse.com/docs/en/sql-reference/statements/select/with/</span> +</span><span id="ClickHouse-95"><a href="#ClickHouse-95"><span class="linenos"> 95</span></a> <span class="k">def</span> <span class="nf">_parse_cte</span><span class="p">(</span><span class="bp">self</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="ClickHouse-96"><a href="#ClickHouse-96"><span class="linenos"> 96</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="ClickHouse-97"><a href="#ClickHouse-97"><span class="linenos"> 97</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="ClickHouse-98"><a href="#ClickHouse-98"><span class="linenos"> 98</span></a> <span class="c1"># WITH <identifier> AS <subquery expression></span> +</span><span id="ClickHouse-99"><a href="#ClickHouse-99"><span class="linenos"> 99</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_cte</span><span class="p">()</span> +</span><span id="ClickHouse-100"><a href="#ClickHouse-100"><span class="linenos">100</span></a> <span class="k">except</span> <span class="n">ParseError</span><span class="p">:</span> +</span><span id="ClickHouse-101"><a href="#ClickHouse-101"><span class="linenos">101</span></a> <span class="c1"># WITH <expression> AS <identifier></span> +</span><span id="ClickHouse-102"><a href="#ClickHouse-102"><span class="linenos">102</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="ClickHouse-103"><a href="#ClickHouse-103"><span class="linenos">103</span></a> <span class="n">statement</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> +</span><span id="ClickHouse-104"><a href="#ClickHouse-104"><span class="linenos">104</span></a> +</span><span id="ClickHouse-105"><a href="#ClickHouse-105"><span class="linenos">105</span></a> <span class="k">if</span> <span class="n">statement</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">statement</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">Alias</span><span class="p">):</span> +</span><span id="ClickHouse-106"><a href="#ClickHouse-106"><span class="linenos">106</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected CTE to have alias"</span><span class="p">)</span> </span><span id="ClickHouse-107"><a href="#ClickHouse-107"><span class="linenos">107</span></a> -</span><span id="ClickHouse-108"><a href="#ClickHouse-108"><span class="linenos">108</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="ClickHouse-109"><a href="#ClickHouse-109"><span class="linenos">109</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="ClickHouse-110"><a href="#ClickHouse-110"><span class="linenos">110</span></a> -</span><span id="ClickHouse-111"><a href="#ClickHouse-111"><span class="linenos">111</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="ClickHouse-112"><a href="#ClickHouse-112"><span class="linenos">112</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 class="c1"># type: ignore</span> -</span><span id="ClickHouse-113"><a href="#ClickHouse-113"><span class="linenos">113</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">NULLABLE</span><span class="p">:</span> <span class="s2">"Nullable"</span><span class="p">,</span> -</span><span id="ClickHouse-114"><a href="#ClickHouse-114"><span class="linenos">114</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">"DateTime64"</span><span class="p">,</span> -</span><span id="ClickHouse-115"><a href="#ClickHouse-115"><span class="linenos">115</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">MAP</span><span class="p">:</span> <span class="s2">"Map"</span><span class="p">,</span> -</span><span id="ClickHouse-116"><a href="#ClickHouse-116"><span class="linenos">116</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">ARRAY</span><span class="p">:</span> <span class="s2">"Array"</span><span class="p">,</span> -</span><span id="ClickHouse-117"><a href="#ClickHouse-117"><span class="linenos">117</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">"Tuple"</span><span class="p">,</span> -</span><span id="ClickHouse-118"><a href="#ClickHouse-118"><span class="linenos">118</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">TINYINT</span><span class="p">:</span> <span class="s2">"Int8"</span><span class="p">,</span> -</span><span id="ClickHouse-119"><a href="#ClickHouse-119"><span class="linenos">119</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">SMALLINT</span><span class="p">:</span> <span class="s2">"Int16"</span><span class="p">,</span> -</span><span id="ClickHouse-120"><a href="#ClickHouse-120"><span class="linenos">120</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">"Int32"</span><span class="p">,</span> -</span><span id="ClickHouse-121"><a href="#ClickHouse-121"><span class="linenos">121</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">BIGINT</span><span class="p">:</span> <span class="s2">"Int64"</span><span class="p">,</span> -</span><span id="ClickHouse-122"><a href="#ClickHouse-122"><span class="linenos">122</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">"Float32"</span><span class="p">,</span> -</span><span id="ClickHouse-123"><a href="#ClickHouse-123"><span class="linenos">123</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">DOUBLE</span><span class="p">:</span> <span class="s2">"Float64"</span><span class="p">,</span> -</span><span id="ClickHouse-124"><a href="#ClickHouse-124"><span class="linenos">124</span></a> <span class="p">}</span> -</span><span id="ClickHouse-125"><a href="#ClickHouse-125"><span class="linenos">125</span></a> -</span><span id="ClickHouse-126"><a href="#ClickHouse-126"><span class="linenos">126</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="ClickHouse-127"><a href="#ClickHouse-127"><span class="linenos">127</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 class="c1"># type: ignore</span> -</span><span id="ClickHouse-128"><a href="#ClickHouse-128"><span class="linenos">128</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> -</span><span id="ClickHouse-129"><a href="#ClickHouse-129"><span class="linenos">129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ExponentialTimeDecayedAvg</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">"exponentialTimeDecayedAvg</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'decay'</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="s1">'this'</span><span class="p">,</span><span class="w"> </span><span class="s1">'time'</span><span class="p">])</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> -</span><span id="ClickHouse-130"><a href="#ClickHouse-130"><span class="linenos">130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Final</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">"</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"> FINAL"</span><span class="p">,</span> -</span><span id="ClickHouse-131"><a href="#ClickHouse-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupUniqArray</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">"groupUniqArray</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'size'</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="ClickHouse-132"><a href="#ClickHouse-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Histogram</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">"histogram</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'bins'</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="ClickHouse-133"><a href="#ClickHouse-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</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">_lower_func</span><span class="p">(</span><span class="n">var_map_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><span id="ClickHouse-134"><a href="#ClickHouse-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</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">"quantile</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'quantile'</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="ClickHouse-135"><a href="#ClickHouse-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantiles</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">"quantiles</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> -</span><span id="ClickHouse-136"><a href="#ClickHouse-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">QuantileIf</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">"quantileIf</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> -</span><span id="ClickHouse-137"><a href="#ClickHouse-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</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">"position(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</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="w"> </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="s1">'substr'</span><span class="p">),</span><span class="w"> </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="s1">'position'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="ClickHouse-138"><a href="#ClickHouse-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</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">_lower_func</span><span class="p">(</span><span class="n">var_map_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><span id="ClickHouse-139"><a href="#ClickHouse-139"><span class="linenos">139</span></a> <span class="p">}</span> -</span><span id="ClickHouse-140"><a href="#ClickHouse-140"><span class="linenos">140</span></a> -</span><span id="ClickHouse-141"><a href="#ClickHouse-141"><span class="linenos">141</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="ClickHouse-108"><a href="#ClickHouse-108"><span class="linenos">108</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">statement</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">statement</span> <span class="ow">and</span> <span class="n">statement</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="ClickHouse-109"><a href="#ClickHouse-109"><span class="linenos">109</span></a> +</span><span id="ClickHouse-110"><a href="#ClickHouse-110"><span class="linenos">110</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="ClickHouse-111"><a href="#ClickHouse-111"><span class="linenos">111</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="ClickHouse-112"><a href="#ClickHouse-112"><span class="linenos">112</span></a> +</span><span id="ClickHouse-113"><a href="#ClickHouse-113"><span class="linenos">113</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse-114"><a href="#ClickHouse-114"><span class="linenos">114</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 class="c1"># type: ignore</span> +</span><span id="ClickHouse-115"><a href="#ClickHouse-115"><span class="linenos">115</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">NULLABLE</span><span class="p">:</span> <span class="s2">"Nullable"</span><span class="p">,</span> +</span><span id="ClickHouse-116"><a href="#ClickHouse-116"><span class="linenos">116</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">"DateTime64"</span><span class="p">,</span> +</span><span id="ClickHouse-117"><a href="#ClickHouse-117"><span class="linenos">117</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">MAP</span><span class="p">:</span> <span class="s2">"Map"</span><span class="p">,</span> +</span><span id="ClickHouse-118"><a href="#ClickHouse-118"><span class="linenos">118</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">ARRAY</span><span class="p">:</span> <span class="s2">"Array"</span><span class="p">,</span> +</span><span id="ClickHouse-119"><a href="#ClickHouse-119"><span class="linenos">119</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">"Tuple"</span><span class="p">,</span> +</span><span id="ClickHouse-120"><a href="#ClickHouse-120"><span class="linenos">120</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">TINYINT</span><span class="p">:</span> <span class="s2">"Int8"</span><span class="p">,</span> +</span><span id="ClickHouse-121"><a href="#ClickHouse-121"><span class="linenos">121</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">SMALLINT</span><span class="p">:</span> <span class="s2">"Int16"</span><span class="p">,</span> +</span><span id="ClickHouse-122"><a href="#ClickHouse-122"><span class="linenos">122</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">"Int32"</span><span class="p">,</span> +</span><span id="ClickHouse-123"><a href="#ClickHouse-123"><span class="linenos">123</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">BIGINT</span><span class="p">:</span> <span class="s2">"Int64"</span><span class="p">,</span> +</span><span id="ClickHouse-124"><a href="#ClickHouse-124"><span class="linenos">124</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">"Float32"</span><span class="p">,</span> +</span><span id="ClickHouse-125"><a href="#ClickHouse-125"><span class="linenos">125</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">DOUBLE</span><span class="p">:</span> <span class="s2">"Float64"</span><span class="p">,</span> +</span><span id="ClickHouse-126"><a href="#ClickHouse-126"><span class="linenos">126</span></a> <span class="p">}</span> +</span><span id="ClickHouse-127"><a href="#ClickHouse-127"><span class="linenos">127</span></a> +</span><span id="ClickHouse-128"><a href="#ClickHouse-128"><span class="linenos">128</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse-129"><a href="#ClickHouse-129"><span class="linenos">129</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 class="c1"># type: ignore</span> +</span><span id="ClickHouse-130"><a href="#ClickHouse-130"><span class="linenos">130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="ClickHouse-131"><a href="#ClickHouse-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ExponentialTimeDecayedAvg</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">"exponentialTimeDecayedAvg</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'decay'</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="s1">'this'</span><span class="p">,</span><span class="w"> </span><span class="s1">'time'</span><span class="p">])</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="ClickHouse-132"><a href="#ClickHouse-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Final</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">"</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"> FINAL"</span><span class="p">,</span> +</span><span id="ClickHouse-133"><a href="#ClickHouse-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupUniqArray</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">"groupUniqArray</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'size'</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="ClickHouse-134"><a href="#ClickHouse-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Histogram</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">"histogram</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'bins'</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="ClickHouse-135"><a href="#ClickHouse-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</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">_lower_func</span><span class="p">(</span><span class="n">var_map_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><span id="ClickHouse-136"><a href="#ClickHouse-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</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">"quantile</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'quantile'</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="ClickHouse-137"><a href="#ClickHouse-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantiles</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">"quantiles</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="ClickHouse-138"><a href="#ClickHouse-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">QuantileIf</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">"quantileIf</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="ClickHouse-139"><a href="#ClickHouse-139"><span class="linenos">139</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</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">"position(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</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="w"> </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="s1">'substr'</span><span class="p">),</span><span class="w"> </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="s1">'position'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="ClickHouse-140"><a href="#ClickHouse-140"><span class="linenos">140</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</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">_lower_func</span><span class="p">(</span><span class="n">var_map_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><span id="ClickHouse-141"><a href="#ClickHouse-141"><span class="linenos">141</span></a> <span class="p">}</span> </span><span id="ClickHouse-142"><a href="#ClickHouse-142"><span class="linenos">142</span></a> -</span><span id="ClickHouse-143"><a href="#ClickHouse-143"><span class="linenos">143</span></a> <span class="k">def</span> <span class="nf">_param_args_sql</span><span class="p">(</span> -</span><span id="ClickHouse-144"><a href="#ClickHouse-144"><span class="linenos">144</span></a> <span class="bp">self</span><span class="p">,</span> -</span><span id="ClickHouse-145"><a href="#ClickHouse-145"><span class="linenos">145</span></a> <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><span id="ClickHouse-146"><a href="#ClickHouse-146"><span class="linenos">146</span></a> <span class="n">param_names</span><span class="p">:</span> <span class="nb">str</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="ClickHouse-147"><a href="#ClickHouse-147"><span class="linenos">147</span></a> <span class="n">arg_names</span><span class="p">:</span> <span class="nb">str</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="ClickHouse-148"><a href="#ClickHouse-148"><span class="linenos">148</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="ClickHouse-149"><a href="#ClickHouse-149"><span class="linenos">149</span></a> <span class="n">params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> -</span><span id="ClickHouse-150"><a href="#ClickHouse-150"><span class="linenos">150</span></a> <span class="o">*</span><span class="p">(</span> -</span><span id="ClickHouse-151"><a href="#ClickHouse-151"><span class="linenos">151</span></a> <span class="n">arg</span> -</span><span id="ClickHouse-152"><a href="#ClickHouse-152"><span class="linenos">152</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">param_names</span><span class="p">)</span> -</span><span id="ClickHouse-153"><a href="#ClickHouse-153"><span class="linenos">153</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</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="n">name</span><span class="p">))</span> -</span><span id="ClickHouse-154"><a href="#ClickHouse-154"><span class="linenos">154</span></a> <span class="p">)</span> -</span><span id="ClickHouse-155"><a href="#ClickHouse-155"><span class="linenos">155</span></a> <span class="p">)</span> -</span><span id="ClickHouse-156"><a href="#ClickHouse-156"><span class="linenos">156</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> -</span><span id="ClickHouse-157"><a href="#ClickHouse-157"><span class="linenos">157</span></a> <span class="o">*</span><span class="p">(</span> -</span><span id="ClickHouse-158"><a href="#ClickHouse-158"><span class="linenos">158</span></a> <span class="n">arg</span> -</span><span id="ClickHouse-159"><a href="#ClickHouse-159"><span class="linenos">159</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">arg_names</span><span class="p">)</span> -</span><span id="ClickHouse-160"><a href="#ClickHouse-160"><span class="linenos">160</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</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="n">name</span><span class="p">))</span> -</span><span id="ClickHouse-161"><a href="#ClickHouse-161"><span class="linenos">161</span></a> <span class="p">)</span> -</span><span id="ClickHouse-162"><a href="#ClickHouse-162"><span class="linenos">162</span></a> <span class="p">)</span> -</span><span id="ClickHouse-163"><a href="#ClickHouse-163"><span class="linenos">163</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">params</span><span class="si">}</span><span class="s2">)(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> -</span><span id="ClickHouse-164"><a href="#ClickHouse-164"><span class="linenos">164</span></a> -</span><span id="ClickHouse-165"><a href="#ClickHouse-165"><span class="linenos">165</span></a> <span class="k">def</span> <span class="nf">cte_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">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="ClickHouse-166"><a href="#ClickHouse-166"><span class="linenos">166</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">Alias</span><span class="p">):</span> -</span><span id="ClickHouse-167"><a href="#ClickHouse-167"><span class="linenos">167</span></a> <span class="k">return</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="ClickHouse-168"><a href="#ClickHouse-168"><span class="linenos">168</span></a> -</span><span id="ClickHouse-169"><a href="#ClickHouse-169"><span class="linenos">169</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cte_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="ClickHouse-143"><a href="#ClickHouse-143"><span class="linenos">143</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="ClickHouse-144"><a href="#ClickHouse-144"><span class="linenos">144</span></a> +</span><span id="ClickHouse-145"><a href="#ClickHouse-145"><span class="linenos">145</span></a> <span class="k">def</span> <span class="nf">_param_args_sql</span><span class="p">(</span> +</span><span id="ClickHouse-146"><a href="#ClickHouse-146"><span class="linenos">146</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="ClickHouse-147"><a href="#ClickHouse-147"><span class="linenos">147</span></a> <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><span id="ClickHouse-148"><a href="#ClickHouse-148"><span class="linenos">148</span></a> <span class="n">param_names</span><span class="p">:</span> <span class="nb">str</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="ClickHouse-149"><a href="#ClickHouse-149"><span class="linenos">149</span></a> <span class="n">arg_names</span><span class="p">:</span> <span class="nb">str</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="ClickHouse-150"><a href="#ClickHouse-150"><span class="linenos">150</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="ClickHouse-151"><a href="#ClickHouse-151"><span class="linenos">151</span></a> <span class="n">params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> +</span><span id="ClickHouse-152"><a href="#ClickHouse-152"><span class="linenos">152</span></a> <span class="o">*</span><span class="p">(</span> +</span><span id="ClickHouse-153"><a href="#ClickHouse-153"><span class="linenos">153</span></a> <span class="n">arg</span> +</span><span id="ClickHouse-154"><a href="#ClickHouse-154"><span class="linenos">154</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">param_names</span><span class="p">)</span> +</span><span id="ClickHouse-155"><a href="#ClickHouse-155"><span class="linenos">155</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</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="n">name</span><span class="p">))</span> +</span><span id="ClickHouse-156"><a href="#ClickHouse-156"><span class="linenos">156</span></a> <span class="p">)</span> +</span><span id="ClickHouse-157"><a href="#ClickHouse-157"><span class="linenos">157</span></a> <span class="p">)</span> +</span><span id="ClickHouse-158"><a href="#ClickHouse-158"><span class="linenos">158</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> +</span><span id="ClickHouse-159"><a href="#ClickHouse-159"><span class="linenos">159</span></a> <span class="o">*</span><span class="p">(</span> +</span><span id="ClickHouse-160"><a href="#ClickHouse-160"><span class="linenos">160</span></a> <span class="n">arg</span> +</span><span id="ClickHouse-161"><a href="#ClickHouse-161"><span class="linenos">161</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">arg_names</span><span class="p">)</span> +</span><span id="ClickHouse-162"><a href="#ClickHouse-162"><span class="linenos">162</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</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="n">name</span><span class="p">))</span> +</span><span id="ClickHouse-163"><a href="#ClickHouse-163"><span class="linenos">163</span></a> <span class="p">)</span> +</span><span id="ClickHouse-164"><a href="#ClickHouse-164"><span class="linenos">164</span></a> <span class="p">)</span> +</span><span id="ClickHouse-165"><a href="#ClickHouse-165"><span class="linenos">165</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">params</span><span class="si">}</span><span class="s2">)(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="ClickHouse-166"><a href="#ClickHouse-166"><span class="linenos">166</span></a> +</span><span id="ClickHouse-167"><a href="#ClickHouse-167"><span class="linenos">167</span></a> <span class="k">def</span> <span class="nf">cte_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">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="ClickHouse-168"><a href="#ClickHouse-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">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="ClickHouse-169"><a href="#ClickHouse-169"><span class="linenos">169</span></a> <span class="k">return</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="ClickHouse-170"><a href="#ClickHouse-170"><span class="linenos">170</span></a> +</span><span id="ClickHouse-171"><a href="#ClickHouse-171"><span class="linenos">171</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cte_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> </span></pre></div> @@ -523,41 +527,43 @@ </span><span id="ClickHouse.Parser-69"><a href="#ClickHouse.Parser-69"><span class="linenos"> 69</span></a> </span><span id="ClickHouse.Parser-70"><a href="#ClickHouse.Parser-70"><span class="linenos"> 70</span></a> <span class="n">TABLE_ALIAS_TOKENS</span> <span class="o">=</span> <span class="p">{</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">TABLE_ALIAS_TOKENS</span><span class="p">}</span> <span class="o">-</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ANY</span><span class="p">}</span> <span class="c1"># type: ignore</span> </span><span id="ClickHouse.Parser-71"><a href="#ClickHouse.Parser-71"><span class="linenos"> 71</span></a> -</span><span id="ClickHouse.Parser-72"><a href="#ClickHouse.Parser-72"><span class="linenos"> 72</span></a> <span class="k">def</span> <span class="nf">_parse_in</span><span class="p">(</span> -</span><span id="ClickHouse.Parser-73"><a href="#ClickHouse.Parser-73"><span class="linenos"> 73</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</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">Expression</span><span class="p">],</span> <span class="n">is_global</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="ClickHouse.Parser-74"><a href="#ClickHouse.Parser-74"><span class="linenos"> 74</span></a> <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="ClickHouse.Parser-75"><a href="#ClickHouse.Parser-75"><span class="linenos"> 75</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> -</span><span id="ClickHouse.Parser-76"><a href="#ClickHouse.Parser-76"><span class="linenos"> 76</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"is_global"</span><span class="p">,</span> <span class="n">is_global</span><span class="p">)</span> -</span><span id="ClickHouse.Parser-77"><a href="#ClickHouse.Parser-77"><span class="linenos"> 77</span></a> <span class="k">return</span> <span class="n">this</span> -</span><span id="ClickHouse.Parser-78"><a href="#ClickHouse.Parser-78"><span class="linenos"> 78</span></a> -</span><span id="ClickHouse.Parser-79"><a href="#ClickHouse.Parser-79"><span class="linenos"> 79</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> -</span><span id="ClickHouse.Parser-80"><a href="#ClickHouse.Parser-80"><span class="linenos"> 80</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">alias_tokens</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">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="ClickHouse.Parser-81"><a href="#ClickHouse.Parser-81"><span class="linenos"> 81</span></a> <span class="p">)</span> <span class="o">-></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">Expression</span><span class="p">]:</span> -</span><span id="ClickHouse.Parser-82"><a href="#ClickHouse.Parser-82"><span class="linenos"> 82</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">)</span> -</span><span id="ClickHouse.Parser-83"><a href="#ClickHouse.Parser-83"><span class="linenos"> 83</span></a> -</span><span id="ClickHouse.Parser-84"><a href="#ClickHouse.Parser-84"><span class="linenos"> 84</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FINAL</span><span class="p">):</span> -</span><span id="ClickHouse.Parser-85"><a href="#ClickHouse.Parser-85"><span class="linenos"> 85</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Final</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> -</span><span id="ClickHouse.Parser-86"><a href="#ClickHouse.Parser-86"><span class="linenos"> 86</span></a> -</span><span id="ClickHouse.Parser-87"><a href="#ClickHouse.Parser-87"><span class="linenos"> 87</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="ClickHouse.Parser-72"><a href="#ClickHouse.Parser-72"><span class="linenos"> 72</span></a> <span class="n">LOG_DEFAULTS_TO_LN</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="ClickHouse.Parser-73"><a href="#ClickHouse.Parser-73"><span class="linenos"> 73</span></a> +</span><span id="ClickHouse.Parser-74"><a href="#ClickHouse.Parser-74"><span class="linenos"> 74</span></a> <span class="k">def</span> <span class="nf">_parse_in</span><span class="p">(</span> +</span><span id="ClickHouse.Parser-75"><a href="#ClickHouse.Parser-75"><span class="linenos"> 75</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</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">Expression</span><span class="p">],</span> <span class="n">is_global</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="ClickHouse.Parser-76"><a href="#ClickHouse.Parser-76"><span class="linenos"> 76</span></a> <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="ClickHouse.Parser-77"><a href="#ClickHouse.Parser-77"><span class="linenos"> 77</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-78"><a href="#ClickHouse.Parser-78"><span class="linenos"> 78</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"is_global"</span><span class="p">,</span> <span class="n">is_global</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-79"><a href="#ClickHouse.Parser-79"><span class="linenos"> 79</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="ClickHouse.Parser-80"><a href="#ClickHouse.Parser-80"><span class="linenos"> 80</span></a> +</span><span id="ClickHouse.Parser-81"><a href="#ClickHouse.Parser-81"><span class="linenos"> 81</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> +</span><span id="ClickHouse.Parser-82"><a href="#ClickHouse.Parser-82"><span class="linenos"> 82</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">alias_tokens</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">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="ClickHouse.Parser-83"><a href="#ClickHouse.Parser-83"><span class="linenos"> 83</span></a> <span class="p">)</span> <span class="o">-></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">Expression</span><span class="p">]:</span> +</span><span id="ClickHouse.Parser-84"><a href="#ClickHouse.Parser-84"><span class="linenos"> 84</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-85"><a href="#ClickHouse.Parser-85"><span class="linenos"> 85</span></a> +</span><span id="ClickHouse.Parser-86"><a href="#ClickHouse.Parser-86"><span class="linenos"> 86</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FINAL</span><span class="p">):</span> +</span><span id="ClickHouse.Parser-87"><a href="#ClickHouse.Parser-87"><span class="linenos"> 87</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Final</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> </span><span id="ClickHouse.Parser-88"><a href="#ClickHouse.Parser-88"><span class="linenos"> 88</span></a> -</span><span id="ClickHouse.Parser-89"><a href="#ClickHouse.Parser-89"><span class="linenos"> 89</span></a> <span class="k">def</span> <span class="nf">_parse_position</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">haystack_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</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="ClickHouse.Parser-90"><a href="#ClickHouse.Parser-90"><span class="linenos"> 90</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_position</span><span class="p">(</span><span class="n">haystack_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> -</span><span id="ClickHouse.Parser-91"><a href="#ClickHouse.Parser-91"><span class="linenos"> 91</span></a> -</span><span id="ClickHouse.Parser-92"><a href="#ClickHouse.Parser-92"><span class="linenos"> 92</span></a> <span class="c1"># https://clickhouse.com/docs/en/sql-reference/statements/select/with/</span> -</span><span id="ClickHouse.Parser-93"><a href="#ClickHouse.Parser-93"><span class="linenos"> 93</span></a> <span class="k">def</span> <span class="nf">_parse_cte</span><span class="p">(</span><span class="bp">self</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="ClickHouse.Parser-94"><a href="#ClickHouse.Parser-94"><span class="linenos"> 94</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> -</span><span id="ClickHouse.Parser-95"><a href="#ClickHouse.Parser-95"><span class="linenos"> 95</span></a> <span class="k">try</span><span class="p">:</span> -</span><span id="ClickHouse.Parser-96"><a href="#ClickHouse.Parser-96"><span class="linenos"> 96</span></a> <span class="c1"># WITH <identifier> AS <subquery expression></span> -</span><span id="ClickHouse.Parser-97"><a href="#ClickHouse.Parser-97"><span class="linenos"> 97</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_cte</span><span class="p">()</span> -</span><span id="ClickHouse.Parser-98"><a href="#ClickHouse.Parser-98"><span class="linenos"> 98</span></a> <span class="k">except</span> <span class="n">ParseError</span><span class="p">:</span> -</span><span id="ClickHouse.Parser-99"><a href="#ClickHouse.Parser-99"><span class="linenos"> 99</span></a> <span class="c1"># WITH <expression> AS <identifier></span> -</span><span id="ClickHouse.Parser-100"><a href="#ClickHouse.Parser-100"><span class="linenos">100</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> -</span><span id="ClickHouse.Parser-101"><a href="#ClickHouse.Parser-101"><span class="linenos">101</span></a> <span class="n">statement</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> -</span><span id="ClickHouse.Parser-102"><a href="#ClickHouse.Parser-102"><span class="linenos">102</span></a> -</span><span id="ClickHouse.Parser-103"><a href="#ClickHouse.Parser-103"><span class="linenos">103</span></a> <span class="k">if</span> <span class="n">statement</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">statement</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">Alias</span><span class="p">):</span> -</span><span id="ClickHouse.Parser-104"><a href="#ClickHouse.Parser-104"><span class="linenos">104</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected CTE to have alias"</span><span class="p">)</span> -</span><span id="ClickHouse.Parser-105"><a href="#ClickHouse.Parser-105"><span class="linenos">105</span></a> -</span><span id="ClickHouse.Parser-106"><a href="#ClickHouse.Parser-106"><span class="linenos">106</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">statement</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">statement</span> <span class="ow">and</span> <span class="n">statement</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-89"><a href="#ClickHouse.Parser-89"><span class="linenos"> 89</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="ClickHouse.Parser-90"><a href="#ClickHouse.Parser-90"><span class="linenos"> 90</span></a> +</span><span id="ClickHouse.Parser-91"><a href="#ClickHouse.Parser-91"><span class="linenos"> 91</span></a> <span class="k">def</span> <span class="nf">_parse_position</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">haystack_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</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="ClickHouse.Parser-92"><a href="#ClickHouse.Parser-92"><span class="linenos"> 92</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_position</span><span class="p">(</span><span class="n">haystack_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-93"><a href="#ClickHouse.Parser-93"><span class="linenos"> 93</span></a> +</span><span id="ClickHouse.Parser-94"><a href="#ClickHouse.Parser-94"><span class="linenos"> 94</span></a> <span class="c1"># https://clickhouse.com/docs/en/sql-reference/statements/select/with/</span> +</span><span id="ClickHouse.Parser-95"><a href="#ClickHouse.Parser-95"><span class="linenos"> 95</span></a> <span class="k">def</span> <span class="nf">_parse_cte</span><span class="p">(</span><span class="bp">self</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="ClickHouse.Parser-96"><a href="#ClickHouse.Parser-96"><span class="linenos"> 96</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="ClickHouse.Parser-97"><a href="#ClickHouse.Parser-97"><span class="linenos"> 97</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="ClickHouse.Parser-98"><a href="#ClickHouse.Parser-98"><span class="linenos"> 98</span></a> <span class="c1"># WITH <identifier> AS <subquery expression></span> +</span><span id="ClickHouse.Parser-99"><a href="#ClickHouse.Parser-99"><span class="linenos"> 99</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_cte</span><span class="p">()</span> +</span><span id="ClickHouse.Parser-100"><a href="#ClickHouse.Parser-100"><span class="linenos">100</span></a> <span class="k">except</span> <span class="n">ParseError</span><span class="p">:</span> +</span><span id="ClickHouse.Parser-101"><a href="#ClickHouse.Parser-101"><span class="linenos">101</span></a> <span class="c1"># WITH <expression> AS <identifier></span> +</span><span id="ClickHouse.Parser-102"><a href="#ClickHouse.Parser-102"><span class="linenos">102</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-103"><a href="#ClickHouse.Parser-103"><span class="linenos">103</span></a> <span class="n">statement</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> +</span><span id="ClickHouse.Parser-104"><a href="#ClickHouse.Parser-104"><span class="linenos">104</span></a> +</span><span id="ClickHouse.Parser-105"><a href="#ClickHouse.Parser-105"><span class="linenos">105</span></a> <span class="k">if</span> <span class="n">statement</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">statement</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">Alias</span><span class="p">):</span> +</span><span id="ClickHouse.Parser-106"><a href="#ClickHouse.Parser-106"><span class="linenos">106</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected CTE to have alias"</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-107"><a href="#ClickHouse.Parser-107"><span class="linenos">107</span></a> +</span><span id="ClickHouse.Parser-108"><a href="#ClickHouse.Parser-108"><span class="linenos">108</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">statement</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">statement</span> <span class="ow">and</span> <span class="n">statement</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> </span></pre></div> @@ -614,68 +620,68 @@ Default: "nulls_are_small"</li> </div> <a class="headerlink" href="#ClickHouse.Generator"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="ClickHouse.Generator-108"><a href="#ClickHouse.Generator-108"><span class="linenos">108</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="ClickHouse.Generator-109"><a href="#ClickHouse.Generator-109"><span class="linenos">109</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="ClickHouse.Generator-110"><a href="#ClickHouse.Generator-110"><span class="linenos">110</span></a> -</span><span id="ClickHouse.Generator-111"><a href="#ClickHouse.Generator-111"><span class="linenos">111</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="ClickHouse.Generator-112"><a href="#ClickHouse.Generator-112"><span class="linenos">112</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 class="c1"># type: ignore</span> -</span><span id="ClickHouse.Generator-113"><a href="#ClickHouse.Generator-113"><span class="linenos">113</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">NULLABLE</span><span class="p">:</span> <span class="s2">"Nullable"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-114"><a href="#ClickHouse.Generator-114"><span class="linenos">114</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">"DateTime64"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-115"><a href="#ClickHouse.Generator-115"><span class="linenos">115</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">MAP</span><span class="p">:</span> <span class="s2">"Map"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-116"><a href="#ClickHouse.Generator-116"><span class="linenos">116</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">ARRAY</span><span class="p">:</span> <span class="s2">"Array"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-117"><a href="#ClickHouse.Generator-117"><span class="linenos">117</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">"Tuple"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-118"><a href="#ClickHouse.Generator-118"><span class="linenos">118</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">TINYINT</span><span class="p">:</span> <span class="s2">"Int8"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-119"><a href="#ClickHouse.Generator-119"><span class="linenos">119</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">SMALLINT</span><span class="p">:</span> <span class="s2">"Int16"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-120"><a href="#ClickHouse.Generator-120"><span class="linenos">120</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">"Int32"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-121"><a href="#ClickHouse.Generator-121"><span class="linenos">121</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">BIGINT</span><span class="p">:</span> <span class="s2">"Int64"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-122"><a href="#ClickHouse.Generator-122"><span class="linenos">122</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">"Float32"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-123"><a href="#ClickHouse.Generator-123"><span class="linenos">123</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">DOUBLE</span><span class="p">:</span> <span class="s2">"Float64"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-124"><a href="#ClickHouse.Generator-124"><span class="linenos">124</span></a> <span class="p">}</span> -</span><span id="ClickHouse.Generator-125"><a href="#ClickHouse.Generator-125"><span class="linenos">125</span></a> -</span><span id="ClickHouse.Generator-126"><a href="#ClickHouse.Generator-126"><span class="linenos">126</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="ClickHouse.Generator-127"><a href="#ClickHouse.Generator-127"><span class="linenos">127</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 class="c1"># type: ignore</span> -</span><span id="ClickHouse.Generator-128"><a href="#ClickHouse.Generator-128"><span class="linenos">128</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-129"><a href="#ClickHouse.Generator-129"><span class="linenos">129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ExponentialTimeDecayedAvg</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">"exponentialTimeDecayedAvg</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'decay'</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="s1">'this'</span><span class="p">,</span><span class="w"> </span><span class="s1">'time'</span><span class="p">])</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-130"><a href="#ClickHouse.Generator-130"><span class="linenos">130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Final</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">"</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"> FINAL"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-131"><a href="#ClickHouse.Generator-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupUniqArray</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">"groupUniqArray</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'size'</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="ClickHouse.Generator-132"><a href="#ClickHouse.Generator-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Histogram</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">"histogram</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'bins'</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="ClickHouse.Generator-133"><a href="#ClickHouse.Generator-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</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">_lower_func</span><span class="p">(</span><span class="n">var_map_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><span id="ClickHouse.Generator-134"><a href="#ClickHouse.Generator-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</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">"quantile</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'quantile'</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="ClickHouse.Generator-135"><a href="#ClickHouse.Generator-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantiles</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">"quantiles</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-136"><a href="#ClickHouse.Generator-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">QuantileIf</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">"quantileIf</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-137"><a href="#ClickHouse.Generator-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</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">"position(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</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="w"> </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="s1">'substr'</span><span class="p">),</span><span class="w"> </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="s1">'position'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-138"><a href="#ClickHouse.Generator-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</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">_lower_func</span><span class="p">(</span><span class="n">var_map_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><span id="ClickHouse.Generator-139"><a href="#ClickHouse.Generator-139"><span class="linenos">139</span></a> <span class="p">}</span> -</span><span id="ClickHouse.Generator-140"><a href="#ClickHouse.Generator-140"><span class="linenos">140</span></a> -</span><span id="ClickHouse.Generator-141"><a href="#ClickHouse.Generator-141"><span class="linenos">141</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">True</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="ClickHouse.Generator-110"><a href="#ClickHouse.Generator-110"><span class="linenos">110</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="ClickHouse.Generator-111"><a href="#ClickHouse.Generator-111"><span class="linenos">111</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="ClickHouse.Generator-112"><a href="#ClickHouse.Generator-112"><span class="linenos">112</span></a> +</span><span id="ClickHouse.Generator-113"><a href="#ClickHouse.Generator-113"><span class="linenos">113</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse.Generator-114"><a href="#ClickHouse.Generator-114"><span class="linenos">114</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 class="c1"># type: ignore</span> +</span><span id="ClickHouse.Generator-115"><a href="#ClickHouse.Generator-115"><span class="linenos">115</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">NULLABLE</span><span class="p">:</span> <span class="s2">"Nullable"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-116"><a href="#ClickHouse.Generator-116"><span class="linenos">116</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">"DateTime64"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-117"><a href="#ClickHouse.Generator-117"><span class="linenos">117</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">MAP</span><span class="p">:</span> <span class="s2">"Map"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-118"><a href="#ClickHouse.Generator-118"><span class="linenos">118</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">ARRAY</span><span class="p">:</span> <span class="s2">"Array"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-119"><a href="#ClickHouse.Generator-119"><span class="linenos">119</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">"Tuple"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-120"><a href="#ClickHouse.Generator-120"><span class="linenos">120</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">TINYINT</span><span class="p">:</span> <span class="s2">"Int8"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-121"><a href="#ClickHouse.Generator-121"><span class="linenos">121</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">SMALLINT</span><span class="p">:</span> <span class="s2">"Int16"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-122"><a href="#ClickHouse.Generator-122"><span class="linenos">122</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">"Int32"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-123"><a href="#ClickHouse.Generator-123"><span class="linenos">123</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">BIGINT</span><span class="p">:</span> <span class="s2">"Int64"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-124"><a href="#ClickHouse.Generator-124"><span class="linenos">124</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">"Float32"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-125"><a href="#ClickHouse.Generator-125"><span class="linenos">125</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">DOUBLE</span><span class="p">:</span> <span class="s2">"Float64"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-126"><a href="#ClickHouse.Generator-126"><span class="linenos">126</span></a> <span class="p">}</span> +</span><span id="ClickHouse.Generator-127"><a href="#ClickHouse.Generator-127"><span class="linenos">127</span></a> +</span><span id="ClickHouse.Generator-128"><a href="#ClickHouse.Generator-128"><span class="linenos">128</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse.Generator-129"><a href="#ClickHouse.Generator-129"><span class="linenos">129</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 class="c1"># type: ignore</span> +</span><span id="ClickHouse.Generator-130"><a href="#ClickHouse.Generator-130"><span class="linenos">130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-131"><a href="#ClickHouse.Generator-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ExponentialTimeDecayedAvg</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">"exponentialTimeDecayedAvg</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'decay'</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="s1">'this'</span><span class="p">,</span><span class="w"> </span><span class="s1">'time'</span><span class="p">])</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-132"><a href="#ClickHouse.Generator-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Final</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">"</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"> FINAL"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-133"><a href="#ClickHouse.Generator-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupUniqArray</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">"groupUniqArray</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'size'</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="ClickHouse.Generator-134"><a href="#ClickHouse.Generator-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Histogram</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">"histogram</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'bins'</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="ClickHouse.Generator-135"><a href="#ClickHouse.Generator-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</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">_lower_func</span><span class="p">(</span><span class="n">var_map_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><span id="ClickHouse.Generator-136"><a href="#ClickHouse.Generator-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</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">"quantile</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'quantile'</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="ClickHouse.Generator-137"><a href="#ClickHouse.Generator-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantiles</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">"quantiles</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-138"><a href="#ClickHouse.Generator-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">QuantileIf</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">"quantileIf</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-139"><a href="#ClickHouse.Generator-139"><span class="linenos">139</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</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">"position(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</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="w"> </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="s1">'substr'</span><span class="p">),</span><span class="w"> </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="s1">'position'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-140"><a href="#ClickHouse.Generator-140"><span class="linenos">140</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</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">_lower_func</span><span class="p">(</span><span class="n">var_map_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><span id="ClickHouse.Generator-141"><a href="#ClickHouse.Generator-141"><span class="linenos">141</span></a> <span class="p">}</span> </span><span id="ClickHouse.Generator-142"><a href="#ClickHouse.Generator-142"><span class="linenos">142</span></a> -</span><span id="ClickHouse.Generator-143"><a href="#ClickHouse.Generator-143"><span class="linenos">143</span></a> <span class="k">def</span> <span class="nf">_param_args_sql</span><span class="p">(</span> -</span><span id="ClickHouse.Generator-144"><a href="#ClickHouse.Generator-144"><span class="linenos">144</span></a> <span class="bp">self</span><span class="p">,</span> -</span><span id="ClickHouse.Generator-145"><a href="#ClickHouse.Generator-145"><span class="linenos">145</span></a> <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><span id="ClickHouse.Generator-146"><a href="#ClickHouse.Generator-146"><span class="linenos">146</span></a> <span class="n">param_names</span><span class="p">:</span> <span class="nb">str</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="ClickHouse.Generator-147"><a href="#ClickHouse.Generator-147"><span class="linenos">147</span></a> <span class="n">arg_names</span><span class="p">:</span> <span class="nb">str</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="ClickHouse.Generator-148"><a href="#ClickHouse.Generator-148"><span class="linenos">148</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="ClickHouse.Generator-149"><a href="#ClickHouse.Generator-149"><span class="linenos">149</span></a> <span class="n">params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> -</span><span id="ClickHouse.Generator-150"><a href="#ClickHouse.Generator-150"><span class="linenos">150</span></a> <span class="o">*</span><span class="p">(</span> -</span><span id="ClickHouse.Generator-151"><a href="#ClickHouse.Generator-151"><span class="linenos">151</span></a> <span class="n">arg</span> -</span><span id="ClickHouse.Generator-152"><a href="#ClickHouse.Generator-152"><span class="linenos">152</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">param_names</span><span class="p">)</span> -</span><span id="ClickHouse.Generator-153"><a href="#ClickHouse.Generator-153"><span class="linenos">153</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</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="n">name</span><span class="p">))</span> -</span><span id="ClickHouse.Generator-154"><a href="#ClickHouse.Generator-154"><span class="linenos">154</span></a> <span class="p">)</span> -</span><span id="ClickHouse.Generator-155"><a href="#ClickHouse.Generator-155"><span class="linenos">155</span></a> <span class="p">)</span> -</span><span id="ClickHouse.Generator-156"><a href="#ClickHouse.Generator-156"><span class="linenos">156</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> -</span><span id="ClickHouse.Generator-157"><a href="#ClickHouse.Generator-157"><span class="linenos">157</span></a> <span class="o">*</span><span class="p">(</span> -</span><span id="ClickHouse.Generator-158"><a href="#ClickHouse.Generator-158"><span class="linenos">158</span></a> <span class="n">arg</span> -</span><span id="ClickHouse.Generator-159"><a href="#ClickHouse.Generator-159"><span class="linenos">159</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">arg_names</span><span class="p">)</span> -</span><span id="ClickHouse.Generator-160"><a href="#ClickHouse.Generator-160"><span class="linenos">160</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</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="n">name</span><span class="p">))</span> -</span><span id="ClickHouse.Generator-161"><a href="#ClickHouse.Generator-161"><span class="linenos">161</span></a> <span class="p">)</span> -</span><span id="ClickHouse.Generator-162"><a href="#ClickHouse.Generator-162"><span class="linenos">162</span></a> <span class="p">)</span> -</span><span id="ClickHouse.Generator-163"><a href="#ClickHouse.Generator-163"><span class="linenos">163</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">params</span><span class="si">}</span><span class="s2">)(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> -</span><span id="ClickHouse.Generator-164"><a href="#ClickHouse.Generator-164"><span class="linenos">164</span></a> -</span><span id="ClickHouse.Generator-165"><a href="#ClickHouse.Generator-165"><span class="linenos">165</span></a> <span class="k">def</span> <span class="nf">cte_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">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="ClickHouse.Generator-166"><a href="#ClickHouse.Generator-166"><span class="linenos">166</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">Alias</span><span class="p">):</span> -</span><span id="ClickHouse.Generator-167"><a href="#ClickHouse.Generator-167"><span class="linenos">167</span></a> <span class="k">return</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="ClickHouse.Generator-168"><a href="#ClickHouse.Generator-168"><span class="linenos">168</span></a> -</span><span id="ClickHouse.Generator-169"><a href="#ClickHouse.Generator-169"><span class="linenos">169</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cte_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="ClickHouse.Generator-143"><a href="#ClickHouse.Generator-143"><span class="linenos">143</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="ClickHouse.Generator-144"><a href="#ClickHouse.Generator-144"><span class="linenos">144</span></a> +</span><span id="ClickHouse.Generator-145"><a href="#ClickHouse.Generator-145"><span class="linenos">145</span></a> <span class="k">def</span> <span class="nf">_param_args_sql</span><span class="p">(</span> +</span><span id="ClickHouse.Generator-146"><a href="#ClickHouse.Generator-146"><span class="linenos">146</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-147"><a href="#ClickHouse.Generator-147"><span class="linenos">147</span></a> <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><span id="ClickHouse.Generator-148"><a href="#ClickHouse.Generator-148"><span class="linenos">148</span></a> <span class="n">param_names</span><span class="p">:</span> <span class="nb">str</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="ClickHouse.Generator-149"><a href="#ClickHouse.Generator-149"><span class="linenos">149</span></a> <span class="n">arg_names</span><span class="p">:</span> <span class="nb">str</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="ClickHouse.Generator-150"><a href="#ClickHouse.Generator-150"><span class="linenos">150</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="ClickHouse.Generator-151"><a href="#ClickHouse.Generator-151"><span class="linenos">151</span></a> <span class="n">params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> +</span><span id="ClickHouse.Generator-152"><a href="#ClickHouse.Generator-152"><span class="linenos">152</span></a> <span class="o">*</span><span class="p">(</span> +</span><span id="ClickHouse.Generator-153"><a href="#ClickHouse.Generator-153"><span class="linenos">153</span></a> <span class="n">arg</span> +</span><span id="ClickHouse.Generator-154"><a href="#ClickHouse.Generator-154"><span class="linenos">154</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">param_names</span><span class="p">)</span> +</span><span id="ClickHouse.Generator-155"><a href="#ClickHouse.Generator-155"><span class="linenos">155</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</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="n">name</span><span class="p">))</span> +</span><span id="ClickHouse.Generator-156"><a href="#ClickHouse.Generator-156"><span class="linenos">156</span></a> <span class="p">)</span> +</span><span id="ClickHouse.Generator-157"><a href="#ClickHouse.Generator-157"><span class="linenos">157</span></a> <span class="p">)</span> +</span><span id="ClickHouse.Generator-158"><a href="#ClickHouse.Generator-158"><span class="linenos">158</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> +</span><span id="ClickHouse.Generator-159"><a href="#ClickHouse.Generator-159"><span class="linenos">159</span></a> <span class="o">*</span><span class="p">(</span> +</span><span id="ClickHouse.Generator-160"><a href="#ClickHouse.Generator-160"><span class="linenos">160</span></a> <span class="n">arg</span> +</span><span id="ClickHouse.Generator-161"><a href="#ClickHouse.Generator-161"><span class="linenos">161</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">arg_names</span><span class="p">)</span> +</span><span id="ClickHouse.Generator-162"><a href="#ClickHouse.Generator-162"><span class="linenos">162</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</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="n">name</span><span class="p">))</span> +</span><span id="ClickHouse.Generator-163"><a href="#ClickHouse.Generator-163"><span class="linenos">163</span></a> <span class="p">)</span> +</span><span id="ClickHouse.Generator-164"><a href="#ClickHouse.Generator-164"><span class="linenos">164</span></a> <span class="p">)</span> +</span><span id="ClickHouse.Generator-165"><a href="#ClickHouse.Generator-165"><span class="linenos">165</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">params</span><span class="si">}</span><span class="s2">)(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="ClickHouse.Generator-166"><a href="#ClickHouse.Generator-166"><span class="linenos">166</span></a> +</span><span id="ClickHouse.Generator-167"><a href="#ClickHouse.Generator-167"><span class="linenos">167</span></a> <span class="k">def</span> <span class="nf">cte_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">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="ClickHouse.Generator-168"><a href="#ClickHouse.Generator-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">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="ClickHouse.Generator-169"><a href="#ClickHouse.Generator-169"><span class="linenos">169</span></a> <span class="k">return</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="ClickHouse.Generator-170"><a href="#ClickHouse.Generator-170"><span class="linenos">170</span></a> +</span><span id="ClickHouse.Generator-171"><a href="#ClickHouse.Generator-171"><span class="linenos">171</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cte_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> </span></pre></div> @@ -734,11 +740,11 @@ Default: True</li> </div> <a class="headerlink" href="#ClickHouse.Generator.cte_sql"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="ClickHouse.Generator.cte_sql-165"><a href="#ClickHouse.Generator.cte_sql-165"><span class="linenos">165</span></a> <span class="k">def</span> <span class="nf">cte_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">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="ClickHouse.Generator.cte_sql-166"><a href="#ClickHouse.Generator.cte_sql-166"><span class="linenos">166</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">Alias</span><span class="p">):</span> -</span><span id="ClickHouse.Generator.cte_sql-167"><a href="#ClickHouse.Generator.cte_sql-167"><span class="linenos">167</span></a> <span class="k">return</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="ClickHouse.Generator.cte_sql-168"><a href="#ClickHouse.Generator.cte_sql-168"><span class="linenos">168</span></a> -</span><span id="ClickHouse.Generator.cte_sql-169"><a href="#ClickHouse.Generator.cte_sql-169"><span class="linenos">169</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cte_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="ClickHouse.Generator.cte_sql-167"><a href="#ClickHouse.Generator.cte_sql-167"><span class="linenos">167</span></a> <span class="k">def</span> <span class="nf">cte_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">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="ClickHouse.Generator.cte_sql-168"><a href="#ClickHouse.Generator.cte_sql-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">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="ClickHouse.Generator.cte_sql-169"><a href="#ClickHouse.Generator.cte_sql-169"><span class="linenos">169</span></a> <span class="k">return</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="ClickHouse.Generator.cte_sql-170"><a href="#ClickHouse.Generator.cte_sql-170"><span class="linenos">170</span></a> +</span><span id="ClickHouse.Generator.cte_sql-171"><a href="#ClickHouse.Generator.cte_sql-171"><span class="linenos">171</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cte_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> </span></pre></div> @@ -765,6 +771,7 @@ Default: True</li> <dd id="ClickHouse.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> <dd id="ClickHouse.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> <dd id="ClickHouse.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="ClickHouse.Generator.columnposition_sql" class="function"><a href="../generator.html#Generator.columnposition_sql">columnposition_sql</a></dd> <dd id="ClickHouse.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> <dd id="ClickHouse.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> <dd id="ClickHouse.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> @@ -881,6 +888,7 @@ Default: True</li> <dd id="ClickHouse.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> <dd id="ClickHouse.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> <dd id="ClickHouse.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="ClickHouse.Generator.matchagainst_sql" class="function"><a href="../generator.html#Generator.matchagainst_sql">matchagainst_sql</a></dd> <dd id="ClickHouse.Generator.jsonkeyvalue_sql" class="function"><a href="../generator.html#Generator.jsonkeyvalue_sql">jsonkeyvalue_sql</a></dd> <dd id="ClickHouse.Generator.jsonobject_sql" class="function"><a href="../generator.html#Generator.jsonobject_sql">jsonobject_sql</a></dd> <dd id="ClickHouse.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> @@ -932,8 +940,10 @@ Default: True</li> <dd id="ClickHouse.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> <dd id="ClickHouse.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> <dd id="ClickHouse.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="ClickHouse.Generator.ilikeany_sql" class="function"><a href="../generator.html#Generator.ilikeany_sql">ilikeany_sql</a></dd> <dd id="ClickHouse.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> <dd id="ClickHouse.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="ClickHouse.Generator.likeany_sql" class="function"><a href="../generator.html#Generator.likeany_sql">likeany_sql</a></dd> <dd id="ClickHouse.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> <dd id="ClickHouse.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> <dd id="ClickHouse.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> |