blob: f40d98aaadbff65bd294cabedf39734a0b4078a3 [file] [log] [blame]
import{_ as e,o as s,c as n,e as t}from"./app-Bx8hKGcu.js";const a={},i=t(`<h1 id="string-processing" tabindex="-1"><a class="header-anchor" href="#string-processing"><span>String Processing</span></a></h1><h2 id="string-contains" tabindex="-1"><a class="header-anchor" href="#string-contains"><span>STRING_CONTAINS</span></a></h2><h3 id="function-introduction" tabindex="-1"><a class="header-anchor" href="#function-introduction"><span>Function introduction</span></a></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"><span>Usage example</span></a></h3><div class="language-sql line-numbers-mode" data-ext="sql" data-title="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" data-title="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"><span>STRING_MATCHES</span></a></h2><h3 id="function-introduction-1" tabindex="-1"><a class="header-anchor" href="#function-introduction-1"><span>Function introduction</span></a></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"><span>Usage example</span></a></h3><div class="language-sql line-numbers-mode" data-ext="sql" data-title="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" data-title="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"><span>Length</span></a></h2><h3 id="usage" tabindex="-1"><a class="header-anchor" href="#usage"><span>Usage</span></a></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"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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"><span>Locate</span></a></h2><h3 id="usage-1" tabindex="-1"><a class="header-anchor" href="#usage-1"><span>Usage</span></a></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"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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" data-title="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" data-title="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"><span>StartsWith</span></a></h2><h3 id="usage-2" tabindex="-1"><a class="header-anchor" href="#usage-2"><span>Usage</span></a></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"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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"><span>EndsWith</span></a></h2><h3 id="usage-3" tabindex="-1"><a class="header-anchor" href="#usage-3"><span>Usage</span></a></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"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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"><span>Concat</span></a></h2><h3 id="usage-4" tabindex="-1"><a class="header-anchor" href="#usage-4"><span>Usage</span></a></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<br><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"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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" data-title="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" data-title="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"><span>Substr</span></a></h2><h3 id="usage-5" tabindex="-1"><a class="header-anchor" href="#usage-5"><span>Usage</span></a></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"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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"><span>Upper</span></a></h2><h3 id="usage-6" tabindex="-1"><a class="header-anchor" href="#usage-6"><span>Usage</span></a></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"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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"><span>Lower</span></a></h2><h3 id="usage-7" tabindex="-1"><a class="header-anchor" href="#usage-7"><span>Usage</span></a></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"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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"><span>Trim</span></a></h2><h3 id="usage-8" tabindex="-1"><a class="header-anchor" href="#usage-8"><span>Usage</span></a></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"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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"><span>StrCmp</span></a></h2><h3 id="usage-9" tabindex="-1"><a class="header-anchor" href="#usage-9"><span>Usage</span></a></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,<br> 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"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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"><span>StrReplace</span></a></h2><h3 id="usage-10" tabindex="-1"><a class="header-anchor" href="#usage-10"><span>Usage</span></a></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,<br> 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"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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" data-title="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" data-title="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"><span>RegexMatch</span></a></h2><h3 id="usage-11" tabindex="-1"><a class="header-anchor" href="#usage-11"><span>Usage</span></a></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,<br> 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.<br> Reference to java.util.regex, group 0 is the whole pattern and<br> the next ones are numbered with the appearance order of left parentheses.<br> 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"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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"><span>RegexReplace</span></a></h2><h3 id="usage-12" tabindex="-1"><a class="header-anchor" href="#usage-12"><span>Usage</span></a></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,<br> 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,<br> 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"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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"><span>RegexSplit</span></a></h2><h3 id="usage-13" tabindex="-1"><a class="header-anchor" href="#usage-13"><span>Usage</span></a></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.<br> 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.<br> It should be an integer no less than -1, default to -1 which means the length of the result array is returned<br> 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,<br> no result are returned for that record.</p><h3 id="examples-13" tabindex="-1"><a class="header-anchor" href="#examples-13"><span>Examples</span></a></h3><p>Input series:</p><div class="language-text line-numbers-mode" data-ext="text" data-title="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" data-title="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" data-title="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" data-title="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" data-title="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),l=[i];function r(o,d){return s(),n("div",null,l)}const p=e(a,[["render",r],["__file","String.html.vue"]]),c=JSON.parse('{"path":"/UserGuide/V1.1.x/Operators-Functions/String.html","title":"String Processing","lang":"en-US","frontmatter":{"description":"String Processing STRING_CONTAINS Function introduction This function checks whether the substring s exists in the string Function name: STRING_CONTAINS Input sequence: Only a s...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://iotdb.apache.org/zh/UserGuide/V1.1.x/Operators-Functions/String.html"}],["meta",{"property":"og:url","content":"https://iotdb.apache.org/UserGuide/V1.1.x/Operators-Functions/String.html"}],["meta",{"property":"og:site_name","content":"IoTDB Website"}],["meta",{"property":"og:title","content":"String Processing"}],["meta",{"property":"og:description","content":"String Processing STRING_CONTAINS Function introduction This function checks whether the substring s exists in the string Function name: STRING_CONTAINS Input sequence: Only a s..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"en-US"}],["meta",{"property":"og:locale:alternate","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2023-07-10T03:11:17.000Z"}],["meta",{"property":"article:modified_time","content":"2023-07-10T03:11:17.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"String Processing\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2023-07-10T03:11:17.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":2,"title":"STRING_CONTAINS","slug":"string-contains","link":"#string-contains","children":[{"level":3,"title":"Function introduction","slug":"function-introduction","link":"#function-introduction","children":[]},{"level":3,"title":"Usage example","slug":"usage-example","link":"#usage-example","children":[]}]},{"level":2,"title":"STRING_MATCHES","slug":"string-matches","link":"#string-matches","children":[{"level":3,"title":"Function introduction","slug":"function-introduction-1","link":"#function-introduction-1","children":[]},{"level":3,"title":"Usage example","slug":"usage-example-1","link":"#usage-example-1","children":[]}]},{"level":2,"title":"Length","slug":"length","link":"#length","children":[{"level":3,"title":"Usage","slug":"usage","link":"#usage","children":[]},{"level":3,"title":"Examples","slug":"examples","link":"#examples","children":[]}]},{"level":2,"title":"Locate","slug":"locate","link":"#locate","children":[{"level":3,"title":"Usage","slug":"usage-1","link":"#usage-1","children":[]},{"level":3,"title":"Examples","slug":"examples-1","link":"#examples-1","children":[]}]},{"level":2,"title":"StartsWith","slug":"startswith","link":"#startswith","children":[{"level":3,"title":"Usage","slug":"usage-2","link":"#usage-2","children":[]},{"level":3,"title":"Examples","slug":"examples-2","link":"#examples-2","children":[]}]},{"level":2,"title":"EndsWith","slug":"endswith","link":"#endswith","children":[{"level":3,"title":"Usage","slug":"usage-3","link":"#usage-3","children":[]},{"level":3,"title":"Examples","slug":"examples-3","link":"#examples-3","children":[]}]},{"level":2,"title":"Concat","slug":"concat","link":"#concat","children":[{"level":3,"title":"Usage","slug":"usage-4","link":"#usage-4","children":[]},{"level":3,"title":"Examples","slug":"examples-4","link":"#examples-4","children":[]}]},{"level":2,"title":"Substr","slug":"substr","link":"#substr","children":[{"level":3,"title":"Usage","slug":"usage-5","link":"#usage-5","children":[]},{"level":3,"title":"Examples","slug":"examples-5","link":"#examples-5","children":[]}]},{"level":2,"title":"Upper","slug":"upper","link":"#upper","children":[{"level":3,"title":"Usage","slug":"usage-6","link":"#usage-6","children":[]},{"level":3,"title":"Examples","slug":"examples-6","link":"#examples-6","children":[]}]},{"level":2,"title":"Lower","slug":"lower","link":"#lower","children":[{"level":3,"title":"Usage","slug":"usage-7","link":"#usage-7","children":[]},{"level":3,"title":"Examples","slug":"examples-7","link":"#examples-7","children":[]}]},{"level":2,"title":"Trim","slug":"trim","link":"#trim","children":[{"level":3,"title":"Usage","slug":"usage-8","link":"#usage-8","children":[]},{"level":3,"title":"Examples","slug":"examples-8","link":"#examples-8","children":[]}]},{"level":2,"title":"StrCmp","slug":"strcmp","link":"#strcmp","children":[{"level":3,"title":"Usage","slug":"usage-9","link":"#usage-9","children":[]},{"level":3,"title":"Examples","slug":"examples-9","link":"#examples-9","children":[]}]},{"level":2,"title":"StrReplace","slug":"strreplace","link":"#strreplace","children":[{"level":3,"title":"Usage","slug":"usage-10","link":"#usage-10","children":[]},{"level":3,"title":"Examples","slug":"examples-10","link":"#examples-10","children":[]}]},{"level":2,"title":"RegexMatch","slug":"regexmatch","link":"#regexmatch","children":[{"level":3,"title":"Usage","slug":"usage-11","link":"#usage-11","children":[]},{"level":3,"title":"Examples","slug":"examples-11","link":"#examples-11","children":[]}]},{"level":2,"title":"RegexReplace","slug":"regexreplace","link":"#regexreplace","children":[{"level":3,"title":"Usage","slug":"usage-12","link":"#usage-12","children":[]},{"level":3,"title":"Examples","slug":"examples-12","link":"#examples-12","children":[]}]},{"level":2,"title":"RegexSplit","slug":"regexsplit","link":"#regexsplit","children":[{"level":3,"title":"Usage","slug":"usage-13","link":"#usage-13","children":[]},{"level":3,"title":"Examples","slug":"examples-13","link":"#examples-13","children":[]}]}],"git":{"createdTime":1688958677000,"updatedTime":1688958677000,"contributors":[{"name":"CritasWang","email":"critas@outlook.com","commits":1}]},"readingTime":{"minutes":9.84,"words":2953},"filePathRelative":"UserGuide/V1.1.x/Operators-Functions/String.md","localizedDate":"July 10, 2023","autoDesc":true}');export{p as comp,c as data};