blob: fbb0d98ae300938e3c71b1933dd1a20ef3ec67b9 [file] [log] [blame]
import{_ as e,O as s,P as n,ah as a,aW as t}from"./framework-62ad666a.js";const i={},r=t(`<h1 id="string-processing" tabindex="-1"><a class="header-anchor" href="#string-processing" aria-hidden="true">#</a> String Processing</h1><h2 id="string-contains" tabindex="-1"><a class="header-anchor" href="#string-contains" aria-hidden="true">#</a> STRING_CONTAINS</h2><h3 id="function-introduction" tabindex="-1"><a class="header-anchor" href="#function-introduction" aria-hidden="true">#</a> Function introduction</h3><p>This function checks whether the substring <code>s</code> exists in the string</p><p><strong>Function name:</strong> STRING_CONTAINS</p><p><strong>Input sequence:</strong> Only a single input sequence is supported, the type is TEXT.</p><p><strong>parameter:</strong></p><ul><li><code>s</code>: The string to search for.</li></ul><p><strong>Output Sequence:</strong> Output a single sequence, the type is BOOLEAN.</p><h3 id="usage-example" tabindex="-1"><a class="header-anchor" href="#usage-example" aria-hidden="true">#</a> Usage example</h3><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s1<span class="token punctuation">,</span> string_contains<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> <span class="token string">&#39;s&#39;</span><span class="token operator">=</span><span class="token string">&#39;warn&#39;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d4<span class="token punctuation">;</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+-------------------------------------------+
| Time|root.sg1.d4.s1|string_contains(root.sg1.d4.s1, &quot;s&quot;=&quot;warn&quot;)|
+-----------------------------+--------------+-------------------------------------------+
|1970-01-01T08:00:00.001+08:00| warn:-8721| true|
|1970-01-01T08:00:00.002+08:00| error:-37229| false|
|1970-01-01T08:00:00.003+08:00| warn:1731| true|
+-----------------------------+--------------+-------------------------------------------+
Total line number = 3
It costs 0.007s
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="string-matches" tabindex="-1"><a class="header-anchor" href="#string-matches" aria-hidden="true">#</a> STRING_MATCHES</h2><h3 id="function-introduction-1" tabindex="-1"><a class="header-anchor" href="#function-introduction-1" aria-hidden="true">#</a> Function introduction</h3><p>This function judges whether a string can be matched by the regular expression <code>regex</code>.</p><p><strong>Function name:</strong> STRING_MATCHES</p><p><strong>Input sequence:</strong> Only a single input sequence is supported, the type is TEXT.</p><p><strong>parameter:</strong></p><ul><li><code>regex</code>: Java standard library-style regular expressions.</li></ul><p><strong>Output Sequence:</strong> Output a single sequence, the type is BOOLEAN.</p><h3 id="usage-example-1" tabindex="-1"><a class="header-anchor" href="#usage-example-1" aria-hidden="true">#</a> Usage example</h3><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s1<span class="token punctuation">,</span> string_matches<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> <span class="token string">&#39;regex&#39;</span><span class="token operator">=</span><span class="token string">&#39;[^\\\\s]+37229&#39;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d4<span class="token punctuation">;</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+------------------------------------------------------+
| Time|root.sg1.d4.s1|string_matches(root.sg1.d4.s1, &quot;regex&quot;=&quot;[^\\\\s]+37229&quot;)|
+-----------------------------+--------------+------------------------------------------------------+
|1970-01-01T08:00:00.001+08:00| warn:-8721| false|
|1970-01-01T08:00:00.002+08:00| error:-37229| true|
|1970-01-01T08:00:00.003+08:00| warn:1731| false|
+-----------------------------+--------------+------------------------------------------------------+
Total line number = 3
It costs 0.007s
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="length" tabindex="-1"><a class="header-anchor" href="#length" aria-hidden="true">#</a> Length</h2><h3 id="usage" tabindex="-1"><a class="header-anchor" href="#usage" aria-hidden="true">#</a> Usage</h3><p>The function is used to get the length of input series.</p><p><strong>Name:</strong> LENGTH</p><p><strong>Input Series:</strong> Only support a single input series. The data type is TEXT.</p><p><strong>Output Series:</strong> Output a single series. The type is INT32.</p><p><strong>Note:</strong> Returns NULL if input is NULL.</p><h3 id="examples" tabindex="-1"><a class="header-anchor" href="#examples" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+
| Time|root.sg1.d1.s1|
+-----------------------------+--------------+
|1970-01-01T08:00:00.001+08:00| 1test1|
|1970-01-01T08:00:00.002+08:00| 22test22|
+-----------------------------+--------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s1<span class="token punctuation">,</span> length<span class="token punctuation">(</span>s1<span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+----------------------+
| Time|root.sg1.d1.s1|length(root.sg1.d1.s1)|
+-----------------------------+--------------+----------------------+
|1970-01-01T08:00:00.001+08:00| 1test1| 6|
|1970-01-01T08:00:00.002+08:00| 22test22| 8|
+-----------------------------+--------------+----------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="locate" tabindex="-1"><a class="header-anchor" href="#locate" aria-hidden="true">#</a> Locate</h2><h3 id="usage-1" tabindex="-1"><a class="header-anchor" href="#usage-1" aria-hidden="true">#</a> Usage</h3><p>The function is used to get the position of the first occurrence of substring <code>target</code> in input series. Returns -1 if there are no <code>target</code> in input.</p><p><strong>Name:</strong> LOCATE</p><p><strong>Input Series:</strong> Only support a single input series. The data type is TEXT.</p><p><strong>Parameter:</strong></p><ul><li><code>target</code>: The substring to be located.</li><li><code>reverse</code>: Indicates whether reverse locate is required. The default value is <code>false</code>, means left-to-right locate.</li></ul><p><strong>Output Series:</strong> Output a single series. The type is INT32.</p><p><strong>Note:</strong> The index begins from 0.</p><h3 id="examples-1" tabindex="-1"><a class="header-anchor" href="#examples-1" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+
| Time|root.sg1.d1.s1|
+-----------------------------+--------------+
|1970-01-01T08:00:00.001+08:00| 1test1|
|1970-01-01T08:00:00.002+08:00| 22test22|
+-----------------------------+--------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s1<span class="token punctuation">,</span> locate<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> <span class="token string">&quot;target&quot;</span><span class="token operator">=</span><span class="token string">&quot;1&quot;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+------------------------------------+
| Time|root.sg1.d1.s1|locate(root.sg1.d1.s1, &quot;target&quot;=&quot;1&quot;)|
+-----------------------------+--------------+------------------------------------+
|1970-01-01T08:00:00.001+08:00| 1test1| 0|
|1970-01-01T08:00:00.002+08:00| 22test22| -1|
+-----------------------------+--------------+------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Another SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s1<span class="token punctuation">,</span> locate<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> <span class="token string">&quot;target&quot;</span><span class="token operator">=</span><span class="token string">&quot;1&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;reverse&quot;</span><span class="token operator">=</span><span class="token string">&quot;true&quot;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+------------------------------------------------------+
| Time|root.sg1.d1.s1|locate(root.sg1.d1.s1, &quot;target&quot;=&quot;1&quot;, &quot;reverse&quot;=&quot;true&quot;)|
+-----------------------------+--------------+------------------------------------------------------+
|1970-01-01T08:00:00.001+08:00| 1test1| 5|
|1970-01-01T08:00:00.002+08:00| 22test22| -1|
+-----------------------------+--------------+------------------------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="startswith" tabindex="-1"><a class="header-anchor" href="#startswith" aria-hidden="true">#</a> StartsWith</h2><h3 id="usage-2" tabindex="-1"><a class="header-anchor" href="#usage-2" aria-hidden="true">#</a> Usage</h3><p>The function is used to check whether input series starts with the specified prefix.</p><p><strong>Name:</strong> STARTSWITH</p><p><strong>Input Series:</strong> Only support a single input series. The data type is TEXT.</p><p><strong>Parameter:</strong></p><ul><li><code>target</code>: The prefix to be checked.</li></ul><p><strong>Output Series:</strong> Output a single series. The type is BOOLEAN.</p><p><strong>Note:</strong> Returns NULL if input is NULL.</p><h3 id="examples-2" tabindex="-1"><a class="header-anchor" href="#examples-2" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+
| Time|root.sg1.d1.s1|
+-----------------------------+--------------+
|1970-01-01T08:00:00.001+08:00| 1test1|
|1970-01-01T08:00:00.002+08:00| 22test22|
+-----------------------------+--------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s1<span class="token punctuation">,</span> startswith<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> <span class="token string">&quot;target&quot;</span><span class="token operator">=</span><span class="token string">&quot;1&quot;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+----------------------------------------+
| Time|root.sg1.d1.s1|startswith(root.sg1.d1.s1, &quot;target&quot;=&quot;1&quot;)|
+-----------------------------+--------------+----------------------------------------+
|1970-01-01T08:00:00.001+08:00| 1test1| true|
|1970-01-01T08:00:00.002+08:00| 22test22| false|
+-----------------------------+--------------+----------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="endswith" tabindex="-1"><a class="header-anchor" href="#endswith" aria-hidden="true">#</a> EndsWith</h2><h3 id="usage-3" tabindex="-1"><a class="header-anchor" href="#usage-3" aria-hidden="true">#</a> Usage</h3><p>The function is used to check whether input series ends with the specified suffix.</p><p><strong>Name:</strong> ENDSWITH</p><p><strong>Input Series:</strong> Only support a single input series. The data type is TEXT.</p><p><strong>Parameter:</strong></p><ul><li><code>target</code>: The suffix to be checked.</li></ul><p><strong>Output Series:</strong> Output a single series. The type is BOOLEAN.</p><p><strong>Note:</strong> Returns NULL if input is NULL.</p><h3 id="examples-3" tabindex="-1"><a class="header-anchor" href="#examples-3" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+
| Time|root.sg1.d1.s1|
+-----------------------------+--------------+
|1970-01-01T08:00:00.001+08:00| 1test1|
|1970-01-01T08:00:00.002+08:00| 22test22|
+-----------------------------+--------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s1<span class="token punctuation">,</span> endswith<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> <span class="token string">&quot;target&quot;</span><span class="token operator">=</span><span class="token string">&quot;1&quot;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+--------------------------------------+
| Time|root.sg1.d1.s1|endswith(root.sg1.d1.s1, &quot;target&quot;=&quot;1&quot;)|
+-----------------------------+--------------+--------------------------------------+
|1970-01-01T08:00:00.001+08:00| 1test1| true|
|1970-01-01T08:00:00.002+08:00| 22test22| false|
+-----------------------------+--------------+--------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="concat" tabindex="-1"><a class="header-anchor" href="#concat" aria-hidden="true">#</a> Concat</h2><h3 id="usage-4" tabindex="-1"><a class="header-anchor" href="#usage-4" aria-hidden="true">#</a> Usage</h3><p>The function is used to concat input series and target strings.</p><p><strong>Name:</strong> CONCAT</p><p><strong>Input Series:</strong> At least one input series. The data type is TEXT.</p><p><strong>Parameter:</strong></p><ul><li><code>targets</code>: A series of K-V, key needs to start with <code>target</code> and be not duplicated, value is the string you want to concat.</li><li><code>series_behind</code>: Indicates whether series behind targets. The default value is <code>false</code>.</li></ul><p><strong>Output Series:</strong> Output a single series. The type is TEXT.</p><p><strong>Note:</strong></p><ul><li>If value of input series is NULL, it will be skipped.</li><li>We can only concat input series and <code>targets</code> separately. <code>concat(s1, &quot;target1&quot;=&quot;IoT&quot;, s2, &quot;target2&quot;=&quot;DB&quot;)</code> and <code>concat(s1, s2, &quot;target1&quot;=&quot;IoT&quot;, &quot;target2&quot;=&quot;DB&quot;)</code> gives the same result.</li></ul><h3 id="examples-4" tabindex="-1"><a class="header-anchor" href="#examples-4" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+--------------+
| Time|root.sg1.d1.s1|root.sg1.d1.s2|
+-----------------------------+--------------+--------------+
|1970-01-01T08:00:00.001+08:00| 1test1| null|
|1970-01-01T08:00:00.002+08:00| 22test22| 2222test|
+-----------------------------+--------------+--------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s1<span class="token punctuation">,</span> s2<span class="token punctuation">,</span> concat<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> s2<span class="token punctuation">,</span> <span class="token string">&quot;target1&quot;</span><span class="token operator">=</span><span class="token string">&quot;IoT&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;target2&quot;</span><span class="token operator">=</span><span class="token string">&quot;DB&quot;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+--------------+-----------------------------------------------------------------------+
| Time|root.sg1.d1.s1|root.sg1.d1.s2|concat(root.sg1.d1.s1, root.sg1.d1.s2, &quot;target1&quot;=&quot;IoT&quot;, &quot;target2&quot;=&quot;DB&quot;)|
+-----------------------------+--------------+--------------+-----------------------------------------------------------------------+
|1970-01-01T08:00:00.001+08:00| 1test1| null| 1test1IoTDB|
|1970-01-01T08:00:00.002+08:00| 22test22| 2222test| 22test222222testIoTDB|
+-----------------------------+--------------+--------------+-----------------------------------------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Another SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s1<span class="token punctuation">,</span> s2<span class="token punctuation">,</span> concat<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> s2<span class="token punctuation">,</span> <span class="token string">&quot;target1&quot;</span><span class="token operator">=</span><span class="token string">&quot;IoT&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;target2&quot;</span><span class="token operator">=</span><span class="token string">&quot;DB&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;series_behind&quot;</span><span class="token operator">=</span><span class="token string">&quot;true&quot;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+--------------+-----------------------------------------------------------------------------------------------+
| Time|root.sg1.d1.s1|root.sg1.d1.s2|concat(root.sg1.d1.s1, root.sg1.d1.s2, &quot;target1&quot;=&quot;IoT&quot;, &quot;target2&quot;=&quot;DB&quot;, &quot;series_behind&quot;=&quot;true&quot;)|
+-----------------------------+--------------+--------------+-----------------------------------------------------------------------------------------------+
|1970-01-01T08:00:00.001+08:00| 1test1| null| IoTDB1test1|
|1970-01-01T08:00:00.002+08:00| 22test22| 2222test| IoTDB22test222222test|
+-----------------------------+--------------+--------------+-----------------------------------------------------------------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="substr" tabindex="-1"><a class="header-anchor" href="#substr" aria-hidden="true">#</a> Substr</h2><h3 id="usage-5" tabindex="-1"><a class="header-anchor" href="#usage-5" aria-hidden="true">#</a> Usage</h3><p>The function is used to get the substring <code>start</code> to <code>end - 1</code>.</p><p><strong>Name:</strong> SUBSTR</p><p><strong>Input Series:</strong> Only support a single input series. The data type is TEXT.</p><p><strong>Parameter:</strong></p><ul><li><code>start</code>: Indicates the start position of substring.</li><li><code>end</code>: Indicates the end position of substring.</li></ul><p><strong>Output Series:</strong> Output a single series. The type is TEXT.</p><p><strong>Note:</strong> Returns NULL if input is NULL.</p><h3 id="examples-5" tabindex="-1"><a class="header-anchor" href="#examples-5" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+
| Time|root.sg1.d1.s1|
+-----------------------------+--------------+
|1970-01-01T08:00:00.001+08:00| 1test1|
|1970-01-01T08:00:00.002+08:00| 22test22|
+-----------------------------+--------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s1<span class="token punctuation">,</span> substr<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> <span class="token string">&quot;start&quot;</span><span class="token operator">=</span><span class="token string">&quot;0&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;end&quot;</span><span class="token operator">=</span><span class="token string">&quot;2&quot;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+----------------------------------------------+
| Time|root.sg1.d1.s1|substr(root.sg1.d1.s1, &quot;start&quot;=&quot;0&quot;, &quot;end&quot;=&quot;2&quot;)|
+-----------------------------+--------------+----------------------------------------------+
|1970-01-01T08:00:00.001+08:00| 1test1| 1t|
|1970-01-01T08:00:00.002+08:00| 22test22| 22|
+-----------------------------+--------------+----------------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="upper" tabindex="-1"><a class="header-anchor" href="#upper" aria-hidden="true">#</a> Upper</h2><h3 id="usage-6" tabindex="-1"><a class="header-anchor" href="#usage-6" aria-hidden="true">#</a> Usage</h3><p>The function is used to get the string of input series with all characters changed to uppercase.</p><p><strong>Name:</strong> UPPER</p><p><strong>Input Series:</strong> Only support a single input series. The data type is TEXT.</p><p><strong>Output Series:</strong> Output a single series. The type is TEXT.</p><p><strong>Note:</strong> Returns NULL if input is NULL.</p><h3 id="examples-6" tabindex="-1"><a class="header-anchor" href="#examples-6" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+
| Time|root.sg1.d1.s1|
+-----------------------------+--------------+
|1970-01-01T08:00:00.001+08:00| 1test1|
|1970-01-01T08:00:00.002+08:00| 22test22|
+-----------------------------+--------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s1<span class="token punctuation">,</span> upper<span class="token punctuation">(</span>s1<span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+---------------------+
| Time|root.sg1.d1.s1|upper(root.sg1.d1.s1)|
+-----------------------------+--------------+---------------------+
|1970-01-01T08:00:00.001+08:00| 1test1| 1TEST1|
|1970-01-01T08:00:00.002+08:00| 22test22| 22TEST22|
+-----------------------------+--------------+---------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="lower" tabindex="-1"><a class="header-anchor" href="#lower" aria-hidden="true">#</a> Lower</h2><h3 id="usage-7" tabindex="-1"><a class="header-anchor" href="#usage-7" aria-hidden="true">#</a> Usage</h3><p>The function is used to get the string of input series with all characters changed to lowercase.</p><p><strong>Name:</strong> LOWER</p><p><strong>Input Series:</strong> Only support a single input series. The data type is TEXT.</p><p><strong>Output Series:</strong> Output a single series. The type is TEXT.</p><p><strong>Note:</strong> Returns NULL if input is NULL.</p><h3 id="examples-7" tabindex="-1"><a class="header-anchor" href="#examples-7" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+
| Time|root.sg1.d1.s1|
+-----------------------------+--------------+
|1970-01-01T08:00:00.001+08:00| 1TEST1|
|1970-01-01T08:00:00.002+08:00| 22TEST22|
+-----------------------------+--------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s1<span class="token punctuation">,</span> lower<span class="token punctuation">(</span>s1<span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+---------------------+
| Time|root.sg1.d1.s1|lower(root.sg1.d1.s1)|
+-----------------------------+--------------+---------------------+
|1970-01-01T08:00:00.001+08:00| 1TEST1| 1test1|
|1970-01-01T08:00:00.002+08:00| 22TEST22| 22test22|
+-----------------------------+--------------+---------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="trim" tabindex="-1"><a class="header-anchor" href="#trim" aria-hidden="true">#</a> Trim</h2><h3 id="usage-8" tabindex="-1"><a class="header-anchor" href="#usage-8" aria-hidden="true">#</a> Usage</h3><p>The function is used to get the string whose value is same to input series, with all leading and trailing space removed.</p><p><strong>Name:</strong> TRIM</p><p><strong>Input Series:</strong> Only support a single input series. The data type is TEXT.</p><p><strong>Output Series:</strong> Output a single series. The type is TEXT.</p><p><strong>Note:</strong> Returns NULL if input is NULL.</p><h3 id="examples-8" tabindex="-1"><a class="header-anchor" href="#examples-8" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+
| Time|root.sg1.d1.s3|
+-----------------------------+--------------+
|1970-01-01T08:00:00.002+08:00| 3querytest3|
|1970-01-01T08:00:00.003+08:00| 3querytest3 |
+-----------------------------+--------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s3<span class="token punctuation">,</span> trim<span class="token punctuation">(</span>s3<span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+--------------------+
| Time|root.sg1.d1.s3|trim(root.sg1.d1.s3)|
+-----------------------------+--------------+--------------------+
|1970-01-01T08:00:00.002+08:00| 3querytest3| 3querytest3|
|1970-01-01T08:00:00.003+08:00| 3querytest3 | 3querytest3|
+-----------------------------+--------------+--------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="strcmp" tabindex="-1"><a class="header-anchor" href="#strcmp" aria-hidden="true">#</a> StrCmp</h2><h3 id="usage-9" tabindex="-1"><a class="header-anchor" href="#usage-9" aria-hidden="true">#</a> Usage</h3><p>The function is used to get the compare result of two input series. Returns <code>0</code> if series value are the same, a <code>negative integer</code> if value of series1 is smaller than series2, a <code>positive integer</code> if value of series1 is more than series2.</p><p><strong>Name:</strong> StrCmp</p><p><strong>Input Series:</strong> Support two input series. Data types are all the TEXT.</p><p><strong>Output Series:</strong> Output a single series. The type is INT32.</p><p><strong>Note:</strong> Returns NULL either series value is NULL.</p><h3 id="examples-9" tabindex="-1"><a class="header-anchor" href="#examples-9" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+--------------+
| Time|root.sg1.d1.s1|root.sg1.d1.s2|
+-----------------------------+--------------+--------------+
|1970-01-01T08:00:00.001+08:00| 1test1| null|
|1970-01-01T08:00:00.002+08:00| 22test22| 2222test|
+-----------------------------+--------------+--------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> s1<span class="token punctuation">,</span> s2<span class="token punctuation">,</span> strcmp<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> s2<span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------+--------------+--------------------------------------+
| Time|root.sg1.d1.s1|root.sg1.d1.s2|strcmp(root.sg1.d1.s1, root.sg1.d1.s2)|
+-----------------------------+--------------+--------------+--------------------------------------+
|1970-01-01T08:00:00.001+08:00| 1test1| null| null|
|1970-01-01T08:00:00.002+08:00| 22test22| 2222test| 66|
+-----------------------------+--------------+--------------+--------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="strreplace" tabindex="-1"><a class="header-anchor" href="#strreplace" aria-hidden="true">#</a> StrReplace</h2><h3 id="usage-10" tabindex="-1"><a class="header-anchor" href="#usage-10" aria-hidden="true">#</a> Usage</h3><p><strong>This is not a built-in function and can only be used after registering the library-udf.</strong> The function is used to replace the specific substring with given string.</p><p><strong>Name:</strong> STRREPLACE</p><p><strong>Input Series:</strong> Only support a single input series. The data type is TEXT.</p><p><strong>Parameter:</strong></p><ul><li><code>target</code>: The target substring to be replaced.</li><li><code>replace</code>: The string to be put on.</li><li><code>limit</code>: The number of matches to be replaced which should be an integer no less than -1, default to -1 which means all matches will be replaced.</li><li><code>offset</code>: The number of matches to be skipped, which means the first <code>offset</code> matches will not be replaced, default to 0.</li><li><code>reverse</code>: Whether to count all the matches reversely, default to &#39;false&#39;.</li></ul><p><strong>Output Series:</strong> Output a single series. The type is TEXT.</p><h3 id="examples-10" tabindex="-1"><a class="header-anchor" href="#examples-10" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+---------------+
| Time|root.test.d1.s1|
+-----------------------------+---------------+
|2021-01-01T00:00:01.000+08:00| A,B,A+,B-|
|2021-01-01T00:00:02.000+08:00| A,A+,A,B+|
|2021-01-01T00:00:03.000+08:00| B+,B,B|
|2021-01-01T00:00:04.000+08:00| A+,A,A+,A|
|2021-01-01T00:00:05.000+08:00| A,B-,B,B|
+-----------------------------+---------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> strreplace<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> <span class="token string">&quot;target&quot;</span><span class="token operator">=</span><span class="token string">&quot;,&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;replace&quot;</span><span class="token operator">=</span><span class="token string">&quot;/&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;limit&quot;</span><span class="token operator">=</span><span class="token string">&quot;2&quot;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>test<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+-----------------------------------------+
| Time|strreplace(root.test.d1.s1, &quot;target&quot;=&quot;,&quot;,|
| | &quot;replace&quot;=&quot;/&quot;, &quot;limit&quot;=&quot;2&quot;)|
+-----------------------------+-----------------------------------------+
|2021-01-01T00:00:01.000+08:00| A/B/A+,B-|
|2021-01-01T00:00:02.000+08:00| A/A+/A,B+|
|2021-01-01T00:00:03.000+08:00| B+/B/B|
|2021-01-01T00:00:04.000+08:00| A+/A/A+,A|
|2021-01-01T00:00:05.000+08:00| A/B-/B,B|
+-----------------------------+-----------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Another SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> strreplace<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> <span class="token string">&quot;target&quot;</span><span class="token operator">=</span><span class="token string">&quot;,&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;replace&quot;</span><span class="token operator">=</span><span class="token string">&quot;/&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;limit&quot;</span><span class="token operator">=</span><span class="token string">&quot;1&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;offset&quot;</span><span class="token operator">=</span><span class="token string">&quot;1&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;reverse&quot;</span><span class="token operator">=</span><span class="token string">&quot;true&quot;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>test<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+-----------------------------------------------------+
| Time|strreplace(root.test.d1.s1, &quot;target&quot;=&quot;,&quot;, &quot;replace&quot;= |
| | &quot;|&quot;, &quot;limit&quot;=&quot;1&quot;, &quot;offset&quot;=&quot;1&quot;, &quot;reverse&quot;=&quot;true&quot;)|
+-----------------------------+-----------------------------------------------------+
|2021-01-01T00:00:01.000+08:00| A,B/A+,B-|
|2021-01-01T00:00:02.000+08:00| A,A+/A,B+|
|2021-01-01T00:00:03.000+08:00| B+/B,B|
|2021-01-01T00:00:04.000+08:00| A+,A/A+,A|
|2021-01-01T00:00:05.000+08:00| A,B-/B,B|
+-----------------------------+-----------------------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="regexmatch" tabindex="-1"><a class="header-anchor" href="#regexmatch" aria-hidden="true">#</a> RegexMatch</h2><h3 id="usage-11" tabindex="-1"><a class="header-anchor" href="#usage-11" aria-hidden="true">#</a> Usage</h3><p><strong>This is not a built-in function and can only be used after registering the library-udf.</strong> The function is used to fetch matched contents from text with given regular expression.</p><p><strong>Name:</strong> REGEXMATCH</p><p><strong>Input Series:</strong> Only support a single input series. The data type is TEXT.</p><p><strong>Parameter:</strong></p><ul><li><code>regex</code>: The regular expression to match in the text. All grammars supported by Java are acceptable, for example, <code>\\d+\\.\\d+\\.\\d+\\.\\d+</code> is expected to match any IPv4 addresses.</li><li><code>group</code>: The wanted group index in the matched result. Reference to java.util.regex, group 0 is the whole pattern and the next ones are numbered with the appearance order of left parentheses. For example, the groups in <code>A(B(CD))</code> are: 0-<code>A(B(CD))</code>, 1-<code>B(CD)</code>, 2-<code>CD</code>.</li></ul><p><strong>Output Series:</strong> Output a single series. The type is TEXT.</p><p><strong>Note:</strong> Those points with null values or not matched with the given pattern will not return any results.</p><h3 id="examples-11" tabindex="-1"><a class="header-anchor" href="#examples-11" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+-------------------------------+
| Time| root.test.d1.s1|
+-----------------------------+-------------------------------+
|2021-01-01T00:00:01.000+08:00| [192.168.0.1] [SUCCESS]|
|2021-01-01T00:00:02.000+08:00| [192.168.0.24] [SUCCESS]|
|2021-01-01T00:00:03.000+08:00| [192.168.0.2] [FAIL]|
|2021-01-01T00:00:04.000+08:00| [192.168.0.5] [SUCCESS]|
|2021-01-01T00:00:05.000+08:00| [192.168.0.124] [SUCCESS]|
+-----------------------------+-------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> regexmatch<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> <span class="token string">&quot;regex&quot;</span><span class="token operator">=</span><span class="token string">&quot;\\d+\\.\\d+\\.\\d+\\.\\d+&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;group&quot;</span><span class="token operator">=</span><span class="token string">&quot;0&quot;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>test<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+----------------------------------------------------------------------+
| Time|regexmatch(root.test.d1.s1, &quot;regex&quot;=&quot;\\d+\\.\\d+\\.\\d+\\.\\d+&quot;, &quot;group&quot;=&quot;0&quot;)|
+-----------------------------+----------------------------------------------------------------------+
|2021-01-01T00:00:01.000+08:00| 192.168.0.1|
|2021-01-01T00:00:02.000+08:00| 192.168.0.24|
|2021-01-01T00:00:03.000+08:00| 192.168.0.2|
|2021-01-01T00:00:04.000+08:00| 192.168.0.5|
|2021-01-01T00:00:05.000+08:00| 192.168.0.124|
+-----------------------------+----------------------------------------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="regexreplace" tabindex="-1"><a class="header-anchor" href="#regexreplace" aria-hidden="true">#</a> RegexReplace</h2><h3 id="usage-12" tabindex="-1"><a class="header-anchor" href="#usage-12" aria-hidden="true">#</a> Usage</h3><p><strong>This is not a built-in function and can only be used after registering the library-udf.</strong> The function is used to replace the specific regular expression matches with given string.</p><p><strong>Name:</strong> REGEXREPLACE</p><p><strong>Input Series:</strong> Only support a single input series. The data type is TEXT.</p><p><strong>Parameter:</strong></p><ul><li><code>regex</code>: The target regular expression to be replaced. All grammars supported by Java are acceptable.</li><li><code>replace</code>: The string to be put on and back reference notes in Java is also supported, for example, &#39;$1&#39; refers to group 1 in the <code>regex</code> which will be filled with corresponding matched results.</li><li><code>limit</code>: The number of matches to be replaced which should be an integer no less than -1, default to -1 which means all matches will be replaced.</li><li><code>offset</code>: The number of matches to be skipped, which means the first <code>offset</code> matches will not be replaced, default to 0.</li><li><code>reverse</code>: Whether to count all the matches reversely, default to &#39;false&#39;.</li></ul><p><strong>Output Series:</strong> Output a single series. The type is TEXT.</p><h3 id="examples-12" tabindex="-1"><a class="header-anchor" href="#examples-12" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+-------------------------------+
| Time| root.test.d1.s1|
+-----------------------------+-------------------------------+
|2021-01-01T00:00:01.000+08:00| [192.168.0.1] [SUCCESS]|
|2021-01-01T00:00:02.000+08:00| [192.168.0.24] [SUCCESS]|
|2021-01-01T00:00:03.000+08:00| [192.168.0.2] [FAIL]|
|2021-01-01T00:00:04.000+08:00| [192.168.0.5] [SUCCESS]|
|2021-01-01T00:00:05.000+08:00| [192.168.0.124] [SUCCESS]|
+-----------------------------+-------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> regexreplace<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> <span class="token string">&quot;regex&quot;</span><span class="token operator">=</span><span class="token string">&quot;192\\.168\\.0\\.(\\d+)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;replace&quot;</span><span class="token operator">=</span><span class="token string">&quot;cluster-$1&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;limit&quot;</span><span class="token operator">=</span><span class="token string">&quot;1&quot;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>test<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+-----------------------------------------------------------+
| Time|regexreplace(root.test.d1.s1, &quot;regex&quot;=&quot;192\\.168\\.0\\.(\\d+)&quot;,|
| | &quot;replace&quot;=&quot;cluster-$1&quot;, &quot;limit&quot;=&quot;1&quot;)|
+-----------------------------+-----------------------------------------------------------+
|2021-01-01T00:00:01.000+08:00| [cluster-1] [SUCCESS]|
|2021-01-01T00:00:02.000+08:00| [cluster-24] [SUCCESS]|
|2021-01-01T00:00:03.000+08:00| [cluster-2] [FAIL]|
|2021-01-01T00:00:04.000+08:00| [cluster-5] [SUCCESS]|
|2021-01-01T00:00:05.000+08:00| [cluster-124] [SUCCESS]|
+-----------------------------+-----------------------------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="regexsplit" tabindex="-1"><a class="header-anchor" href="#regexsplit" aria-hidden="true">#</a> RegexSplit</h2><h3 id="usage-13" tabindex="-1"><a class="header-anchor" href="#usage-13" aria-hidden="true">#</a> Usage</h3><p><strong>This is not a built-in function and can only be used after registering the library-udf.</strong> The function is used to split text with given regular expression and return specific element.</p><p><strong>Name:</strong> REGEXSPLIT</p><p><strong>Input Series:</strong> Only support a single input series. The data type is TEXT.</p><p><strong>Parameter:</strong></p><ul><li><code>regex</code>: The regular expression used to split the text. All grammars supported by Java are acceptable, for example, <code>[&#39;&quot;]</code> is expected to match <code>&#39;</code> and <code>&quot;</code>.</li><li><code>index</code>: The wanted index of elements in the split result. It should be an integer no less than -1, default to -1 which means the length of the result array is returned and any non-negative integer is used to fetch the text of the specific index starting from 0.</li></ul><p><strong>Output Series:</strong> Output a single series. The type is INT32 when <code>index</code> is -1 and TEXT when it&#39;s an valid index.</p><p><strong>Note:</strong> When <code>index</code> is out of the range of the result array, for example <code>0,1,2</code> split with <code>,</code> and <code>index</code> is set to 3, no result are returned for that record.</p><h3 id="examples-13" tabindex="-1"><a class="header-anchor" href="#examples-13" aria-hidden="true">#</a> Examples</h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+---------------+
| Time|root.test.d1.s1|
+-----------------------------+---------------+
|2021-01-01T00:00:01.000+08:00| A,B,A+,B-|
|2021-01-01T00:00:02.000+08:00| A,A+,A,B+|
|2021-01-01T00:00:03.000+08:00| B+,B,B|
|2021-01-01T00:00:04.000+08:00| A+,A,A+,A|
|2021-01-01T00:00:05.000+08:00| A,B-,B,B|
+-----------------------------+---------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> regexsplit<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> <span class="token string">&quot;regex&quot;</span><span class="token operator">=</span><span class="token string">&quot;,&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;index&quot;</span><span class="token operator">=</span><span class="token string">&quot;-1&quot;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>test<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+------------------------------------------------------+
| Time|regexsplit(root.test.d1.s1, &quot;regex&quot;=&quot;,&quot;, &quot;index&quot;=&quot;-1&quot;)|
+-----------------------------+------------------------------------------------------+
|2021-01-01T00:00:01.000+08:00| 4|
|2021-01-01T00:00:02.000+08:00| 4|
|2021-01-01T00:00:03.000+08:00| 3|
|2021-01-01T00:00:04.000+08:00| 4|
|2021-01-01T00:00:05.000+08:00| 4|
+-----------------------------+------------------------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Another SQL for query:</p><p>SQL for query:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> regexsplit<span class="token punctuation">(</span>s1<span class="token punctuation">,</span> <span class="token string">&quot;regex&quot;</span><span class="token operator">=</span><span class="token string">&quot;,&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;index&quot;</span><span class="token operator">=</span><span class="token string">&quot;3&quot;</span><span class="token punctuation">)</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>test<span class="token punctuation">.</span>d1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Output series:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+-----------------------------------------------------+
| Time|regexsplit(root.test.d1.s1, &quot;regex&quot;=&quot;,&quot;, &quot;index&quot;=&quot;3&quot;)|
+-----------------------------+-----------------------------------------------------+
|2021-01-01T00:00:01.000+08:00| B-|
|2021-01-01T00:00:02.000+08:00| B+|
|2021-01-01T00:00:04.000+08:00| A|
|2021-01-01T00:00:05.000+08:00| B|
+-----------------------------+-----------------------------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,253);function o(d,l){return s(),n("div",null,[a(`
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
`),r])}const p=e(i,[["render",o],["__file","String.html.vue"]]);export{p as default};