blob: 8d1861ee20f7085a7dabc3b8d2410bfc34ff5c10 [file] [log] [blame]
Ian Maxon858061a2022-05-12 19:11:28 -07001<!DOCTYPE html>
2<!--
3 | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/aql/builtins.md at 2022-05-12
4 | Rendered using Apache Maven Fluido Skin 1.7
5-->
6<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7 <head>
8 <meta charset="UTF-8" />
9 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
10 <meta name="Date-Revision-yyyymmdd" content="20220512" />
11 <meta http-equiv="Content-Language" content="en" />
12 <title>AsterixDB &#x2013; Builtin Functions</title>
13 <link rel="stylesheet" href="../css/apache-maven-fluido-1.7.min.css" />
14 <link rel="stylesheet" href="../css/site.css" />
15 <link rel="stylesheet" href="../css/print.css" media="print" />
16 <script type="text/javascript" src="../js/apache-maven-fluido-1.7.min.js"></script>
17
18 </head>
19 <body class="topBarDisabled">
20 <div class="container-fluid">
21 <div id="banner">
22 <div class="pull-left"><a href=".././" id="bannerLeft"><img src="../images/asterixlogo.png" alt="AsterixDB"/></a></div>
23 <div class="pull-right"></div>
24 <div class="clear"><hr/></div>
25 </div>
26
27 <div id="breadcrumbs">
28 <ul class="breadcrumb">
29 <li id="publishDate">Last Published: 2022-05-12</li>
30 <li id="projectVersion" class="pull-right">Version: 0.9.8</li>
31 <li class="pull-right"><a href="../index.html" title="Documentation Home">Documentation Home</a></li>
32 </ul>
33 </div>
34 <div class="row-fluid">
35 <div id="leftColumn" class="span2">
36 <div class="well sidebar-nav">
37 <ul class="nav nav-list">
38 <li class="nav-header">Get Started - Installation</li>
39 <li><a href="../ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
40 <li><a href="../ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
41 <li><a href="../aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
42 <li class="nav-header">AsterixDB Primer</li>
43 <li><a href="../sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
44 <li class="nav-header">Data Model</li>
45 <li><a href="../datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
46 <li class="nav-header">Queries</li>
47 <li><a href="../sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
48 <li><a href="../SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
49 <li><a href="../sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
50 <li class="nav-header">API/SDK</li>
51 <li><a href="../api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
52 <li><a href="../csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
53 <li class="nav-header">Advanced Features</li>
54 <li><a href="../aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
55 <li><a href="../feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
56 <li><a href="../udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
57 <li><a href="../sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
58 <li><a href="../sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
59 <li><a href="../sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
60 <li><a href="../geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
61 <li><a href="../geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
62 <li><a href="../interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
63 <li><a href="../spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
64 <li><a href="../sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
65 <li class="nav-header">Deprecated</li>
66 <li><a href="../aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
67 <li><a href="../aql/manual.html" title="Queries: The Asterix Query Language (AQL)"><span class="none"></span>Queries: The Asterix Query Language (AQL)</a></li>
68 <li class="active"><a href="#"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
69</ul>
70 <hr />
71 <div id="poweredBy">
72 <div class="clear"></div>
73 <div class="clear"></div>
74 <div class="clear"></div>
75 <div class="clear"></div>
76<a href=".././" title="AsterixDB" class="builtBy"><img class="builtBy" alt="AsterixDB" src="../images/asterixlogo.png" /></a>
77 </div>
78 </div>
79 </div>
80 <div id="bodyColumn" class="span10" >
81<!--
82 ! Licensed to the Apache Software Foundation (ASF) under one
83 ! or more contributor license agreements. See the NOTICE file
84 ! distributed with this work for additional information
85 ! regarding copyright ownership. The ASF licenses this file
86 ! to you under the Apache License, Version 2.0 (the
87 ! "License"); you may not use this file except in compliance
88 ! with the License. You may obtain a copy of the License at
89 !
90 ! http://www.apache.org/licenses/LICENSE-2.0
91 !
92 ! Unless required by applicable law or agreed to in writing,
93 ! software distributed under the License is distributed on an
94 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
95 ! KIND, either express or implied. See the License for the
96 ! specific language governing permissions and limitations
97 ! under the License.
98 !-->
99<h1>Builtin Functions</h1><!--
100 ! Licensed to the Apache Software Foundation (ASF) under one
101 ! or more contributor license agreements. See the NOTICE file
102 ! distributed with this work for additional information
103 ! regarding copyright ownership. The ASF licenses this file
104 ! to you under the Apache License, Version 2.0 (the
105 ! "License"); you may not use this file except in compliance
106 ! with the License. You may obtain a copy of the License at
107 !
108 ! http://www.apache.org/licenses/LICENSE-2.0
109 !
110 ! Unless required by applicable law or agreed to in writing,
111 ! software distributed under the License is distributed on an
112 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
113 ! KIND, either express or implied. See the License for the
114 ! specific language governing permissions and limitations
115 ! under the License.
116 !-->
117
118<div class="section">
119<h2><a name="Table_of_Contents"></a><a name="toc" id="toc">Table of Contents</a></h2>
120<ul>
121
122<li><a href="#NumericFunctions">Numeric Functions</a></li>
123<li><a href="#StringFunctions">String Functions</a></li>
124<li><a href="#BinaryFunctions">Binary Functions</a></li>
125<li><a href="#SpatialFunctions">Spatial Functions</a></li>
126<li><a href="#SimilarityFunctions">Similarity Functions</a></li>
127<li><a href="#TokenizingFunctions">Tokenizing Functions</a></li>
128<li><a href="#TemporalFunctions">Temporal Functions</a></li>
129<li><a href="#ObjectFunctions">Object Functions</a></li>
130<li><a href="#AggregateFunctions">Aggregate Functions (Array Functions)</a></li>
131<li><a href="#ComparisonFunctions">Comparison Functions</a></li>
132<li><a href="#TypeFunctions">Type Functions</a></li>
133<li><a href="#ConditionalFunctions">Conditional Functions</a></li>
134<li><a href="#MiscFunctions">Miscellaneous Functions</a></li>
135</ul><!--
136 ! Licensed to the Apache Software Foundation (ASF) under one
137 ! or more contributor license agreements. See the NOTICE file
138 ! distributed with this work for additional information
139 ! regarding copyright ownership. The ASF licenses this file
140 ! to you under the Apache License, Version 2.0 (the
141 ! "License"); you may not use this file except in compliance
142 ! with the License. You may obtain a copy of the License at
143 !
144 ! http://www.apache.org/licenses/LICENSE-2.0
145 !
146 ! Unless required by applicable law or agreed to in writing,
147 ! software distributed under the License is distributed on an
148 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
149 ! KIND, either express or implied. See the License for the
150 ! specific language governing permissions and limitations
151 ! under the License.
152 !-->
153
154<p>The system provides various classes of functions to support operations on numeric, string, spatial, and temporal data. This document explains how to use these functions.</p><!--
155 ! Licensed to the Apache Software Foundation (ASF) under one
156 ! or more contributor license agreements. See the NOTICE file
157 ! distributed with this work for additional information
158 ! regarding copyright ownership. The ASF licenses this file
159 ! to you under the Apache License, Version 2.0 (the
160 ! "License"); you may not use this file except in compliance
161 ! with the License. You may obtain a copy of the License at
162 !
163 ! http://www.apache.org/licenses/LICENSE-2.0
164 !
165 ! Unless required by applicable law or agreed to in writing,
166 ! software distributed under the License is distributed on an
167 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
168 ! KIND, either express or implied. See the License for the
169 ! specific language governing permissions and limitations
170 ! under the License.
171 !-->
172</div>
173<div class="section">
174<h2><a name="Numeric_Functions"></a><a name="NumericFunctions" id="NumericFunctions">Numeric Functions</a></h2>
175<div class="section">
176<h3><a name="abs"></a>abs</h3>
177<ul>
178
179<li>
180
181<p>Syntax:</p>
182
183<div>
184<div>
185<pre class="source">abs(numeric_value)
186</pre></div></div>
187</li>
188<li>
189
190<p>Computes the absolute value of the argument.</p>
191</li>
192<li>Arguments:
193<ul>
194
195<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
196</ul>
197</li>
198<li>Return Value:
199<ul>
200
201<li>The absolute value of the argument with the same type as the input argument,</li>
202<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
203<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
204<li>any other non-numeric input value will cause a type error.</li>
205</ul>
206</li>
207<li>
208
209<p>Example:</p>
210
211<div>
212<div>
213<pre class="source">{ &quot;v1&quot;: abs(2013), &quot;v2&quot;: abs(-4036), &quot;v3&quot;: abs(0), &quot;v4&quot;: abs(float(&quot;-2013.5&quot;)), &quot;v5&quot;: abs(double(&quot;-2013.593823748327284&quot;)) };
214</pre></div></div>
215</li>
216<li>
217
218<p>The expected result is:</p>
219
220<div>
221<div>
222<pre class="source">{ &quot;v1&quot;: 2013, &quot;v2&quot;: 4036, &quot;v3&quot;: 0, &quot;v4&quot;: 2013.5, &quot;v5&quot;: 2013.5938237483274 }
223</pre></div></div>
224</li>
225</ul></div>
226<div class="section">
227<h3><a name="acos"></a>acos</h3>
228<ul>
229
230<li>
231
232<p>Syntax:</p>
233
234<div>
235<div>
236<pre class="source">acos(numeric_value)
237</pre></div></div>
238</li>
239<li>
240
241<p>Computes the arc cosine value of the argument.</p>
242</li>
243<li>Arguments:
244<ul>
245
246<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
247</ul>
248</li>
249<li>Return Value:
250<ul>
251
252<li>the <tt>double</tt> arc cosine in radians for the argument, if the argument is in the range of -1 (inclusive) to 1 (inclusive),</li>
253<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
254<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
255<li>any other non-numeric input value will cause a type error,</li>
256<li>&#x201c;NaN&#x201d; for other legitimate numeric values.</li>
257</ul>
258</li>
259<li>
260
261<p>Example:</p>
262
263<div>
264<div>
265<pre class="source">{ &quot;v1&quot;: acos(1), &quot;v2&quot;: acos(2), &quot;v3&quot;: acos(0), &quot;v4&quot;: acos(float(&quot;0.5&quot;)), &quot;v5&quot;: acos(double(&quot;-0.5&quot;)) };
266</pre></div></div>
267</li>
268<li>
269
270<p>The expected result is:</p>
271
272<div>
273<div>
274<pre class="source">{ &quot;v1&quot;: 0.0, &quot;v2&quot;: &quot;NaN&quot;, &quot;v3&quot;: 1.5707963267948966, &quot;v4&quot;: 1.0471975511965979, &quot;v5&quot;: 2.0943951023931957 }
275</pre></div></div>
276</li>
277</ul></div>
278<div class="section">
279<h3><a name="asin"></a>asin</h3>
280<ul>
281
282<li>
283
284<p>Syntax:</p>
285
286<div>
287<div>
288<pre class="source">asin(numeric_value)
289</pre></div></div>
290</li>
291<li>
292
293<p>Computes the arc sine value of the argument.</p>
294</li>
295<li>Arguments:
296<ul>
297
298<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
299</ul>
300</li>
301<li>Return Value:
302<ul>
303
304<li>the <tt>double</tt> arc sin in radians for the argument, if the argument is in the range of -1 (inclusive) to 1 (inclusive),</li>
305<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
306<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
307<li>any other non-numeric input value will cause a type error,</li>
308<li>&#x201c;NaN&#x201d; for other legitimate numeric values.</li>
309</ul>
310</li>
311<li>
312
313<p>Example:</p>
314
315<div>
316<div>
317<pre class="source">{ &quot;v1&quot;: asin(1), &quot;v2&quot;: asin(2), &quot;v3&quot;: asin(0), &quot;v4&quot;: asin(float(&quot;0.5&quot;)), &quot;v5&quot;: asin(double(&quot;-0.5&quot;)) };
318</pre></div></div>
319</li>
320<li>
321
322<p>The expected result is:</p>
323
324<div>
325<div>
326<pre class="source">{ &quot;v1&quot;: 1.5707963267948966, &quot;v2&quot;: &quot;NaN&quot;, &quot;v3&quot;: 0.0, &quot;v4&quot;: 0.5235987755982989, &quot;v5&quot;: -0.5235987755982989 }
327</pre></div></div>
328</li>
329</ul></div>
330<div class="section">
331<h3><a name="atan"></a>atan</h3>
332<ul>
333
334<li>
335
336<p>Syntax:</p>
337
338<div>
339<div>
340<pre class="source">atan(numeric_value)
341</pre></div></div>
342</li>
343<li>
344
345<p>Computes the arc tangent value of the argument.</p>
346</li>
347<li>Arguments:
348<ul>
349
350<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
351</ul>
352</li>
353<li>Return Value:
354<ul>
355
356<li>the <tt>double</tt> arc tangent in radians for the argument,</li>
357<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
358<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
359<li>any other non-numeric input value will cause a type error.</li>
360</ul>
361</li>
362<li>
363
364<p>Example:</p>
365
366<div>
367<div>
368<pre class="source">{ &quot;v1&quot;: atan(1), &quot;v2&quot;: atan(2), &quot;v3&quot;: atan(0), &quot;v4&quot;: atan(float(&quot;0.5&quot;)), &quot;v5&quot;: atan(double(&quot;1000&quot;)) };
369</pre></div></div>
370</li>
371<li>
372
373<p>The expected result is:</p>
374
375<div>
376<div>
377<pre class="source">{ &quot;v1&quot;: 0.7853981633974483, &quot;v2&quot;: 1.1071487177940904, &quot;v3&quot;: 0.0, &quot;v4&quot;: 0.4636476090008061, &quot;v5&quot;: 1.5697963271282298 }
378</pre></div></div>
379</li>
380</ul></div>
381<div class="section">
382<h3><a name="atan2"></a>atan2</h3>
383<ul>
384
385<li>
386
387<p>Syntax:</p>
388
389<div>
390<div>
391<pre class="source">atan2(numeric_value1, numeric_value2)
392</pre></div></div>
393</li>
394<li>
395
396<p>Computes the arc tangent value of numeric_value2/numeric_value1.</p>
397</li>
398<li>Arguments:
399<ul>
400
401<li><tt>numeric_value1</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value,</li>
402<li><tt>numeric_value2</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
403</ul>
404</li>
405<li>Return Value:
406<ul>
407
408<li>the <tt>double</tt> arc tangent in radians for <tt>numeric_value1</tt> and <tt>numeric_value2</tt>,</li>
409<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
410<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
411<li>any other non-numeric input value will cause a type error.</li>
412</ul>
413</li>
414<li>
415
416<p>Example:</p>
417
418<div>
419<div>
420<pre class="source">{ &quot;v1&quot;: atan2(1, 2), &quot;v2&quot;: atan2(0, 4), &quot;v3&quot;: atan2(float(&quot;0.5&quot;), double(&quot;-0.5&quot;)) };
421</pre></div></div>
422</li>
423<li>
424
425<p>The expected result is:</p>
426
427<div>
428<div>
429<pre class="source">{ &quot;v1&quot;: 0.4636476090008061, &quot;v2&quot;: 0.0, &quot;v3&quot;: 2.356194490192345 }
430</pre></div></div>
431</li>
432</ul></div>
433<div class="section">
434<h3><a name="ceil"></a>ceil</h3>
435<ul>
436
437<li>
438
439<p>Syntax:</p>
440
441<div>
442<div>
443<pre class="source">ceil(numeric_value)
444</pre></div></div>
445</li>
446<li>
447
448<p>Computes the smallest (closest to negative infinity) number with no fractional part that is not less than the value of the argument. If the argument is already equal to mathematical integer, then the result is the same as the argument.</p>
449</li>
450<li>Arguments:
451<ul>
452
453<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
454</ul>
455</li>
456<li>Return Value:
457<ul>
458
459<li>The ceiling value for the given number in the same type as the input argument,</li>
460<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
461<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
462<li>any other non-numeric input value will cause a type error.</li>
463</ul>
464</li>
465<li>
466
467<p>Example:</p>
468
469<div>
470<div>
471<pre class="source">{
472 &quot;v1&quot;: ceil(2013),
473 &quot;v2&quot;: ceil(-4036),
474 &quot;v3&quot;: ceil(0.3),
475 &quot;v4&quot;: ceil(float(&quot;-2013.2&quot;)),
476 &quot;v5&quot;: ceil(double(&quot;-2013.893823748327284&quot;))
477};
478</pre></div></div>
479</li>
480<li>
481
482<p>The expected result is:</p>
483
484<div>
485<div>
486<pre class="source">{ &quot;v1&quot;: 2013, &quot;v2&quot;: -4036, &quot;v3&quot;: 1.0, &quot;v4&quot;: -2013.0, &quot;v5&quot;: -2013.0 }
487</pre></div></div>
488</li>
489</ul></div>
490<div class="section">
491<h3><a name="cos"></a>cos</h3>
492<ul>
493
494<li>
495
496<p>Syntax:</p>
497
498<div>
499<div>
500<pre class="source">cos(numeric_value)
501</pre></div></div>
502</li>
503<li>
504
505<p>Computes the cosine value of the argument.</p>
506</li>
507<li>Arguments:
508<ul>
509
510<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
511</ul>
512</li>
513<li>Return Value:
514<ul>
515
516<li>the <tt>double</tt> cosine value for the argument,</li>
517<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
518<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
519<li>any other non-numeric input value will cause a type error.</li>
520</ul>
521</li>
522<li>
523
524<p>Example:</p>
525
526<div>
527<div>
528<pre class="source">{ &quot;v1&quot;: cos(1), &quot;v2&quot;: cos(2), &quot;v3&quot;: cos(0), &quot;v4&quot;: cos(float(&quot;0.5&quot;)), &quot;v5&quot;: cos(double(&quot;1000&quot;)) };
529</pre></div></div>
530</li>
531<li>
532
533<p>The expected result is:</p>
534
535<div>
536<div>
537<pre class="source">{ &quot;v1&quot;: 0.5403023058681398, &quot;v2&quot;: -0.4161468365471424, &quot;v3&quot;: 1.0, &quot;v4&quot;: 0.8775825618903728, &quot;v5&quot;: 0.562379076290703 }
538</pre></div></div>
539</li>
540</ul></div>
541<div class="section">
542<h3><a name="cosh"></a>cosh</h3>
543<ul>
544
545<li>
546
547<p>Syntax:</p>
548
549<div>
550<div>
551<pre class="source">cosh(numeric_value)
552</pre></div></div>
553</li>
554<li>
555
556<p>Computes the hyperbolic cosine value of the argument.</p>
557</li>
558<li>Arguments:
559<ul>
560
561<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
562</ul>
563</li>
564<li>Return Value:
565<ul>
566
567<li>the <tt>double</tt> hyperbolic cosine value for the argument,</li>
568<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
569<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
570<li>any other non-numeric input value will cause a type error.</li>
571</ul>
572</li>
573<li>
574
575<p>Example:</p>
576
577<div>
578<div>
579<pre class="source">{ &quot;v1&quot;: cosh(1), &quot;v2&quot;: cosh(2), &quot;v3&quot;: cosh(0), &quot;v4&quot;: cosh(float(&quot;0.5&quot;)), &quot;v5&quot;: cosh(double(&quot;8&quot;)) };
580</pre></div></div>
581</li>
582<li>
583
584<p>The expected result is:</p>
585
586<div>
587<div>
588<pre class="source">{ &quot;v1&quot;: 1.5430806348152437, &quot;v2&quot;: 3.7621956910836314, &quot;v3&quot;: 1.0, &quot;v4&quot;: 1.1276259652063807, &quot;v5&quot;: 1490.479161252178 }
589</pre></div></div>
590</li>
591</ul></div>
592<div class="section">
593<h3><a name="degrees"></a>degrees</h3>
594<ul>
595
596<li>
597
598<p>Syntax:</p>
599
600<div>
601<div>
602<pre class="source">degrees(numeric_value)
603</pre></div></div>
604</li>
605<li>
606
607<p>Converts radians to degrees</p>
608</li>
609<li>Arguments:
610<ul>
611
612<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
613</ul>
614</li>
615<li>Return Value:
616<ul>
617
618<li>The degrees value for the given radians value. The returned value has type <tt>double</tt>,</li>
619<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
620<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
621<li>any other non-numeric input value will cause a type error.</li>
622</ul>
623</li>
624<li>
625
626<p>Example:</p>
627
628<div>
629<div>
630<pre class="source">{ &quot;v1&quot;: degrees(pi()) };
631</pre></div></div>
632</li>
633<li>
634
635<p>The expected result is:</p>
636
637<div>
638<div>
639<pre class="source">{ &quot;v1&quot;: 180.0 }
640</pre></div></div>
641</li>
642</ul></div>
643<div class="section">
644<h3><a name="e"></a>e</h3>
645<ul>
646
647<li>
648
649<p>Syntax:</p>
650
651<div>
652<div>
653<pre class="source">e()
654</pre></div></div>
655</li>
656<li>
657
658<p>Return Value:</p>
659<ul>
660
661<li>e (base of the natural logarithm)</li>
662</ul>
663</li>
664<li>
665
666<p>Example:</p>
667
668<div>
669<div>
670<pre class="source">{ &quot;v1&quot;: e() };
671</pre></div></div>
672</li>
673<li>
674
675<p>The expected result is:</p>
676
677<div>
678<div>
679<pre class="source">{ &quot;v1&quot;: 2.718281828459045 }
680</pre></div></div>
681</li>
682</ul></div>
683<div class="section">
684<h3><a name="exp"></a>exp</h3>
685<ul>
686
687<li>
688
689<p>Syntax:</p>
690
691<div>
692<div>
693<pre class="source">exp(numeric_value)
694</pre></div></div>
695</li>
696<li>
697
698<p>Computes e<sup>numeric_value</sup>.</p>
699</li>
700<li>Arguments:
701<ul>
702
703<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
704</ul>
705</li>
706<li>Return Value:
707<ul>
708
709<li>e<sup>numeric_value</sup>,</li>
710<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
711<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
712<li>any other non-numeric input value will cause a type error.</li>
713</ul>
714</li>
715<li>
716
717<p>Example:</p>
718
719<div>
720<div>
721<pre class="source">{ &quot;v1&quot;: exp(1), &quot;v2&quot;: exp(2), &quot;v3&quot;: exp(0), &quot;v4&quot;: exp(float(&quot;0.5&quot;)), &quot;v5&quot;: exp(double(&quot;1000&quot;)) };
722</pre></div></div>
723</li>
724<li>
725
726<p>The expected result is:</p>
727
728<div>
729<div>
730<pre class="source">{ &quot;v1&quot;: 2.718281828459045, &quot;v2&quot;: 7.38905609893065, &quot;v3&quot;: 1.0, &quot;v4&quot;: 1.6487212707001282, &quot;v5&quot;: &quot;Infinity&quot; }
731</pre></div></div>
732</li>
733</ul></div>
734<div class="section">
735<h3><a name="floor"></a>floor</h3>
736<ul>
737
738<li>
739
740<p>Syntax:</p>
741
742<div>
743<div>
744<pre class="source">floor(numeric_value)
745</pre></div></div>
746</li>
747<li>
748
749<p>Computes the largest (closest to positive infinity) number with no fractional part that is not greater than the value. If the argument is already equal to mathematical integer, then the result is the same as the argument.</p>
750</li>
751<li>Arguments:
752<ul>
753
754<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
755</ul>
756</li>
757<li>Return Value:
758<ul>
759
760<li>The floor value for the given number in the same type as the input argument,</li>
761<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
762<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
763<li>any other non-numeric input value will cause a type error.</li>
764</ul>
765</li>
766<li>
767
768<p>Example:</p>
769
770<div>
771<div>
772<pre class="source">{
773 &quot;v1&quot;: floor(2013),
774 &quot;v2&quot;: floor(-4036),
775 &quot;v3&quot;: floor(0.8),
776 &quot;v4&quot;: floor(float(&quot;-2013.2&quot;)),
777 &quot;v5&quot;: floor(double(&quot;-2013.893823748327284&quot;))
778};
779</pre></div></div>
780</li>
781<li>
782
783<p>The expected result is:</p>
784
785<div>
786<div>
787<pre class="source">{ &quot;v1&quot;: 2013, &quot;v2&quot;: -4036, &quot;v3&quot;: 0.0, &quot;v4&quot;: -2014.0, &quot;v5&quot;: -2014.0 }
788</pre></div></div>
789</li>
790</ul></div>
791<div class="section">
792<h3><a name="ln"></a>ln</h3>
793<ul>
794
795<li>
796
797<p>Syntax:</p>
798
799<div>
800<div>
801<pre class="source">ln(numeric_value)
802</pre></div></div>
803</li>
804<li>
805
806<p>Computes log<sub>e</sub>numeric_value.</p>
807</li>
808<li>Arguments:
809<ul>
810
811<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
812</ul>
813</li>
814<li>Return Value:
815<ul>
816
817<li>log<sub>e</sub>numeric_value,</li>
818<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
819<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
820<li>any other non-numeric input value will cause a type error.</li>
821</ul>
822</li>
823<li>
824
825<p>Example:</p>
826
827<div>
828<div>
829<pre class="source">{ &quot;v1&quot;: ln(1), &quot;v2&quot;: ln(2), &quot;v3&quot;: ln(0), &quot;v4&quot;: ln(float(&quot;0.5&quot;)), &quot;v5&quot;: ln(double(&quot;1000&quot;)) };
830</pre></div></div>
831</li>
832<li>
833
834<p>The expected result is:</p>
835
836<div>
837<div>
838<pre class="source">{ &quot;v1&quot;: 0.0, &quot;v2&quot;: 0.6931471805599453, &quot;v3&quot;: &quot;-Infinity&quot;, &quot;v4&quot;: -0.6931471805599453, &quot;v5&quot;: 6.907755278982137 }
839</pre></div></div>
840</li>
841</ul></div>
842<div class="section">
843<h3><a name="log"></a>log</h3>
844<ul>
845
846<li>
847
848<p>Syntax:</p>
849
850<div>
851<div>
852<pre class="source">log(numeric_value)
853</pre></div></div>
854</li>
855<li>
856
857<p>Computes log<sub>10</sub>numeric_value.</p>
858</li>
859<li>Arguments:
860<ul>
861
862<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
863</ul>
864</li>
865<li>Return Value:
866<ul>
867
868<li>log<sub>10</sub>numeric_value,</li>
869<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
870<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
871<li>any other non-numeric input value will cause a type error.</li>
872</ul>
873</li>
874<li>
875
876<p>Example:</p>
877
878<div>
879<div>
880<pre class="source">{ &quot;v1&quot;: log(1), &quot;v2&quot;: log(2), &quot;v3&quot;: log(0), &quot;v4&quot;: log(float(&quot;0.5&quot;)), &quot;v5&quot;: log(double(&quot;1000&quot;)) };
881</pre></div></div>
882</li>
883<li>
884
885<p>The expected result is:</p>
886
887<div>
888<div>
889<pre class="source">{ &quot;v1&quot;: 0.0, &quot;v2&quot;: 0.3010299956639812, &quot;v3&quot;: &quot;-Infinity&quot;, &quot;v4&quot;: -0.3010299956639812, &quot;v5&quot;: 3.0 }
890</pre></div></div>
891</li>
892</ul></div>
893<div class="section">
894<h3><a name="pi"></a>pi</h3>
895<ul>
896
897<li>
898
899<p>Syntax:</p>
900
901<div>
902<div>
903<pre class="source">pi()
904</pre></div></div>
905</li>
906<li>
907
908<p>Return Value:</p>
909<ul>
910
911<li>Pi</li>
912</ul>
913</li>
914<li>
915
916<p>Example:</p>
917
918<div>
919<div>
920<pre class="source">{ &quot;v1&quot;: pi() };
921</pre></div></div>
922</li>
923<li>
924
925<p>The expected result is:</p>
926
927<div>
928<div>
929<pre class="source">{ &quot;v1&quot;: 3.141592653589793 }
930</pre></div></div>
931</li>
932</ul></div>
933<div class="section">
934<h3><a name="power"></a>power</h3>
935<ul>
936
937<li>
938
939<p>Syntax:</p>
940
941<div>
942<div>
943<pre class="source">power(numeric_value1, numeric_value2)
944</pre></div></div>
945</li>
946<li>
947
948<p>Computes numeric_value1<sup>numeric_value2</sup>.</p>
949</li>
950<li>Arguments:
951<ul>
952
953<li><tt>numeric_value1</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value,</li>
954<li><tt>numeric_value2</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
955</ul>
956</li>
957<li>Return Value:
958<ul>
959
960<li>numeric_value1<sup>numeric_value2</sup>,</li>
961<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
962<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
963<li>any other non-numeric input value will cause a type error.</li>
964</ul>
965</li>
966<li>
967
968<p>Example:</p>
969
970<div>
971<div>
972<pre class="source">{ &quot;v1&quot;: power(1, 2), &quot;v3&quot;: power(0, 4), &quot;v4&quot;: power(float(&quot;0.5&quot;), double(&quot;-0.5&quot;)) };
973</pre></div></div>
974</li>
975<li>
976
977<p>The expected result is:</p>
978
979<div>
980<div>
981<pre class="source">{ &quot;v1&quot;: 1, &quot;v3&quot;: 0, &quot;v4&quot;: 1.4142135623730951 }
982</pre></div></div>
983</li>
984</ul></div>
985<div class="section">
986<h3><a name="radians"></a>radians</h3>
987<ul>
988
989<li>
990
991<p>Syntax:</p>
992
993<div>
994<div>
995<pre class="source">radians(numeric_value)
996</pre></div></div>
997</li>
998<li>
999
1000<p>Converts degrees to radians</p>
1001</li>
1002<li>Arguments:
1003<ul>
1004
1005<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
1006</ul>
1007</li>
1008<li>Return Value:
1009<ul>
1010
1011<li>The radians value for the given degrees value. The returned value has type <tt>double</tt>,</li>
1012<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1013<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1014<li>any other non-numeric input value will cause a type error.</li>
1015</ul>
1016</li>
1017<li>
1018
1019<p>Example:</p>
1020
1021<div>
1022<div>
1023<pre class="source">{ &quot;v1&quot;: radians(180) };
1024</pre></div></div>
1025</li>
1026<li>
1027
1028<p>The expected result is:</p>
1029
1030<div>
1031<div>
1032<pre class="source">{ &quot;v1&quot;: 3.141592653589793 }
1033</pre></div></div>
1034</li>
1035</ul></div>
1036<div class="section">
1037<h3><a name="round"></a>round</h3>
1038<ul>
1039
1040<li>
1041
1042<p>Syntax:</p>
1043
1044<div>
1045<div>
1046<pre class="source">round(numeric_value[, round_digit])
1047</pre></div></div>
1048</li>
1049<li>
1050
1051<p>Rounds the value to the given number of integer digits to the right of the decimal point, or to the left of the decimal point if the number of digits is negative.</p>
1052</li>
1053<li>
1054
1055<p>Arguments:</p>
1056<ul>
1057
1058<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value that represents the numeric value to be rounded.</li>
1059<li><tt>round_digit</tt>: (Optional) a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value that specifies the digit to round to. This argument may be positive or negative; positive indicating that rounding needs to be to the right of the decimal point, and negative indicating that rounding needs to be to the left of the decimal point. Values such as 1.0 and 2.0 are acceptable, but values such as 1.3 and 1.5 result in a <tt>null</tt>. If omitted, the default is 0.</li>
1060</ul>
1061</li>
1062<li>Return Value:
1063<ul>
1064
1065<li>The rounded value for the given number. The returned value has the following type:
1066<ul>
1067
1068<li><tt>bigint</tt> if the input value has type <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt> or <tt>bigint</tt>,</li>
1069<li><tt>float</tt> if the input value has type <tt>float</tt>,</li>
1070<li><tt>double</tt> if the input value has type <tt>double</tt>;</li>
1071</ul>
1072</li>
1073<li><tt>missing</tt> if the input value is a <tt>missing</tt> value,</li>
1074<li><tt>null</tt> if the input value is a <tt>null</tt> value,</li>
1075<li>any other non-numeric input value will return a <tt>null</tt> value.</li>
1076</ul>
1077</li>
1078<li>
1079
1080<p>Example:</p>
1081
1082<div>
1083<div>
1084<pre class="source">{
1085 &quot;v1&quot;: round(2013),
1086 &quot;v2&quot;: round(-4036),
1087 &quot;v3&quot;: round(0.8),
1088 &quot;v4&quot;: round(float(&quot;-2013.256&quot;)),
1089 &quot;v5&quot;: round(double(&quot;-2013.893823748327284&quot;))
1090 &quot;v6&quot;: round(123456, -1),
1091 &quot;v7&quot;: round(456.456, 2),
1092 &quot;v8&quot;: round(456.456, -1),
1093 &quot;v9&quot;: round(-456.456, -2)
1094};
1095</pre></div></div>
1096</li>
1097<li>
1098
1099<p>The expected result is:</p>
1100
1101<div>
1102<div>
1103<pre class="source">{ &quot;v1&quot;: 2013, &quot;v2&quot;: -4036, &quot;v3&quot;: 1.0, &quot;v4&quot;: -2013.0, &quot;v5&quot;: -2014.0, &quot;v6&quot;: 123460, &quot;v7&quot;: 456.46, &quot;v8&quot;: 460, &quot;v9&quot;: -500 }
1104</pre></div></div>
1105</li>
1106</ul></div>
1107<div class="section">
1108<h3><a name="sign"></a>sign</h3>
1109<ul>
1110
1111<li>
1112
1113<p>Syntax:</p>
1114
1115<div>
1116<div>
1117<pre class="source">sign(numeric_value)
1118</pre></div></div>
1119</li>
1120<li>
1121
1122<p>Computes the sign of the argument.</p>
1123</li>
1124<li>Arguments:
1125<ul>
1126
1127<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
1128</ul>
1129</li>
1130<li>Return Value:
1131<ul>
1132
1133<li>the sign (a <tt>tinyint</tt>) of the argument, -1 for negative values, 0 for 0, and 1 for positive values,</li>
1134<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1135<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1136<li>any other non-numeric input value will cause a type error.</li>
1137</ul>
1138</li>
1139<li>
1140
1141<p>Example:</p>
1142
1143<div>
1144<div>
1145<pre class="source">{ &quot;v1&quot;: sign(1), &quot;v2&quot;: sign(2), &quot;v3&quot;: sign(0), &quot;v4&quot;: sign(float(&quot;0.5&quot;)), &quot;v5&quot;: sign(double(&quot;-1000&quot;)) };
1146</pre></div></div>
1147</li>
1148<li>
1149
1150<p>The expected result is:</p>
1151
1152<div>
1153<div>
1154<pre class="source">{ &quot;v1&quot;: 1, &quot;v2&quot;: 1, &quot;v3&quot;: 0, &quot;v4&quot;: 1, &quot;v5&quot;: -1 }
1155</pre></div></div>
1156</li>
1157</ul></div>
1158<div class="section">
1159<h3><a name="sin"></a>sin</h3>
1160<ul>
1161
1162<li>
1163
1164<p>Syntax:</p>
1165
1166<div>
1167<div>
1168<pre class="source">sin(numeric_value)
1169</pre></div></div>
1170</li>
1171<li>
1172
1173<p>Computes the sine value of the argument.</p>
1174</li>
1175<li>Arguments:
1176<ul>
1177
1178<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
1179</ul>
1180</li>
1181<li>Return Value:
1182<ul>
1183
1184<li>the <tt>double</tt> sine value for the argument,</li>
1185<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1186<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1187<li>any other non-numeric input value will cause a type error.</li>
1188</ul>
1189</li>
1190<li>
1191
1192<p>Example:</p>
1193
1194<div>
1195<div>
1196<pre class="source">{ &quot;v1&quot;: sin(1), &quot;v2&quot;: sin(2), &quot;v3&quot;: sin(0), &quot;v4&quot;: sin(float(&quot;0.5&quot;)), &quot;v5&quot;: sin(double(&quot;1000&quot;)) };
1197</pre></div></div>
1198</li>
1199<li>
1200
1201<p>The expected result is:</p>
1202
1203<div>
1204<div>
1205<pre class="source">{ &quot;v1&quot;: 0.8414709848078965, &quot;v2&quot;: 0.9092974268256817, &quot;v3&quot;: 0.0, &quot;v4&quot;: 0.479425538604203, &quot;v5&quot;: 0.8268795405320025 }
1206</pre></div></div>
1207</li>
1208</ul></div>
1209<div class="section">
1210<h3><a name="sinh"></a>sinh</h3>
1211<ul>
1212
1213<li>
1214
1215<p>Syntax:</p>
1216
1217<div>
1218<div>
1219<pre class="source">sinh(numeric_value)
1220</pre></div></div>
1221</li>
1222<li>
1223
1224<p>Computes the hyperbolic sine value of the argument.</p>
1225</li>
1226<li>Arguments:
1227<ul>
1228
1229<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
1230</ul>
1231</li>
1232<li>Return Value:
1233<ul>
1234
1235<li>the <tt>double</tt> hyperbolic sine value for the argument,</li>
1236<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1237<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1238<li>any other non-numeric input value will cause a type error.</li>
1239</ul>
1240</li>
1241<li>
1242
1243<p>Example:</p>
1244
1245<div>
1246<div>
1247<pre class="source">{ &quot;v1&quot;: sinh(1), &quot;v2&quot;: sinh(2), &quot;v3&quot;: sinh(0), &quot;v4&quot;: sinh(float(&quot;0.5&quot;)), &quot;v5&quot;: sinh(double(&quot;8&quot;)) };
1248</pre></div></div>
1249</li>
1250<li>
1251
1252<p>The expected result is:</p>
1253
1254<div>
1255<div>
1256<pre class="source">{ &quot;v1&quot;: 1.1752011936438014, &quot;v2&quot;: 3.626860407847019, &quot;v3&quot;: 0.0, &quot;v4&quot;: 0.5210953054937474, &quot;v5&quot;: 1490.4788257895502 }
1257</pre></div></div>
1258</li>
1259</ul></div>
1260<div class="section">
1261<h3><a name="sqrt"></a>sqrt</h3>
1262<ul>
1263
1264<li>
1265
1266<p>Syntax:</p>
1267
1268<div>
1269<div>
1270<pre class="source">sqrt(numeric_value)
1271</pre></div></div>
1272</li>
1273<li>
1274
1275<p>Computes the square root of the argument.</p>
1276</li>
1277<li>Arguments:
1278<ul>
1279
1280<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
1281</ul>
1282</li>
1283<li>Return Value:
1284<ul>
1285
1286<li>the <tt>double</tt> square root value for the argument,</li>
1287<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1288<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1289<li>any other non-numeric input value will cause a type error.</li>
1290</ul>
1291</li>
1292<li>
1293
1294<p>Example:</p>
1295
1296<div>
1297<div>
1298<pre class="source">{ &quot;v1&quot;: sqrt(1), &quot;v2&quot;: sqrt(2), &quot;v3&quot;: sqrt(0), &quot;v4&quot;: sqrt(float(&quot;0.5&quot;)), &quot;v5&quot;: sqrt(double(&quot;1000&quot;)) };
1299</pre></div></div>
1300</li>
1301<li>
1302
1303<p>The expected result is:</p>
1304
1305<div>
1306<div>
1307<pre class="source">{ &quot;v1&quot;: 1.0, &quot;v2&quot;: 1.4142135623730951, &quot;v3&quot;: 0.0, &quot;v4&quot;: 0.7071067811865476, &quot;v5&quot;: 31.622776601683793 }
1308</pre></div></div>
1309</li>
1310</ul></div>
1311<div class="section">
1312<h3><a name="tan"></a>tan</h3>
1313<ul>
1314
1315<li>
1316
1317<p>Syntax:</p>
1318
1319<div>
1320<div>
1321<pre class="source">tan(numeric_value)
1322</pre></div></div>
1323</li>
1324<li>
1325
1326<p>Computes the tangent value of the argument.</p>
1327</li>
1328<li>Arguments:
1329<ul>
1330
1331<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
1332</ul>
1333</li>
1334<li>Return Value:
1335<ul>
1336
1337<li>the <tt>double</tt> tangent value for the argument,</li>
1338<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1339<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1340<li>any other non-numeric input value will cause a type error.</li>
1341</ul>
1342</li>
1343<li>
1344
1345<p>Example:</p>
1346
1347<div>
1348<div>
1349<pre class="source">{ &quot;v1&quot;: tan(1), &quot;v2&quot;: tan(2), &quot;v3&quot;: tan(0), &quot;v4&quot;: tan(float(&quot;0.5&quot;)), &quot;v5&quot;: tan(double(&quot;1000&quot;)) };
1350</pre></div></div>
1351</li>
1352<li>
1353
1354<p>The expected result is:</p>
1355
1356<div>
1357<div>
1358<pre class="source">{ &quot;v1&quot;: 1.5574077246549023, &quot;v2&quot;: -2.185039863261519, &quot;v3&quot;: 0.0, &quot;v4&quot;: 0.5463024898437905, &quot;v5&quot;: 1.4703241557027185 }
1359</pre></div></div>
1360</li>
1361</ul></div>
1362<div class="section">
1363<h3><a name="tanh"></a>tanh</h3>
1364<ul>
1365
1366<li>
1367
1368<p>Syntax:</p>
1369
1370<div>
1371<div>
1372<pre class="source">tanh(numeric_value)
1373</pre></div></div>
1374</li>
1375<li>
1376
1377<p>Computes the hyperbolic tangent value of the argument.</p>
1378</li>
1379<li>Arguments:
1380<ul>
1381
1382<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
1383</ul>
1384</li>
1385<li>Return Value:
1386<ul>
1387
1388<li>the <tt>double</tt> hyperbolic tangent value for the argument,</li>
1389<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1390<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1391<li>any other non-numeric input value will cause a type error.</li>
1392</ul>
1393</li>
1394<li>
1395
1396<p>Example:</p>
1397
1398<div>
1399<div>
1400<pre class="source">{ &quot;v1&quot;: tanh(1), &quot;v2&quot;: tanh(2), &quot;v3&quot;: tanh(0), &quot;v4&quot;: tanh(float(&quot;0.5&quot;)), &quot;v5&quot;: tanh(double(&quot;8&quot;)) };
1401</pre></div></div>
1402</li>
1403<li>
1404
1405<p>The expected result is:</p>
1406
1407<div>
1408<div>
1409<pre class="source">{ &quot;v1&quot;: 0.7615941559557649, &quot;v2&quot;: 0.964027580075817, &quot;v3&quot;: 0.0, &quot;v4&quot;: 0.4621171572600098, &quot;v5&quot;: 0.999999774929676 }
1410</pre></div></div>
1411</li>
1412</ul></div>
1413<div class="section">
1414<h3><a name="trunc"></a>trunc</h3>
1415<ul>
1416
1417<li>
1418
1419<p>Syntax:</p>
1420
1421<div>
1422<div>
1423<pre class="source">trunc(numeric_value, number_digits)
1424</pre></div></div>
1425</li>
1426<li>
1427
1428<p>Truncates the number to the given number of integer digits to the right of the decimal point (left if digits is negative). Digits is 0 if not given.</p>
1429</li>
1430<li>Arguments:
1431<ul>
1432
1433<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value,</li>
1434<li><tt>number_digits</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value.</li>
1435</ul>
1436</li>
1437<li>Return Value:
1438<ul>
1439
1440<li>the <tt>double</tt> tangent value for the argument,</li>
1441<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
1442<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is <tt>missing</tt>,</li>
1443<li>a type error will be raised if:
1444<ul>
1445
1446<li>the first argument is any other non-numeric value,</li>
1447<li>the second argument is any other non-tinyint, non-smallint, non-integer, and non-bigint value.</li>
1448</ul>
1449</li>
1450</ul>
1451</li>
1452<li>
1453
1454<p>Example:</p>
1455
1456<div>
1457<div>
1458<pre class="source">{ &quot;v1&quot;: trunc(1, 1), &quot;v2&quot;: trunc(2, -2), &quot;v3&quot;: trunc(0.122, 2), &quot;v4&quot;: trunc(float(&quot;11.52&quot;), -1), &quot;v5&quot;: trunc(double(&quot;1000.5252&quot;), 3) };
1459</pre></div></div>
1460</li>
1461<li>
1462
1463<p>The expected result is:</p>
1464
1465<div>
1466<div>
1467<pre class="source">{ &quot;v1&quot;: 1, &quot;v2&quot;: 2, &quot;v3&quot;: 0.12, &quot;v4&quot;: 10.0, &quot;v5&quot;: 1000.525 }
1468</pre></div></div>
1469</li>
1470</ul><!--
1471 ! Licensed to the Apache Software Foundation (ASF) under one
1472 ! or more contributor license agreements. See the NOTICE file
1473 ! distributed with this work for additional information
1474 ! regarding copyright ownership. The ASF licenses this file
1475 ! to you under the Apache License, Version 2.0 (the
1476 ! "License"); you may not use this file except in compliance
1477 ! with the License. You may obtain a copy of the License at
1478 !
1479 ! http://www.apache.org/licenses/LICENSE-2.0
1480 !
1481 ! Unless required by applicable law or agreed to in writing,
1482 ! software distributed under the License is distributed on an
1483 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1484 ! KIND, either express or implied. See the License for the
1485 ! specific language governing permissions and limitations
1486 ! under the License.
1487 !-->
1488</div>
1489<div class="section">
1490<h3><a name="round_half_to_even"></a>round_half_to_even</h3>
1491<ul>
1492
1493<li>
1494
1495<p>Syntax:</p>
1496
1497<div>
1498<div>
1499<pre class="source">round_half_to_even(numeric_value, [precision])
1500</pre></div></div>
1501</li>
1502<li>
1503
1504<p>Computes the closest numeric value to <tt>numeric_value</tt> that is a multiple of ten to the power of minus <tt>precision</tt>. <tt>precision</tt> is optional and by default value <tt>0</tt> is used.</p>
1505</li>
1506<li>Arguments:
1507<ul>
1508
1509<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value.</li>
1510<li><tt>precision</tt>: an optional <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> field representing the number of digits in the fraction of the the result</li>
1511</ul>
1512</li>
1513<li>Return Value:
1514<ul>
1515
1516<li>The rounded value for the given number in the same type as the input argument,</li>
1517<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
1518<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
1519<li>a type error will be raised if:
1520<ul>
1521
1522<li>the first argument is any other non-numeric value,</li>
1523<li>or, the second argument is any other non-tinyint, non-smallint, non-integer, or non-bigint value.</li>
1524</ul>
1525</li>
1526</ul>
1527</li>
1528<li>
1529
1530<p>Example:</p>
1531
1532<div>
1533<div>
1534<pre class="source">{
1535 &quot;v1&quot;: round_half_to_even(2013),
1536 &quot;v2&quot;: round_half_to_even(-4036),
1537 &quot;v3&quot;: round_half_to_even(0.8),
1538 &quot;v4&quot;: round_half_to_even(float(&quot;-2013.256&quot;)),
1539 &quot;v5&quot;: round_half_to_even(double(&quot;-2013.893823748327284&quot;)),
1540 &quot;v6&quot;: round_half_to_even(double(&quot;-2013.893823748327284&quot;), 2),
1541 &quot;v7&quot;: round_half_to_even(2013, 4),
1542 &quot;v8&quot;: round_half_to_even(float(&quot;-2013.256&quot;), 5)
1543};
1544</pre></div></div>
1545</li>
1546<li>
1547
1548<p>The expected result is:</p>
1549
1550<div>
1551<div>
1552<pre class="source">{ &quot;v1&quot;: 2013, &quot;v2&quot;: -4036, &quot;v3&quot;: 1.0, &quot;v4&quot;: -2013.0, &quot;v5&quot;: -2014.0, &quot;v6&quot;: -2013.89, &quot;v7&quot;: 2013, &quot;v8&quot;: -2013.256 }
1553</pre></div></div>
1554</li>
1555</ul><!--
1556 ! Licensed to the Apache Software Foundation (ASF) under one
1557 ! or more contributor license agreements. See the NOTICE file
1558 ! distributed with this work for additional information
1559 ! regarding copyright ownership. The ASF licenses this file
1560 ! to you under the Apache License, Version 2.0 (the
1561 ! "License"); you may not use this file except in compliance
1562 ! with the License. You may obtain a copy of the License at
1563 !
1564 ! http://www.apache.org/licenses/LICENSE-2.0
1565 !
1566 ! Unless required by applicable law or agreed to in writing,
1567 ! software distributed under the License is distributed on an
1568 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1569 ! KIND, either express or implied. See the License for the
1570 ! specific language governing permissions and limitations
1571 ! under the License.
1572 !-->
1573</div></div>
1574<div class="section">
1575<h2><a name="String_Functions"></a><a name="StringFunctions" id="StringFunctions">String Functions</a></h2>
1576<div class="section">
1577<h3><a name="concat"></a>concat</h3>
1578<ul>
1579
1580<li>
1581
1582<p>Syntax:</p>
1583
1584<div>
1585<div>
1586<pre class="source">concat(string1, string2, ...)
1587</pre></div></div>
1588</li>
1589<li>
1590
1591<p>Returns a concatenated string from arguments.</p>
1592</li>
1593<li>Arguments:
1594<ul>
1595
1596<li><tt>string1</tt>: a string value,</li>
1597<li><tt>string2</tt>: a string value,</li>
1598<li>&#x2026;.</li>
1599</ul>
1600</li>
1601<li>Return Value:
1602<ul>
1603
1604<li>a concatenated string from arguments,</li>
1605<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
1606<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
1607<li>any other non-string input value will cause a type error.</li>
1608</ul>
1609</li>
1610<li>
1611
1612<p>Example:</p>
1613
1614<div>
1615<div>
1616<pre class="source">concat(&quot;test &quot;, &quot;driven &quot;, &quot;development&quot;);
1617</pre></div></div>
1618</li>
1619<li>
1620
1621<p>The expected result is:</p>
1622
1623<div>
1624<div>
1625<pre class="source">&quot;test driven development&quot;
1626</pre></div></div>
1627</li>
1628</ul></div>
1629<div class="section">
1630<h3><a name="contains"></a>contains</h3>
1631<ul>
1632
1633<li>
1634
1635<p>Syntax:</p>
1636
1637<div>
1638<div>
1639<pre class="source">contains(string, substring_to_contain)
1640</pre></div></div>
1641</li>
1642<li>
1643
1644<p>Checks whether the string <tt>string</tt> contains the string <tt>substring_to_contain</tt></p>
1645</li>
1646<li>Arguments:
1647<ul>
1648
1649<li><tt>string</tt> : a <tt>string</tt> that might contain the given substring,</li>
1650<li><tt>substring_to_contain</tt> : a target <tt>string</tt> that might be contained.</li>
1651</ul>
1652</li>
1653<li>Return Value:
1654<ul>
1655
1656<li>a <tt>boolean</tt> value, <tt>true</tt> if <tt>string</tt> contains <tt>substring_to_contain</tt>,</li>
1657<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
1658<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
1659<li>any other non-string input value will cause a type error,</li>
1660<li><tt>false</tt> otherwise.</li>
1661</ul>
1662</li>
1663<li>
1664
1665<p>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</p>
1666</li>
1667<li>Example:
1668
1669<div>
1670<div>
1671<pre class="source">{ &quot;v1&quot;: contains(&quot;I like x-phone&quot;, &quot;phone&quot;), &quot;v2&quot;: contains(&quot;one&quot;, &quot;phone&quot;) };
1672</pre></div></div>
1673</li>
1674<li>
1675
1676<p>The expected result is:</p>
1677
1678<div>
1679<div>
1680<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
1681</pre></div></div>
1682</li>
1683</ul></div>
1684<div class="section">
1685<h3><a name="ends_with"></a>ends_with</h3>
1686<ul>
1687
1688<li>
1689
1690<p>Syntax:</p>
1691
1692<div>
1693<div>
1694<pre class="source">ends_with(string, substring_to_end_with)
1695</pre></div></div>
1696</li>
1697<li>
1698
1699<p>Checks whether the string <tt>string</tt> ends with the string <tt>substring_to_end_with</tt>.</p>
1700</li>
1701<li>Arguments:
1702<ul>
1703
1704<li><tt>string</tt> : a <tt>string</tt> that might end with the given string,</li>
1705<li><tt>substring_to_end_with</tt> : a <tt>string</tt> that might be contained as the ending substring.</li>
1706</ul>
1707</li>
1708<li>Return Value:
1709<ul>
1710
1711<li>a <tt>boolean</tt> value, <tt>true</tt> if <tt>string</tt> contains <tt>substring_to_contain</tt>,</li>
1712<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
1713<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
1714<li>any other non-string input value will cause a type error,</li>
1715<li><tt>false</tt> otherwise.</li>
1716</ul>
1717</li>
1718<li>
1719
1720<p>Example:</p>
1721
1722<div>
1723<div>
1724<pre class="source">{
1725 &quot;v1&quot;: ends_with(&quot; love product-b its shortcut_menu is awesome:)&quot;, &quot;:)&quot;),
1726 &quot;v2&quot;: ends_with(&quot; awsome:)&quot;, &quot;:-)&quot;)
1727};
1728</pre></div></div>
1729</li>
1730<li>
1731
1732<p>The expected result is:</p>
1733
1734<div>
1735<div>
1736<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
1737</pre></div></div>
1738</li>
1739</ul></div>
1740<div class="section">
1741<h3><a name="initcap_.28or_title.29"></a>initcap (or title)</h3>
1742<ul>
1743
1744<li>
1745
1746<p>Syntax:</p>
1747
1748<div>
1749<div>
1750<pre class="source">initcap(string)
1751</pre></div></div>
1752</li>
1753<li>
1754
1755<p>Converts a given string <tt>string</tt> so that the first letter of each word is uppercase and every other letter is lowercase. The function has an alias called &#x201c;title&#x201d;.</p>
1756</li>
1757<li>Arguments:
1758<ul>
1759
1760<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
1761</ul>
1762</li>
1763<li>Return Value:
1764<ul>
1765
1766<li>a <tt>string</tt> as the title form of the given <tt>string</tt>,</li>
1767<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1768<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1769<li>any other non-string input value will cause a type error.</li>
1770</ul>
1771</li>
1772<li>
1773
1774<p>Example:</p>
1775
1776<div>
1777<div>
1778<pre class="source">{ &quot;v1&quot;: initcap(&quot;ASTERIXDB is here!&quot;), &quot;v2&quot;: title(&quot;ASTERIXDB is here!&quot;) };
1779</pre></div></div>
1780</li>
1781<li>
1782
1783<p>The expected result is:</p>
1784
1785<div>
1786<div>
1787<pre class="source">{ &quot;v1&quot;: &quot;Asterixdb Is Here!&quot;, &quot;v2&quot;: &quot;Asterixdb Is Here!&quot; }
1788</pre></div></div>
1789</li>
1790</ul></div>
1791<div class="section">
1792<h3><a name="length"></a>length</h3>
1793<ul>
1794
1795<li>
1796
1797<p>Syntax:</p>
1798
1799<div>
1800<div>
1801<pre class="source">length(string)
1802</pre></div></div>
1803</li>
1804<li>
1805
1806<p>Returns the length of the string <tt>string</tt>. Note that the length is in the unit of code point. See the following examples for more details.</p>
1807</li>
1808<li>Arguments:
1809<ul>
1810
1811<li><tt>string</tt> : a <tt>string</tt> or <tt>null</tt> that represents the string to be checked.</li>
1812</ul>
1813</li>
1814<li>Return Value:
1815<ul>
1816
1817<li>an <tt>bigint</tt> that represents the length of <tt>string</tt>,</li>
1818<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1819<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1820<li>any other non-string input value will cause a type error.</li>
1821</ul>
1822</li>
1823<li>
1824
1825<p>Example:</p>
1826
1827<div>
1828<div>
1829<pre class="source">length(&quot;test string&quot;);
1830</pre></div></div>
1831</li>
1832<li>
1833
1834<p>The expected result is:</p>
1835
1836<div>
1837<div>
1838<pre class="source">11
1839</pre></div></div>
1840</li>
1841<li>
1842
1843<p>Example:</p>
1844
1845<div>
1846<div>
1847<pre class="source">length(&quot;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;);
1848</pre></div></div>
1849</li>
1850<li>
1851
1852<p>The expected result is (the emoji character &#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466; has 7 code points):</p>
1853
1854<div>
1855<div>
1856<pre class="source">7
1857</pre></div></div>
1858</li>
1859</ul></div>
1860<div class="section">
1861<h3><a name="lower"></a>lower</h3>
1862<ul>
1863
1864<li>
1865
1866<p>Syntax:</p>
1867
1868<div>
1869<div>
1870<pre class="source">lower(string)
1871</pre></div></div>
1872</li>
1873<li>
1874
1875<p>Converts a given string <tt>string</tt> to its lowercase form.</p>
1876</li>
1877<li>Arguments:
1878<ul>
1879
1880<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
1881</ul>
1882</li>
1883<li>Return Value:
1884<ul>
1885
1886<li>a <tt>string</tt> as the lowercase form of the given <tt>string</tt>,</li>
1887<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1888<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1889<li>any other non-string input value will cause a type error.</li>
1890</ul>
1891</li>
1892<li>
1893
1894<p>Example:</p>
1895
1896<div>
1897<div>
1898<pre class="source">lower(&quot;ASTERIXDB&quot;);
1899</pre></div></div>
1900</li>
1901<li>
1902
1903<p>The expected result is:</p>
1904
1905<div>
1906<div>
1907<pre class="source">&quot;asterixdb&quot;
1908</pre></div></div>
1909</li>
1910</ul></div>
1911<div class="section">
1912<h3><a name="ltrim"></a>ltrim</h3>
1913<ul>
1914
1915<li>
1916
1917<p>Syntax:</p>
1918
1919<div>
1920<div>
1921<pre class="source">ltrim(string[, chars]);
1922</pre></div></div>
1923</li>
1924<li>
1925
1926<p>Returns a new string with all leading characters that appear in <tt>chars</tt> removed. By default, white space is the character to trim. Note that here one character means one code point. For example, the emoji 4-people-family notation &#x201c;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x201d; contains 7 code points, and it is possible to trim a few code points (such as a 2-people-family &#x201c;&#x1f468;&#x200d;&#x1f466;&#x201d;) from it. See the following example for more details.</p>
1927</li>
1928<li>Arguments:
1929<ul>
1930
1931<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
1932<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
1933</ul>
1934</li>
1935<li>Return Value:
1936<ul>
1937
1938<li>a trimmed, new <tt>string</tt>,</li>
1939<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
1940<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
1941<li>any other non-string input value will cause a type error.</li>
1942</ul>
1943</li>
1944<li>Related functions: see <tt>trim()</tt>, <tt>rtrim()</tt></li>
1945<li>
1946
1947<p>Example:</p>
1948
1949<div>
1950<div>
1951<pre class="source">ltrim(&quot;me like x-phone&quot;, &quot;eml&quot;);
1952</pre></div></div>
1953</li>
1954<li>
1955
1956<p>The expected result is:</p>
1957
1958<div>
1959<div>
1960<pre class="source">&quot; like x-phone&quot;
1961</pre></div></div>
1962</li>
1963<li>
1964
1965<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
1966
1967<div>
1968<div>
1969<pre class="source">ltrim(&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;, &quot;&#x1f468;&#x200d;&#x1f466;&quot;)
1970</pre></div></div>
1971</li>
1972<li>
1973
1974<p>The expected result is (only woman, girl and boy are left in the family):</p>
1975
1976<div>
1977<div>
1978<pre class="source">&quot;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;
1979</pre></div></div>
1980</li>
1981</ul></div>
1982<div class="section">
1983<h3><a name="position"></a>position</h3>
1984<ul>
1985
1986<li>
1987
1988<p>Syntax:</p>
1989
1990<div>
1991<div>
1992<pre class="source">position(string, string_pattern)
1993</pre></div></div>
1994</li>
1995<li>
1996
1997<p>Returns the first position of <tt>string_pattern</tt> within <tt>string</tt>. The result is counted in the unit of code points. See the following example for more details.</p>
1998</li>
1999<li>
2000
2001<p>The function returns the 0-based position. Another version of the function returns the 1-based position. Below are the aliases for each version:</p>
2002<ul>
2003
2004<li>0-based: <tt>position</tt>, <tt>pos</tt>, <tt>position0</tt>, <tt>pos0</tt>.</li>
2005<li>1-based: <tt>position1</tt>, <tt>pos1</tt>.</li>
2006</ul>
2007</li>
2008<li>
2009
2010<p>Arguments:</p>
2011<ul>
2012
2013<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
2014<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
2015</ul>
2016</li>
2017<li>Return Value:
2018<ul>
2019
2020<li>the first position that <tt>string_pattern</tt> appears within <tt>string</tt> (starting at 0), or -1 if it does not appear,</li>
2021<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2022<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2023<li>any other non-string input value will return a <tt>null</tt>.</li>
2024</ul>
2025</li>
2026<li>
2027
2028<p>Example:</p>
2029
2030<div>
2031<div>
2032<pre class="source">{
2033 &quot;v1&quot;: position(&quot;ppphonepp&quot;, &quot;phone&quot;),
2034 &quot;v2&quot;: position(&quot;hone&quot;, &quot;phone&quot;),
2035 &quot;v3&quot;: position1(&quot;ppphonepp&quot;, &quot;phone&quot;),
2036 &quot;v4&quot;: position1(&quot;hone&quot;, &quot;phone&quot;)
2037};
2038</pre></div></div>
2039</li>
2040<li>
2041
2042<p>The expected result is:</p>
2043
2044<div>
2045<div>
2046<pre class="source">{ &quot;v1&quot;: 2, &quot;v2&quot;: -1, v3&quot;: 3, &quot;v4&quot;: -1 }
2047</pre></div></div>
2048</li>
2049<li>
2050
2051<p>Example of multi-code-point character:</p>
2052
2053<div>
2054<div>
2055<pre class="source">position(&quot;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x1f3c0;&quot;, &quot;&#x1f3c0;&quot;);
2056</pre></div></div>
2057</li>
2058<li>
2059
2060<p>The expected result is (the emoji family character has 7 code points):</p>
2061
2062<div>
2063<div>
2064<pre class="source">7
2065</pre></div></div>
2066</li>
2067</ul></div>
2068<div class="section">
2069<h3><a name="regexp_contains"></a>regexp_contains</h3>
2070<ul>
2071
2072<li>
2073
2074<p>Syntax:</p>
2075
2076<div>
2077<div>
2078<pre class="source">regexp_contains(string, string_pattern[, string_flags])
2079</pre></div></div>
2080</li>
2081<li>
2082
2083<p>Checks whether the strings <tt>string</tt> contains the regular expression pattern <tt>string_pattern</tt> (a Java regular expression pattern).</p>
2084</li>
2085<li>
2086
2087<p>Aliases:</p>
2088<ul>
2089
2090<li><tt>regexp_contains</tt>, <tt>regex_contains</tt>, <tt>contains_regexp</tt>, <tt>contains_regex</tt>.</li>
2091</ul>
2092</li>
2093<li>
2094
2095<p>Arguments:</p>
2096<ul>
2097
2098<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
2099<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
2100<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
2101<ul>
2102
2103<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
2104</ul>
2105</li>
2106</ul>
2107</li>
2108<li>Return Value:
2109<ul>
2110
2111<li>a <tt>boolean</tt>, returns <tt>true</tt> if <tt>string</tt> contains the pattern <tt>string_pattern</tt>, <tt>false</tt> otherwise.</li>
2112<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
2113<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
2114<li>any other non-string input value will return a <tt>null</tt>.</li>
2115</ul>
2116</li>
2117<li>
2118
2119<p>Example:</p>
2120
2121<div>
2122<div>
2123<pre class="source">{
2124 &quot;v1&quot;: regexp_contains(&quot;pphonepp&quot;, &quot;p*hone&quot;),
2125 &quot;v2&quot;: regexp_contains(&quot;hone&quot;, &quot;p+hone&quot;)
2126};
2127</pre></div></div>
2128</li>
2129<li>
2130
2131<p>The expected result is:</p>
2132
2133<div>
2134<div>
2135<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
2136</pre></div></div>
2137</li>
2138</ul></div>
2139<div class="section">
2140<h3><a name="regexp_like"></a>regexp_like</h3>
2141<ul>
2142
2143<li>
2144
2145<p>Syntax:</p>
2146
2147<div>
2148<div>
2149<pre class="source">regexp_like(string, string_pattern[, string_flags])
2150</pre></div></div>
2151</li>
2152<li>
2153
2154<p>Checks whether the string <tt>string</tt> exactly matches the regular expression pattern <tt>string_pattern</tt> (a Java regular expression pattern).</p>
2155</li>
2156<li>
2157
2158<p>Aliases:</p>
2159<ul>
2160
2161<li><tt>regexp_like</tt>, <tt>regex_like</tt>.</li>
2162</ul>
2163</li>
2164<li>
2165
2166<p>Arguments:</p>
2167<ul>
2168
2169<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
2170<li><tt>string_pattern</tt> : a pattern <tt>string</tt> that might be contained.</li>
2171<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
2172<ul>
2173
2174<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
2175</ul>
2176</li>
2177</ul>
2178</li>
2179<li>Return Value:
2180<ul>
2181
2182<li>a <tt>boolean</tt> value, <tt>true</tt> if <tt>string</tt> contains the pattern <tt>string_pattern</tt>, <tt>false</tt> otherwise.</li>
2183<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
2184<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
2185<li>any other non-string input value will return a <tt>null</tt>.</li>
2186</ul>
2187</li>
2188<li>
2189
2190<p>Example:</p>
2191
2192<div>
2193<div>
2194<pre class="source">{
2195 &quot;v1&quot;: regexp_like(&quot; can't stand acast the network is horrible:(&quot;, &quot;.*acast.*&quot;),
2196 &quot;v2&quot;: regexp_like(&quot;acast&quot;, &quot;.*acst.*&quot;)
2197};
2198</pre></div></div>
2199</li>
2200<li>
2201
2202<p>The expected result is:</p>
2203
2204<div>
2205<div>
2206<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
2207</pre></div></div>
2208</li>
2209</ul></div>
2210<div class="section">
2211<h3><a name="regexp_position"></a>regexp_position</h3>
2212<ul>
2213
2214<li>
2215
2216<p>Syntax:</p>
2217
2218<div>
2219<div>
2220<pre class="source">regexp_position(string, string_pattern[, string_flags])
2221</pre></div></div>
2222</li>
2223<li>
2224
2225<p>Returns first position of the regular expression <tt>string_pattern</tt> (a Java regular expression pattern) within <tt>string</tt>. The function returns the 0-based position. Another version of the function returns the 1-based position. Below are the aliases for each version:</p>
2226</li>
2227<li>
2228
2229<p>Aliases:</p>
2230<ul>
2231
2232<li>0-Based: <tt>regexp_position</tt>, <tt>regexp_pos</tt>, <tt>regexp_position0</tt>, <tt>regexp_pos0</tt>, <tt>regex_position</tt>, <tt>regex_pos</tt>, <tt>regex_position0</tt>, <tt>regex_pos0</tt>.</li>
2233<li>1-Based: <tt>regexp_position1</tt>, <tt>regexp_pos1</tt>, <tt>regex_position1</tt> <tt>regex_pos1</tt>.</li>
2234</ul>
2235</li>
2236<li>
2237
2238<p>Arguments:</p>
2239<ul>
2240
2241<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
2242<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
2243<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
2244<ul>
2245
2246<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
2247</ul>
2248</li>
2249</ul>
2250</li>
2251<li>Return Value:
2252<ul>
2253
2254<li>the first position that the regular expression <tt>string_pattern</tt> appears in <tt>string</tt> (starting at 0), or -1 if it does not appear.</li>
2255<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2256<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2257<li>any other non-string input value will return a <tt>null</tt>.</li>
2258</ul>
2259</li>
2260<li>
2261
2262<p>Example:</p>
2263
2264<div>
2265<div>
2266<pre class="source">{
2267 &quot;v1&quot;: regexp_position(&quot;pphonepp&quot;, &quot;p*hone&quot;),
2268 &quot;v2&quot;: regexp_position(&quot;hone&quot;, &quot;p+hone&quot;),
2269 &quot;v3&quot;: regexp_position1(&quot;pphonepp&quot;, &quot;p*hone&quot;),
2270 &quot;v4&quot;: regexp_position1(&quot;hone&quot;, &quot;p+hone&quot;)
2271};
2272</pre></div></div>
2273</li>
2274<li>
2275
2276<p>The expected result is:</p>
2277
2278<div>
2279<div>
2280<pre class="source">{ &quot;v1&quot;: 0, &quot;v2&quot;: -1, &quot;v3&quot;: 1, &quot;v4&quot;: -1 }
2281</pre></div></div>
2282</li>
2283</ul></div>
2284<div class="section">
2285<h3><a name="regexp_replace"></a>regexp_replace</h3>
2286<ul>
2287
2288<li>
2289
2290<p>Syntax:</p>
2291
2292<div>
2293<div>
2294<pre class="source">regexp_replace(string, string_pattern, string_replacement[, string_flags])
2295regexp_replace(string, string_pattern, string_replacement[, replacement_limit])
2296</pre></div></div>
2297</li>
2298<li>
2299
2300<p>Checks whether the string <tt>string</tt> matches the given regular expression pattern <tt>string_pattern</tt> (a Java regular expression pattern), and replaces the matched pattern <tt>string_pattern</tt> with the new pattern <tt>string_replacement</tt>.</p>
2301</li>
2302<li>
2303
2304<p>Aliases:</p>
2305<ul>
2306
2307<li><tt>regexp_replace</tt>, <tt>regex_replace</tt>.</li>
2308</ul>
2309</li>
2310<li>
2311
2312<p>Arguments:</p>
2313<ul>
2314
2315<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
2316<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
2317<li><tt>string_replacement</tt> : a pattern <tt>string</tt> to be used as the replacement.</li>
2318<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during replace.
2319<ul>
2320
2321<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
2322</ul>
2323</li>
2324<li><tt>replacement_limit</tt>: (Optional) an <tt>integer</tt> specifying the maximum number of replacements to make (if negative then all occurrences will be replaced)</li>
2325</ul>
2326</li>
2327<li>Return Value:
2328<ul>
2329
2330<li>Returns a <tt>string</tt> that is obtained after the replacements.</li>
2331<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
2332<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
2333<li>any other non-string input value will return a <tt>null</tt>.</li>
2334</ul>
2335</li>
2336<li>
2337
2338<p>Example:</p>
2339
2340<div>
2341<div>
2342<pre class="source">regexp_replace(&quot; like x-phone the voicemail_service is awesome&quot;, &quot; like x-phone&quot;, &quot;like product-a&quot;);
2343</pre></div></div>
2344</li>
2345<li>
2346
2347<p>The expected result is:</p>
2348
2349<div>
2350<div>
2351<pre class="source">&quot;like product-a the voicemail_service is awesome&quot;
2352</pre></div></div>
2353</li>
2354</ul></div>
2355<div class="section">
2356<h3><a name="repeat"></a>repeat</h3>
2357<ul>
2358
2359<li>
2360
2361<p>Syntax:</p>
2362
2363<div>
2364<div>
2365<pre class="source">repeat(string, n)
2366</pre></div></div>
2367</li>
2368<li>
2369
2370<p>Returns a string formed by repeating the input <tt>string</tt> <tt>n</tt> times.</p>
2371</li>
2372<li>Arguments:
2373<ul>
2374
2375<li><tt>string</tt> : a <tt>string</tt> to be repeated,</li>
2376<li><tt>n</tt> : an <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value - how many times the string should be repeated.</li>
2377</ul>
2378</li>
2379<li>Return Value:
2380<ul>
2381
2382<li>a string that repeats the input <tt>string</tt> <tt>n</tt> times,</li>
2383<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2384<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2385<li>a type error will be raised if:
2386<ul>
2387
2388<li>the first argument is any other non-string value,</li>
2389<li>or, the second argument is not a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt>.</li>
2390</ul>
2391</li>
2392</ul>
2393</li>
2394<li>
2395
2396<p>Example:</p>
2397
2398<div>
2399<div>
2400<pre class="source">repeat(&quot;test&quot;, 3);
2401</pre></div></div>
2402</li>
2403<li>
2404
2405<p>The expected result is:</p>
2406
2407<div>
2408<div>
2409<pre class="source">&quot;testtesttest&quot;
2410</pre></div></div>
2411</li>
2412</ul></div>
2413<div class="section">
2414<h3><a name="replace"></a>replace</h3>
2415<ul>
2416
2417<li>
2418
2419<p>Syntax:</p>
2420
2421<div>
2422<div>
2423<pre class="source">replace(string, search_string, replacement_string[, limit])
2424</pre></div></div>
2425</li>
2426<li>
2427
2428<p>Finds occurrences of the given substring <tt>search_string</tt> in the input string <tt>string</tt> and replaces them with the new substring <tt>replacement_string</tt>.</p>
2429</li>
2430<li>Arguments:
2431<ul>
2432
2433<li><tt>string</tt> : an input <tt>string</tt>,</li>
2434<li><tt>search_string</tt> : a <tt>string</tt> substring to be searched for,</li>
2435<li><tt>replacement_string</tt> : a <tt>string</tt> to be used as the replacement,</li>
2436<li><tt>limit</tt> : (Optional) an <tt>integer</tt> - maximum number of occurrences to be replaced. If not specified or negative then all occurrences will be replaced</li>
2437</ul>
2438</li>
2439<li>Return Value:
2440<ul>
2441
2442<li>Returns a <tt>string</tt> that is obtained after the replacements,</li>
2443<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2444<li>any other non-string input value or non-integer <tt>limit</tt> will cause a type error,</li>
2445<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
2446</ul>
2447</li>
2448<li>
2449
2450<p>Example:</p>
2451
2452<div>
2453<div>
2454<pre class="source">{
2455 &quot;v1&quot;: replace(&quot; like x-phone the voicemail_service is awesome&quot;, &quot; like x-phone&quot;, &quot;like product-a&quot;),
2456 &quot;v2&quot;: replace(&quot;x-phone and x-phone&quot;, &quot;x-phone&quot;, &quot;product-a&quot;, 1)
2457};
2458</pre></div></div>
2459</li>
2460<li>
2461
2462<p>The expected result is:</p>
2463
2464<div>
2465<div>
2466<pre class="source">{
2467 &quot;v1&quot;: &quot;like product-a the voicemail_service is awesome&quot;,
2468 &quot;v2&quot;: &quot;product-a and x-phone&quot;
2469}
2470</pre></div></div>
2471</li>
2472</ul></div>
2473<div class="section">
2474<h3><a name="reverse"></a>reverse</h3>
2475<ul>
2476
2477<li>
2478
2479<p>Syntax:</p>
2480
2481<div>
2482<div>
2483<pre class="source">reverse(string)
2484</pre></div></div>
2485</li>
2486<li>
2487
2488<p>Returns a string formed by reversing characters in the input <tt>string</tt>. For characters of multiple code points, code point is the minimal unit to reverse. See the following examples for more details.</p>
2489</li>
2490<li>Arguments:
2491<ul>
2492
2493<li><tt>string</tt> : a <tt>string</tt> to be reversed</li>
2494</ul>
2495</li>
2496<li>Return Value:
2497<ul>
2498
2499<li>a string containing characters from the the input <tt>string</tt> in the reverse order,</li>
2500<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2501<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2502<li>a type error will be raised if:
2503<ul>
2504
2505<li>the first argument is any other non-string value</li>
2506</ul>
2507</li>
2508</ul>
2509</li>
2510<li>
2511
2512<p>Example:</p>
2513
2514<div>
2515<div>
2516<pre class="source">reverse(&quot;hello&quot;);
2517</pre></div></div>
2518</li>
2519<li>
2520
2521<p>The expected result is:</p>
2522
2523<div>
2524<div>
2525<pre class="source">&quot;olleh&quot;
2526</pre></div></div>
2527</li>
2528<li>
2529
2530<p>Example of multi-code-point character (Korean):</p>
2531
2532<div>
2533<div>
2534<pre class="source">reverse(&quot;&#x1112;&#x1161;&#x11ab;&#x1100;&#x1173;&#x11af;&quot;);
2535</pre></div></div>
2536</li>
2537<li>
2538
2539<p>The expected result is (the Korean characters are splitted into code points and then the code points are reversed):</p>
2540
2541<div>
2542<div>
2543<pre class="source">&quot;&#x11af;&#x1173;&#x1100;&#x11ab;&#x1161;&#x1112;&quot;
2544</pre></div></div>
2545</li>
2546</ul></div>
2547<div class="section">
2548<h3><a name="rtrim"></a>rtrim</h3>
2549<ul>
2550
2551<li>
2552
2553<p>Syntax:</p>
2554
2555<div>
2556<div>
2557<pre class="source">rtrim(string[, chars]);
2558</pre></div></div>
2559</li>
2560<li>
2561
2562<p>Returns a new string with all trailing characters that appear in <tt>chars</tt> removed. By default, white space is the character to trim. Note that here one character means one code point. For example, the emoji 4-people-family notation &#x201c;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x201d; contains 7 code points, and it is possible to trim a few code points (such as a 2-people-family &#x201c;&#x1f468;&#x200d;&#x1f466;&#x201d;) from it. See the following example for more details.</p>
2563</li>
2564<li>Arguments:
2565<ul>
2566
2567<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
2568<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
2569</ul>
2570</li>
2571<li>Return Value:
2572<ul>
2573
2574<li>a trimmed, new <tt>string</tt>,</li>
2575<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2576<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2577<li>any other non-string input value will cause a type error.</li>
2578</ul>
2579</li>
2580<li>Related functions: see <tt>trim()</tt>, <tt>ltrim()</tt></li>
2581<li>
2582
2583<p>Example:</p>
2584
2585<div>
2586<div>
2587<pre class="source">{
2588 &quot;v1&quot;: rtrim(&quot;i like x-phone&quot;, &quot;x-phone&quot;),
2589 &quot;v2&quot;: rtrim(&quot;i like x-phone&quot;, &quot;onexph&quot;)
2590};
2591</pre></div></div>
2592</li>
2593<li>
2594
2595<p>The expected result is:</p>
2596
2597<div>
2598<div>
2599<pre class="source">{ &quot;v1&quot;: &quot;i like &quot;, &quot;v2&quot;: &quot;i like x-&quot; }
2600</pre></div></div>
2601</li>
2602<li>
2603
2604<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
2605
2606<div>
2607<div>
2608<pre class="source">rtrim(&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;, &quot;&#x1f468;&#x200d;&#x1f466;&quot;)
2609</pre></div></div>
2610</li>
2611<li>
2612
2613<p>The expected result is (only man, woman and girl are left in the family):</p>
2614
2615<div>
2616<div>
2617<pre class="source">&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&quot;
2618</pre></div></div>
2619</li>
2620</ul></div>
2621<div class="section">
2622<h3><a name="split"></a>split</h3>
2623<ul>
2624
2625<li>
2626
2627<p>Syntax:</p>
2628
2629<div>
2630<div>
2631<pre class="source">split(string, sep)
2632</pre></div></div>
2633</li>
2634<li>
2635
2636<p>Splits the input <tt>string</tt> into an array of substrings separated by the string <tt>sep</tt>.</p>
2637</li>
2638<li>Arguments:
2639<ul>
2640
2641<li><tt>string</tt> : a <tt>string</tt> to be split.</li>
2642</ul>
2643</li>
2644<li>Return Value:
2645<ul>
2646
2647<li>an array of substrings by splitting the input <tt>string</tt> by <tt>sep</tt>,</li>
2648<li>in case of two consecutive <tt>sep</tt>s in the <tt>string</tt>, the result of splitting the two consecutive <tt>sep</tt>s will be the empty string <tt>&quot;&quot;</tt>,</li>
2649<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
2650<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
2651<li>any other non-string input value will cause a type error.</li>
2652</ul>
2653</li>
2654<li>
2655
2656<p>Example:</p>
2657
2658<div>
2659<div>
2660<pre class="source">split(&quot;test driven development&quot;, &quot; &quot;);
2661</pre></div></div>
2662</li>
2663<li>
2664
2665<p>The expected result is:</p>
2666
2667<div>
2668<div>
2669<pre class="source">[ &quot;test&quot;, &quot;driven&quot;, &quot;development&quot; ]
2670</pre></div></div>
2671</li>
2672<li>
2673
2674<p>Example with two consecutive <tt>sep</tt>s in the <tt>string</tt>:</p>
2675
2676<div>
2677<div>
2678<pre class="source">split(&quot;123//456&quot;, &quot;/&quot;);
2679</pre></div></div>
2680</li>
2681<li>
2682
2683<p>The expected result is:</p>
2684
2685<div>
2686<div>
2687<pre class="source">[ &quot;123&quot;, &quot;&quot;, &quot;456&quot; ]
2688</pre></div></div>
2689</li>
2690</ul></div>
2691<div class="section">
2692<h3><a name="starts_with"></a>starts_with</h3>
2693<ul>
2694
2695<li>
2696
2697<p>Syntax:</p>
2698
2699<div>
2700<div>
2701<pre class="source">starts_with(string, substring_to_start_with)
2702</pre></div></div>
2703</li>
2704<li>
2705
2706<p>Checks whether the string <tt>string</tt> starts with the string <tt>substring_to_start_with</tt>.</p>
2707</li>
2708<li>Arguments:
2709<ul>
2710
2711<li><tt>string</tt> : a <tt>string</tt> that might start with the given string.</li>
2712<li><tt>substring_to_start_with</tt> : a <tt>string</tt> that might be contained as the starting substring.</li>
2713</ul>
2714</li>
2715<li>Return Value:
2716<ul>
2717
2718<li>a <tt>boolean</tt>, returns <tt>true</tt> if <tt>string</tt> starts with the string <tt>substring_to_start_with</tt>,</li>
2719<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2720<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2721<li>any other non-string input value will cause a type error,</li>
2722<li><tt>false</tt> otherwise.</li>
2723</ul>
2724</li>
2725<li>
2726
2727<p>Example:</p>
2728
2729<div>
2730<div>
2731<pre class="source">{
2732 &quot;v1&quot; : starts_with(&quot; like the plan, amazing&quot;, &quot; like&quot;),
2733 &quot;v2&quot; : starts_with(&quot;I like the plan, amazing&quot;, &quot; like&quot;)
2734};
2735</pre></div></div>
2736</li>
2737<li>
2738
2739<p>The expected result is:</p>
2740
2741<div>
2742<div>
2743<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
2744</pre></div></div>
2745</li>
2746</ul></div>
2747<div class="section">
2748<h3><a name="substr"></a>substr</h3>
2749<ul>
2750
2751<li>
2752
2753<p>Syntax:</p>
2754
2755<div>
2756<div>
2757<pre class="source">substr(string, offset[, length])
2758</pre></div></div>
2759</li>
2760<li>
2761
2762<p>Returns the substring from the given string <tt>string</tt> based on the given start offset <tt>offset</tt> with the optional <tt>length</tt>. Note that both of the <tt>offset</tt> and <tt>length</tt> are in the unit of code point (e.g. the emoji family &#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466; has 7 code points). The function uses the 0-based position. Another version of the function uses the 1-based position. Below are the aliases for each version:</p>
2763</li>
2764<li>
2765
2766<p>Aliases:</p>
2767<ul>
2768
2769<li>0-Based: <tt>substring</tt>, <tt>substr</tt>, <tt>substring0</tt>, <tt>substr0</tt>.</li>
2770<li>1-Based: <tt>substring1</tt>, <tt>substr1</tt>.</li>
2771</ul>
2772</li>
2773<li>
2774
2775<p>Arguments:</p>
2776<ul>
2777
2778<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
2779<li><tt>offset</tt> : an <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value as the starting offset of the substring in <tt>string</tt> (starting at 0). If negative then counted from the end of the string.</li>
2780<li><tt>length</tt> : (Optional) an an <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value as the length of the substring.</li>
2781</ul>
2782</li>
2783<li>Return Value:
2784<ul>
2785
2786<li>a <tt>string</tt> that represents the substring,</li>
2787<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2788<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value, or if the substring could not be obtained because the starting offset is not within string bounds or <tt>length</tt> is negative.</li>
2789<li>a <tt>null</tt> will be returned if:
2790<ul>
2791
2792<li>the first argument is any other non-string value.</li>
2793<li>the second argument is not a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt>.</li>
2794<li>the third argument is not a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt> if the argument is present.</li>
2795</ul>
2796</li>
2797</ul>
2798</li>
2799<li>
2800
2801<p>Example:</p>
2802
2803<div>
2804<div>
2805<pre class="source">{ &quot;v1&quot;: substr(&quot;test string&quot;, 6, 3), &quot;v2&quot;: substr1(&quot;test string&quot;, 6, 3) };
2806</pre></div></div>
2807</li>
2808<li>
2809
2810<p>The expected result is:</p>
2811
2812<div>
2813<div>
2814<pre class="source">{ &quot;v1&quot;: &quot;tri&quot;, &quot;v2&quot;: &quot;str&quot; }
2815</pre></div></div>
2816</li>
2817</ul>
2818<p>The function has an alias <tt>substring</tt>.</p></div>
2819<div class="section">
2820<h3><a name="trim"></a>trim</h3>
2821<ul>
2822
2823<li>
2824
2825<p>Syntax:</p>
2826
2827<div>
2828<div>
2829<pre class="source">trim(string[, chars]);
2830</pre></div></div>
2831</li>
2832<li>
2833
2834<p>Returns a new string with all leading and trailing characters that appear in <tt>chars</tt> removed. By default, white space is the character to trim. Note that here one character means one code point. For example, the emoji 4-people-family notation &#x201c;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x201d; contains 7 code points, and it is possible to trim a few code points (such as a 2-people-family &#x201c;&#x1f468;&#x200d;&#x1f466;&#x201d;) from it. See the following example for more details.</p>
2835</li>
2836<li>Arguments:
2837<ul>
2838
2839<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
2840<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
2841</ul>
2842</li>
2843<li>Return Value:
2844<ul>
2845
2846<li>a trimmed, new <tt>string</tt>,</li>
2847<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2848<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2849<li>any other non-string input value will cause a type error.</li>
2850</ul>
2851</li>
2852<li>Related functions: see <tt>ltrim()</tt>, <tt>rtrim()</tt></li>
2853<li>
2854
2855<p>Example:</p>
2856
2857<div>
2858<div>
2859<pre class="source">trim(&quot;i like x-phone&quot;, &quot;xphoen&quot;);
2860</pre></div></div>
2861</li>
2862<li>
2863
2864<p>The expected result is:</p>
2865
2866<div>
2867<div>
2868<pre class="source">&quot; like &quot;
2869</pre></div></div>
2870</li>
2871<li>
2872
2873<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
2874<p>trim(&#x201c;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x201d;, &#x201c;&#x1f468;&#x200d;&#x1f466;&#x201d;)</p>
2875</li>
2876<li>
2877
2878<p>The expected result is (only woman and girl are left in the family):</p>
2879
2880<div>
2881<div>
2882<pre class="source"> &quot;&#x1f469;&#x200d;&#x1f467;&quot;
2883</pre></div></div>
2884</li>
2885</ul></div>
2886<div class="section">
2887<h3><a name="upper"></a>upper</h3>
2888<ul>
2889
2890<li>
2891
2892<p>Syntax:</p>
2893
2894<div>
2895<div>
2896<pre class="source">upper(string)
2897</pre></div></div>
2898</li>
2899<li>
2900
2901<p>Converts a given string <tt>string</tt> to its uppercase form.</p>
2902</li>
2903<li>Arguments:
2904<ul>
2905
2906<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
2907</ul>
2908</li>
2909<li>Return Value:
2910<ul>
2911
2912<li>a <tt>string</tt> as the uppercase form of the given <tt>string</tt>,</li>
2913<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
2914<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
2915<li>any other non-string input value will cause a type error.</li>
2916</ul>
2917</li>
2918<li>
2919
2920<p>Example:</p>
2921
2922<div>
2923<div>
2924<pre class="source">upper(&quot;hello&quot;)
2925</pre></div></div>
2926</li>
2927<li>
2928
2929<p>The expected result is:</p>
2930
2931<div>
2932<div>
2933<pre class="source">&quot;HELLO&quot;
2934</pre></div></div>
2935</li>
2936</ul><!--
2937 ! Licensed to the Apache Software Foundation (ASF) under one
2938 ! or more contributor license agreements. See the NOTICE file
2939 ! distributed with this work for additional information
2940 ! regarding copyright ownership. The ASF licenses this file
2941 ! to you under the Apache License, Version 2.0 (the
2942 ! "License"); you may not use this file except in compliance
2943 ! with the License. You may obtain a copy of the License at
2944 !
2945 ! http://www.apache.org/licenses/LICENSE-2.0
2946 !
2947 ! Unless required by applicable law or agreed to in writing,
2948 ! software distributed under the License is distributed on an
2949 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
2950 ! KIND, either express or implied. See the License for the
2951 ! specific language governing permissions and limitations
2952 ! under the License.
2953 !-->
2954</div>
2955<div class="section">
2956<h3><a name="string_concat"></a>string_concat</h3>
2957<ul>
2958
2959<li>
2960
2961<p>Syntax:</p>
2962
2963<div>
2964<div>
2965<pre class="source">string_concat(array)
2966</pre></div></div>
2967</li>
2968<li>
2969
2970<p>Concatenates an array of strings <tt>array</tt> into a single string.</p>
2971</li>
2972<li>Arguments:
2973<ul>
2974
2975<li><tt>array</tt> : an <tt>array</tt> or <tt>multiset</tt> of <tt>string</tt>s (could be <tt>null</tt> or <tt>missing</tt>) to be concatenated.</li>
2976</ul>
2977</li>
2978<li>Return Value:
2979<ul>
2980
2981<li>the concatenated <tt>string</tt> value,</li>
2982<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
2983<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2984<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
2985<li><tt>null</tt> if any element in the input array is <tt>null</tt> but no element in the input array is <tt>missing</tt>,</li>
2986<li>any other non-array input value or non-integer element in the input array will cause a type error.</li>
2987</ul>
2988</li>
2989<li>
2990
2991<p>Example:</p>
2992
2993<div>
2994<div>
2995<pre class="source">string_concat([&quot;ASTERIX&quot;, &quot; &quot;, &quot;ROCKS!&quot;]);
2996</pre></div></div>
2997</li>
2998<li>
2999
3000<p>The expected result is:</p>
3001
3002<div>
3003<div>
3004<pre class="source">&quot;ASTERIX ROCKS!&quot;
3005</pre></div></div>
3006</li>
3007</ul></div>
3008<div class="section">
3009<h3><a name="string_join"></a>string_join</h3>
3010<ul>
3011
3012<li>
3013
3014<p>Syntax:</p>
3015
3016<div>
3017<div>
3018<pre class="source">string_join(array, string)
3019</pre></div></div>
3020</li>
3021<li>
3022
3023<p>Joins an array or multiset of strings <tt>array</tt> with the given separator <tt>string</tt> into a single string.</p>
3024</li>
3025<li>Arguments:
3026<ul>
3027
3028<li><tt>array</tt> : an <tt>array</tt> or <tt>multiset</tt> of strings (could be <tt>null</tt>) to be joined.</li>
3029<li><tt>string</tt> : a <tt>string</tt> to serve as the separator.</li>
3030</ul>
3031</li>
3032<li>Return Value:
3033<ul>
3034
3035<li>the joined <tt>string</tt>,</li>
3036<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3037<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3038<li><tt>missing</tt> if the first argument array contains a <tt>missing</tt>,</li>
3039<li><tt>null</tt> if the first argument array contains a <tt>null</tt> but does not contain a <tt>missing</tt>,</li>
3040<li>a type error will be raised if:
3041<ul>
3042
3043<li>the first argument is any other non-array value, or contains any other non-string value,</li>
3044<li>or, the second argument is any other non-string value.</li>
3045</ul>
3046</li>
3047</ul>
3048</li>
3049<li>
3050
3051<p>Example:</p>
3052
3053<div>
3054<div>
3055<pre class="source">string_join([&quot;ASTERIX&quot;, &quot;ROCKS~&quot;], &quot;!! &quot;);
3056</pre></div></div>
3057</li>
3058<li>
3059
3060<p>The expected result is:</p>
3061
3062<div>
3063<div>
3064<pre class="source">&quot;ASTERIX!! ROCKS~&quot;
3065</pre></div></div>
3066</li>
3067</ul></div>
3068<div class="section">
3069<h3><a name="string_to_codepoint"></a>string_to_codepoint</h3>
3070<ul>
3071
3072<li>
3073
3074<p>Syntax:</p>
3075
3076<div>
3077<div>
3078<pre class="source">string_to_codepoint(string)
3079</pre></div></div>
3080</li>
3081<li>
3082
3083<p>Converts the string <tt>string</tt> to its code_based representation.</p>
3084</li>
3085<li>Arguments:
3086<ul>
3087
3088<li><tt>string</tt> : a <tt>string</tt> that will be converted.</li>
3089</ul>
3090</li>
3091<li>Return Value:
3092<ul>
3093
3094<li>an <tt>array</tt> of the code points for the string <tt>string</tt>,</li>
3095<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3096<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3097<li>any other non-string input value will cause a type error.</li>
3098</ul>
3099</li>
3100<li>
3101
3102<p>Example:</p>
3103
3104<div>
3105<div>
3106<pre class="source">string_to_codepoint(&quot;Hello ASTERIX!&quot;);
3107</pre></div></div>
3108</li>
3109<li>
3110
3111<p>The expected result is:</p>
3112
3113<div>
3114<div>
3115<pre class="source">[ 72, 101, 108, 108, 111, 32, 65, 83, 84, 69, 82, 73, 88, 33 ]
3116</pre></div></div>
3117</li>
3118</ul></div>
3119<div class="section">
3120<h3><a name="codepoint_to_string"></a>codepoint_to_string</h3>
3121<ul>
3122
3123<li>
3124
3125<p>Syntax:</p>
3126
3127<div>
3128<div>
3129<pre class="source">codepoint_to_string(array)
3130</pre></div></div>
3131</li>
3132<li>
3133
3134<p>Converts the ordered code_based representation <tt>array</tt> to the corresponding string.</p>
3135</li>
3136<li>Arguments:
3137<ul>
3138
3139<li><tt>array</tt> : an <tt>array</tt> of integer code_points.</li>
3140</ul>
3141</li>
3142<li>Return Value:
3143<ul>
3144
3145<li>a <tt>string</tt> representation of <tt>array</tt>.</li>
3146<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3147<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3148<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
3149<li><tt>null</tt> if any element in the input array is <tt>null</tt> but no element in the input array is <tt>missing</tt>,</li>
3150<li>any other non-array input value or non-integer element in the input array will cause a type error.</li>
3151</ul>
3152</li>
3153<li>
3154
3155<p>Example:</p>
3156
3157<div>
3158<div>
3159<pre class="source">codepoint_to_string([72, 101, 108, 108, 111, 32, 65, 83, 84, 69, 82, 73, 88, 33]);
3160</pre></div></div>
3161</li>
3162<li>
3163
3164<p>The expected result is:</p>
3165
3166<div>
3167<div>
3168<pre class="source">&quot;Hello ASTERIX!&quot;
3169</pre></div></div>
3170</li>
3171</ul></div>
3172<div class="section">
3173<h3><a name="substring_before"></a>substring_before</h3>
3174<ul>
3175
3176<li>
3177
3178<p>Syntax:</p>
3179
3180<div>
3181<div>
3182<pre class="source">substring_before(string, string_pattern)
3183</pre></div></div>
3184</li>
3185<li>
3186
3187<p>Returns the substring from the given string <tt>string</tt> before the given pattern <tt>string_pattern</tt>.</p>
3188</li>
3189<li>Arguments:
3190<ul>
3191
3192<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
3193<li><tt>string_pattern</tt> : a <tt>string</tt> pattern to be searched.</li>
3194</ul>
3195</li>
3196<li>Return Value:
3197<ul>
3198
3199<li>a <tt>string</tt> that represents the substring,</li>
3200<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3201<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3202<li>any other non-string input value will cause a type error.</li>
3203</ul>
3204</li>
3205<li>
3206
3207<p>Example:</p>
3208
3209<div>
3210<div>
3211<pre class="source">substring_before(&quot; like x-phone&quot;, &quot;x-phone&quot;);
3212</pre></div></div>
3213</li>
3214<li>
3215
3216<p>The expected result is:</p>
3217
3218<div>
3219<div>
3220<pre class="source">&quot; like &quot;
3221</pre></div></div>
3222</li>
3223</ul></div>
3224<div class="section">
3225<h3><a name="substring_after"></a>substring_after</h3>
3226<ul>
3227
3228<li>
3229
3230<p>Syntax:</p>
3231<p>substring_after(string, string_pattern);</p>
3232</li>
3233<li>
3234
3235<p>Returns the substring from the given string <tt>string</tt> after the given pattern <tt>string_pattern</tt>.</p>
3236</li>
3237<li>Arguments:
3238<ul>
3239
3240<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
3241<li><tt>string_pattern</tt> : a <tt>string</tt> pattern to be searched.</li>
3242</ul>
3243</li>
3244<li>Return Value:
3245<ul>
3246
3247<li>a <tt>string</tt> that represents the substring,</li>
3248<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3249<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3250<li>any other non-string input value will cause a type error.</li>
3251</ul>
3252</li>
3253<li>
3254
3255<p>Example:</p>
3256
3257<div>
3258<div>
3259<pre class="source">substring_after(&quot; like x-phone&quot;, &quot;xph&quot;);
3260</pre></div></div>
3261</li>
3262<li>
3263
3264<p>The expected result is:</p>
3265
3266<div>
3267<div>
3268<pre class="source">&quot;one&quot;
3269</pre></div></div>
3270</li>
3271</ul><!--
3272 ! Licensed to the Apache Software Foundation (ASF) under one
3273 ! or more contributor license agreements. See the NOTICE file
3274 ! distributed with this work for additional information
3275 ! regarding copyright ownership. The ASF licenses this file
3276 ! to you under the Apache License, Version 2.0 (the
3277 ! "License"); you may not use this file except in compliance
3278 ! with the License. You may obtain a copy of the License at
3279 !
3280 ! http://www.apache.org/licenses/LICENSE-2.0
3281 !
3282 ! Unless required by applicable law or agreed to in writing,
3283 ! software distributed under the License is distributed on an
3284 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
3285 ! KIND, either express or implied. See the License for the
3286 ! specific language governing permissions and limitations
3287 ! under the License.
3288 !-->
3289</div></div>
3290<div class="section">
3291<h2><a name="Binary_Functions"></a><a name="BinaryFunctions" id="BinaryFunctions">Binary Functions</a></h2>
3292<div class="section">
3293<h3><a name="parse_binary"></a>parse_binary</h3>
3294<ul>
3295
3296<li>
3297
3298<p>Syntax:</p>
3299<p>parse_binary(string, encoding)</p>
3300</li>
3301<li>
3302
3303<p>Creates a <tt>binary</tt> from an string encoded in <tt>encoding</tt> format.</p>
3304</li>
3305<li>Arguments:
3306<ul>
3307
3308<li><tt>string</tt> : an encoded <tt>string</tt>,</li>
3309<li><tt>encoding</tt> : a string notation specifies the encoding type of the given <tt>string</tt>. Currently we support <tt>hex</tt> and <tt>base64</tt> format.</li>
3310</ul>
3311</li>
3312<li>Return Value:
3313<ul>
3314
3315<li>a <tt>binary</tt> that is decoded from the given <tt>string</tt>,</li>
3316<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3317<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3318<li>any other non-string input value will cause a type error.</li>
3319</ul>
3320</li>
3321<li>
3322
3323<p>Example:</p>
3324<p>[ parse_binary(&#x201c;ABCDEF0123456789&#x201d;,&#x201c;hex&#x201d;), parse_binary(&#x201c;abcdef0123456789&#x201d;,&#x201c;HEX&#x201d;), parse_binary(&#x2018;QXN0ZXJpeAE=&#x2019;,&#x201c;base64&#x201d;) ];</p>
3325</li>
3326<li>
3327
3328<p>The expected result is:</p>
3329<p>[ hex(&#x201c;ABCDEF0123456789&#x201d;), hex(&#x201c;ABCDEF0123456789&#x201d;), hex(&#x201c;4173746572697801&#x201d;) ]</p>
3330</li>
3331</ul></div>
3332<div class="section">
3333<h3><a name="print_binary"></a>print_binary</h3>
3334<ul>
3335
3336<li>
3337
3338<p>Syntax:</p>
3339<p>print_binary(binary, encoding)</p>
3340</li>
3341<li>
3342
3343<p>Prints a <tt>binary</tt> to the required encoding <tt>string</tt> format.</p>
3344</li>
3345<li>Arguments:
3346<ul>
3347
3348<li><tt>binary</tt> : a <tt>binary</tt> data need to be printed.</li>
3349<li><tt>encoding</tt> : a string notation specifies the expected encoding type. Currently we support <tt>hex</tt> and <tt>base64</tt> format.</li>
3350</ul>
3351</li>
3352<li>Return Value:
3353<ul>
3354
3355<li>a <tt>string</tt> that represents the encoded format of a <tt>binary</tt>,</li>
3356<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3357<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3358<li>any other non-string input value will cause a type error.</li>
3359</ul>
3360</li>
3361<li>
3362
3363<p>Example:</p>
3364
3365<div>
3366<div>
3367<pre class="source">[ print_binary(hex(&quot;ABCDEF0123456789&quot;), &quot;base64&quot;), print_binary(base64(&quot;q83vASNFZ4k=&quot;), &quot;hex&quot;) ]
3368</pre></div></div>
3369</li>
3370<li>
3371
3372<p>The expected result are:</p>
3373
3374<div>
3375<div>
3376<pre class="source">[ &quot;q83vASNFZ4k=&quot;, &quot;ABCDEF0123456789&quot; ]
3377</pre></div></div>
3378</li>
3379</ul></div>
3380<div class="section">
3381<h3><a name="binary_length"></a>binary_length</h3>
3382<ul>
3383
3384<li>
3385
3386<p>Syntax:</p>
3387<p>binary_length(binary)</p>
3388</li>
3389<li>
3390
3391<p>Returns the number of bytes storing the binary data.</p>
3392</li>
3393<li>Arguments:
3394<ul>
3395
3396<li><tt>binary</tt> : a <tt>binary</tt> value to be checked.</li>
3397</ul>
3398</li>
3399<li>Return Value:
3400<ul>
3401
3402<li>an <tt>bigint</tt> that represents the number of bytes,</li>
3403<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3404<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3405<li>any other non-binary input value will cause a type error.</li>
3406</ul>
3407</li>
3408<li>
3409
3410<p>Example:</p>
3411
3412<div>
3413<div>
3414<pre class="source">binary_length(hex(&quot;00AA&quot;))
3415</pre></div></div>
3416</li>
3417<li>
3418
3419<p>The expected result is:</p>
3420<p>2</p>
3421</li>
3422</ul></div>
3423<div class="section">
3424<h3><a name="sub_binary"></a>sub_binary</h3>
3425<ul>
3426
3427<li>
3428
3429<p>Syntax:</p>
3430<p>sub_binary(binary, offset[, length])</p>
3431</li>
3432<li>
3433
3434<p>Returns the sub binary from the given <tt>binary</tt> based on the given start offset with the optional <tt>length</tt>.</p>
3435</li>
3436<li>Arguments:
3437<ul>
3438
3439<li><tt>binary</tt> : a <tt>binary</tt> to be extracted,</li>
3440<li><tt>offset</tt> : a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt> value as the starting offset of the sub binary in <tt>binary</tt> (starting at 0),</li>
3441<li><tt>length</tt> : (Optional) a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt> value as the length of the sub binary.</li>
3442</ul>
3443</li>
3444<li>Return Value:
3445<ul>
3446
3447<li>a <tt>binary</tt> that represents the sub binary,</li>
3448<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3449<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3450<li>a type error will be raised if:
3451<ul>
3452
3453<li>the first argument is any other non-binary value,</li>
3454<li>or, the second argument is any other non-integer value,</li>
3455<li>or, the third argument is any other non-integer value, if it is present.</li>
3456</ul>
3457</li>
3458</ul>
3459</li>
3460<li>
3461
3462<p>Example:</p>
3463
3464<div>
3465<div>
3466<pre class="source">sub_binary(hex(&quot;AABBCCDD&quot;), 4);
3467</pre></div></div>
3468</li>
3469<li>
3470
3471<p>The expected result is</p>
3472
3473<div>
3474<div>
3475<pre class="source">hex(&quot;DD&quot;)
3476</pre></div></div>
3477</li>
3478</ul></div>
3479<div class="section">
3480<h3><a name="binary_concat"></a>binary_concat</h3>
3481<ul>
3482
3483<li>
3484
3485<p>Syntax:</p>
3486<p>binary_concat(array)</p>
3487</li>
3488<li>
3489
3490<p>Concatenates a binary <tt>array</tt> or <tt>multiset</tt> into a single binary.</p>
3491</li>
3492<li>Arguments:
3493<ul>
3494
3495<li><tt>array</tt> : an <tt>array</tt> or <tt>multiset</tt> of binaries (could be <tt>null</tt> or <tt>missing</tt>) to be concatenated.</li>
3496</ul>
3497</li>
3498<li>Return Value :
3499<ul>
3500
3501<li>the concatenated <tt>binary</tt> value,</li>
3502<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3503<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3504<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
3505<li><tt>null</tt> if any element in the input array is <tt>null</tt> but no element in the input array is <tt>missing</tt>,</li>
3506<li>any other non-array input value or non-binary element in the input array will cause a type error.</li>
3507</ul>
3508</li>
3509<li>
3510
3511<p>Example:</p>
3512<p>binary_concat([hex(&#x201c;42&#x201d;), hex(&quot;&quot;), hex(&#x2018;42&#x2019;)]);</p>
3513</li>
3514<li>
3515
3516<p>The expected result is</p>
3517<p>hex(&#x201c;4242&#x201d;)</p>
3518</li>
3519</ul><!--
3520 ! Licensed to the Apache Software Foundation (ASF) under one
3521 ! or more contributor license agreements. See the NOTICE file
3522 ! distributed with this work for additional information
3523 ! regarding copyright ownership. The ASF licenses this file
3524 ! to you under the Apache License, Version 2.0 (the
3525 ! "License"); you may not use this file except in compliance
3526 ! with the License. You may obtain a copy of the License at
3527 !
3528 ! http://www.apache.org/licenses/LICENSE-2.0
3529 !
3530 ! Unless required by applicable law or agreed to in writing,
3531 ! software distributed under the License is distributed on an
3532 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
3533 ! KIND, either express or implied. See the License for the
3534 ! specific language governing permissions and limitations
3535 ! under the License.
3536 !-->
3537</div></div>
3538<div class="section">
3539<h2><a name="Spatial_Functions"></a><a name="SpatialFunctions" id="SpatialFunctions">Spatial Functions</a></h2>
3540<div class="section">
3541<h3><a name="create_point"></a>create_point</h3>
3542<ul>
3543
3544<li>
3545
3546<p>Syntax:</p>
3547
3548<div>
3549<div>
3550<pre class="source">create_point(x, y)
3551</pre></div></div>
3552</li>
3553<li>
3554
3555<p>Creates the primitive type <tt>point</tt> using an <tt>x</tt> and <tt>y</tt> value.</p>
3556</li>
3557<li>Arguments:</li>
3558<li><tt>x</tt> : a <tt>double</tt> that represents the x-coordinate,</li>
3559<li><tt>y</tt> : a <tt>double</tt> that represents the y-coordinate.</li>
3560<li>Return Value:</li>
3561<li>a <tt>point</tt> representing the ordered pair (<tt>x</tt>, <tt>y</tt>),</li>
3562<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3563<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3564<li>any other non-double input value will cause a type error.</li>
3565<li>
3566
3567<p>Example:</p>
3568
3569<div>
3570<div>
3571<pre class="source">{ &quot;point&quot;: create_point(30.0,70.0) };
3572</pre></div></div>
3573</li>
3574<li>
3575
3576<p>The expected result is:</p>
3577
3578<div>
3579<div>
3580<pre class="source">{ &quot;point&quot;: point(&quot;30.0,70.0&quot;) }
3581</pre></div></div>
3582</li>
3583</ul></div>
3584<div class="section">
3585<h3><a name="create_line"></a>create_line</h3>
3586<ul>
3587
3588<li>
3589
3590<p>Syntax:</p>
3591
3592<div>
3593<div>
3594<pre class="source">create_line(point1, point2)
3595</pre></div></div>
3596</li>
3597<li>
3598
3599<p>Creates the primitive type <tt>line</tt> using <tt>point1</tt> and <tt>point2</tt>.</p>
3600</li>
3601<li>Arguments:
3602<ul>
3603
3604<li><tt>point1</tt> : a <tt>point</tt> that represents the start point of the line.</li>
3605<li><tt>point2</tt> : a <tt>point</tt> that represents the end point of the line.</li>
3606</ul>
3607</li>
3608<li>Return Value:
3609<ul>
3610
3611<li>a spatial <tt>line</tt> created using the points provided in <tt>point1</tt> and <tt>point2</tt>,</li>
3612<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3613<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3614<li>any other non-point input value will cause a type error.</li>
3615</ul>
3616</li>
3617<li>
3618
3619<p>Example:</p>
3620
3621<div>
3622<div>
3623<pre class="source">{ &quot;line&quot;: create_line(create_point(30.0,70.0), create_point(50.0,90.0)) };
3624</pre></div></div>
3625</li>
3626<li>
3627
3628<p>The expected result is:</p>
3629
3630<div>
3631<div>
3632<pre class="source">{ &quot;line&quot;: line(&quot;30.0,70.0 50.0,90.0&quot;) }
3633</pre></div></div>
3634</li>
3635</ul></div>
3636<div class="section">
3637<h3><a name="create_rectangle"></a>create_rectangle</h3>
3638<ul>
3639
3640<li>
3641
3642<p>Syntax:</p>
3643
3644<div>
3645<div>
3646<pre class="source">create_rectangle(point1, point2)
3647</pre></div></div>
3648</li>
3649<li>
3650
3651<p>Creates the primitive type <tt>rectangle</tt> using <tt>point1</tt> and <tt>point2</tt>.</p>
3652</li>
3653<li>Arguments:
3654<ul>
3655
3656<li><tt>point1</tt> : a <tt>point</tt> that represents the lower_left point of the rectangle.</li>
3657<li><tt>point2</tt> : a <tt>point</tt> that represents the upper_right point of the rectangle.</li>
3658</ul>
3659</li>
3660<li>Return Value:
3661<ul>
3662
3663<li>a spatial <tt>rectangle</tt> created using the points provided in <tt>point1</tt> and <tt>point2</tt>,</li>
3664<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3665<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3666<li>any other non-point input value will cause a type error.</li>
3667</ul>
3668</li>
3669<li>
3670
3671<p>Example:</p>
3672
3673<div>
3674<div>
3675<pre class="source">{ &quot;rectangle&quot;: create_rectangle(create_point(30.0,70.0), create_point(50.0,90.0)) };
3676</pre></div></div>
3677</li>
3678<li>
3679
3680<p>The expected result is:</p>
3681
3682<div>
3683<div>
3684<pre class="source">{ &quot;rectangle&quot;: rectangle(&quot;30.0,70.0 50.0,90.0&quot;) }
3685</pre></div></div>
3686</li>
3687</ul></div>
3688<div class="section">
3689<h3><a name="create_circle"></a>create_circle</h3>
3690<ul>
3691
3692<li>
3693
3694<p>Syntax:</p>
3695
3696<div>
3697<div>
3698<pre class="source">create_circle(point, radius)
3699</pre></div></div>
3700</li>
3701<li>
3702
3703<p>Creates the primitive type <tt>circle</tt> using <tt>point</tt> and <tt>radius</tt>.</p>
3704</li>
3705<li>Arguments:
3706<ul>
3707
3708<li><tt>point</tt> : a <tt>point</tt> that represents the center of the circle.</li>
3709<li><tt>radius</tt> : a <tt>double</tt> that represents the radius of the circle.</li>
3710</ul>
3711</li>
3712<li>Return Value:
3713<ul>
3714
3715<li>a spatial <tt>circle</tt> created using the center point and the radius provided in <tt>point</tt> and <tt>radius</tt>.</li>
3716<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3717<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3718<li>a type error will be raised if:
3719<ul>
3720
3721<li>the first argument is any other non-point value,</li>
3722<li>or, the second argument is any other non-double value.</li>
3723</ul>
3724</li>
3725</ul>
3726</li>
3727<li>
3728
3729<p>Example:</p>
3730
3731<div>
3732<div>
3733<pre class="source">{ &quot;circle&quot;: create_circle(create_point(30.0,70.0), 5.0) }
3734</pre></div></div>
3735</li>
3736<li>
3737
3738<p>The expected result is:</p>
3739
3740<div>
3741<div>
3742<pre class="source">{ &quot;circle&quot;: circle(&quot;30.0,70.0 5.0&quot;) }
3743</pre></div></div>
3744</li>
3745</ul></div>
3746<div class="section">
3747<h3><a name="create_polygon"></a>create_polygon</h3>
3748<ul>
3749
3750<li>
3751
3752<p>Syntax:</p>
3753
3754<div>
3755<div>
3756<pre class="source">create_polygon(array)
3757</pre></div></div>
3758</li>
3759<li>
3760
3761<p>Creates the primitive type <tt>polygon</tt> using the double values provided in the argument <tt>array</tt>. Each two consecutive double values represent a point starting from the first double value in the array. Note that at least six double values should be specified, meaning a total of three points.</p>
3762</li>
3763<li>Arguments:
3764<ul>
3765
3766<li><tt>array</tt> : an array of doubles representing the points of the polygon.</li>
3767</ul>
3768</li>
3769<li>Return Value:
3770<ul>
3771
3772<li>a <tt>polygon</tt>, represents a spatial simple polygon created using the points provided in <tt>array</tt>.</li>
3773<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3774<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3775<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
3776<li><tt>null</tt> if any element in the input array is <tt>null</tt> but no element in the input array is <tt>missing</tt>,</li>
3777<li>any other non-array input value or non-double element in the input array will cause a type error.</li>
3778</ul>
3779</li>
3780<li>
3781
3782<p>Example:</p>
3783
3784<div>
3785<div>
3786<pre class="source">{ &quot;polygon&quot;: create_polygon([1.0,1.0,2.0,2.0,3.0,3.0,4.0,4.0]) };
3787</pre></div></div>
3788</li>
3789<li>
3790
3791<p>The expected result is:</p>
3792
3793<div>
3794<div>
3795<pre class="source">{ &quot;polygon&quot;: polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;) }
3796</pre></div></div>
3797</li>
3798</ul></div>
3799<div class="section">
3800<h3><a name="get_x.2Fget_y"></a>get_x/get_y</h3>
3801<ul>
3802
3803<li>
3804
3805<p>Syntax:</p>
3806
3807<div>
3808<div>
3809<pre class="source">get_x(point) or get_y(point)
3810</pre></div></div>
3811</li>
3812<li>
3813
3814<p>Returns the x or y coordinates of a point <tt>point</tt>.</p>
3815</li>
3816<li>Arguments:
3817<ul>
3818
3819<li><tt>point</tt> : a <tt>point</tt>.</li>
3820</ul>
3821</li>
3822<li>Return Value:
3823<ul>
3824
3825<li>a <tt>double</tt> representing the x or y coordinates of the point <tt>point</tt>,</li>
3826<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3827<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3828<li>any other non-point input value will cause a type error.</li>
3829</ul>
3830</li>
3831<li>
3832
3833<p>Example:</p>
3834
3835<div>
3836<div>
3837<pre class="source">{ &quot;x_coordinate&quot;: get_x(create_point(2.3,5.0)), &quot;y_coordinate&quot;: get_y(create_point(2.3,5.0)) };
3838</pre></div></div>
3839</li>
3840<li>
3841
3842<p>The expected result is:</p>
3843
3844<div>
3845<div>
3846<pre class="source">{ &quot;x_coordinate&quot;: 2.3, &quot;y_coordinate&quot;: 5.0 }
3847</pre></div></div>
3848</li>
3849</ul></div>
3850<div class="section">
3851<h3><a name="get_points"></a>get_points</h3>
3852<ul>
3853
3854<li>
3855
3856<p>Syntax:</p>
3857
3858<div>
3859<div>
3860<pre class="source">get_points(spatial_object)
3861</pre></div></div>
3862</li>
3863<li>
3864
3865<p>Returns an ordered array of the points forming the spatial object <tt>spatial_object</tt>.</p>
3866</li>
3867<li>Arguments:
3868<ul>
3869
3870<li><tt>spatial_object</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
3871</ul>
3872</li>
3873<li>Return Value:
3874<ul>
3875
3876<li>an <tt>array</tt> of the points forming the spatial object <tt>spatial_object</tt>,</li>
3877<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3878<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3879<li>any other non-spatial-object input value will cause a type error.</li>
3880</ul>
3881</li>
3882<li>
3883
3884<p>Example:</p>
3885
3886<div>
3887<div>
3888<pre class="source">get_points(create_polygon([1.0,1.0,2.0,2.0,3.0,3.0,4.0,4.0]))
3889</pre></div></div>
3890</li>
3891<li>
3892
3893<p>The expected result is:</p>
3894
3895<div>
3896<div>
3897<pre class="source">[ point(&quot;1.0,1.0&quot;), point(&quot;2.0,2.0&quot;), point(&quot;3.0,3.0&quot;), point(&quot;4.0,4.0&quot;) ]
3898</pre></div></div>
3899</li>
3900</ul></div>
3901<div class="section">
3902<h3><a name="get_center.2Fget_radius"></a>get_center/get_radius</h3>
3903<ul>
3904
3905<li>
3906
3907<p>Syntax:</p>
3908
3909<div>
3910<div>
3911<pre class="source">get_center(circle_expression) or get_radius(circle_expression)
3912</pre></div></div>
3913</li>
3914<li>
3915
3916<p>Returns the center and the radius of a circle <tt>circle_expression</tt>, respectively.</p>
3917</li>
3918<li>Arguments:
3919<ul>
3920
3921<li><tt>circle_expression</tt> : a <tt>circle</tt>.</li>
3922</ul>
3923</li>
3924<li>Return Value:
3925<ul>
3926
3927<li>a <tt>point</tt> or <tt>double</tt>, represent the center or radius of the circle <tt>circle_expression</tt>.</li>
3928<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3929<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3930<li>any other non-circle input value will cause a type error.</li>
3931</ul>
3932</li>
3933<li>
3934
3935<p>Example:</p>
3936
3937<div>
3938<div>
3939<pre class="source">{
3940 &quot;circle_radius&quot;: get_radius(create_circle(create_point(6.0,3.0), 1.0)),
3941 &quot;circle_center&quot;: get_center(create_circle(create_point(6.0,3.0), 1.0))
3942};
3943</pre></div></div>
3944</li>
3945<li>
3946
3947<p>The expected result is:</p>
3948
3949<div>
3950<div>
3951<pre class="source">{ &quot;circle_radius&quot;: 1.0, &quot;circle_center&quot;: point(&quot;6.0,3.0&quot;) }
3952</pre></div></div>
3953</li>
3954</ul></div>
3955<div class="section">
3956<h3><a name="spatial_distance"></a>spatial_distance</h3>
3957<ul>
3958
3959<li>
3960
3961<p>Syntax:</p>
3962
3963<div>
3964<div>
3965<pre class="source">spatial_distance(point1, point2)
3966</pre></div></div>
3967</li>
3968<li>
3969
3970<p>Returns the Euclidean distance between <tt>point1</tt> and <tt>point2</tt>.</p>
3971</li>
3972<li>Arguments:
3973<ul>
3974
3975<li><tt>point1</tt> : a <tt>point</tt>.</li>
3976<li><tt>point2</tt> : a <tt>point</tt>.</li>
3977</ul>
3978</li>
3979<li>Return Value:
3980<ul>
3981
3982<li>a <tt>double</tt> as the Euclidean distance between <tt>point1</tt> and <tt>point2</tt>.</li>
3983<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3984<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3985<li>any other non-point input value will cause a type error.</li>
3986</ul>
3987</li>
3988<li>
3989
3990<p>Example:</p>
3991
3992<div>
3993<div>
3994<pre class="source">spatial_distance(point(&quot;47.44,80.65&quot;), create_point(30.0,70.0));
3995</pre></div></div>
3996</li>
3997<li>
3998
3999<p>The expected result is:</p>
4000
4001<div>
4002<div>
4003<pre class="source">20.434678857275934
4004</pre></div></div>
4005</li>
4006</ul></div>
4007<div class="section">
4008<h3><a name="spatial_area"></a>spatial_area</h3>
4009<ul>
4010
4011<li>
4012
4013<p>Syntax:</p>
4014
4015<div>
4016<div>
4017<pre class="source">spatial_area(spatial_2d_expression)
4018</pre></div></div>
4019</li>
4020<li>
4021
4022<p>Returns the spatial area of <tt>spatial_2d_expression</tt>.</p>
4023</li>
4024<li>Arguments:
4025<ul>
4026
4027<li><tt>spatial_2d_expression</tt> : a <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
4028</ul>
4029</li>
4030<li>Return Value:
4031<ul>
4032
4033<li>a <tt>double</tt> representing the area of <tt>spatial_2d_expression</tt>.</li>
4034<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
4035<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
4036<li>any other non-2d-spatial-object will cause a type error.</li>
4037</ul>
4038</li>
4039<li>
4040
4041<p>Example:</p>
4042
4043<div>
4044<div>
4045<pre class="source">spatial_area(create_circle(create_point(0.0,0.0), 5.0));
4046</pre></div></div>
4047</li>
4048<li>
4049
4050<p>The expected result is:</p>
4051
4052<div>
4053<div>
4054<pre class="source">78.53981625
4055</pre></div></div>
4056</li>
4057</ul></div>
4058<div class="section">
4059<h3><a name="spatial_intersect"></a>spatial_intersect</h3>
4060<ul>
4061
4062<li>
4063
4064<p>Syntax:</p>
4065
4066<div>
4067<div>
4068<pre class="source">spatial_intersect(spatial_object1, spatial_object2)
4069</pre></div></div>
4070</li>
4071<li>
4072
4073<p>Checks whether <tt>@arg1</tt> and <tt>@arg2</tt> spatially intersect each other.</p>
4074</li>
4075<li>Arguments:
4076<ul>
4077
4078<li><tt>spatial_object1</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
4079<li><tt>spatial_object2</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
4080</ul>
4081</li>
4082<li>Return Value:
4083<ul>
4084
4085<li>a <tt>boolean</tt> representing whether <tt>spatial_object1</tt> and <tt>spatial_object2</tt> spatially overlap with each other,</li>
4086<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4087<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4088<li>any other non-spatial-object input value will cause a type error.</li>
4089</ul>
4090</li>
4091<li>
4092
4093<p>Example:</p>
4094
4095<div>
4096<div>
4097<pre class="source">spatial_intersect(point(&quot;39.28,70.48&quot;), create_rectangle(create_point(30.0,70.0), create_point(40.0,80.0)));
4098</pre></div></div>
4099</li>
4100<li>
4101
4102<p>The expected result is:</p>
4103
4104<div>
4105<div>
4106<pre class="source">true
4107</pre></div></div>
4108</li>
4109</ul></div>
4110<div class="section">
4111<h3><a name="spatial_cell"></a>spatial_cell</h3>
4112<ul>
4113
4114<li>
4115
4116<p>Syntax:</p>
4117
4118<div>
4119<div>
4120<pre class="source">spatial_cell(point1, point2, x_increment, y_increment)
4121</pre></div></div>
4122</li>
4123<li>
4124
4125<p>Returns the grid cell that <tt>point1</tt> belongs to.</p>
4126</li>
4127<li>Arguments:
4128<ul>
4129
4130<li><tt>point1</tt> : a <tt>point</tt> representing the point of interest that its grid cell will be returned.</li>
4131<li><tt>point2</tt> : a <tt>point</tt> representing the origin of the grid.</li>
4132<li><tt>x_increment</tt> : a <tt>double</tt>, represents X increments.</li>
4133<li><tt>y_increment</tt> : a <tt>double</tt>, represents Y increments.</li>
4134</ul>
4135</li>
4136<li>Return Value:
4137<ul>
4138
4139<li>a <tt>rectangle</tt> representing the grid cell that <tt>point1</tt> belongs to,</li>
4140<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4141<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4142<li>a type error will be raised if:
4143<ul>
4144
4145<li>the first or second argument is any other non-point value,</li>
4146<li>or, the second or third argument is any other non-double value.</li>
4147</ul>
4148</li>
4149</ul>
4150</li>
4151<li>
4152
4153<p>Example:</p>
4154
4155<div>
4156<div>
4157<pre class="source">spatial_cell(point(&quot;39.28,70.48&quot;), create_point(20.0,50.0), 5.5, 6.0);
4158</pre></div></div>
4159</li>
4160<li>
4161
4162<p>The expected result is:</p>
4163
4164<div>
4165<div>
4166<pre class="source">rectangle(&quot;36.5,68.0 42.0,74.0&quot;);
4167</pre></div></div>
4168</li>
4169</ul><!--
4170 ! Licensed to the Apache Software Foundation (ASF) under one
4171 ! or more contributor license agreements. See the NOTICE file
4172 ! distributed with this work for additional information
4173 ! regarding copyright ownership. The ASF licenses this file
4174 ! to you under the Apache License, Version 2.0 (the
4175 ! "License"); you may not use this file except in compliance
4176 ! with the License. You may obtain a copy of the License at
4177 !
4178 ! http://www.apache.org/licenses/LICENSE-2.0
4179 !
4180 ! Unless required by applicable law or agreed to in writing,
4181 ! software distributed under the License is distributed on an
4182 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4183 ! KIND, either express or implied. See the License for the
4184 ! specific language governing permissions and limitations
4185 ! under the License.
4186 !-->
4187</div></div>
4188<div class="section">
4189<h2><a name="Similarity_Functions"></a><a name="SimilarityFunctions" id="SimilarityFunctions">Similarity Functions</a></h2>
4190<p>AsterixDB supports queries with different similarity functions, including <a class="externalLink" href="http://en.wikipedia.org/wiki/Levenshtein_distance">edit distance</a> and <a class="externalLink" href="https://en.wikipedia.org/wiki/Jaccard_index">Jaccard</a>.</p>
4191<div class="section">
4192<h3><a name="edit_distance"></a>edit_distance</h3>
4193<ul>
4194
4195<li>
4196
4197<p>Syntax:</p>
4198
4199<div>
4200<div>
4201<pre class="source">edit_distance(expression1, expression2)
4202</pre></div></div>
4203</li>
4204<li>
4205
4206<p>Returns the edit distance of <tt>expression1</tt> and <tt>expression2</tt>.</p>
4207</li>
4208<li>Arguments:
4209<ul>
4210
4211<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
4212<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
4213</ul>
4214</li>
4215<li>Return Value:
4216<ul>
4217
4218<li>an <tt>bigint</tt> that represents the edit distance between <tt>expression1</tt> and <tt>expression2</tt>,</li>
4219<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4220<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4221<li>any other non-string input value will cause a type error.</li>
4222</ul>
4223</li>
4224<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
4225<li>Example:
4226
4227<div>
4228<div>
4229<pre class="source">edit_distance(&quot;SuzannaTillson&quot;, &quot;Suzanna Tilson&quot;);
4230</pre></div></div>
4231</li>
4232<li>
4233
4234<p>The expected result is:</p>
4235
4236<div>
4237<div>
4238<pre class="source">2
4239</pre></div></div>
4240</li>
4241</ul></div>
4242<div class="section">
4243<h3><a name="edit_distance_check"></a>edit_distance_check</h3>
4244<ul>
4245
4246<li>
4247
4248<p>Syntax:</p>
4249
4250<div>
4251<div>
4252<pre class="source">edit_distance_check(expression1, expression2, threshold)
4253</pre></div></div>
4254</li>
4255<li>
4256
4257<p>Checks whether the edit distance of <tt>expression1</tt> and <tt>expression2</tt> is within a given threshold.</p>
4258</li>
4259<li>
4260
4261<p>Arguments:</p>
4262<ul>
4263
4264<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
4265<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
4266<li><tt>threshold</tt> : a <tt>bigint</tt> that represents the distance threshold.</li>
4267</ul>
4268</li>
4269<li>Return Value:
4270<ul>
4271
4272<li>an <tt>array</tt> with two items:
4273<ul>
4274
4275<li>The first item contains a <tt>boolean</tt> value representing whether the edit distance of <tt>expression1</tt> and <tt>expression2</tt> is within the given threshold.</li>
4276<li>The second item contains an <tt>integer</tt> that represents the edit distance of <tt>expression1</tt> and <tt>expression2</tt> if the first item is true.</li>
4277<li>If the first item is false, then the second item is set to 2147483647.</li>
4278</ul>
4279</li>
4280<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4281<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4282<li>a type error will be raised if:
4283<ul>
4284
4285<li>the first or second argument is any other non-string value,</li>
4286<li>or, the third argument is any other non-bigint value.</li>
4287</ul>
4288</li>
4289</ul>
4290</li>
4291<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
4292<li>Example:
4293
4294<div>
4295<div>
4296<pre class="source">edit_distance_check(&quot;happy&quot;,&quot;hapr&quot;,2);
4297</pre></div></div>
4298</li>
4299<li>
4300
4301<p>The expected result is:</p>
4302
4303<div>
4304<div>
4305<pre class="source">[ true, 2 ]
4306</pre></div></div>
4307</li>
4308</ul></div>
4309<div class="section">
4310<h3><a name="edit_distance_contains"></a>edit_distance_contains</h3>
4311<ul>
4312
4313<li>
4314
4315<p>Syntax:</p>
4316
4317<div>
4318<div>
4319<pre class="source">edit_distance_contains(expression1, expression2, threshold)
4320</pre></div></div>
4321</li>
4322<li>
4323
4324<p>Checks whether <tt>expression1</tt> contains <tt>expression2</tt> with an <a class="externalLink" href="http://en.wikipedia.org/wiki/Levenshtein_distance">edit distance</a> within a given threshold.</p>
4325</li>
4326<li>
4327
4328<p>Arguments:</p>
4329<ul>
4330
4331<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
4332<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
4333<li><tt>threshold</tt> : a <tt>bigint</tt> that represents the distance threshold.</li>
4334</ul>
4335</li>
4336<li>Return Value:
4337<ul>
4338
4339<li>an <tt>array</tt> with two items:
4340<ul>
4341
4342<li>The first item contains a <tt>boolean</tt> value representing whether <tt>expression1</tt> can contain <tt>expression2</tt>.</li>
4343<li>The second item contains an <tt>integer</tt> that represents the required edit distance for <tt>expression1</tt> to contain <tt>expression2</tt> if the first item is true.</li>
4344</ul>
4345</li>
4346<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4347<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4348<li>a type error will be raised if:
4349<ul>
4350
4351<li>the first or second argument is any other non-string value,</li>
4352<li>or, the third argument is any other non-bigint value.</li>
4353</ul>
4354</li>
4355</ul>
4356</li>
4357<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
4358<li>Example:
4359
4360<div>
4361<div>
4362<pre class="source">edit_distance_contains(&quot;happy&quot;,&quot;hapr&quot;,2);
4363</pre></div></div>
4364</li>
4365<li>
4366
4367<p>The expected result is:</p>
4368
4369<div>
4370<div>
4371<pre class="source">[ true, 1 ]
4372</pre></div></div>
4373</li>
4374</ul></div>
4375<div class="section">
4376<h3><a name="similarity_jaccard"></a>similarity_jaccard</h3>
4377<ul>
4378
4379<li>
4380
4381<p>Syntax:</p>
4382
4383<div>
4384<div>
4385<pre class="source">similarity_jaccard(array1, array2)
4386</pre></div></div>
4387</li>
4388<li>
4389
4390<p>Returns the <a class="externalLink" href="http://en.wikipedia.org/wiki/Jaccard_index">Jaccard similarity</a> of <tt>array1</tt> and <tt>array2</tt>.</p>
4391</li>
4392<li>Arguments:
4393<ul>
4394
4395<li><tt>array1</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
4396<li><tt>array2</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
4397</ul>
4398</li>
4399<li>Return Value:
4400<ul>
4401
4402<li>a <tt>float</tt> that represents the Jaccard similarity of <tt>array1</tt> and <tt>array2</tt>,</li>
4403<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4404<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4405<li><tt>missing</tt> if any element in any input array is <tt>missing</tt>,</li>
4406<li><tt>null</tt> if any element in any input array is <tt>null</tt> but no element in the input array is <tt>missing</tt>,</li>
4407<li>any other non-array input value or non-integer element in any input array will cause a type error.</li>
4408</ul>
4409</li>
4410<li>
4411
4412<p>Note: a <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">keyword index</a> can be utilized for this function.</p>
4413</li>
4414<li>Example:
4415
4416<div>
4417<div>
4418<pre class="source">similarity_jaccard([1,5,8,9], [1,5,9,10]);
4419</pre></div></div>
4420</li>
4421<li>
4422
4423<p>The expected result is:</p>
4424
4425<div>
4426<div>
4427<pre class="source">0.6
4428</pre></div></div>
4429</li>
4430</ul></div>
4431<div class="section">
4432<h3><a name="similarity_jaccard_check"></a>similarity_jaccard_check</h3>
4433<ul>
4434
4435<li>
4436
4437<p>Syntax:</p>
4438
4439<div>
4440<div>
4441<pre class="source">similarity_jaccard_check(array1, array2, threshold)
4442</pre></div></div>
4443</li>
4444<li>
4445
4446<p>Checks whether <tt>array1</tt> and <tt>array2</tt> have a <a class="externalLink" href="http://en.wikipedia.org/wiki/Jaccard_index">Jaccard similarity</a> greater than or equal to threshold. Again, the &#x201c;check&#x201d; version of Jaccard is faster than the &#x201c;non_check&#x201d; version.</p>
4447</li>
4448<li>
4449
4450<p>Arguments:</p>
4451<ul>
4452
4453<li><tt>array1</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
4454<li><tt>array2</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
4455<li><tt>threshold</tt> : a <tt>double</tt> that represents the similarity threshold.</li>
4456</ul>
4457</li>
4458<li>Return Value:
4459<ul>
4460
4461<li>an <tt>array</tt> with two items:
4462<ul>
4463
4464<li>The first item contains a <tt>boolean</tt> value representing whether <tt>array1</tt> and <tt>array2</tt> are similar.</li>
4465<li>The second item contains a <tt>float</tt> that represents the Jaccard similarity of <tt>array1</tt> and <tt>array2</tt> if it is greater than or equal to the threshold, or 0 otherwise.</li>
4466</ul>
4467</li>
4468<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4469<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4470<li><tt>missing</tt> if any element in any input array is <tt>missing</tt>,</li>
4471<li><tt>null</tt> if any element in any input array is <tt>null</tt> but no element in the input array is <tt>missing</tt>,</li>
4472<li>a type error will be raised if:
4473<ul>
4474
4475<li>the first or second argument is any other non-array value,
4476<ul>
4477
4478<li>or, the third argument is any other non-double value.</li>
4479</ul>
4480</li>
4481</ul>
4482</li>
4483</ul>
4484</li>
4485<li>
4486
4487<p>Note: a <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">keyword index</a> can be utilized for this function.</p>
4488</li>
4489<li>Example:
4490
4491<div>
4492<div>
4493<pre class="source">similarity_jaccard_check([1,5,8,9], [1,5,9,10], 0.6);
4494</pre></div></div>
4495</li>
4496<li>
4497
4498<p>The expected result is:</p>
4499
4500<div>
4501<div>
4502<pre class="source">[ false, 0.0 ]
4503</pre></div></div>
4504</li>
4505</ul><!--
4506 ! Licensed to the Apache Software Foundation (ASF) under one
4507 ! or more contributor license agreements. See the NOTICE file
4508 ! distributed with this work for additional information
4509 ! regarding copyright ownership. The ASF licenses this file
4510 ! to you under the Apache License, Version 2.0 (the
4511 ! "License"); you may not use this file except in compliance
4512 ! with the License. You may obtain a copy of the License at
4513 !
4514 ! http://www.apache.org/licenses/LICENSE-2.0
4515 !
4516 ! Unless required by applicable law or agreed to in writing,
4517 ! software distributed under the License is distributed on an
4518 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4519 ! KIND, either express or implied. See the License for the
4520 ! specific language governing permissions and limitations
4521 ! under the License.
4522 !-->
4523</div></div>
4524<div class="section">
4525<h2><a name="Tokenizing_Functions"></a><a name="TokenizingFunctions" id="TokenizingFunctions">Tokenizing Functions</a></h2>
4526<div class="section">
4527<h3><a name="word_tokens"></a>word_tokens</h3>
4528<ul>
4529
4530<li>
4531
4532<p>Syntax:</p>
4533
4534<div>
4535<div>
4536<pre class="source">word_tokens(string)
4537</pre></div></div>
4538</li>
4539<li>
4540
4541<p>Returns an array of word tokens of <tt>string</tt> using non_alphanumeric characters as delimiters.</p>
4542</li>
4543<li>Arguments:
4544<ul>
4545
4546<li><tt>string</tt> : a <tt>string</tt> that will be tokenized.</li>
4547</ul>
4548</li>
4549<li>Return Value:
4550<ul>
4551
4552<li>an <tt>array</tt> of <tt>string</tt> word tokens,</li>
4553<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
4554<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
4555<li>any other non-string input value will cause a type error.</li>
4556</ul>
4557</li>
4558<li>
4559
4560<p>Example:</p>
4561
4562<div>
4563<div>
4564<pre class="source">word_tokens(&quot;I like the phone, awesome!&quot;);
4565</pre></div></div>
4566</li>
4567<li>
4568
4569<p>The expected result is:</p>
4570
4571<div>
4572<div>
4573<pre class="source">[ &quot;i&quot;, &quot;like&quot;, &quot;the&quot;, &quot;phone&quot;, &quot;awesome&quot; ]
4574</pre></div></div>
4575</li>
4576</ul><!--
4577 ! Licensed to the Apache Software Foundation (ASF) under one
4578 ! or more contributor license agreements. See the NOTICE file
4579 ! distributed with this work for additional information
4580 ! regarding copyright ownership. The ASF licenses this file
4581 ! to you under the Apache License, Version 2.0 (the
4582 ! "License"); you may not use this file except in compliance
4583 ! with the License. You may obtain a copy of the License at
4584 !
4585 ! http://www.apache.org/licenses/LICENSE-2.0
4586 !
4587 ! Unless required by applicable law or agreed to in writing,
4588 ! software distributed under the License is distributed on an
4589 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4590 ! KIND, either express or implied. See the License for the
4591 ! specific language governing permissions and limitations
4592 ! under the License.
4593 !-->
4594</div></div>
4595<div class="section">
4596<h2><a name="Temporal_Functions"></a><a name="TemporalFunctions" id="TemporalFunctions">Temporal Functions</a></h2>
4597<div class="section">
4598<h3><a name="get_year.2Fget_month.2Fget_day.2Fget_hour.2Fget_minute.2Fget_second.2Fget_millisecond"></a>get_year/get_month/get_day/get_hour/get_minute/get_second/get_millisecond</h3>
4599<ul>
4600
4601<li>
4602
4603<p>Syntax:</p>
4604
4605<div>
4606<div>
4607<pre class="source">get_year/get_month/get_day/get_hour/get_minute/get_second/get_millisecond(temporal_value)
4608</pre></div></div>
4609</li>
4610<li>
4611
4612<p>Accessors for accessing fields in a temporal value</p>
4613</li>
4614<li>Arguments:
4615<ul>
4616
4617<li><tt>temporal_value</tt> : a temporal value represented as one of the following types: <tt>date</tt>, <tt>datetime</tt>, <tt>time</tt>, and <tt>duration</tt>.</li>
4618</ul>
4619</li>
4620<li>Return Value:
4621<ul>
4622
4623<li>an <tt>bigint</tt> value representing the field to be extracted,</li>
4624<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
4625<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4626<li>any other non-interval input value will cause a type error.</li>
4627</ul>
4628</li>
4629<li>
4630
4631<p>Example:</p>
4632
4633<div>
4634<div>
4635<pre class="source">{
4636 &quot;year&quot;: get_year(date(&quot;2010-10-30&quot;)),
4637 &quot;month&quot;: get_month(datetime(&quot;1987-11-19T23:49:23.938&quot;)),
4638 &quot;day&quot;: get_day(date(&quot;2010-10-30&quot;)),
4639 &quot;hour&quot;: get_hour(time(&quot;12:23:34.930&quot;)),
4640 &quot;min&quot;: get_minute(duration(&quot;P3Y73M632DT49H743M3948.94S&quot;)),
4641 &quot;second&quot;: get_second(datetime(&quot;1987-11-19T23:49:23.938&quot;)),
4642 &quot;ms&quot;: get_millisecond(duration(&quot;P3Y73M632DT49H743M3948.94S&quot;))
4643};
4644</pre></div></div>
4645</li>
4646<li>
4647
4648<p>The expected result is:</p>
4649
4650<div>
4651<div>
4652<pre class="source">{ &quot;year&quot;: 2010, &quot;month&quot;: 11, &quot;day&quot;: 30, &quot;hour&quot;: 12, &quot;min&quot;: 28, &quot;second&quot;: 23, &quot;ms&quot;: 94 }
4653</pre></div></div>
4654</li>
4655</ul></div>
4656<div class="section">
4657<h3><a name="adjust_datetime_for_timezone"></a>adjust_datetime_for_timezone</h3>
4658<ul>
4659
4660<li>
4661
4662<p>Syntax:</p>
4663
4664<div>
4665<div>
4666<pre class="source">adjust_datetime_for_timezone(datetime, string)
4667</pre></div></div>
4668</li>
4669<li>
4670
4671<p>Adjusts the given datetime <tt>datetime</tt> by applying the timezone information <tt>string</tt>.</p>
4672</li>
4673<li>Arguments:
4674<ul>
4675
4676<li><tt>datetime</tt> : a <tt>datetime</tt> value to be adjusted.</li>
4677<li><tt>string</tt> : a <tt>string</tt> representing the timezone information.</li>
4678</ul>
4679</li>
4680<li>Return Value:
4681<ul>
4682
4683<li>a <tt>string</tt> value representing the new datetime after being adjusted by the timezone information,</li>
4684<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4685<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4686<li>a type error will be raised if:
4687<ul>
4688
4689<li>the first argument is any other non-datetime value,</li>
4690<li>or, the second argument is any other non-string value.</li>
4691</ul>
4692</li>
4693</ul>
4694</li>
4695<li>
4696
4697<p>Example:</p>
4698
4699<div>
4700<div>
4701<pre class="source">adjust_datetime_for_timezone(datetime(&quot;2008-04-26T10:10:00&quot;), &quot;+08:00&quot;);
4702</pre></div></div>
4703</li>
4704<li>
4705
4706<p>The expected result is:</p>
4707
4708<div>
4709<div>
4710<pre class="source">&quot;2008-04-26T18:10:00.000+08:00&quot;
4711</pre></div></div>
4712</li>
4713</ul></div>
4714<div class="section">
4715<h3><a name="adjust_time_for_timezone"></a>adjust_time_for_timezone</h3>
4716<ul>
4717
4718<li>
4719
4720<p>Syntax:</p>
4721
4722<div>
4723<div>
4724<pre class="source">adjust_time_for_timezone(time, string)
4725</pre></div></div>
4726</li>
4727<li>
4728
4729<p>Adjusts the given time <tt>time</tt> by applying the timezone information <tt>string</tt>.</p>
4730</li>
4731<li>Arguments:
4732<ul>
4733
4734<li><tt>time</tt> : a <tt>time</tt> value to be adjusted.</li>
4735<li><tt>string</tt> : a <tt>string</tt> representing the timezone information.</li>
4736</ul>
4737</li>
4738<li>Return Value:
4739<ul>
4740
4741<li>a <tt>string</tt> value representing the new time after being adjusted by the timezone information,</li>
4742<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4743<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4744<li>a type error will be raised if:
4745<ul>
4746
4747<li>the first argument is any other non-time value,</li>
4748<li>or, the second argument is any other non-string value.</li>
4749</ul>
4750</li>
4751</ul>
4752</li>
4753<li>
4754
4755<p>Example:</p>
4756
4757<div>
4758<div>
4759<pre class="source">adjust_time_for_timezone(get_time_from_datetime(datetime(&quot;2008-04-26T10:10:00&quot;)), &quot;+08:00&quot;);
4760</pre></div></div>
4761</li>
4762<li>
4763
4764<p>The expected result is:</p>
4765
4766<div>
4767<div>
4768<pre class="source">&quot;18:10:00.000+08:00&quot;
4769</pre></div></div>
4770</li>
4771</ul></div>
4772<div class="section">
4773<h3><a name="calendar_duration_from_datetime"></a>calendar_duration_from_datetime</h3>
4774<ul>
4775
4776<li>
4777
4778<p>Syntax:</p>
4779
4780<div>
4781<div>
4782<pre class="source">calendar_duration_from_datetime(datetime, duration_value)
4783</pre></div></div>
4784</li>
4785<li>
4786
4787<p>Gets a user_friendly representation of the duration <tt>duration_value</tt> based on the given datetime <tt>datetime</tt>.</p>
4788</li>
4789<li>Arguments:
4790<ul>
4791
4792<li><tt>datetime</tt> : a <tt>datetime</tt> value to be used as the reference time point.</li>
4793<li><tt>duration_value</tt> : a <tt>duration</tt> value to be converted.</li>
4794</ul>
4795</li>
4796<li>Return Value:
4797<ul>
4798
4799<li>a <tt>duration</tt> value with the duration as <tt>duration_value</tt> but with a user_friendly representation,</li>
4800<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4801<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4802<li>a type error will be raised if:
4803<ul>
4804
4805<li>the first argument is any other non-datetime value,</li>
4806<li>or, the second argument is any other non-duration input value.</li>
4807</ul>
4808</li>
4809</ul>
4810</li>
4811<li>
4812
4813<p>Example:</p>
4814
4815<div>
4816<div>
4817<pre class="source">calendar_duration_from_datetime(
4818 datetime(&quot;2016-03-26T10:10:00&quot;),
4819 datetime(&quot;2016-03-26T10:10:00&quot;) - datetime(&quot;2011-01-01T00:00:00&quot;)
4820);
4821</pre></div></div>
4822</li>
4823<li>
4824
4825<p>The expected result is:</p>
4826
4827<div>
4828<div>
4829<pre class="source">duration(&quot;P5Y2M24DT10H10M&quot;)
4830</pre></div></div>
4831</li>
4832</ul></div>
4833<div class="section">
4834<h3><a name="get_year_month_duration.2Fget_day_time_duration"></a>get_year_month_duration/get_day_time_duration</h3>
4835<ul>
4836
4837<li>
4838
4839<p>Syntax:</p>
4840
4841<div>
4842<div>
4843<pre class="source">get_year_month_duration/get_day_time_duration(duration_value)
4844</pre></div></div>
4845</li>
4846<li>
4847
4848<p>Extracts the correct <tt>duration</tt> subtype from <tt>duration_value</tt>.</p>
4849</li>
4850<li>Arguments:
4851<ul>
4852
4853<li><tt>duration_value</tt> : a <tt>duration</tt> value to be converted.</li>
4854</ul>
4855</li>
4856<li>Return Value:
4857<ul>
4858
4859<li>a <tt>year_month_duration</tt> value or a <tt>day_time_duration</tt> value,</li>
4860<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
4861<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
4862<li>any other non-duration input value will cause a type error.</li>
4863</ul>
4864</li>
4865<li>
4866
4867<p>Example:</p>
4868
4869<div>
4870<div>
4871<pre class="source">get_year_month_duration(duration(&quot;P12M50DT10H&quot;));
4872</pre></div></div>
4873</li>
4874<li>
4875
4876<p>The expected result is:</p>
4877
4878<div>
4879<div>
4880<pre class="source">year_month_duration(&quot;P1Y&quot;)
4881</pre></div></div>
4882</li>
4883</ul></div>
4884<div class="section">
4885<h3><a name="months_from_year_month_duration.2Fms_from_day_time_duration"></a>months_from_year_month_duration/ms_from_day_time_duration</h3>
4886<ul>
4887
4888<li>
4889
4890<p>Syntax:</p>
4891
4892<div>
4893<div>
4894<pre class="source">months_from_year_month_duration/ms_from_day_time_duration(duration_value)
4895</pre></div></div>
4896</li>
4897<li>
4898
4899<p>Extracts the number of months or the number of milliseconds from the <tt>duration</tt> subtype.</p>
4900</li>
4901<li>Arguments:
4902<ul>
4903
4904<li><tt>duration_value</tt> : a <tt>duration</tt> of the correct subtype.</li>
4905</ul>
4906</li>
4907<li>Return Value:
4908<ul>
4909
4910<li>a <tt>bigint</tt> representing the number of months/milliseconds,</li>
4911<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
4912<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
4913<li>any other non-duration input value will cause a type error.</li>
4914</ul>
4915</li>
4916<li>
4917
4918<p>Example:</p>
4919
4920<div>
4921<div>
4922<pre class="source">{
4923 &quot;months&quot;: months_from_year_month_duration(get_year_month_duration(duration(&quot;P5Y7MT50M&quot;))),
4924 &quot;milliseconds&quot;: ms_from_day_time_duration(get_day_time_duration(duration(&quot;P5Y7MT50M&quot;)))
4925};
4926</pre></div></div>
4927</li>
4928<li>
4929
4930<p>The expected result is:</p>
4931
4932<div>
4933<div>
4934<pre class="source">{&quot;months&quot;: 67, &quot;milliseconds&quot;: 3000000}
4935</pre></div></div>
4936</li>
4937</ul></div>
4938<div class="section">
4939<h3><a name="duration_from_months.2Fduration_from_ms"></a>duration_from_months/duration_from_ms</h3>
4940<ul>
4941
4942<li>
4943
4944<p>Syntax:</p>
4945
4946<div>
4947<div>
4948<pre class="source">duration_from_months/duration_from_ms(number_value)
4949</pre></div></div>
4950</li>
4951<li>
4952
4953<p>Creates a <tt>duration</tt> from <tt>number_value</tt>.</p>
4954</li>
4955<li>Arguments:
4956<ul>
4957
4958<li><tt>number_value</tt> : a <tt>bigint</tt> representing the number of months/milliseconds</li>
4959</ul>
4960</li>
4961<li>Return Value:
4962<ul>
4963
4964<li>a <tt>duration</tt> containing <tt>number_value</tt> value for months/milliseconds,</li>
4965<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
4966<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
4967<li>any other non-duration input value will cause a type error.</li>
4968</ul>
4969</li>
4970<li>
4971
4972<p>Example:</p>
4973
4974<div>
4975<div>
4976<pre class="source">duration_from_months(8);
4977</pre></div></div>
4978</li>
4979<li>
4980
4981<p>The expected result is:</p>
4982
4983<div>
4984<div>
4985<pre class="source">duration(&quot;P8M&quot;)
4986</pre></div></div>
4987</li>
4988</ul></div>
4989<div class="section">
4990<h3><a name="duration_from_interval"></a>duration_from_interval</h3>
4991<ul>
4992
4993<li>
4994
4995<p>Syntax:</p>
4996
4997<div>
4998<div>
4999<pre class="source">duration_from_interval(interval_value)
5000</pre></div></div>
5001</li>
5002<li>
5003
5004<p>Creates a <tt>duration</tt> from <tt>interval_value</tt>.</p>
5005</li>
5006<li>Arguments:
5007<ul>
5008
5009<li><tt>interval_value</tt> : an <tt>interval</tt> value</li>
5010</ul>
5011</li>
5012<li>Return Value:
5013<ul>
5014
5015<li>a <tt>duration</tt> representing the time in the <tt>interval_value</tt></li>
5016<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5017<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5018<li>any other non-duration input value will cause a type error.</li>
5019</ul>
5020</li>
5021<li>
5022
5023<p>Example:</p>
5024
5025<div>
5026<div>
5027<pre class="source">{
5028 &quot;dr1&quot; : duration_from_interval(interval(date(&quot;2010-10-30&quot;), date(&quot;2010-12-21&quot;))),
5029 &quot;dr2&quot; : duration_from_interval(interval(datetime(&quot;2012-06-26T01:01:01.111&quot;), datetime(&quot;2012-07-27T02:02:02.222&quot;))),
5030 &quot;dr3&quot; : duration_from_interval(interval(time(&quot;12:32:38&quot;), time(&quot;20:29:20&quot;))),
5031 &quot;dr4&quot; : duration_from_interval(null)
5032};
5033</pre></div></div>
5034</li>
5035<li>
5036
5037<p>The expected result is:</p>
5038
5039<div>
5040<div>
5041<pre class="source">{
5042 &quot;dr1&quot;: day_time_duration(&quot;P52D&quot;),
5043 &quot;dr2&quot;: day_time_duration(&quot;P31DT1H1M1.111S&quot;),
5044 &quot;dr3&quot;: day_time_duration(&quot;PT7H56M42S&quot;),
5045 &quot;dr4&quot;: null
5046}
5047</pre></div></div>
5048</li>
5049</ul></div>
5050<div class="section">
5051<h3><a name="current_date"></a>current_date</h3>
5052<ul>
5053
5054<li>
5055
5056<p>Syntax:</p>
5057
5058<div>
5059<div>
5060<pre class="source">current_date()
5061</pre></div></div>
5062</li>
5063<li>
5064
5065<p>Gets the current date.</p>
5066</li>
5067<li>Arguments: None</li>
5068<li>Return Value:
5069<ul>
5070
5071<li>a <tt>date</tt> value of the date when the function is called.</li>
5072</ul>
5073</li>
5074</ul></div>
5075<div class="section">
5076<h3><a name="current_time"></a>current_time</h3>
5077<ul>
5078
5079<li>
5080
5081<p>Syntax:</p>
5082
5083<div>
5084<div>
5085<pre class="source">current_time()
5086</pre></div></div>
5087</li>
5088<li>
5089
5090<p>Get the current time</p>
5091</li>
5092<li>Arguments: None</li>
5093<li>Return Value:
5094<ul>
5095
5096<li>a <tt>time</tt> value of the time when the function is called.</li>
5097</ul>
5098</li>
5099</ul></div>
5100<div class="section">
5101<h3><a name="current_datetime"></a>current_datetime</h3>
5102<ul>
5103
5104<li>
5105
5106<p>Syntax:</p>
5107
5108<div>
5109<div>
5110<pre class="source">current_datetime()
5111</pre></div></div>
5112</li>
5113<li>
5114
5115<p>Get the current datetime</p>
5116</li>
5117<li>Arguments: None</li>
5118<li>Return Value:
5119<ul>
5120
5121<li>a <tt>datetime</tt> value of the datetime when the function is called.</li>
5122</ul>
5123</li>
5124</ul></div>
5125<div class="section">
5126<h3><a name="get_date_from_datetime"></a>get_date_from_datetime</h3>
5127<ul>
5128
5129<li>
5130
5131<p>Syntax:</p>
5132
5133<div>
5134<div>
5135<pre class="source">get_date_from_datetime(datetime)
5136</pre></div></div>
5137</li>
5138<li>
5139
5140<p>Gets the date value from the given datetime value <tt>datetime</tt>.</p>
5141</li>
5142<li>Arguments:
5143<ul>
5144
5145<li><tt>datetime</tt>: a <tt>datetime</tt> value to be extracted from.</li>
5146</ul>
5147</li>
5148<li>Return Value:
5149<ul>
5150
5151<li>a <tt>date</tt> value from the datetime,</li>
5152<li>any other non-datetime input value will cause a type error.</li>
5153</ul>
5154</li>
5155<li>
5156
5157<p>Example:</p>
5158<p>get_date_from_datetime(datetime(&#x201c;2016-03-26T10:10:00&#x201d;));</p>
5159</li>
5160<li>
5161
5162<p>The expected result is:</p>
5163<p>date(&#x201c;2016-03-26&#x201d;)</p>
5164</li>
5165</ul></div>
5166<div class="section">
5167<h3><a name="get_time_from_datetime"></a>get_time_from_datetime</h3>
5168<ul>
5169
5170<li>
5171
5172<p>Syntax:</p>
5173
5174<div>
5175<div>
5176<pre class="source">get_time_from_datetime(datetime)
5177</pre></div></div>
5178</li>
5179<li>
5180
5181<p>Get the time value from the given datetime value <tt>datetime</tt></p>
5182</li>
5183<li>Arguments:
5184<ul>
5185
5186<li><tt>datetime</tt>: a <tt>datetime</tt> value to be extracted from.</li>
5187</ul>
5188</li>
5189<li>Return Value:
5190<ul>
5191
5192<li>a <tt>time</tt> value from the datetime.</li>
5193<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5194<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5195<li>any other non-datetime input value will cause a type error.</li>
5196</ul>
5197</li>
5198<li>
5199
5200<p>Example:</p>
5201
5202<div>
5203<div>
5204<pre class="source">get_time_from_datetime(datetime(&quot;2016-03-26T10:10:00&quot;));
5205</pre></div></div>
5206</li>
5207<li>
5208
5209<p>The expected result is:</p>
5210
5211<div>
5212<div>
5213<pre class="source">time(&quot;10:10:00.000&quot;)
5214</pre></div></div>
5215</li>
5216</ul></div>
5217<div class="section">
5218<h3><a name="day_of_week"></a>day_of_week</h3>
5219<ul>
5220
5221<li>
5222
5223<p>Syntax:</p>
5224
5225<div>
5226<div>
5227<pre class="source">day_of_week(date[, week_start_day])
5228</pre></div></div>
5229</li>
5230<li>
5231
5232<p>Finds the day of the week for a given date (1_7)</p>
5233</li>
5234<li>Arguments:
5235<ul>
5236
5237<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
5238<li><tt>week_start_day</tt>: (Optional) an integer or a string value (case-insensitive) specifying the day of the week to start counting from: 1=Sun[day], 2=Mon[day], &#x2026;, 7=Sat[urday]. If omitted, the default is 1 (Sunday).</li>
5239</ul>
5240</li>
5241<li>Return Value:
5242<ul>
5243
5244<li>an <tt>bigint</tt> representing the day of the week (1_7),</li>
5245<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5246<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5247<li>any other non-date input value will cause a type error.</li>
5248</ul>
5249</li>
5250<li>
5251
5252<p>Example:</p>
5253
5254<div>
5255<div>
5256<pre class="source">{
5257 &quot;day_1&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;)),
5258 &quot;day_2&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), 2),
5259 &quot;day_3&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), &quot;Monday&quot;),
5260 &quot;day_4&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), &quot;MON&quot;)
5261};
5262</pre></div></div>
5263</li>
5264<li>
5265
5266<p>The expected result is:</p>
5267
5268<div>
5269<div>
5270<pre class="source">{ &quot;day_1&quot;: 1, &quot;day_2&quot;: 7, &quot;day_3&quot;: 7, &quot;day_4&quot;: 7 }
5271</pre></div></div>
5272</li>
5273</ul></div>
5274<div class="section">
5275<h3><a name="day_of_year"></a>day_of_year</h3>
5276<ul>
5277
5278<li>
5279
5280<p>Syntax:</p>
5281
5282<div>
5283<div>
5284<pre class="source">day_of_year(date)
5285</pre></div></div>
5286</li>
5287<li>
5288
5289<p>Finds the day of the year for a given date</p>
5290</li>
5291<li>Arguments:
5292<ul>
5293
5294<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
5295</ul>
5296</li>
5297<li>Return Value:
5298<ul>
5299
5300<li>an <tt>bigint</tt> representing the day of the year,</li>
5301<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5302<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5303<li>any other non-date input value will cause a type error.</li>
5304</ul>
5305</li>
5306<li>
5307
5308<p>Example:</p>
5309
5310<div>
5311<div>
5312<pre class="source">day_of_year(date(&quot;2011-12-31&quot;));
5313</pre></div></div>
5314</li>
5315<li>
5316
5317<p>The expected result is:</p>
5318
5319<div>
5320<div>
5321<pre class="source">365
5322</pre></div></div>
5323</li>
5324</ul></div>
5325<div class="section">
5326<h3><a name="week_of_year"></a>week_of_year</h3>
5327<ul>
5328
5329<li>
5330
5331<p>Syntax:</p>
5332
5333<div>
5334<div>
5335<pre class="source">week_of_year(date[, week_start_day])
5336</pre></div></div>
5337</li>
5338<li>
5339
5340<p>Finds the week of the year for a given date</p>
5341</li>
5342<li>Arguments:
5343<ul>
5344
5345<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
5346<li><tt>week_start_day</tt>: (Optional) an integer or a string value (case-insensitive) specifying the day of the week to start counting from: 1=Sun[day], 2=Mon[day], &#x2026;, 7=Sat[urday]. If omitted, the default is 1 (Sunday).</li>
5347</ul>
5348</li>
5349<li>Return Value:
5350<ul>
5351
5352<li>an <tt>bigint</tt> representing the week of the year,</li>
5353<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5354<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5355<li>any other non-date input value will cause a type error.</li>
5356</ul>
5357</li>
5358<li>
5359
5360<p>Example:</p>
5361
5362<div>
5363<div>
5364<pre class="source">{
5365 &quot;week_1&quot;: week_of_year(date(&quot;2012-12-01&quot;)),
5366 &quot;week_2&quot;: week_of_year(date(&quot;2012-12-01&quot;), 2),
5367 &quot;week_3&quot;: week_of_year(date(&quot;2012-12-01&quot;), &quot;Monday&quot;),
5368 &quot;week_4&quot;: week_of_year(date(&quot;2012-12-01&quot;), &quot;MON&quot;)
5369};
5370</pre></div></div>
5371</li>
5372<li>
5373
5374<p>The expected result is:</p>
5375
5376<div>
5377<div>
5378<pre class="source">{ &quot;week_1&quot;: 48, &quot;week_2&quot;: 49, &quot;week_3&quot;: 49, &quot;week_4&quot;: 49 }
5379</pre></div></div>
5380</li>
5381</ul></div>
5382<div class="section">
5383<h3><a name="quarter_of_year"></a>quarter_of_year</h3>
5384<ul>
5385
5386<li>
5387
5388<p>Syntax:</p>
5389
5390<div>
5391<div>
5392<pre class="source">quarter_of_year(date)
5393</pre></div></div>
5394</li>
5395<li>
5396
5397<p>Finds the quarter of the year for a given date</p>
5398</li>
5399<li>Arguments:
5400<ul>
5401
5402<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
5403</ul>
5404</li>
5405<li>Return Value:
5406<ul>
5407
5408<li>an <tt>bigint</tt> representing the quarter of the year (1_4),</li>
5409<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5410<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5411<li>any other non-date input value will cause a type error.</li>
5412</ul>
5413</li>
5414<li>
5415
5416<p>Example:</p>
5417
5418<div>
5419<div>
5420<pre class="source">quarter_of_year(date(&quot;2011-12-31&quot;));
5421</pre></div></div>
5422</li>
5423<li>
5424
5425<p>The expected result is:</p>
5426
5427<div>
5428<div>
5429<pre class="source">4
5430</pre></div></div>
5431</li>
5432</ul></div>
5433<div class="section">
5434<h3><a name="datetime_from_date_time"></a>datetime_from_date_time</h3>
5435<ul>
5436
5437<li>Syntax:</li>
5438</ul>
5439<p>datetime_from_date_time(date,time)</p>
5440<ul>
5441
5442<li>Gets a datetime representing the combination of <tt>date</tt> and <tt>time</tt>
5443<ul>
5444
5445<li>Arguments:</li>
5446<li><tt>date</tt>: a <tt>date</tt> value</li>
5447<li><tt>time</tt> a <tt>time</tt> value</li>
5448</ul>
5449</li>
5450<li>Return Value:
5451<ul>
5452
5453<li>a <tt>datetime</tt> value by combining <tt>date</tt> and <tt>time</tt>,</li>
5454<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
5455<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
5456<li>a type error will be raised if
5457<ul>
5458
5459<li>the first argument is any other non-date value,</li>
5460<li>or, the second argument is any other non-time value.</li>
5461</ul>
5462</li>
5463</ul>
5464</li>
5465</ul></div>
5466<div class="section">
5467<h3><a name="date_from_unix_time_in_days"></a>date_from_unix_time_in_days</h3>
5468<ul>
5469
5470<li>
5471
5472<p>Syntax:</p>
5473
5474<div>
5475<div>
5476<pre class="source">date_from_unix_time_in_days(numeric_value)
5477</pre></div></div>
5478</li>
5479<li>
5480
5481<p>Gets a date representing the time after <tt>numeric_value</tt> days since 1970-01-01.</p>
5482</li>
5483<li>Arguments:
5484<ul>
5485
5486<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value representing the number of days.</li>
5487</ul>
5488</li>
5489<li>Return Value:
5490<ul>
5491
5492<li>a <tt>date</tt> value as the time after <tt>numeric_value</tt> days since 1970-01-01,</li>
5493<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5494<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5495<li>any other non-numeric input value will cause a type error.</li>
5496</ul>
5497</li>
5498<li>
5499
5500<p>Example:</p>
5501
5502<div>
5503<div>
5504<pre class="source">date_from_unix_time_in_days(15800);
5505</pre></div></div>
5506</li>
5507<li>
5508
5509<p>The expected result is:</p>
5510<p>date(&#x201c;2013-04-05&#x201d;)</p>
5511</li>
5512</ul></div>
5513<div class="section">
5514<h3><a name="datetime_from_unix_time_in_ms"></a>datetime_from_unix_time_in_ms</h3>
5515<ul>
5516
5517<li>
5518
5519<p>Syntax:</p>
5520
5521<div>
5522<div>
5523<pre class="source">datetime_from_unix_time_in_ms(numeric_value[, string])
5524</pre></div></div>
5525</li>
5526<li>
5527
5528<p>Gets a datetime representing the time after <tt>numeric_value</tt> milliseconds since 1970-01-01T00:00:00Z.</p>
5529</li>
5530<li>Arguments:
5531<ul>
5532
5533<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value representing the number of milliseconds.</li>
5534<li><tt>string</tt> : (Optional) a string representing the target timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
5535</ul>
5536</li>
5537<li>Return Value:
5538<ul>
5539
5540<li>a <tt>datetime</tt> value as the time in the target time zone after <tt>numeric_value</tt> milliseconds since 1970-01-01T00:00:00Z,</li>
5541<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5542<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5543<li>any other non-numeric input value will cause a type error.</li>
5544</ul>
5545</li>
5546<li>
5547
5548<p>Example:</p>
5549
5550<div>
5551<div>
5552<pre class="source"> {
5553 &quot;datetime_1&quot;: datetime_from_unix_time_in_ms(1365139700000),
5554 &quot;datetime_2&quot;: datetime_from_unix_time_in_ms(1365139700000, &quot;America/Los_Angeles&quot;)
5555 };
5556</pre></div></div>
5557</li>
5558<li>
5559
5560<p>The expected result is:</p>
5561<p>{ &#x201c;datetime_1&#x201d;: datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;), &#x201c;datetime_2&#x201d;: datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;) }</p>
5562</li>
5563</ul></div>
5564<div class="section">
5565<h3><a name="datetime_from_unix_time_in_secs"></a>datetime_from_unix_time_in_secs</h3>
5566<ul>
5567
5568<li>
5569
5570<p>Syntax:</p>
5571
5572<div>
5573<div>
5574<pre class="source">datetime_from_unix_time_in_secs(numeric_value[, string])
5575</pre></div></div>
5576</li>
5577<li>
5578
5579<p>Gets a datetime representing the time after <tt>numeric_value</tt> seconds since 1970-01-01T00:00:00Z.</p>
5580</li>
5581<li>Arguments:
5582<ul>
5583
5584<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value representing the number of seconds.</li>
5585<li><tt>string</tt> : (Optional) a string representing the target timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
5586</ul>
5587</li>
5588<li>Return Value:
5589<ul>
5590
5591<li>a <tt>datetime</tt> value as the time in the target time zone after <tt>numeric_value</tt> seconds since 1970-01-01T00:00:00Z,</li>
5592<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5593<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5594<li>any other non-numeric input value will cause a type error.</li>
5595</ul>
5596</li>
5597<li>
5598
5599<p>Example:</p>
5600
5601<div>
5602<div>
5603<pre class="source">{
5604 &quot;datetime_1&quot;: datetime_from_unix_time_in_secs(1365139700),
5605 &quot;datetime_2&quot;: datetime_from_unix_time_in_secs(1365139700, &quot;America/Los_Angeles&quot;)
5606};
5607</pre></div></div>
5608</li>
5609<li>
5610
5611<p>The expected result is:</p>
5612<p>{ &#x201c;datetime_1&#x201d;: datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;), &#x201c;datetime_2&#x201d;: datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;) }</p>
5613</li>
5614</ul></div>
5615<div class="section">
5616<h3><a name="time_from_unix_time_in_ms"></a>time_from_unix_time_in_ms</h3>
5617<ul>
5618
5619<li>
5620
5621<p>Syntax:</p>
5622
5623<div>
5624<div>
5625<pre class="source">time_from_unix_time_in_ms(numeric_value)
5626</pre></div></div>
5627</li>
5628<li>
5629
5630<p>Gets a time representing the time after <tt>numeric_value</tt> milliseconds since 00:00:00.000.</p>
5631</li>
5632<li>Arguments:
5633<ul>
5634
5635<li><tt>numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value representing the number of milliseconds.</li>
5636</ul>
5637</li>
5638<li>Return Value:
5639<ul>
5640
5641<li>a <tt>time</tt> value as the time after <tt>numeric_value</tt> milliseconds since 00:00:00.000,</li>
5642<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5643<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5644<li>any other non-numeric input value will cause a type error.</li>
5645</ul>
5646</li>
5647<li>
5648
5649<p>Example:</p>
5650
5651<div>
5652<div>
5653<pre class="source">time_from_unix_time_in_ms(3748);
5654</pre></div></div>
5655</li>
5656<li>
5657
5658<p>The expected result is:</p>
5659
5660<div>
5661<div>
5662<pre class="source">time(&quot;00:00:03.748&quot;)
5663</pre></div></div>
5664</li>
5665</ul></div>
5666<div class="section">
5667<h3><a name="unix_time_from_date_in_days"></a>unix_time_from_date_in_days</h3>
5668<ul>
5669
5670<li>
5671
5672<p>Syntax:</p>
5673
5674<div>
5675<div>
5676<pre class="source">unix_time_from_date_in_days(date_value)
5677</pre></div></div>
5678</li>
5679<li>
5680
5681<p>Gets an integer value representing the number of days since 1970-01-01 for <tt>date_value</tt>.</p>
5682</li>
5683<li>Arguments:
5684<ul>
5685
5686<li><tt>date_value</tt>: a <tt>date</tt> value.</li>
5687</ul>
5688</li>
5689<li>Return Value:
5690<ul>
5691
5692<li>a <tt>bigint</tt> value representing the number of days,</li>
5693<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5694<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5695<li>any other non-date input value will cause a type error.</li>
5696</ul>
5697</li>
5698<li>
5699
5700<p>Example:</p>
5701<p>unix_time_from_date_in_days(date(&#x201c;2013-04-05&#x201d;));</p>
5702</li>
5703<li>
5704
5705<p>The expected result is:</p>
5706<p>15800</p>
5707</li>
5708</ul></div>
5709<div class="section">
5710<h3><a name="unix_time_from_datetime_in_ms"></a>unix_time_from_datetime_in_ms</h3>
5711<ul>
5712
5713<li>
5714
5715<p>Syntax:</p>
5716
5717<div>
5718<div>
5719<pre class="source">unix_time_from_datetime_in_ms(datetime_value[, string])
5720</pre></div></div>
5721</li>
5722<li>
5723
5724<p>Gets an integer value representing the time in milliseconds since 1970-01-01T00:00:00Z for <tt>datetime_value</tt>.</p>
5725</li>
5726<li>Arguments:
5727<ul>
5728
5729<li><tt>datetime_value</tt> : a <tt>datetime</tt> value.</li>
5730<li><tt>string</tt> : (Optional) a string representing the source timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
5731</ul>
5732</li>
5733<li>
5734
5735<p>Return Value:</p>
5736<ul>
5737
5738<li>a <tt>bigint</tt> value representing the number of milliseconds,</li>
5739<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5740<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5741<li>any other non-datetime input value will cause a type error.</li>
5742</ul>
5743</li>
5744<li>
5745
5746<p>Example:</p>
5747<p>{ &#x201c;unix_time_1&#x201d;: unix_time_from_datetime_in_ms(datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;)), &#x201c;unix_time_2&#x201d;: unix_time_from_datetime_in_ms(datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;), &#x201c;America/Los_Angeles&#x201d;) };</p>
5748</li>
5749<li>
5750
5751<p>The expected result is:</p>
5752<p>{ &#x201c;unix_time_1&#x201d;: 1365139700000, &#x201c;unix_time_2&#x201d;: 1365139700000 }</p>
5753</li>
5754</ul></div>
5755<div class="section">
5756<h3><a name="unix_time_from_datetime_in_secs"></a>unix_time_from_datetime_in_secs</h3>
5757<ul>
5758
5759<li>
5760
5761<p>Syntax:</p>
5762
5763<div>
5764<div>
5765<pre class="source">unix_time_from_datetime_in_secs(datetime_value[, string])
5766</pre></div></div>
5767</li>
5768<li>
5769
5770<p>Gets an integer value representing the time in seconds since 1970-01-01T00:00:00Z for <tt>datetime_value</tt>.</p>
5771</li>
5772<li>Arguments:
5773<ul>
5774
5775<li><tt>datetime_value</tt> : a <tt>datetime</tt> value.</li>
5776</ul>
5777</li>
5778<li><tt>string</tt> : (Optional) a string representing the source timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
5779<li>Return Value:
5780<ul>
5781
5782<li>a <tt>bigint</tt> value representing the number of seconds,</li>
5783<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5784<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5785<li>any other non-datetime input value will cause a type error.</li>
5786</ul>
5787</li>
5788<li>
5789
5790<p>Example:</p>
5791<p>{ &#x201c;unix_time_1&#x201d;: unix_time_from_datetime_in_secs(datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;)), &#x201c;unix_time_2&#x201d;: unix_time_from_datetime_in_secs(datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;), &#x201c;America/Los_Angeles&#x201d;) };</p>
5792</li>
5793<li>
5794
5795<p>The expected result is:</p>
5796<p>{ &#x201c;unix_time_1&#x201d;: 1365139700, &#x201c;unix_time_2&#x201d;: 1365139700 }</p>
5797</li>
5798</ul></div>
5799<div class="section">
5800<h3><a name="unix_time_from_time_in_ms"></a>unix_time_from_time_in_ms</h3>
5801<ul>
5802
5803<li>
5804
5805<p>Syntax:</p>
5806
5807<div>
5808<div>
5809<pre class="source">unix_time_from_time_in_ms(time_value)
5810</pre></div></div>
5811</li>
5812<li>
5813
5814<p>Gets an integer value representing the time the milliseconds since 00:00:00.000 for <tt>time_value</tt>.</p>
5815</li>
5816<li>Arguments:
5817<ul>
5818
5819<li><tt>time_value</tt> : a <tt>time</tt> value.</li>
5820</ul>
5821</li>
5822<li>Return Value:
5823<ul>
5824
5825<li>a <tt>bigint</tt> value representing the number of milliseconds,</li>
5826<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5827<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5828<li>any other non-datetime input value will cause a type error.</li>
5829</ul>
5830</li>
5831<li>
5832
5833<p>Example:</p>
5834
5835<div>
5836<div>
5837<pre class="source">unix_time_from_time_in_ms(time(&quot;00:00:03.748&quot;));
5838</pre></div></div>
5839</li>
5840<li>
5841
5842<p>The expected result is:</p>
5843
5844<div>
5845<div>
5846<pre class="source">3748
5847</pre></div></div>
5848</li>
5849</ul></div>
5850<div class="section">
5851<h3><a name="parse_date.2Fparse_time.2Fparse_datetime"></a>parse_date/parse_time/parse_datetime</h3>
5852<ul>
5853
5854<li>Syntax:</li>
5855</ul>
5856<p>parse_date/parse_time/parse_datetime(date,formatting_expression)</p>
5857<ul>
5858
5859<li>Creates a <tt>date/time/date_time</tt> value by treating <tt>date</tt> with formatting <tt>formatting_expression</tt></li>
5860<li>Arguments:
5861<ul>
5862
5863<li><tt>date</tt>: a <tt>string</tt> value representing the <tt>date/time/datetime</tt>.</li>
5864<li><tt>formatting_expression</tt> a <tt>string</tt> value providing the formatting for <tt>date_expression</tt>.Characters used to create date expression:</li>
5865<li><tt>h</tt> hours</li>
5866<li><tt>m</tt> minutes</li>
5867<li><tt>s</tt> seconds</li>
5868<li><tt>n</tt> (or <tt>S</tt>) milliseconds</li>
5869<li><tt>a</tt> am/pm</li>
5870<li><tt>z</tt> timezone (parsed and ignored)</li>
5871<li><tt>Y</tt> year</li>
5872<li><tt>Q</tt> quarter of year (1-4)</li>
5873<li><tt>QQ</tt> quarter of year (01-04)</li>
5874<li><tt>M</tt> month</li>
5875<li><tt>D</tt> day</li>
5876<li><tt>EEE</tt> weekday (abbreviated name, parsed and ignored)</li>
5877<li><tt>EEEE</tt> weekday (full name, parsed and ignored)</li>
5878<li><tt>_</tt>, <tt>'</tt>, <tt>/</tt>, <tt>.</tt>, <tt>,</tt>, <tt>T</tt> seperators for both time and date</li>
5879</ul>
5880</li>
5881<li>Return Value:
5882<ul>
5883
5884<li>a <tt>date/time/date_time</tt> value corresponding to <tt>date</tt>,</li>
5885<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
5886<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
5887<li>a type error will be raised if:</li>
5888<li>the first argument is any other non-date value,</li>
5889<li>the second argument is any other non-string value.</li>
5890</ul>
5891</li>
5892<li>
5893
5894<p>Example:</p>
5895
5896<div>
5897<div>
5898<pre class="source">parse_time(&quot;30:30&quot;,&quot;m:s&quot;);
5899</pre></div></div>
5900</li>
5901<li>
5902
5903<p>The expected result is:</p>
5904
5905<div>
5906<div>
5907<pre class="source">time(&quot;00:30:30.000&quot;)
5908</pre></div></div>
5909</li>
5910</ul></div>
5911<div class="section">
5912<h3><a name="print_date.2Fprint_time.2Fprint_datetime"></a>print_date/print_time/print_datetime</h3>
5913<ul>
5914
5915<li>
5916
5917<p>Syntax:</p>
5918
5919<div>
5920<div>
5921<pre class="source">print_date/print_time/print_datetime(date,formatting_expression)
5922</pre></div></div>
5923</li>
5924<li>
5925
5926<p>Creates a <tt>string</tt> representing a <tt>date/time/date_time</tt> value of the <tt>date</tt> using the formatting <tt>formatting_expression</tt></p>
5927</li>
5928<li>Arguments:
5929<ul>
5930
5931<li><tt>date</tt>: a <tt>date/time/datetime</tt> value.</li>
5932<li><tt>formatting_expression</tt> a <tt>string</tt> value providing the formatting for <tt>date_expression</tt>. Characters used to create date expression:</li>
5933<li><tt>h</tt> hours</li>
5934<li><tt>m</tt> minutes</li>
5935<li><tt>s</tt> seconds</li>
5936<li><tt>n</tt> (or <tt>S</tt>) milliseconds</li>
5937<li><tt>a</tt> am/pm</li>
5938<li><tt>Y</tt> year</li>
5939<li><tt>Q</tt> quarter of year (1-4)</li>
5940<li><tt>QQ</tt> quarter of year (01-04)</li>
5941<li><tt>M</tt> month</li>
5942<li><tt>MMM</tt> month (abbreviated name)</li>
5943<li><tt>MMMM</tt> month (full name)</li>
5944<li><tt>D</tt> day</li>
5945<li><tt>DDD</tt> day of year</li>
5946<li><tt>EEE</tt> weekday (abbreviated name)</li>
5947<li><tt>EEEE</tt> weekday (full name)</li>
5948<li><tt>_</tt>, <tt>'</tt>, <tt>/</tt>, <tt>.</tt>, <tt>,</tt>, <tt>T</tt> seperators for both time and date</li>
5949</ul>
5950</li>
5951<li>Return Value:
5952<ul>
5953
5954<li>a <tt>string</tt> value corresponding to <tt>date</tt>,</li>
5955<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
5956<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
5957<li>a type error will be raised if:
5958<ul>
5959
5960<li>the first argument is any other non-date value,</li>
5961<li>the second argument is any other non-string value.</li>
5962</ul>
5963</li>
5964</ul>
5965</li>
5966<li>
5967
5968<p>Example:</p>
5969
5970<div>
5971<div>
5972<pre class="source">print_time(time(&quot;00:30:30.000&quot;),&quot;m:s&quot;);
5973</pre></div></div>
5974</li>
5975<li>
5976
5977<p>The expected result is:</p>
5978
5979<div>
5980<div>
5981<pre class="source">&quot;30:30&quot;
5982</pre></div></div>
5983</li>
5984</ul></div>
5985<div class="section">
5986<h3><a name="get_interval_start.2C_get_interval_end"></a>get_interval_start, get_interval_end</h3>
5987<ul>
5988
5989<li>
5990
5991<p>Syntax:</p>
5992
5993<div>
5994<div>
5995<pre class="source">get_interval_start/get_interval_end(interval)
5996</pre></div></div>
5997</li>
5998<li>
5999
6000<p>Gets the start/end of the given interval.</p>
6001</li>
6002<li>Arguments:
6003<ul>
6004
6005<li><tt>interval</tt>: the interval to be accessed.</li>
6006</ul>
6007</li>
6008<li>Return Value:
6009<ul>
6010
6011<li>a <tt>time</tt>, <tt>date</tt>, or <tt>datetime</tt> (depending on the time instances of the interval) representing the starting or ending time,</li>
6012<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
6013<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
6014<li>any other non-interval value will cause a type error.</li>
6015</ul>
6016</li>
6017<li>
6018
6019<p>Example:</p>
6020
6021<div>
6022<div>
6023<pre class="source">{
6024 &quot;start&quot;: get_interval_start(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
6025 &quot;end&quot;: get_interval_end(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;))
6026};
6027</pre></div></div>
6028</li>
6029<li>
6030
6031<p>The expected result is:</p>
6032
6033<div>
6034<div>
6035<pre class="source">{ &quot;start&quot;: date(&quot;1984-01-01&quot;), &quot;end&quot;: date(&quot;1985-01-01&quot;) }
6036</pre></div></div>
6037</li>
6038</ul></div>
6039<div class="section">
6040<h3><a name="get_interval_start_date.2Fget_interval_start_datetimeget_interval_start_time.2C_get_interval_end_date.2Fget_interval_end_datetime.2Fget_interval_end_time"></a>get_interval_start_date/get_interval_start_datetimeget_interval_start_time, get_interval_end_date/get_interval_end_datetime/get_interval_end_time</h3>
6041<ul>
6042
6043<li>
6044
6045<p>Syntax:</p>
6046
6047<div>
6048<div>
6049<pre class="source">get_interval_start_date/get_interval_start_datetime/get_interval_start_time/get_interval_end_date/get_interval_end_datetime/get_interval_end_time(interval)
6050</pre></div></div>
6051</li>
6052<li>
6053
6054<p>Gets the start/end of the given interval for the specific date/datetime/time type.</p>
6055</li>
6056<li>Arguments:
6057<ul>
6058
6059<li><tt>interval</tt>: the interval to be accessed.</li>
6060</ul>
6061</li>
6062<li>Return Value:
6063<ul>
6064
6065<li>a <tt>time</tt>, <tt>date</tt>, or <tt>datetime</tt> (depending on the function) representing the starting or ending time,</li>
6066<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
6067<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
6068<li>any other non-interval value will cause a type error.</li>
6069</ul>
6070</li>
6071<li>
6072
6073<p>Example:</p>
6074
6075<div>
6076<div>
6077<pre class="source">{
6078 &quot;start1&quot;: get_interval_start_date(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
6079 &quot;end1&quot;: get_interval_end_date(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
6080 &quot;start2&quot;: get_interval_start_datetime(interval_start_from_datetime(&quot;1984-01-01T08:30:00.000&quot;, &quot;P1Y1H&quot;)),
6081 &quot;end2&quot;: get_interval_end_datetime(interval_start_from_datetime(&quot;1984-01-01T08:30:00.000&quot;, &quot;P1Y1H&quot;)),
6082 &quot;start3&quot;: get_interval_start_time(interval_start_from_time(&quot;08:30:00.000&quot;, &quot;P1H&quot;)),
6083 &quot;end3&quot;: get_interval_end_time(interval_start_from_time(&quot;08:30:00.000&quot;, &quot;P1H&quot;))
6084};
6085</pre></div></div>
6086</li>
6087<li>
6088
6089<p>The expected result is:</p>
6090
6091<div>
6092<div>
6093<pre class="source">{
6094 &quot;start1&quot;: date(&quot;1984-01-01&quot;),
6095 &quot;end1&quot;: date(&quot;1985-01-01&quot;),
6096 &quot;start2&quot;: datetime(&quot;1984-01-01T08:30:00.000&quot;),
6097 &quot;end2&quot;: datetime(&quot;1985-01-01T09:30:00.000&quot;),
6098 &quot;start3&quot;: time(&quot;08:30:00.000&quot;),
6099 &quot;end3&quot;: time(&quot;09:30:00.000&quot;)
6100}
6101</pre></div></div>
6102</li>
6103</ul></div>
6104<div class="section">
6105<h3><a name="get_overlapping_interval"></a>get_overlapping_interval</h3>
6106<ul>
6107
6108<li>
6109
6110<p>Syntax:</p>
6111
6112<div>
6113<div>
6114<pre class="source">get_overlapping_interval(interval1, interval2)
6115</pre></div></div>
6116</li>
6117<li>
6118
6119<p>Gets the start/end of the given interval for the specific date/datetime/time type.</p>
6120</li>
6121<li>Arguments:
6122<ul>
6123
6124<li><tt>interval1</tt>: an <tt>interval</tt> value</li>
6125<li><tt>interval2</tt>: an <tt>interval</tt> value</li>
6126</ul>
6127</li>
6128<li>Return Value:
6129<ul>
6130
6131<li>an <tt>interval</tt> that is overlapping <tt>interval1</tt> and <tt>interval2</tt>. If <tt>interval1</tt> and <tt>interval2</tt> do not overlap <tt>null</tt> is returned. Note each interval must be of the same type.</li>
6132<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
6133<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6134<li>any other non-interval input value will cause a type error.</li>
6135</ul>
6136</li>
6137<li>
6138
6139<p>Example:</p>
6140
6141<div>
6142<div>
6143<pre class="source">{
6144 &quot;overlap1&quot;: get_overlapping_interval(interval(time(&quot;11:23:39&quot;), time(&quot;18:27:19&quot;)), interval(time(&quot;12:23:39&quot;), time(&quot;23:18:00&quot;))),
6145 &quot;overlap2&quot;: get_overlapping_interval(interval(time(&quot;12:23:39&quot;), time(&quot;18:27:19&quot;)), interval(time(&quot;07:19:39&quot;), time(&quot;09:18:00&quot;))),
6146 &quot;overlap3&quot;: get_overlapping_interval(interval(date(&quot;1980-11-30&quot;), date(&quot;1999-09-09&quot;)), interval(date(&quot;2013-01-01&quot;), date(&quot;2014-01-01&quot;))),
6147 &quot;overlap4&quot;: get_overlapping_interval(interval(date(&quot;1980-11-30&quot;), date(&quot;2099-09-09&quot;)), interval(date(&quot;2013-01-01&quot;), date(&quot;2014-01-01&quot;))),
6148 &quot;overlap5&quot;: get_overlapping_interval(interval(datetime(&quot;1844-03-03T11:19:39&quot;), datetime(&quot;2000-10-30T18:27:19&quot;)), interval(datetime(&quot;1989-03-04T12:23:39&quot;), datetime(&quot;2009-10-10T23:18:00&quot;))),
6149 &quot;overlap6&quot;: get_overlapping_interval(interval(datetime(&quot;1989-03-04T12:23:39&quot;), datetime(&quot;2000-10-30T18:27:19&quot;)), interval(datetime(&quot;1844-03-03T11:19:39&quot;), datetime(&quot;1888-10-10T23:18:00&quot;)))
6150};
6151</pre></div></div>
6152</li>
6153<li>
6154
6155<p>The expected result is:</p>
6156
6157<div>
6158<div>
6159<pre class="source">{
6160 &quot;overlap1&quot;: interval(time(&quot;12:23:39.000&quot;), time(&quot;18:27:19.000&quot;)),
6161 &quot;overlap2&quot;: null,
6162 &quot;overlap3&quot;: null,
6163 &quot;overlap4&quot;: interval(date(&quot;2013-01-01&quot;), date(&quot;2014-01-01&quot;)),
6164 &quot;overlap5&quot;: interval(datetime(&quot;1989-03-04T12:23:39.000&quot;), datetime(&quot;2000-10-30T18:27:19.000&quot;)),
6165 &quot;overlap6&quot;: null
6166}
6167</pre></div></div>
6168</li>
6169</ul></div>
6170<div class="section">
6171<h3><a name="interval_bin"></a>interval_bin</h3>
6172<ul>
6173
6174<li>
6175
6176<p>Syntax:</p>
6177
6178<div>
6179<div>
6180<pre class="source">interval_bin(time_to_bin, time_bin_anchor, duration_bin_size)
6181</pre></div></div>
6182</li>
6183<li>
6184
6185<p>Returns the <tt>interval</tt> value representing the bin containing the <tt>time_to_bin</tt> value.</p>
6186</li>
6187<li>Arguments:
6188<ul>
6189
6190<li><tt>time_to_bin</tt>: a date/time/datetime value representing the time to be binned.</li>
6191<li><tt>time_bin_anchor</tt>: a date/time/datetime value representing an anchor of a bin starts. The type of this argument should be the same as the first <tt>time_to_bin</tt> argument.</li>
6192<li><tt>duration_bin_size</tt>: the duration value representing the size of the bin, in the type of year_month_duration or day_time_duration. The type of this duration should be compatible with the type of <tt>time_to_bin</tt>, so that the arithmetic operation between <tt>time_to_bin</tt> and <tt>duration_bin_size</tt> is well_defined. Currently AsterixDB supports the following arithmetic operations:
6193<ul>
6194
6195<li>datetime +|_ year_month_duration</li>
6196<li>datetime +|_ day_time_duration</li>
6197<li>date +|_ year_month_duration</li>
6198<li>date +|_ day_time_duration</li>
6199<li>time +|_ day_time_duration</li>
6200</ul>
6201</li>
6202</ul>
6203</li>
6204<li>Return Value:</li>
6205<li>a <tt>interval</tt> value representing the bin containing the <tt>time_to_bin</tt> value. Note that the internal type of this interval value should be the same as the <tt>time_to_bin</tt> type,</li>
6206<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
6207<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6208<li>a type error will be raised if:
6209<ul>
6210
6211<li>the first argument or the second argument is any other non-date/non-time/non-datetime value,</li>
6212<li>or, the second argument is any other non-year_month_duration/non-day_time_duration value.</li>
6213</ul>
6214</li>
6215<li>
6216
6217<p>Example:</p>
6218<p>{ &#x201c;bin1&#x201d;: interval_bin(date(&#x201c;2010-10-30&#x201d;), date(&#x201c;1990-01-01&#x201d;), year_month_duration(&#x201c;P1Y&#x201d;)), &#x201c;bin2&#x201d;: interval_bin(datetime(&#x201c;1987-11-19T23:49:23.938&#x201d;), datetime(&#x201c;1990-01-01T00:00:00.000&#x201d;), year_month_duration(&#x201c;P6M&#x201d;)), &#x201c;bin3&#x201d;: interval_bin(time(&#x201c;12:23:34.930+07:00&#x201d;), time(&#x201c;00:00:00&#x201d;), day_time_duration(&#x201c;PT1M&#x201d;)), &#x201c;bin4&#x201d;: interval_bin(datetime(&#x201c;1987-11-19T23:49:23.938&#x201d;), datetime(&#x201c;2013-01-01T00:00:00.000&#x201d;), day_time_duration(&#x201c;PT24H&#x201d;)) };</p>
6219</li>
6220<li>
6221
6222<p>The expected result is:</p>
6223<p>{ &#x201c;bin1&#x201d;: interval(date(&#x201c;2010-01-01&#x201d;), date(&#x201c;2011-01-01&#x201d;)), &#x201c;bin2&#x201d;: interval(datetime(&#x201c;1987-07-01T00:00:00.000&#x201d;), datetime(&#x201c;1988-01-01T00:00:00.000&#x201d;)), &#x201c;bin3&#x201d;: interval(time(&#x201c;12:23:00.000&#x201d;), time(&#x201c;12:24:00.000&#x201d;)), &#x201c;bin4&#x201d;: interval(datetime(&#x201c;1987-11-19T00:00:00.000&#x201d;), datetime(&#x201c;1987-11-20T00:00:00.000&#x201d;)) }</p>
6224</li>
6225</ul></div>
6226<div class="section">
6227<h3><a name="interval_start_from_date.2Ftime.2Fdatetime"></a>interval_start_from_date/time/datetime</h3>
6228<ul>
6229
6230<li>
6231
6232<p>Syntax:</p>
6233
6234<div>
6235<div>
6236<pre class="source">interval_start_from_date/time/datetime(date/time/datetime, duration)
6237</pre></div></div>
6238</li>
6239<li>
6240
6241<p>Construct an <tt>interval</tt> value by the given starting <tt>date</tt>/<tt>time</tt>/<tt>datetime</tt> and the <tt>duration</tt> that the interval lasts.</p>
6242</li>
6243<li>Arguments:
6244<ul>
6245
6246<li><tt>date/time/datetime</tt>: a <tt>string</tt> representing a <tt>date</tt>, <tt>time</tt> or <tt>datetime</tt>, or a <tt>date</tt>/<tt>time</tt>/<tt>datetime</tt> value, representing the starting time point.</li>
6247<li><tt>duration</tt>: a <tt>string</tt> or <tt>duration</tt> value representing the duration of the interval. Note that duration cannot be negative value.</li>
6248</ul>
6249</li>
6250<li>Return Value:
6251<ul>
6252
6253<li>an <tt>interval</tt> value representing the interval starting from the given time point with the length of duration,</li>
6254<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
6255<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6256<li>a type error will be raised if:
6257<ul>
6258
6259<li>the first argument or the second argument is any other non-date/non-time/non-datetime value,</li>
6260<li>or, the second argument is any other non-duration value.</li>
6261</ul>
6262</li>
6263</ul>
6264</li>
6265<li>
6266
6267<p>Example:</p>
6268
6269<div>
6270<div>
6271<pre class="source">{
6272 &quot;interval1&quot;: interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;),
6273 &quot;interval2&quot;: interval_start_from_time(time(&quot;02:23:28.394&quot;), &quot;PT3H24M&quot;),
6274 &quot;interval3&quot;: interval_start_from_datetime(&quot;1999-09-09T09:09:09.999&quot;, duration(&quot;P2M30D&quot;))
6275};
6276</pre></div></div>
6277</li>
6278<li>
6279
6280<p>The expected result is:</p>
6281
6282<div>
6283<div>
6284<pre class="source">{
6285 &quot;interval1&quot;: interval(date(&quot;1984-01-01&quot;), date(&quot;1985-01-01&quot;)),
6286 &quot;interval2&quot;: interval(time(&quot;02:23:28.394&quot;), time(&quot;05:47:28.394&quot;)),
6287 &quot;interval3&quot;: interval(datetime(&quot;1999-09-09T09:09:09.999&quot;), datetime(&quot;1999-12-09T09:09:09.999&quot;))
6288}
6289</pre></div></div>
6290</li>
6291</ul></div>
6292<div class="section">
6293<h3><a name="overlap_bins"></a>overlap_bins</h3>
6294<ul>
6295
6296<li>
6297
6298<p>Return Value:</p>
6299<ul>
6300
6301<li>a <tt>interval</tt> value representing the bin containing the <tt>time_to_bin</tt> value. Note that the internal type of this interval value should be the same as the <tt>time_to_bin</tt> type.</li>
6302</ul>
6303</li>
6304<li>
6305
6306<p>Syntax:</p>
6307
6308<div>
6309<div>
6310<pre class="source"> overlap_bins(interval, time_bin_anchor, duration_bin_size)
6311</pre></div></div>
6312</li>
6313<li>
6314
6315<p>Returns an ordered list of <tt>interval</tt> values representing each bin that is overlapping the <tt>interval</tt>.</p>
6316</li>
6317<li>Arguments:
6318<ul>
6319
6320<li><tt>interval</tt>: an <tt>interval</tt> value</li>
6321<li><tt>time_bin_anchor</tt>: a date/time/datetime value representing an anchor of a bin starts. The type of this argument should be the same as the first <tt>time_to_bin</tt> argument.</li>
6322<li><tt>duration_bin_size</tt>: the duration value representing the size of the bin, in the type of year_month_duration or day_time_duration. The type of this duration should be compatible with the type of <tt>time_to_bin</tt>, so that the arithmetic operation between <tt>time_to_bin</tt> and <tt>duration_bin_size</tt> is well_defined. Currently AsterixDB supports the following arithmetic operations:
6323<ul>
6324
6325<li>datetime +|_ year_month_duration</li>
6326<li>datetime +|_ day_time_duration</li>
6327<li>date +|_ year_month_duration</li>
6328<li>date +|_ day_time_duration</li>
6329<li>time +|_ day_time_duration</li>
6330</ul>
6331</li>
6332</ul>
6333</li>
6334<li>Return Value:
6335<ul>
6336
6337<li>a ordered list of <tt>interval</tt> values representing each bin that is overlapping the <tt>interval</tt>. Note that the internal type as <tt>time_to_bin</tt> and <tt>duration_bin_size</tt>.</li>
6338<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
6339<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6340<li>a type error will be raised if:
6341<ul>
6342
6343<li>the first arugment is any other non-interval value,</li>
6344<li>or, the second argument is any other non-date/non-time/non-datetime value,</li>
6345<li>or, the second argument is any other non-year_month_duration/non-day_time_duration value.</li>
6346</ul>
6347</li>
6348</ul>
6349</li>
6350<li>
6351
6352<p>Example:</p>
6353
6354<div>
6355<div>
6356<pre class="source">{
6357 &quot;timebins&quot;: overlap_bins(interval(time(&quot;17:23:37&quot;), time(&quot;18:30:21&quot;)), time(&quot;00:00:00&quot;), day_time_duration(&quot;PT30M&quot;)),
6358 &quot;datebins&quot;: overlap_bins(interval(date(&quot;1984-03-17&quot;), date(&quot;2013-08-22&quot;)), date(&quot;1990-01-01&quot;), year_month_duration(&quot;P10Y&quot;)),
6359 &quot;datetimebins&quot;: overlap_bins(interval(datetime(&quot;1800-01-01T23:59:48.938&quot;), datetime(&quot;2015-07-26T13:28:30.218&quot;)),
6360 datetime(&quot;1900-01-01T00:00:00.000&quot;), year_month_duration(&quot;P100Y&quot;))
6361};
6362</pre></div></div>
6363</li>
6364<li>
6365
6366<p>The expected result is:</p>
6367<p>{ &#x201c;timebins&#x201d;: [ interval(time(&#x201c;17:00:00.000&#x201d;), time(&#x201c;17:30:00.000&#x201d;)), interval(time(&#x201c;17:30:00.000&#x201d;), time(&#x201c;18:00:00.000&#x201d;)), interval(time(&#x201c;18:00:00.000&#x201d;), time(&#x201c;18:30:00.000&#x201d;)), interval(time(&#x201c;18:30:00.000&#x201d;), time(&#x201c;19:00:00.000&#x201d;)) ], &#x201c;datebins&#x201d;: [ interval(date(&#x201c;1980-01-01&#x201d;), date(&#x201c;1990-01-01&#x201d;)), interval(date(&#x201c;1990-01-01&#x201d;), date(&#x201c;2000-01-01&#x201d;)), interval(date(&#x201c;2000-01-01&#x201d;), date(&#x201c;2010-01-01&#x201d;)), interval(date(&#x201c;2010-01-01&#x201d;), date(&#x201c;2020-01-01&#x201d;)) ], &#x201c;datetimebins&#x201d;: [ interval(datetime(&#x201c;1800-01-01T00:00:00.000&#x201d;), datetime(&#x201c;1900-01-01T00:00:00.000&#x201d;)), interval(datetime(&#x201c;1900-01-01T00:00:00.000&#x201d;), datetime(&#x201c;2000-01-01T00:00:00.000&#x201d;)), interval(datetime(&#x201c;2000-01-01T00:00:00.000&#x201d;), datetime(&#x201c;2100-01-01T00:00:00.000&#x201d;)) ] };</p>
6368</li>
6369</ul><!--
6370 ! Licensed to the Apache Software Foundation (ASF) under one
6371 ! or more contributor license agreements. See the NOTICE file
6372 ! distributed with this work for additional information
6373 ! regarding copyright ownership. The ASF licenses this file
6374 ! to you under the Apache License, Version 2.0 (the
6375 ! "License"); you may not use this file except in compliance
6376 ! with the License. You may obtain a copy of the License at
6377 !
6378 ! http://www.apache.org/licenses/LICENSE-2.0
6379 !
6380 ! Unless required by applicable law or agreed to in writing,
6381 ! software distributed under the License is distributed on an
6382 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
6383 ! KIND, either express or implied. See the License for the
6384 ! specific language governing permissions and limitations
6385 ! under the License.
6386 !-->
6387</div>
6388<div class="section">
6389<h3><a name="interval_before.2C_interval_after"></a>interval_before, interval_after</h3>
6390<ul>
6391
6392<li>
6393
6394<p>Syntax:</p>
6395
6396<div>
6397<div>
6398<pre class="source">interval_before(interval1, interval2)
6399interval_after(interval1, interval2)
6400</pre></div></div>
6401</li>
6402<li>
6403
6404<p>These two functions check whether an interval happens before/after another interval.</p>
6405</li>
6406<li>Arguments:
6407<ul>
6408
6409<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6410</ul>
6411</li>
6412<li>Return Value:
6413<ul>
6414
6415<li>a <tt>boolean</tt> value. Specifically, <tt>interval_before(interval1, interval2)</tt> is true if and only if <tt>interval1.end &lt; interval2.start</tt>, and <tt>interval_after(interval1, interval2)</tt> is true if and only if <tt>interval1.start &gt; interval2.end</tt>.</li>
6416<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
6417<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6418<li>any other non-interval input value will cause a type error.</li>
6419</ul>
6420</li>
6421<li>
6422
6423<p>Examples:</p>
6424
6425<div>
6426<div>
6427<pre class="source">{
6428 &quot;interval_before&quot;: interval_before(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6429 interval(date(&quot;2005-05-01&quot;), date(&quot;2012-09-09&quot;))),
6430 &quot;interval_after&quot;: interval_after(interval(date(&quot;2005-05-01&quot;), date(&quot;2012-09-09&quot;)),
6431 interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)))
6432};
6433</pre></div></div>
6434</li>
6435<li>
6436
6437<p>The expected result is:</p>
6438
6439<div>
6440<div>
6441<pre class="source">{ &quot;interval_before&quot;: true, &quot;interval_after&quot;: true }
6442</pre></div></div>
6443</li>
6444</ul></div>
6445<div class="section">
6446<h3><a name="interval_covers.2C_interval_covered_by"></a>interval_covers, interval_covered_by</h3>
6447<ul>
6448
6449<li>
6450
6451<p>Syntax:</p>
6452
6453<div>
6454<div>
6455<pre class="source">interval_covers(interval1, interval2)
6456interval_covered_by(interval1, interval2)
6457</pre></div></div>
6458</li>
6459<li>
6460
6461<p>These two functions check whether one interval covers the other interval.</p>
6462</li>
6463<li>Arguments:
6464<ul>
6465
6466<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6467</ul>
6468</li>
6469<li>Return Value:
6470<ul>
6471
6472<li>
6473
6474<p>a <tt>boolean</tt> value. Specifically, <tt>interval_covers(interval1, interval2)</tt> is true if and only if</p>
6475<p>interval1.start &lt;= interval2.start AND interval1.end &gt;= interval2.end</p>
6476<p><tt>interval_covered_by(interval1, interval2)</tt> is true if and only if</p>
6477<p>interval2.start &lt;= interval1.start AND interval2.end &gt;= interval1.end</p>
6478</li>
6479<li>
6480
6481<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
6482</li>
6483<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6484<li>any other non-interval input value will cause a type error.</li>
6485</ul>
6486</li>
6487<li>
6488
6489<p>Examples:</p>
6490
6491<div>
6492<div>
6493<pre class="source">{
6494 &quot;interval_covers&quot;: interval_covers(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6495 interval(date(&quot;2000-03-01&quot;), date(&quot;2004-09-09&quot;))),
6496 &quot;interval_covered_by&quot;: interval_covered_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
6497 interval(date(&quot;2004-09-10&quot;), date(&quot;2012-08-01&quot;)))
6498};
6499</pre></div></div>
6500</li>
6501<li>
6502
6503<p>The expected result is:</p>
6504
6505<div>
6506<div>
6507<pre class="source">{ &quot;interval_covers&quot;: true, &quot;interval_covered_by&quot;: true }
6508</pre></div></div>
6509</li>
6510</ul></div>
6511<div class="section">
6512<h3><a name="interval_overlaps.2C_interval_overlapped_by"></a>interval_overlaps, interval_overlapped_by</h3>
6513<ul>
6514
6515<li>
6516
6517<p>Syntax:</p>
6518
6519<div>
6520<div>
6521<pre class="source">interval_overlaps(interval1, interval2)
6522interval_overlapped_by(interval1, interval2)
6523</pre></div></div>
6524</li>
6525<li>
6526
6527<p>These functions check whether two intervals overlap with each other.</p>
6528</li>
6529<li>Arguments:
6530<ul>
6531
6532<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6533</ul>
6534</li>
6535<li>Return Value:
6536<ul>
6537
6538<li>a <tt>boolean</tt> value. Specifically, <tt>interval_overlaps(interval1, interval2)</tt> is true if and only if
6539<p>interval1.start &lt; interval2.start AND interval2.end &gt; interval1.end AND interval1.end &gt; interval2.start</p></li>
6540</ul>
6541<p><tt>interval_overlapped_by(interval1, interval2)</tt> is true if and only if</p>
6542
6543<div>
6544<div>
6545<pre class="source">interval2.start &lt; interval1.start
6546AND interval1.end &gt; interval2.end
6547AND interval2.end &gt; interval1.start
6548</pre></div></div>
6549
6550<ul>
6551
6552<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
6553<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6554<li>any other non-interval input value will cause a type error.</li>
6555</ul>
6556<p>Note that <tt>interval_overlaps</tt> and <tt>interval_overlapped_by</tt> are following the Allen&#x2019;s relations on the definition of overlap.</p>
6557</li>
6558<li>
6559
6560<p>Examples:</p>
6561
6562<div>
6563<div>
6564<pre class="source">{
6565 &quot;overlaps&quot;: interval_overlaps(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6566 interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))),
6567 &quot;overlapped_by&quot;: interval_overlapped_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
6568 interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))))
6569};
6570</pre></div></div>
6571</li>
6572<li>
6573
6574<p>The expected result is:</p>
6575
6576<div>
6577<div>
6578<pre class="source">{ &quot;overlaps&quot;: true, &quot;overlapped_by&quot;: true }
6579</pre></div></div>
6580</li>
6581</ul></div>
6582<div class="section">
6583<h3><a name="interval_overlapping"></a>interval_overlapping</h3>
6584<p>Note that <tt>interval_overlapping</tt> is not an Allen&#x2019;s Relation, but syntactic sugar we added for the case that the intersect of two intervals is not empty. Basically this function returns true if any of these functions return true: <tt>interval_overlaps</tt>, <tt>interval_overlapped_by</tt>, <tt>interval_covers</tt>, or <tt>interval_covered_by</tt>.</p>
6585<ul>
6586
6587<li>
6588
6589<p>Syntax:</p>
6590
6591<div>
6592<div>
6593<pre class="source">interval_overlapping(interval1, interval2)
6594</pre></div></div>
6595</li>
6596<li>
6597
6598<p>This functions check whether two intervals share any points with each other.</p>
6599</li>
6600<li>Arguments:
6601<ul>
6602
6603<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6604</ul>
6605</li>
6606<li>Return Value:
6607<ul>
6608
6609<li>
6610
6611<p>a <tt>boolean</tt> value. Specifically, <tt>interval_overlapping(interval1, interval2)</tt> is true if</p>
6612<p>interval1.start &lt; interval2.end AND interval1.end &gt; interval2.start</p>
6613</li>
6614<li>
6615
6616<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
6617</li>
6618<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6619<li>any other non-interval input value will cause a type error.</li>
6620</ul>
6621</li>
6622<li>
6623
6624<p>Examples:</p>
6625
6626<div>
6627<div>
6628<pre class="source">{
6629 &quot;overlapping1&quot;: interval_overlapping(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6630 interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))),
6631 &quot;overlapping2&quot;: interval_overlapping(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
6632 interval(date(&quot;2004-09-10&quot;), date(&quot;2006-12-31&quot;)))
6633};
6634</pre></div></div>
6635</li>
6636<li>
6637
6638<p>The expected result is:</p>
6639
6640<div>
6641<div>
6642<pre class="source">{ &quot;overlapping1&quot;: true, &quot;overlapping2&quot;: true }
6643</pre></div></div>
6644</li>
6645</ul></div>
6646<div class="section">
6647<h3><a name="interval_meets.2C_interval_met_by"></a>interval_meets, interval_met_by</h3>
6648<ul>
6649
6650<li>
6651
6652<p>Syntax:</p>
6653
6654<div>
6655<div>
6656<pre class="source">interval_meets(interval1, interval2)
6657interval_met_by(interval1, interval2)
6658</pre></div></div>
6659</li>
6660<li>
6661
6662<p>These two functions check whether an interval meets with another interval.</p>
6663</li>
6664<li>Arguments:
6665<ul>
6666
6667<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6668</ul>
6669</li>
6670<li>Return Value:
6671<ul>
6672
6673<li>a <tt>boolean</tt> value. Specifically, <tt>interval_meets(interval1, interval2)</tt> is true if and only if <tt>interval1.end = interval2.start</tt>, and <tt>interval_met_by(interval1, interval2)</tt> is true if and only if <tt>interval1.start = interval2.end</tt>. If any of the two inputs is <tt>null</tt>, <tt>null</tt> is returned.</li>
6674<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
6675<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6676<li>any other non-interval input value will cause a type error.</li>
6677</ul>
6678</li>
6679<li>
6680
6681<p>Examples:</p>
6682
6683<div>
6684<div>
6685<pre class="source">{
6686 &quot;meets&quot;: interval_meets(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6687 interval(date(&quot;2005-01-01&quot;), date(&quot;2012-09-09&quot;))),
6688 &quot;metby&quot;: interval_met_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
6689 interval(date(&quot;2004-09-10&quot;), date(&quot;2006-08-01&quot;)))
6690};
6691</pre></div></div>
6692</li>
6693<li>
6694
6695<p>The expected result is:</p>
6696
6697<div>
6698<div>
6699<pre class="source">{ &quot;meets&quot;: true, &quot;metby&quot;: true }
6700</pre></div></div>
6701</li>
6702</ul></div>
6703<div class="section">
6704<h3><a name="interval_starts.2C_interval_started_by"></a>interval_starts, interval_started_by</h3>
6705<ul>
6706
6707<li>
6708
6709<p>Syntax:</p>
6710
6711<div>
6712<div>
6713<pre class="source">interval_starts(interval1, interval2)
6714interval_started_by(interval1, interval2)
6715</pre></div></div>
6716</li>
6717<li>
6718
6719<p>These two functions check whether one interval starts with the other interval.</p>
6720</li>
6721<li>Arguments:
6722<ul>
6723
6724<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6725</ul>
6726</li>
6727<li>Return Value:
6728<ul>
6729
6730<li>a <tt>boolean</tt> value. Specifically, <tt>interval_starts(interval1, interval2)</tt> returns true if and only if
6731<p>interval1.start = interval2.start AND interval1.end &lt;= interval2.end</p></li>
6732</ul>
6733<p><tt>interval_started_by(interval1, interval2)</tt> returns true if and only if</p>
6734
6735<div>
6736<div>
6737<pre class="source">interval1.start = interval2.start
6738AND interval2.end &lt;= interval1.end
6739</pre></div></div>
6740
6741<ul>
6742
6743<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
6744<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6745<li>any other non-interval input value will cause a type error.</li>
6746</ul>
6747</li>
6748<li>
6749
6750<p>Examples:</p>
6751
6752<div>
6753<div>
6754<pre class="source">{
6755 &quot;interval_starts&quot;: interval_starts(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6756 interval(date(&quot;2000-01-01&quot;), date(&quot;2012-09-09&quot;))),
6757 &quot;interval_started_by&quot;: interval_started_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
6758 interval(date(&quot;2006-08-01&quot;), date(&quot;2006-08-02&quot;)))
6759};
6760</pre></div></div>
6761</li>
6762<li>
6763
6764<p>The expected result is:</p>
6765
6766<div>
6767<div>
6768<pre class="source">{ &quot;interval_starts&quot;: true, &quot;interval_started_by&quot;: true }
6769</pre></div></div>
6770</li>
6771</ul></div>
6772<div class="section">
6773<h3><a name="interval_ends.2C_interval_ended_by"></a>interval_ends, interval_ended_by</h3>
6774<ul>
6775
6776<li>
6777
6778<p>Syntax:</p>
6779
6780<div>
6781<div>
6782<pre class="source">interval_ends(interval1, interval2)
6783interval_ended_by(interval1, interval2)
6784</pre></div></div>
6785</li>
6786<li>
6787
6788<p>These two functions check whether one interval ends with the other interval.</p>
6789</li>
6790<li>Arguments:
6791<ul>
6792
6793<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6794</ul>
6795</li>
6796<li>Return Value:
6797<ul>
6798
6799<li>
6800
6801<p>a <tt>boolean</tt> value. Specifically, <tt>interval_ends(interval1, interval2)</tt> returns true if and only if</p>
6802<p>interval1.end = interval2.end AND interval1.start &gt;= interval2.start</p>
6803<p><tt>interval_ended_by(interval1, interval2)</tt> returns true if and only if</p>
6804<p>interval2.end = interval1.end AND interval2.start &gt;= interval1.start</p>
6805</li>
6806<li>
6807
6808<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
6809</li>
6810<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6811<li>any other non-interval input value will cause a type error.</li>
6812</ul>
6813</li>
6814<li>
6815
6816<p>Examples:</p>
6817
6818<div>
6819<div>
6820<pre class="source">{
6821 &quot;interval_ends&quot;: interval_ends(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6822 interval(date(&quot;1998-01-01&quot;), date(&quot;2005-01-01&quot;))),
6823 &quot;interval_ended_by&quot;: interval_ended_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
6824 interval(date(&quot;2006-09-10&quot;), date(&quot;2007-03-01&quot;)))
6825};
6826</pre></div></div>
6827</li>
6828<li>
6829
6830<p>The expected result is:</p>
6831
6832<div>
6833<div>
6834<pre class="source">{ &quot;interval_ends&quot;: true, &quot;interval_ended_by&quot;: true }
6835</pre></div></div>
6836</li>
6837</ul><!--
6838 ! Licensed to the Apache Software Foundation (ASF) under one
6839 ! or more contributor license agreements. See the NOTICE file
6840 ! distributed with this work for additional information
6841 ! regarding copyright ownership. The ASF licenses this file
6842 ! to you under the Apache License, Version 2.0 (the
6843 ! "License"); you may not use this file except in compliance
6844 ! with the License. You may obtain a copy of the License at
6845 !
6846 ! http://www.apache.org/licenses/LICENSE-2.0
6847 !
6848 ! Unless required by applicable law or agreed to in writing,
6849 ! software distributed under the License is distributed on an
6850 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
6851 ! KIND, either express or implied. See the License for the
6852 ! specific language governing permissions and limitations
6853 ! under the License.
6854 !-->
6855</div></div>
6856<div class="section">
6857<h2><a name="Object_Functions"></a><a name="ObjectFunctions" id="ObjectFunctions">Object Functions</a></h2>
6858<div class="section">
6859<h3><a name="get_object_fields"></a>get_object_fields</h3>
6860<ul>
6861
6862<li>
6863
6864<p>Syntax:</p>
6865
6866<div>
6867<div>
6868<pre class="source">get_object_fields(input_object)
6869</pre></div></div>
6870</li>
6871<li>
6872
6873<p>Access the object field names, type and open status for a given object.</p>
6874</li>
6875<li>Arguments:
6876<ul>
6877
6878<li><tt>input_object</tt> : a object value.</li>
6879</ul>
6880</li>
6881<li>Return Value:
6882<ul>
6883
6884<li>an array of <tt>object</tt> values that include the field_name <tt>string</tt>, field_type <tt>string</tt>, is_open <tt>boolean</tt> (used for debug purposes only: <tt>true</tt> if field is open and <tt>false</tt> otherwise), and optional nested <tt>orderedList</tt> for the values of a nested object,</li>
6885<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
6886<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
6887<li>any other non-object input value will cause a type error.</li>
6888</ul>
6889</li>
6890<li>
6891
6892<p>Example:</p>
6893
6894<div>
6895<div>
6896<pre class="source">get_object_fields(
6897 {
6898 &quot;id&quot;: 1,
6899 &quot;project&quot;: &quot;AsterixDB&quot;,
6900 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
6901 &quot;related&quot;: [&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
6902 }
6903 );
6904</pre></div></div>
6905</li>
6906<li>
6907
6908<p>The expected result is:</p>
6909
6910<div>
6911<div>
6912<pre class="source">[
6913 { &quot;field-name&quot;: &quot;id&quot;, &quot;field-type&quot;: &quot;INT64&quot;, &quot;is-open&quot;: false },
6914 { &quot;field-name&quot;: &quot;project&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false },
6915 { &quot;field-name&quot;: &quot;address&quot;, &quot;field-type&quot;: &quot;RECORD&quot;, &quot;is-open&quot;: false,
6916 &quot;nested&quot;: [
6917 { &quot;field-name&quot;: &quot;city&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false },
6918 { &quot;field-name&quot;: &quot;state&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false }
6919 ]
6920 },
6921 { &quot;field-name&quot;:
6922 &quot;related&quot;,
6923 &quot;field-type&quot;: &quot;ORDEREDLIST&quot;,
6924 &quot;is-open&quot;: false,
6925 &quot;list&quot;: [
6926 { &quot;field-type&quot;: &quot;STRING&quot; },
6927 { &quot;field-type&quot;: &quot;STRING&quot; },
6928 { &quot;field-type&quot;: &quot;STRING&quot; }
6929 ]
6930 }
6931]
6932</pre></div></div>
6933</li>
6934</ul>
6935<p>]</p></div>
6936<div class="section">
6937<h3><a name="get_object_field_value"></a>get_object_field_value</h3>
6938<ul>
6939
6940<li>
6941
6942<p>Syntax:</p>
6943
6944<div>
6945<div>
6946<pre class="source">get_object_field_value(input_object, string)
6947</pre></div></div>
6948</li>
6949<li>
6950
6951<p>Access the field name given in the <tt>string_expression</tt> from the <tt>object_expression</tt>.</p>
6952</li>
6953<li>Arguments:
6954<ul>
6955
6956<li><tt>input_object</tt> : a <tt>object</tt> value.</li>
6957<li><tt>string</tt> : a <tt>string</tt> representing the top level field name.</li>
6958</ul>
6959</li>
6960<li>Return Value:
6961<ul>
6962
6963<li>an <tt>any</tt> value saved in the designated field of the object,</li>
6964<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
6965<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6966<li>a type error will be raised if:
6967<ul>
6968
6969<li>the first argument is any other non-object value,</li>
6970<li>or, the second argument is any other non-string value.</li>
6971</ul>
6972</li>
6973</ul>
6974</li>
6975<li>
6976
6977<p>Example:</p>
6978
6979<div>
6980<div>
6981<pre class="source">get_object_field_value({
6982 &quot;id&quot;: 1,
6983 &quot;project&quot;: &quot;AsterixDB&quot;,
6984 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
6985 &quot;related&quot;: [&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
6986 },
6987 &quot;project&quot;
6988 );
6989</pre></div></div>
6990</li>
6991<li>
6992
6993<p>The expected result is:</p>
6994
6995<div>
6996<div>
6997<pre class="source">&quot;AsterixDB&quot;
6998</pre></div></div>
6999</li>
7000</ul></div>
7001<div class="section">
7002<h3><a name="object_remove_fields"></a>object_remove_fields</h3>
7003<ul>
7004
7005<li>
7006
7007<p>Syntax:</p>
7008
7009<div>
7010<div>
7011<pre class="source">object_remove_fields(input_object, field_names)
7012</pre></div></div>
7013</li>
7014<li>
7015
7016<p>Remove indicated fields from a object given a list of field names.</p>
7017</li>
7018<li>Arguments:
7019<ul>
7020
7021<li><tt>input_object</tt>: a object value.</li>
7022<li><tt>field_names</tt>: an array of strings and/or array of array of strings.</li>
7023</ul>
7024</li>
7025<li>
7026
7027<p>Return Value:</p>
7028<ul>
7029
7030<li>a new object value without the fields listed in the second argument,</li>
7031<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
7032<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
7033<li>a type error will be raised if:
7034<ul>
7035
7036<li>the first argument is any other non-object value,</li>
7037<li>or, the second argument is any other non-array value or recursively contains non-string items.</li>
7038</ul>
7039</li>
7040</ul>
7041</li>
7042<li>
7043
7044<p>Example:</p>
7045
7046<div>
7047<div>
7048<pre class="source">object_remove_fields(
7049 {
7050 &quot;id&quot;:1,
7051 &quot;project&quot;:&quot;AsterixDB&quot;,
7052 &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
7053 &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
7054 },
7055 [[&quot;address&quot;, &quot;city&quot;], &quot;related&quot;]
7056 );
7057</pre></div></div>
7058</li>
7059<li>
7060
7061<p>The expected result is:</p>
7062
7063<div>
7064<div>
7065<pre class="source">{
7066 &quot;id&quot;:1,
7067 &quot;project&quot;:&quot;AsterixDB&quot;,
7068 &quot;address&quot;:{ &quot;state&quot;: &quot;CA&quot; }
7069}
7070</pre></div></div>
7071</li>
7072</ul></div>
7073<div class="section">
7074<h3><a name="object_add_fields"></a>object_add_fields</h3>
7075<ul>
7076
7077<li>
7078
7079<p>Syntax:</p>
7080
7081<div>
7082<div>
7083<pre class="source">object_add_fields(input_object, fields)
7084</pre></div></div>
7085</li>
7086<li>
7087
7088<p>Add fields to a object given a list of field names.</p>
7089</li>
7090<li>Arguments:
7091<ul>
7092
7093<li><tt>input_object</tt> : a object value.</li>
7094<li><tt>fields</tt>: an array of field descriptor objects where each object has field_name and field_value.</li>
7095</ul>
7096</li>
7097<li>Return Value:
7098<ul>
7099
7100<li>a new object value with the new fields included,</li>
7101<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
7102<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
7103<li>a type error will be raised if:
7104<ul>
7105
7106<li>the first argument is any other non-object value,</li>
7107<li>the second argument is any other non-array value, or contains non-object items.</li>
7108</ul>
7109</li>
7110</ul>
7111</li>
7112<li>
7113
7114<p>Example:</p>
7115
7116<div>
7117<div>
7118<pre class="source">object_add_fields(
7119 {
7120 &quot;id&quot;:1,
7121 &quot;project&quot;:&quot;AsterixDB&quot;,
7122 &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
7123 &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
7124 },
7125 [{&quot;field-name&quot;:&quot;employment_location&quot;, &quot;field-value&quot;:create_point(30.0,70.0)}]
7126 );
7127</pre></div></div>
7128</li>
7129<li>
7130
7131<p>The expected result is:</p>
7132
7133<div>
7134<div>
7135<pre class="source">{
7136 &quot;id&quot;:1,
7137 &quot;project&quot;:&quot;AsterixDB&quot;,
7138 &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
7139 &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
7140 &quot;employment_location&quot;: point(&quot;30.0,70.0&quot;)
7141 }
7142</pre></div></div>
7143</li>
7144</ul></div>
7145<div class="section">
7146<h3><a name="object_merge"></a>object_merge</h3>
7147<ul>
7148
7149<li>
7150
7151<p>Syntax:</p>
7152
7153<div>
7154<div>
7155<pre class="source">object_merge(object1, object2)
7156</pre></div></div>
7157</li>
7158<li>
7159
7160<p>Merge two different objects into a new object.</p>
7161</li>
7162<li>Arguments:
7163<ul>
7164
7165<li><tt>object1</tt> : a object value.</li>
7166<li><tt>object2</tt> : a object value.</li>
7167</ul>
7168</li>
7169<li>Return Value:
7170<ul>
7171
7172<li>a new object value with fields from both input objects. If a field&#x2019;s names in both objects are the same, an exception is issued,</li>
7173<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
7174<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
7175<li>any other non-object input value will cause a type error.</li>
7176</ul>
7177</li>
7178<li>
7179
7180<p>Example:</p>
7181
7182<div>
7183<div>
7184<pre class="source">object_merge(
7185 {
7186 &quot;id&quot;:1,
7187 &quot;project&quot;:&quot;AsterixDB&quot;,
7188 &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
7189 &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
7190 },
7191 {
7192 &quot;user_id&quot;: 22,
7193 &quot;employer&quot;: &quot;UC Irvine&quot;,
7194 &quot;employment_type&quot;: &quot;visitor&quot;
7195 }
7196 );
7197</pre></div></div>
7198</li>
7199<li>
7200
7201<p>The expected result is:</p>
7202
7203<div>
7204<div>
7205<pre class="source">{
7206 &quot;employment_type&quot;: &quot;visitor&quot;,
7207 &quot;address&quot;: {
7208 &quot;city&quot;: &quot;Irvine&quot;,
7209 &quot;state&quot;: &quot;CA&quot;
7210 },
7211 &quot;related&quot;: [
7212 &quot;Hivestrix&quot;,
7213 &quot;Preglix&quot;,
7214 &quot;Apache VXQuery&quot;
7215 ],
7216 &quot;user_id&quot;: 22,
7217 &quot;project&quot;: &quot;AsterixDB&quot;,
7218 &quot;employer&quot;: &quot;UC Irvine&quot;,
7219 &quot;id&quot;: 1
7220}
7221</pre></div></div>
7222</li>
7223</ul></div>
7224<div class="section">
7225<h3><a name="object_length"></a>object_length</h3>
7226<ul>
7227
7228<li>
7229
7230<p>Syntax:</p>
7231
7232<div>
7233<div>
7234<pre class="source">object_length(input_object)
7235</pre></div></div>
7236</li>
7237<li>
7238
7239<p>Returns number of top-level fields in the given object</p>
7240</li>
7241<li>Arguments:
7242<ul>
7243
7244<li><tt>input_object</tt> : an object value.</li>
7245</ul>
7246</li>
7247<li>Return Value:
7248<ul>
7249
7250<li>an integer that represents the number of top-level fields in the given object,</li>
7251<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
7252<li><tt>null</tt> if the argument is a <tt>null</tt> value or any other non-object value</li>
7253</ul>
7254</li>
7255<li>
7256
7257<p>Example:</p>
7258
7259<div>
7260<div>
7261<pre class="source">object_length(
7262 {
7263 &quot;id&quot;: 1,
7264 &quot;project&quot;: &quot;AsterixDB&quot;,
7265 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
7266 }
7267 );
7268</pre></div></div>
7269</li>
7270<li>
7271
7272<p>The expected result is:</p>
7273
7274<div>
7275<div>
7276<pre class="source">3
7277</pre></div></div>
7278</li>
7279</ul></div>
7280<div class="section">
7281<h3><a name="object_names"></a>object_names</h3>
7282<ul>
7283
7284<li>
7285
7286<p>Syntax:</p>
7287
7288<div>
7289<div>
7290<pre class="source">object_names(input_object)
7291</pre></div></div>
7292</li>
7293<li>
7294
7295<p>Returns names of top-level fields in the given object</p>
7296</li>
7297<li>Arguments:
7298<ul>
7299
7300<li><tt>input_object</tt> : an object value.</li>
7301</ul>
7302</li>
7303<li>Return Value:
7304<ul>
7305
7306<li>an array with top-level field names of the given object,</li>
7307<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
7308<li><tt>null</tt> if the argument is a <tt>null</tt> value or any other non-object value</li>
7309</ul>
7310</li>
7311<li>
7312
7313<p>Example:</p>
7314
7315<div>
7316<div>
7317<pre class="source">object_names(
7318 {
7319 &quot;id&quot;: 1,
7320 &quot;project&quot;: &quot;AsterixDB&quot;,
7321 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
7322 }
7323 );
7324</pre></div></div>
7325</li>
7326<li>
7327
7328<p>The expected result is:</p>
7329
7330<div>
7331<div>
7332<pre class="source">[ &quot;id&quot;, &quot;project&quot;, &quot;address&quot; ]
7333</pre></div></div>
7334</li>
7335</ul></div>
7336<div class="section">
7337<h3><a name="object_remove"></a>object_remove</h3>
7338<ul>
7339
7340<li>
7341
7342<p>Syntax:</p>
7343
7344<div>
7345<div>
7346<pre class="source">object_remove(input_object, field_name)
7347</pre></div></div>
7348</li>
7349<li>
7350
7351<p>Returns a new object that has the same fields as the input object except the field to be removed</p>
7352</li>
7353<li>Arguments:
7354<ul>
7355
7356<li><tt>input_object</tt> : an object value.</li>
7357<li><tt>field_name</tt> : a string field name.</li>
7358</ul>
7359</li>
7360<li>Return Value:
7361<ul>
7362
7363<li>A new object that has the same fields as <tt>input_object</tt> except the field <tt>field_name</tt>,</li>
7364<li><tt>missing</tt> if the argument <tt>input_object</tt> or <tt>field_name</tt> is missing,</li>
7365<li><tt>null</tt> if the argument <tt>input_object</tt> is <tt>null</tt> or any other non-object value, or the argument <tt>field_name</tt> is <tt>null</tt> or any other non-string value.</li>
7366</ul>
7367</li>
7368<li>
7369
7370<p>Example:</p>
7371
7372<div>
7373<div>
7374<pre class="source">object_remove(
7375 {
7376 &quot;id&quot;: 1,
7377 &quot;project&quot;: &quot;AsterixDB&quot;,
7378 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7379 }
7380 , &quot;address&quot;
7381 );
7382</pre></div></div>
7383</li>
7384<li>
7385
7386<p>The expected result is:</p>
7387
7388<div>
7389<div>
7390<pre class="source">{
7391 &quot;id&quot;: 1,
7392 &quot;project&quot;: &quot;AsterixDB&quot;,
7393}
7394</pre></div></div>
7395</li>
7396</ul></div>
7397<div class="section">
7398<h3><a name="object_rename"></a>object_rename</h3>
7399<ul>
7400
7401<li>
7402
7403<p>Syntax:</p>
7404
7405<div>
7406<div>
7407<pre class="source">object_rename(input_object, old_field, new_field)
7408</pre></div></div>
7409</li>
7410<li>
7411
7412<p>Returns a new object that has the same fields as <tt>input_object</tt> with field <tt>old_field</tt> replaced by <tt>new_field</tt></p>
7413</li>
7414<li>Arguments:
7415<ul>
7416
7417<li><tt>input_object</tt> : an object value.</li>
7418<li><tt>old_field</tt> : a string representing the old (original) field name inside the object <tt>input_object</tt>.</li>
7419<li><tt>new_field</tt> : a string representing the new field name to replace <tt>old_field</tt> inside the object <tt>input_object</tt>.</li>
7420</ul>
7421</li>
7422<li>Return Value:
7423<ul>
7424
7425<li>A new object that has the same fields as <tt>input_object</tt> with field <tt>old_field</tt> replaced by <tt>new_field</tt>,</li>
7426<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
7427<li><tt>null</tt> if any argument is <tt>null</tt> or <tt>input_object</tt> is non-object value, or <tt>old_field</tt> is non-string value, or <tt>new_field</tt> is any non-string value.</li>
7428</ul>
7429</li>
7430<li>
7431
7432<p>Example:</p>
7433
7434<div>
7435<div>
7436<pre class="source">object_rename(
7437 {
7438 &quot;id&quot;: 1,
7439 &quot;project&quot;: &quot;AsterixDB&quot;,
7440 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7441 }
7442 , &quot;address&quot;
7443 , &quot;location&quot;
7444 );
7445</pre></div></div>
7446</li>
7447<li>
7448
7449<p>The expected result is:</p>
7450
7451<div>
7452<div>
7453<pre class="source">{
7454 &quot;id&quot;: 1,
7455 &quot;project&quot;: &quot;AsterixDB&quot;,
7456 &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7457}
7458</pre></div></div>
7459</li>
7460</ul></div>
7461<div class="section">
7462<h3><a name="object_unwrap"></a>object_unwrap</h3>
7463<ul>
7464
7465<li>
7466
7467<p>Syntax:</p>
7468
7469<div>
7470<div>
7471<pre class="source">object_unwrap(input_object)
7472</pre></div></div>
7473</li>
7474<li>
7475
7476<p>Returns the value of the single name-value pair that appears in <tt>input_object</tt>.</p>
7477</li>
7478<li>Arguments:
7479<ul>
7480
7481<li><tt>input_object</tt> : an object value that consists of exactly one name-value pair.</li>
7482</ul>
7483</li>
7484<li>Return Value:
7485<ul>
7486
7487<li>The value of the single name-value pair that appears in <tt>input_object</tt>,</li>
7488<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
7489<li><tt>null</tt> if <tt>input_object</tt> is null, or an empty object, or there is more than one name-value pair in <tt>input_object</tt>, or any non-object value.</li>
7490</ul>
7491</li>
7492<li>
7493
7494<p>Example:</p>
7495
7496<div>
7497<div>
7498<pre class="source">object_unwrap(
7499 {
7500 &quot;id&quot;: 1
7501 }
7502 );
7503</pre></div></div>
7504</li>
7505<li>
7506
7507<p>The expected result is:</p>
7508
7509<div>
7510<div>
7511<pre class="source">{
7512 1
7513}
7514</pre></div></div>
7515</li>
7516</ul></div>
7517<div class="section">
7518<h3><a name="object_replace"></a>object_replace</h3>
7519<ul>
7520
7521<li>
7522
7523<p>Syntax:</p>
7524
7525<div>
7526<div>
7527<pre class="source">object_replace(input_object, old_value, new_value)
7528</pre></div></div>
7529</li>
7530<li>
7531
7532<p>Returns a new object that has the same fields as <tt>input_object</tt> with all occurrences of value <tt>old_value</tt> replaced by <tt>new_value</tt></p>
7533</li>
7534<li>Arguments:
7535<ul>
7536
7537<li><tt>input_object</tt> : an object value.</li>
7538<li><tt>old_value</tt> : a primitive type value to be replaced by <tt>new_value</tt>.</li>
7539<li><tt>new_value</tt> : a value to replace <tt>old_value</tt>.</li>
7540</ul>
7541</li>
7542<li>Return Value:
7543<ul>
7544
7545<li>A new object that has the same fields as <tt>input_object</tt> with all occurrences of value <tt>old_value</tt> replaced by <tt>new_value</tt>,</li>
7546<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
7547<li><tt>null</tt> if <tt>input_object</tt> or <tt>old_value</tt> is null,</li>
7548<li>a type error will be raised if:
7549<ul>
7550
7551<li><tt>old_value</tt> is not a primitive type value.</li>
7552</ul>
7553</li>
7554</ul>
7555</li>
7556<li>
7557
7558<p>Example:</p>
7559
7560<div>
7561<div>
7562<pre class="source">object_replace(
7563 {
7564 &quot;id&quot;: 1,
7565 &quot;project&quot;: &quot;AsterixDB&quot;,
7566 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7567 }
7568 , &quot;AsterixDB&quot;
7569 , &quot;Apache AsterixDB&quot;
7570 );
7571</pre></div></div>
7572</li>
7573<li>
7574
7575<p>The expected result is:</p>
7576
7577<div>
7578<div>
7579<pre class="source">{
7580 &quot;id&quot;: 1,
7581 &quot;project&quot;: &quot;Apache AsterixDB&quot;,
7582 &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7583}
7584</pre></div></div>
7585</li>
7586</ul></div>
7587<div class="section">
7588<h3><a name="object_add"></a>object_add</h3>
7589<ul>
7590
7591<li>
7592
7593<p>Syntax:</p>
7594
7595<div>
7596<div>
7597<pre class="source">object_add(input_object, field_name, field_value)
7598</pre></div></div>
7599</li>
7600<li>
7601
7602<p>Returns a new object that has the same fields as <tt>input_object</tt> as well as the new field <tt>field_name</tt>.</p>
7603</li>
7604<li>Arguments:
7605<ul>
7606
7607<li><tt>input_object</tt> : an object value.</li>
7608<li><tt>field_name</tt> : a string representing a field name to be added.</li>
7609<li><tt>field_value</tt> : a value to be assigned to the new field <tt>field_name</tt>.</li>
7610</ul>
7611</li>
7612<li>Return Value:
7613<ul>
7614
7615<li>A new object that has the same fields as <tt>input_object</tt> as well as the new field <tt>field_name</tt>,</li>
7616<li><tt>missing</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>missing</tt>,</li>
7617<li><tt>null</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>null</tt>, or <tt>input_object</tt> is not an object, or <tt>field_name</tt> is not a string,</li>
7618<li><tt>input_object</tt> if <tt>field_name</tt>already exists in <tt>input_object</tt> or <tt>field_value</tt> is missing.</li>
7619</ul>
7620</li>
7621<li>
7622
7623<p>Example:</p>
7624
7625<div>
7626<div>
7627<pre class="source">object_add(
7628 {
7629 &quot;id&quot;: 1,
7630 &quot;project&quot;: &quot;AsterixDB&quot;,
7631 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7632 }
7633 , &quot;company&quot;
7634 , &quot;Apache&quot;
7635 );
7636</pre></div></div>
7637</li>
7638<li>
7639
7640<p>The expected result is:</p>
7641
7642<div>
7643<div>
7644<pre class="source">{
7645 &quot;id&quot;: 1,
7646 &quot;project&quot;: &quot;AsterixDB&quot;,
7647 &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
7648 &quot;company&quot;: &quot;Apache&quot;
7649}
7650</pre></div></div>
7651</li>
7652</ul></div>
7653<div class="section">
7654<h3><a name="object_put"></a>object_put</h3>
7655<ul>
7656
7657<li>
7658
7659<p>Syntax:</p>
7660
7661<div>
7662<div>
7663<pre class="source">object_put(input_object, field_name, field_value)
7664</pre></div></div>
7665</li>
7666<li>
7667
7668<p>Adds, modifies, or removes a field of an object.</p>
7669</li>
7670<li>Arguments:
7671<ul>
7672
7673<li><tt>input_object</tt> : an object value.</li>
7674<li><tt>field_name</tt> : a string representing a field name to be added.</li>
7675<li><tt>field_value</tt> : a value to be assigned to the new field <tt>field_name</tt>.</li>
7676</ul>
7677</li>
7678<li>Return Value:
7679<ul>
7680
7681<li>a new object that has the same fields as <tt>input_object</tt> as well as the new field <tt>field_name</tt>, or with updated <tt>field_name</tt> value to <tt>field_value</tt> if <tt>field_name</tt> already exists in <tt>input_object</tt>, or with <tt>field_name</tt>removed if <tt>field_name</tt> already exists in <tt>input_object</tt> and <tt>field_value</tt> is <tt>missing</tt>,</li>
7682<li><tt>missing</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>missing</tt>,</li>
7683<li><tt>null</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>null</tt>, or <tt>input_object</tt> is not an object, or <tt>field_name</tt> is not not a string.</li>
7684</ul>
7685</li>
7686<li>
7687
7688<p>Example:</p>
7689
7690<div>
7691<div>
7692<pre class="source">object_put(
7693 {
7694 &quot;id&quot;: 1,
7695 &quot;project&quot;: &quot;AsterixDB&quot;,
7696 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7697 }
7698 , &quot;project&quot;
7699 , &quot;Apache AsterixDB&quot;
7700 );
7701</pre></div></div>
7702</li>
7703<li>
7704
7705<p>The expected result is:</p>
7706
7707<div>
7708<div>
7709<pre class="source">{
7710 &quot;id&quot;: 1,
7711 &quot;project&quot;: &quot;Apache AsterixDB&quot;,
7712 &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7713}
7714</pre></div></div>
7715</li>
7716</ul></div>
7717<div class="section">
7718<h3><a name="object_values"></a>object_values</h3>
7719<ul>
7720
7721<li>
7722
7723<p>Syntax:</p>
7724
7725<div>
7726<div>
7727<pre class="source">object_values(input_object)
7728</pre></div></div>
7729</li>
7730<li>
7731
7732<p>Returns an array of the values of the fields in <tt>input_object</tt>.</p>
7733</li>
7734<li>Arguments:
7735<ul>
7736
7737<li><tt>input_object</tt> : an object value.</li>
7738</ul>
7739</li>
7740<li>Return Value:
7741<ul>
7742
7743<li>An array of the values of the fields in <tt>input_object</tt>,</li>
7744<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
7745<li><tt>null</tt> if <tt>input_object</tt> is null or any non-object value.</li>
7746</ul>
7747</li>
7748<li>
7749
7750<p>Example:</p>
7751
7752<div>
7753<div>
7754<pre class="source">object_values(
7755 {
7756 &quot;id&quot;: 1,
7757 &quot;project&quot;: &quot;AsterixDB&quot;,
7758 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7759 }
7760 );
7761</pre></div></div>
7762</li>
7763<li>
7764
7765<p>The expected result is:</p>
7766
7767<div>
7768<div>
7769<pre class="source">[
7770 1,
7771 &quot;AsterixDB&quot;,
7772 {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7773]
7774</pre></div></div>
7775</li>
7776</ul></div>
7777<div class="section">
7778<h3><a name="object_pairs"></a>object_pairs</h3>
7779<ul>
7780
7781<li>
7782
7783<p>Syntax:</p>
7784
7785<div>
7786<div>
7787<pre class="source">object_pairs(input_object)
7788</pre></div></div>
7789</li>
7790<li>
7791
7792<p>Returns an array of objects describing fields of <tt>input_object</tt>. For each field of the <tt>input_object</tt> the returned array contains an object with two fields <tt>name</tt> and <tt>value</tt> which are set to the <tt>input_object</tt>&#x2019;s field name and value.</p>
7793</li>
7794<li>
7795
7796<p>Arguments:</p>
7797<ul>
7798
7799<li><tt>input_object</tt> : an object value.</li>
7800</ul>
7801</li>
7802<li>Return Value:
7803<ul>
7804
7805<li>An array of the <tt>name</tt>/<tt>value</tt> pairs of the fields in <tt>input_object</tt>,</li>
7806<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
7807<li><tt>null</tt> if <tt>input_object</tt> is null or any non-object value.</li>
7808</ul>
7809</li>
7810<li>
7811
7812<p>Example:</p>
7813
7814<div>
7815<div>
7816<pre class="source">object_pairs(
7817 {
7818 &quot;id&quot;: 1,
7819 &quot;project&quot;: &quot;AsterixDB&quot;,
7820 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7821 }
7822 );
7823</pre></div></div>
7824</li>
7825<li>
7826
7827<p>The expected result is:</p>
7828
7829<div>
7830<div>
7831<pre class="source">[
7832 { &quot;name&quot;: &quot;id&quot;, &quot;value&quot;: 1 },
7833 { &quot;name&quot;: &quot;project&quot;, &quot;value&quot;: &quot;AsterixDB&quot; },
7834 { &quot;name&quot;: &quot;address&quot;, &quot;value&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;} }
7835]
7836</pre></div></div>
7837</li>
7838</ul></div>
7839<div class="section">
7840<h3><a name="pairs"></a>pairs</h3>
7841<ul>
7842
7843<li>
7844
7845<p>Syntax:</p>
7846
7847<div>
7848<div>
7849<pre class="source">pairs(input_object)
7850</pre></div></div>
7851</li>
7852<li>
7853
7854<p>Returns an array of arrays describing fields of <tt>input_object</tt>, including nested fields. For each field of the <tt>input_object</tt> the returned array contains an array with two elements. The first element is the name and the second one is the value of the <tt>input_object</tt>&#x2019;s field. The input object is introspected recursively, so all fields of its nested objects are returned. Nested objects contained in arrays and multisets are also processed by this function.</p>
7855</li>
7856<li>
7857
7858<p>Arguments:</p>
7859<ul>
7860
7861<li><tt>input_object</tt> : an object value (or an array or a multiset)</li>
7862</ul>
7863</li>
7864<li>Return Value:
7865<ul>
7866
7867<li>An array of arrays with name, value pairs of the fields in <tt>input_object</tt>, including nested fields. Each inner array has exactly two items: name and value of the <tt>input_object</tt>&#x2019;s field.</li>
7868<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
7869<li><tt>null</tt> if <tt>input_object</tt> is null or a value of a primitive data type.</li>
7870</ul>
7871</li>
7872<li>
7873
7874<p>Example:</p>
7875
7876<div>
7877<div>
7878<pre class="source">pairs(
7879 {
7880 &quot;id&quot;: 1,
7881 &quot;project&quot;: &quot;AsterixDB&quot;,
7882 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7883 }
7884 );
7885</pre></div></div>
7886</li>
7887<li>
7888
7889<p>The expected result is:</p>
7890
7891<div>
7892<div>
7893<pre class="source">[
7894 [ &quot;id&quot;, 1 ],
7895 [ &quot;project&quot;, &quot;AsterixDB&quot; ],
7896 [ &quot;address&quot;, { &quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot; } ],
7897 [ &quot;city&quot;, &quot;Irvine&quot; ],
7898 [ &quot;state&quot;, &quot;CA&quot; ]
7899]
7900</pre></div></div>
7901</li>
7902</ul><!--
7903 ! Licensed to the Apache Software Foundation (ASF) under one
7904 ! or more contributor license agreements. See the NOTICE file
7905 ! distributed with this work for additional information
7906 ! regarding copyright ownership. The ASF licenses this file
7907 ! to you under the Apache License, Version 2.0 (the
7908 ! "License"); you may not use this file except in compliance
7909 ! with the License. You may obtain a copy of the License at
7910 !
7911 ! http://www.apache.org/licenses/LICENSE-2.0
7912 !
7913 ! Unless required by applicable law or agreed to in writing,
7914 ! software distributed under the License is distributed on an
7915 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
7916 ! KIND, either express or implied. See the License for the
7917 ! specific language governing permissions and limitations
7918 ! under the License.
7919 !-->
7920</div></div>
7921<div class="section">
7922<h2><a name="Aggregate_Functions_.28Array_Functions.29"></a><a name="AggregateFunctions" id="AggregateFunctions">Aggregate Functions (Array Functions) </a></h2>
7923<p>This section contains detailed descriptions of the built-in aggregate functions in the query language.</p>
7924<p>The query language also supports standard SQL aggregate functions (e.g., <tt>MIN</tt>, <tt>MAX</tt>, <tt>SUM</tt>, <tt>COUNT</tt>, and <tt>AVG</tt>). Note that these are not real functions in the query language, but just syntactic sugars over corresponding builtin aggregate functions (e.g., <tt>ARRAY_MIN</tt>, <tt>ARRAY_MAX</tt>, <tt>ARRAY_SUM</tt>, <tt>ARRAY_COUNT</tt>, and <tt>ARRAY_AVG</tt>). Refer to <a href="manual.html#Aggregation_PseudoFunctions">Aggregation Pseudo-Functions</a> for details.</p>
7925<p>The <tt>DISTINCT</tt> keyword may be used with built-in aggregate functions and standard SQL aggregate functions. It may also be used with aggregate functions used as window functions. It determines whether the function aggregates all values in the group, or distinct values only. Refer to <a href="manual.html#Function_call_expressions">Function Calls</a> for details.</p>
7926<p>Aggregate functions may be used as window functions when they are used with an OVER clause. Refer to <a href="manual.html#Over_clauses">OVER Clauses</a> for details.</p>
7927<div class="section">
7928<h3><a name="array_count"></a>array_count</h3>
7929<ul>
7930
7931<li>
7932
7933<p>Syntax:</p>
7934
7935<div>
7936<div>
7937<pre class="source">array_count(collection)
7938</pre></div></div>
7939</li>
7940<li>
7941
7942<p>Gets the number of non-null and non-missing items in the given collection.</p>
7943</li>
7944<li>Arguments:
7945<ul>
7946
7947<li><tt>collection</tt> could be:
7948<ul>
7949
7950<li>an <tt>array</tt> or <tt>multiset</tt> to be counted,</li>
7951<li>or, a <tt>null</tt> value,</li>
7952<li>or, a <tt>missing</tt> value.</li>
7953</ul>
7954</li>
7955</ul>
7956</li>
7957<li>Return Value:
7958<ul>
7959
7960<li>a <tt>bigint</tt> value representing the number of non-null and non-missing items in the given collection,</li>
7961<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
7962<li>any other non-array and non-multiset input value will cause an error.</li>
7963</ul>
7964</li>
7965<li>
7966
7967<p>Example:</p>
7968
7969<div>
7970<div>
7971<pre class="source">array_count( ['hello', 'world', 1, 2, 3, null, missing] );
7972</pre></div></div>
7973</li>
7974<li>
7975
7976<p>The expected result is:</p>
7977
7978<div>
7979<div>
7980<pre class="source">5
7981</pre></div></div>
7982</li>
7983</ul></div>
7984<div class="section">
7985<h3><a name="array_avg"></a>array_avg</h3>
7986<ul>
7987
7988<li>
7989
7990<p>Syntax:</p>
7991
7992<div>
7993<div>
7994<pre class="source">array_avg(num_collection)
7995</pre></div></div>
7996</li>
7997<li>
7998
7999<p>Gets the average value of the non-null and non-missing numeric items in the given collection.</p>
8000</li>
8001<li>Arguments:
8002<ul>
8003
8004<li><tt>num_collection</tt> could be:
8005<ul>
8006
8007<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8008<li>or, a <tt>null</tt> value,</li>
8009<li>or, a <tt>missing</tt> value.</li>
8010</ul>
8011</li>
8012</ul>
8013</li>
8014<li>Return Value:
8015<ul>
8016
8017<li>a <tt>double</tt> value representing the average of the non-null and non-missing numbers in the given collection,</li>
8018<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8019<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8020<li>any other non-array and non-multiset input value will cause a type error,</li>
8021<li>any other non-numeric value in the input collection will cause a type error.</li>
8022</ul>
8023</li>
8024<li>
8025
8026<p>Example:</p>
8027
8028<div>
8029<div>
8030<pre class="source">array_avg( [1.2, 2.3, 3.4, 0, null] );
8031</pre></div></div>
8032</li>
8033<li>
8034
8035<p>The expected result is:</p>
8036
8037<div>
8038<div>
8039<pre class="source">1.725
8040</pre></div></div>
8041</li>
8042</ul></div>
8043<div class="section">
8044<h3><a name="array_sum"></a>array_sum</h3>
8045<ul>
8046
8047<li>
8048
8049<p>Syntax:</p>
8050
8051<div>
8052<div>
8053<pre class="source">array_sum(num_collection)
8054</pre></div></div>
8055</li>
8056<li>
8057
8058<p>Gets the sum of non-null and non-missing items in the given collection.</p>
8059</li>
8060<li>Arguments:
8061<ul>
8062
8063<li><tt>num_collection</tt> could be:
8064<ul>
8065
8066<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8067<li>or, a <tt>null</tt> value,</li>
8068<li>or, a <tt>missing</tt> value.</li>
8069</ul>
8070</li>
8071</ul>
8072</li>
8073<li>Return Value:
8074<ul>
8075
8076<li>the sum of the non-null and non-missing numbers in the given collection. The returning type is decided by the item type with the highest order in the numeric type promotion order (<tt>tinyint</tt>-&gt; <tt>smallint</tt>-&gt;<tt>integer</tt>-&gt;<tt>bigint</tt>-&gt;<tt>float</tt>-&gt;<tt>double</tt>) among items.</li>
8077<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8078<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8079<li>any other non-array and non-multiset input value will cause a type error,</li>
8080<li>any other non-numeric value in the input collection will cause a type error.</li>
8081</ul>
8082</li>
8083<li>
8084
8085<p>Example:</p>
8086
8087<div>
8088<div>
8089<pre class="source">array_sum( [1.2, 2.3, 3.4, 0, null, missing] );
8090</pre></div></div>
8091</li>
8092<li>
8093
8094<p>The expected result is:</p>
8095
8096<div>
8097<div>
8098<pre class="source">6.9
8099</pre></div></div>
8100</li>
8101</ul></div>
8102<div class="section">
8103<h3><a name="array_min"></a>array_min</h3>
8104<ul>
8105
8106<li>
8107
8108<p>Syntax:</p>
8109
8110<div>
8111<div>
8112<pre class="source">array_min(num_collection)
8113</pre></div></div>
8114</li>
8115<li>
8116
8117<p>Gets the min value of non-null and non-missing comparable items in the given collection.</p>
8118</li>
8119<li>Arguments:
8120<ul>
8121
8122<li><tt>num_collection</tt> could be:
8123<ul>
8124
8125<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
8126<li>or, a <tt>null</tt> value,</li>
8127<li>or, a <tt>missing</tt> value.</li>
8128</ul>
8129</li>
8130</ul>
8131</li>
8132<li>Return Value:
8133<ul>
8134
8135<li>the min value of non-null and non-missing values in the given collection. The returning type is decided by the item type with the highest order in the type promotion order (<tt>tinyint</tt>-&gt; <tt>smallint</tt>-&gt;<tt>integer</tt>-&gt;<tt>bigint</tt>-&gt;<tt>float</tt>-&gt;<tt>double</tt>) among numeric items.</li>
8136<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8137<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8138<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
8139<li>any other non-array and non-multiset input value will cause a type error.</li>
8140</ul>
8141</li>
8142<li>
8143
8144<p>Example:</p>
8145
8146<div>
8147<div>
8148<pre class="source">array_min( [1.2, 2.3, 3.4, 0, null, missing] );
8149</pre></div></div>
8150</li>
8151<li>
8152
8153<p>The expected result is:</p>
8154
8155<div>
8156<div>
8157<pre class="source">0.0
8158</pre></div></div>
8159</li>
8160</ul></div>
8161<div class="section">
8162<h3><a name="array_max"></a>array_max</h3>
8163<ul>
8164
8165<li>
8166
8167<p>Syntax:</p>
8168
8169<div>
8170<div>
8171<pre class="source">array_max(num_collection)
8172</pre></div></div>
8173</li>
8174<li>
8175
8176<p>Gets the max value of the non-null and non-missing comparable items in the given collection.</p>
8177</li>
8178<li>Arguments:
8179<ul>
8180
8181<li><tt>num_collection</tt> could be:
8182<ul>
8183
8184<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
8185<li>or, a <tt>null</tt> value,</li>
8186<li>or, a <tt>missing</tt> value.</li>
8187</ul>
8188</li>
8189</ul>
8190</li>
8191<li>Return Value:
8192<ul>
8193
8194<li>the max value of non-null and non-missing numbers in the given collection. The returning type is decided by the item type with the highest order in the type promotion order (<tt>tinyint</tt>-&gt; <tt>smallint</tt>-&gt;<tt>integer</tt>-&gt;<tt>bigint</tt>-&gt;<tt>float</tt>-&gt;<tt>double</tt>) among numeric items.</li>
8195<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8196<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8197<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
8198<li>any other non-array and non-multiset input value will cause a type error.</li>
8199</ul>
8200</li>
8201<li>
8202
8203<p>Example:</p>
8204
8205<div>
8206<div>
8207<pre class="source">array_max( [1.2, 2.3, 3.4, 0, null, missing] );
8208</pre></div></div>
8209</li>
8210<li>
8211
8212<p>The expected result is:</p>
8213
8214<div>
8215<div>
8216<pre class="source">3.4
8217</pre></div></div>
8218</li>
8219</ul></div>
8220<div class="section">
8221<h3><a name="array_stddev_samp"></a>array_stddev_samp</h3>
8222<ul>
8223
8224<li>
8225
8226<p>Syntax:</p>
8227
8228<div>
8229<div>
8230<pre class="source">array_stddev_samp(num_collection)
8231</pre></div></div>
8232</li>
8233<li>
8234
8235<p>Gets the sample standard deviation value of the non-null and non-missing numeric items in the given collection.</p>
8236</li>
8237<li>Arguments:
8238<ul>
8239
8240<li><tt>num_collection</tt> could be:
8241<ul>
8242
8243<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8244<li>or, a <tt>null</tt> value,</li>
8245<li>or, a <tt>missing</tt> value.</li>
8246</ul>
8247</li>
8248</ul>
8249</li>
8250<li>Return Value:
8251<ul>
8252
8253<li>a <tt>double</tt> value representing the sample standard deviation of the non-null and non-missing numbers in the given collection,</li>
8254<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8255<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8256<li>any other non-array and non-multiset input value will cause a type error,</li>
8257<li>any other non-numeric value in the input collection will cause a type error.</li>
8258</ul>
8259</li>
8260<li>
8261
8262<p>Example:</p>
8263
8264<div>
8265<div>
8266<pre class="source">array_stddev_samp( [1.2, 2.3, 3.4, 0, null] );
8267</pre></div></div>
8268</li>
8269<li>
8270
8271<p>The expected result is:</p>
8272
8273<div>
8274<div>
8275<pre class="source">1.4591664287073858
8276</pre></div></div>
8277</li>
8278</ul></div>
8279<div class="section">
8280<h3><a name="array_stddev_pop"></a>array_stddev_pop</h3>
8281<ul>
8282
8283<li>
8284
8285<p>Syntax:</p>
8286
8287<div>
8288<div>
8289<pre class="source">array_stddev_pop(num_collection)
8290</pre></div></div>
8291</li>
8292<li>
8293
8294<p>Gets the population standard deviation value of the non-null and non-missing numeric items in the given collection.</p>
8295</li>
8296<li>Arguments:
8297<ul>
8298
8299<li><tt>num_collection</tt> could be:
8300<ul>
8301
8302<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8303<li>or, a <tt>null</tt> value,</li>
8304<li>or, a <tt>missing</tt> value.</li>
8305</ul>
8306</li>
8307</ul>
8308</li>
8309<li>Return Value:
8310<ul>
8311
8312<li>a <tt>double</tt> value representing the population standard deviation of the non-null and non-missing numbers in the given collection,</li>
8313<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8314<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8315<li>any other non-array and non-multiset input value will cause a type error,</li>
8316<li>any other non-numeric value in the input collection will cause a type error.</li>
8317</ul>
8318</li>
8319<li>
8320
8321<p>Example:</p>
8322
8323<div>
8324<div>
8325<pre class="source">array_stddev_pop( [1.2, 2.3, 3.4, 0, null] );
8326</pre></div></div>
8327</li>
8328<li>
8329
8330<p>The expected result is:</p>
8331
8332<div>
8333<div>
8334<pre class="source">1.2636751956100112
8335</pre></div></div>
8336</li>
8337</ul></div>
8338<div class="section">
8339<h3><a name="array_var_samp"></a>array_var_samp</h3>
8340<ul>
8341
8342<li>
8343
8344<p>Syntax:</p>
8345
8346<div>
8347<div>
8348<pre class="source">array_var_samp(num_collection)
8349</pre></div></div>
8350</li>
8351<li>
8352
8353<p>Gets the sample variance value of the non-null and non-missing numeric items in the given collection.</p>
8354</li>
8355<li>Arguments:
8356<ul>
8357
8358<li><tt>num_collection</tt> could be:
8359<ul>
8360
8361<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8362<li>or, a <tt>null</tt> value,</li>
8363<li>or, a <tt>missing</tt> value.</li>
8364</ul>
8365</li>
8366</ul>
8367</li>
8368<li>Return Value:
8369<ul>
8370
8371<li>a <tt>double</tt> value representing the sample variance of the non-null and non-missing numbers in the given collection,</li>
8372<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8373<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8374<li>any other non-array and non-multiset input value will cause a type error,</li>
8375<li>any other non-numeric value in the input collection will cause a type error.</li>
8376</ul>
8377</li>
8378<li>
8379
8380<p>Example:</p>
8381
8382<div>
8383<div>
8384<pre class="source">array_var_samp( [1.2, 2.3, 3.4, 0, null] );
8385</pre></div></div>
8386</li>
8387<li>
8388
8389<p>The expected result is:</p>
8390
8391<div>
8392<div>
8393<pre class="source">2.1291666666666664
8394</pre></div></div>
8395</li>
8396</ul></div>
8397<div class="section">
8398<h3><a name="array_var_pop"></a>array_var_pop</h3>
8399<ul>
8400
8401<li>
8402
8403<p>Syntax:</p>
8404
8405<div>
8406<div>
8407<pre class="source">array_var_pop(num_collection)
8408</pre></div></div>
8409</li>
8410<li>
8411
8412<p>Gets the population variance value of the non-null and non-missing numeric items in the given collection.</p>
8413</li>
8414<li>Arguments:
8415<ul>
8416
8417<li><tt>num_collection</tt> could be:
8418<ul>
8419
8420<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8421<li>or, a <tt>null</tt> value,</li>
8422<li>or, a <tt>missing</tt> value.</li>
8423</ul>
8424</li>
8425</ul>
8426</li>
8427<li>Return Value:
8428<ul>
8429
8430<li>a <tt>double</tt> value representing the population variance of the non-null and non-missing numbers in the given collection,</li>
8431<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8432<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8433<li>any other non-array and non-multiset input value will cause a type error,</li>
8434<li>any other non-numeric value in the input collection will cause a type error.</li>
8435</ul>
8436</li>
8437<li>
8438
8439<p>Example:</p>
8440
8441<div>
8442<div>
8443<pre class="source">array_var_pop( [1.2, 2.3, 3.4, 0, null] );
8444</pre></div></div>
8445</li>
8446<li>
8447
8448<p>The expected result is:</p>
8449
8450<div>
8451<div>
8452<pre class="source">1.5968749999999998
8453</pre></div></div>
8454</li>
8455</ul></div>
8456<div class="section">
8457<h3><a name="array_skewness"></a>array_skewness</h3>
8458<ul>
8459
8460<li>
8461
8462<p>Syntax:</p>
8463
8464<div>
8465<div>
8466<pre class="source">array_skewness(num_collection)
8467</pre></div></div>
8468</li>
8469<li>
8470
8471<p>Gets the skewness value of the non-null and non-missing numeric items in the given collection.</p>
8472</li>
8473<li>Arguments:
8474<ul>
8475
8476<li><tt>num_collection</tt> could be:
8477<ul>
8478
8479<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8480<li>or, a <tt>null</tt> value,</li>
8481<li>or, a <tt>missing</tt> value.</li>
8482</ul>
8483</li>
8484</ul>
8485</li>
8486<li>Return Value:
8487<ul>
8488
8489<li>a <tt>double</tt> value representing the skewness of the non-null and non-missing numbers in the given collection,</li>
8490<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8491<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8492<li>any other non-array and non-multiset input value will cause a type error,</li>
8493<li>any other non-numeric value in the input collection will cause a type error.</li>
8494</ul>
8495</li>
8496<li>
8497
8498<p>Example:</p>
8499
8500<div>
8501<div>
8502<pre class="source">array_skewness( [1.2, 2.3, 3.4, 0, null] );
8503</pre></div></div>
8504</li>
8505<li>
8506
8507<p>The expected result is:</p>
8508
8509<div>
8510<div>
8511<pre class="source">-0.04808451539164242
8512</pre></div></div>
8513</li>
8514</ul></div>
8515<div class="section">
8516<h3><a name="array_kurtosis"></a>array_kurtosis</h3>
8517<ul>
8518
8519<li>
8520
8521<p>Syntax:</p>
8522
8523<div>
8524<div>
8525<pre class="source">array_kurtosis(num_collection)
8526</pre></div></div>
8527</li>
8528<li>
8529
8530<p>Gets the kurtosis value from the normal distribution of the non-null and non-missing numeric items in the given collection.</p>
8531</li>
8532<li>Arguments:
8533<ul>
8534
8535<li><tt>num_collection</tt> could be:
8536<ul>
8537
8538<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8539<li>or, a <tt>null</tt> value,</li>
8540<li>or, a <tt>missing</tt> value.</li>
8541</ul>
8542</li>
8543</ul>
8544</li>
8545<li>Return Value:
8546<ul>
8547
8548<li>a <tt>double</tt> value representing the kurtosis from a normal distribution of the non-null and non-missing numbers in the given collection,</li>
8549<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8550<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8551<li>any other non-array and non-multiset input value will cause a type error,</li>
8552<li>any other non-numeric value in the input collection will cause a type error.</li>
8553</ul>
8554</li>
8555<li>
8556
8557<p>Example:</p>
8558
8559<div>
8560<div>
8561<pre class="source">array_kurtosis( [1.2, 2.3, 3.4, 0, null] );
8562</pre></div></div>
8563</li>
8564<li>
8565
8566<p>The expected result is:</p>
8567
8568<div>
8569<div>
8570<pre class="source">-1.342049701096427
8571</pre></div></div>
8572</li>
8573</ul></div>
8574<div class="section">
8575<h3><a name="strict_count"></a>strict_count</h3>
8576<ul>
8577
8578<li>
8579
8580<p>Syntax:</p>
8581
8582<div>
8583<div>
8584<pre class="source">strict_count(collection)
8585</pre></div></div>
8586</li>
8587<li>
8588
8589<p>Gets the number of items in the given collection.</p>
8590</li>
8591<li>Arguments:
8592<ul>
8593
8594<li><tt>collection</tt> could be:
8595<ul>
8596
8597<li>an <tt>array</tt> or <tt>multiset</tt> containing the items to be counted,</li>
8598<li>or a <tt>null</tt> value,</li>
8599<li>or a <tt>missing</tt> value.</li>
8600</ul>
8601</li>
8602</ul>
8603</li>
8604<li>Return Value:
8605<ul>
8606
8607<li>a <tt>bigint</tt> value representing the number of items in the given collection,</li>
8608<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>.</li>
8609</ul>
8610</li>
8611<li>
8612
8613<p>Example:</p>
8614
8615<div>
8616<div>
8617<pre class="source">strict_count( [1, 2, null, missing] );
8618</pre></div></div>
8619</li>
8620<li>
8621
8622<p>The expected result is:</p>
8623
8624<div>
8625<div>
8626<pre class="source">4
8627</pre></div></div>
8628</li>
8629</ul></div>
8630<div class="section">
8631<h3><a name="strict_avg"></a>strict_avg</h3>
8632<ul>
8633
8634<li>
8635
8636<p>Syntax:</p>
8637
8638<div>
8639<div>
8640<pre class="source">strict_avg(num_collection)
8641</pre></div></div>
8642</li>
8643<li>
8644
8645<p>Gets the average value of the numeric items in the given collection.</p>
8646</li>
8647<li>Arguments:
8648<ul>
8649
8650<li><tt>num_collection</tt> could be:
8651<ul>
8652
8653<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8654<li>or, a <tt>null</tt> value,</li>
8655<li>or, a <tt>missing</tt> value.</li>
8656</ul>
8657</li>
8658</ul>
8659</li>
8660<li>Return Value:
8661<ul>
8662
8663<li>a <tt>double</tt> value representing the average of the numbers in the given collection,</li>
8664<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8665<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8666<li>any other non-numeric value in the input collection will cause a type error.</li>
8667</ul>
8668</li>
8669<li>
8670
8671<p>Example:</p>
8672
8673<div>
8674<div>
8675<pre class="source">strict_avg( [100, 200, 300] );
8676</pre></div></div>
8677</li>
8678<li>
8679
8680<p>The expected result is:</p>
8681
8682<div>
8683<div>
8684<pre class="source">200.0
8685</pre></div></div>
8686</li>
8687</ul></div>
8688<div class="section">
8689<h3><a name="strict_sum"></a>strict_sum</h3>
8690<ul>
8691
8692<li>
8693
8694<p>Syntax:</p>
8695
8696<div>
8697<div>
8698<pre class="source">strict_sum(num_collection)
8699</pre></div></div>
8700</li>
8701<li>
8702
8703<p>Gets the sum of the items in the given collection.</p>
8704</li>
8705<li>Arguments:
8706<ul>
8707
8708<li><tt>num_collection</tt> could be:
8709<ul>
8710
8711<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8712<li>or, a <tt>null</tt> value,</li>
8713<li>or, a <tt>missing</tt> value.</li>
8714</ul>
8715</li>
8716</ul>
8717</li>
8718<li>Return Value:
8719<ul>
8720
8721<li>the sum of the numbers in the given collection. The returning type is decided by the item type with the highest order in the numeric type promotion order (<tt>tinyint</tt>-&gt; <tt>smallint</tt>-&gt;<tt>integer</tt>-&gt;<tt>bigint</tt>-&gt;<tt>float</tt>-&gt;<tt>double</tt>) among items.</li>
8722<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8723<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8724<li>any other non-numeric value in the input collection will cause a type error.</li>
8725</ul>
8726</li>
8727<li>
8728
8729<p>Example:</p>
8730
8731<div>
8732<div>
8733<pre class="source">strict_sum( [100, 200, 300] );
8734</pre></div></div>
8735</li>
8736<li>
8737
8738<p>The expected result is:</p>
8739
8740<div>
8741<div>
8742<pre class="source">600
8743</pre></div></div>
8744</li>
8745</ul></div>
8746<div class="section">
8747<h3><a name="strict_min"></a>strict_min</h3>
8748<ul>
8749
8750<li>
8751
8752<p>Syntax:</p>
8753
8754<div>
8755<div>
8756<pre class="source">strict_min(num_collection)
8757</pre></div></div>
8758</li>
8759<li>
8760
8761<p>Gets the min value of comparable items in the given collection.</p>
8762</li>
8763<li>Arguments:
8764<ul>
8765
8766<li><tt>num_collection</tt> could be:
8767<ul>
8768
8769<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
8770<li>or, a <tt>null</tt> value,</li>
8771<li>or, a <tt>missing</tt> value.</li>
8772</ul>
8773</li>
8774</ul>
8775</li>
8776<li>Return Value:
8777<ul>
8778
8779<li>the min value of the given collection. The returning type is decided by the item type with the highest order in the type promotion order (<tt>tinyint</tt>-&gt; <tt>smallint</tt>-&gt;<tt>integer</tt>-&gt;<tt>bigint</tt>-&gt;<tt>float</tt>-&gt;<tt>double</tt>) among numeric items.</li>
8780<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8781<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8782<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
8783<li>any other non-array and non-multiset input value will cause a type error.</li>
8784</ul>
8785</li>
8786<li>
8787
8788<p>Example:</p>
8789
8790<div>
8791<div>
8792<pre class="source">strict_min( [10.2, 100, 5] );
8793</pre></div></div>
8794</li>
8795<li>
8796
8797<p>The expected result is:</p>
8798
8799<div>
8800<div>
8801<pre class="source">5.0
8802</pre></div></div>
8803</li>
8804</ul></div>
8805<div class="section">
8806<h3><a name="strict_max"></a>strict_max</h3>
8807<ul>
8808
8809<li>
8810
8811<p>Syntax:</p>
8812
8813<div>
8814<div>
8815<pre class="source">strict_max(num_collection)
8816</pre></div></div>
8817</li>
8818<li>
8819
8820<p>Gets the max value of numeric items in the given collection.</p>
8821</li>
8822<li>Arguments:
8823<ul>
8824
8825<li><tt>num_collection</tt> could be:
8826<ul>
8827
8828<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
8829<li>or, a <tt>null</tt> value,</li>
8830<li>or, a <tt>missing</tt> value.</li>
8831</ul>
8832</li>
8833</ul>
8834</li>
8835<li>Return Value:
8836<ul>
8837
8838<li>The max value of the given collection. The returning type is decided by the item type with the highest order in the type promotion order (<tt>tinyint</tt>-&gt; <tt>smallint</tt>-&gt;<tt>integer</tt>-&gt;<tt>bigint</tt>-&gt;<tt>float</tt>-&gt;<tt>double</tt>) among numeric items.</li>
8839<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8840<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8841<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
8842<li>any other non-array and non-multiset input value will cause a type error.</li>
8843</ul>
8844</li>
8845<li>
8846
8847<p>Example:</p>
8848
8849<div>
8850<div>
8851<pre class="source">strict_max( [10.2, 100, 5] );
8852</pre></div></div>
8853</li>
8854<li>
8855
8856<p>The expected result is:</p>
8857
8858<div>
8859<div>
8860<pre class="source">100.0
8861</pre></div></div>
8862</li>
8863</ul></div>
8864<div class="section">
8865<h3><a name="strict_stddev_samp"></a>strict_stddev_samp</h3>
8866<ul>
8867
8868<li>
8869
8870<p>Syntax:</p>
8871
8872<div>
8873<div>
8874<pre class="source">strict_stddev_samp(num_collection)
8875</pre></div></div>
8876</li>
8877<li>
8878
8879<p>Gets the sample standard deviation value of the numeric items in the given collection.</p>
8880</li>
8881<li>Arguments:
8882<ul>
8883
8884<li><tt>num_collection</tt> could be:
8885<ul>
8886
8887<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8888<li>or, a <tt>null</tt> value,</li>
8889<li>or, a <tt>missing</tt> value.</li>
8890</ul>
8891</li>
8892</ul>
8893</li>
8894<li>Return Value:
8895<ul>
8896
8897<li>a <tt>double</tt> value representing the sample standard deviation of the numbers in the given collection,</li>
8898<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8899<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8900<li>any other non-numeric value in the input collection will cause a type error.</li>
8901</ul>
8902</li>
8903<li>
8904
8905<p>Example:</p>
8906
8907<div>
8908<div>
8909<pre class="source">strict_stddev_samp( [100, 200, 300] );
8910</pre></div></div>
8911</li>
8912<li>
8913
8914<p>The expected result is:</p>
8915
8916<div>
8917<div>
8918<pre class="source">100.0
8919</pre></div></div>
8920</li>
8921</ul></div>
8922<div class="section">
8923<h3><a name="strict_stddev_pop"></a>strict_stddev_pop</h3>
8924<ul>
8925
8926<li>
8927
8928<p>Syntax:</p>
8929
8930<div>
8931<div>
8932<pre class="source">strict_stddev_pop(num_collection)
8933</pre></div></div>
8934</li>
8935<li>
8936
8937<p>Gets the population standard deviation value of the numeric items in the given collection.</p>
8938</li>
8939<li>Arguments:
8940<ul>
8941
8942<li><tt>num_collection</tt> could be:
8943<ul>
8944
8945<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8946<li>or, a <tt>null</tt> value,</li>
8947<li>or, a <tt>missing</tt> value.</li>
8948</ul>
8949</li>
8950</ul>
8951</li>
8952<li>Return Value:
8953<ul>
8954
8955<li>a <tt>double</tt> value representing the population standard deviation of the numbers in the given collection,</li>
8956<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8957<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8958<li>any other non-numeric value in the input collection will cause a type error.</li>
8959</ul>
8960</li>
8961<li>
8962
8963<p>Example:</p>
8964
8965<div>
8966<div>
8967<pre class="source">strict_stddev_pop( [100, 200, 300] );
8968</pre></div></div>
8969</li>
8970<li>
8971
8972<p>The expected result is:</p>
8973
8974<div>
8975<div>
8976<pre class="source">81.64965809277261
8977</pre></div></div>
8978</li>
8979</ul></div>
8980<div class="section">
8981<h3><a name="strict_var_samp"></a>strict_var_samp</h3>
8982<ul>
8983
8984<li>
8985
8986<p>Syntax:</p>
8987
8988<div>
8989<div>
8990<pre class="source">strict_var_samp(num_collection)
8991</pre></div></div>
8992</li>
8993<li>
8994
8995<p>Gets the sample variance value of the numeric items in the given collection.</p>
8996</li>
8997<li>Arguments:
8998<ul>
8999
9000<li><tt>num_collection</tt> could be:
9001<ul>
9002
9003<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
9004<li>or, a <tt>null</tt> value,</li>
9005<li>or, a <tt>missing</tt> value.</li>
9006</ul>
9007</li>
9008</ul>
9009</li>
9010<li>Return Value:
9011<ul>
9012
9013<li>a <tt>double</tt> value representing the sample variance of the numbers in the given collection,</li>
9014<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
9015<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
9016<li>any other non-numeric value in the input collection will cause a type error.</li>
9017</ul>
9018</li>
9019<li>
9020
9021<p>Example:</p>
9022
9023<div>
9024<div>
9025<pre class="source">strict_var_samp( [100, 200, 300] );
9026</pre></div></div>
9027</li>
9028<li>
9029
9030<p>The expected result is:</p>
9031
9032<div>
9033<div>
9034<pre class="source">10000.0
9035</pre></div></div>
9036</li>
9037</ul></div>
9038<div class="section">
9039<h3><a name="strict_var_pop"></a>strict_var_pop</h3>
9040<ul>
9041
9042<li>
9043
9044<p>Syntax:</p>
9045
9046<div>
9047<div>
9048<pre class="source">strict_var_pop(num_collection)
9049</pre></div></div>
9050</li>
9051<li>
9052
9053<p>Gets the population variance value of the numeric items in the given collection.</p>
9054</li>
9055<li>Arguments:
9056<ul>
9057
9058<li><tt>num_collection</tt> could be:
9059<ul>
9060
9061<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
9062<li>or, a <tt>null</tt> value,</li>
9063<li>or, a <tt>missing</tt> value.</li>
9064</ul>
9065</li>
9066</ul>
9067</li>
9068<li>Return Value:
9069<ul>
9070
9071<li>a <tt>double</tt> value representing the population variance of the numbers in the given collection,</li>
9072<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
9073<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
9074<li>any other non-numeric value in the input collection will cause a type error.</li>
9075</ul>
9076</li>
9077<li>
9078
9079<p>Example:</p>
9080
9081<div>
9082<div>
9083<pre class="source">strict_var_pop( [100, 200, 300] );
9084</pre></div></div>
9085</li>
9086<li>
9087
9088<p>The expected result is:</p>
9089
9090<div>
9091<div>
9092<pre class="source">6666.666666666667
9093</pre></div></div>
9094</li>
9095</ul></div>
9096<div class="section">
9097<h3><a name="strict_skewness"></a>strict_skewness</h3>
9098<ul>
9099
9100<li>
9101
9102<p>Syntax:</p>
9103
9104<div>
9105<div>
9106<pre class="source">strict_skewness(num_collection)
9107</pre></div></div>
9108</li>
9109<li>
9110
9111<p>Gets the skewness value of the numeric items in the given collection.</p>
9112</li>
9113<li>Arguments:
9114<ul>
9115
9116<li><tt>num_collection</tt> could be:
9117<ul>
9118
9119<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
9120<li>or, a <tt>null</tt> value,</li>
9121<li>or, a <tt>missing</tt> value.</li>
9122</ul>
9123</li>
9124</ul>
9125</li>
9126<li>Return Value:
9127<ul>
9128
9129<li>a <tt>double</tt> value representing the skewness of the numbers in the given collection,</li>
9130<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
9131<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
9132<li>any other non-numeric value in the input collection will cause a type error.</li>
9133</ul>
9134</li>
9135<li>
9136
9137<p>Example:</p>
9138
9139<div>
9140<div>
9141<pre class="source">strict_skewness( [100, 200, 300] );
9142</pre></div></div>
9143</li>
9144<li>
9145
9146<p>The expected result is:</p>
9147
9148<div>
9149<div>
9150<pre class="source">0.0
9151</pre></div></div>
9152</li>
9153</ul></div>
9154<div class="section">
9155<h3><a name="strict_kurtosis"></a>strict_kurtosis</h3>
9156<ul>
9157
9158<li>
9159
9160<p>Syntax:</p>
9161
9162<div>
9163<div>
9164<pre class="source">strict_kurtosis(num_collection)
9165</pre></div></div>
9166</li>
9167<li>
9168
9169<p>Gets the kurtosis value from the normal distribution of the numeric items in the given collection.</p>
9170</li>
9171<li>Arguments:
9172<ul>
9173
9174<li><tt>num_collection</tt> could be:
9175<ul>
9176
9177<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
9178<li>or, a <tt>null</tt> value,</li>
9179<li>or, a <tt>missing</tt> value.</li>
9180</ul>
9181</li>
9182</ul>
9183</li>
9184<li>Return Value:
9185<ul>
9186
9187<li>a <tt>double</tt> value representing the kurtosis from a normal distribution of the numbers in the given collection,</li>
9188<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
9189<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
9190<li>any other non-numeric value in the input collection will cause a type error.</li>
9191</ul>
9192</li>
9193<li>
9194
9195<p>Example:</p>
9196
9197<div>
9198<div>
9199<pre class="source">strict_kurtosis( [100, 200, 300] );
9200</pre></div></div>
9201</li>
9202<li>
9203
9204<p>The expected result is:</p>
9205
9206<div>
9207<div>
9208<pre class="source">-1.5
9209</pre></div></div>
9210</li>
9211</ul><!--
9212 ! Licensed to the Apache Software Foundation (ASF) under one
9213 ! or more contributor license agreements. See the NOTICE file
9214 ! distributed with this work for additional information
9215 ! regarding copyright ownership. The ASF licenses this file
9216 ! to you under the Apache License, Version 2.0 (the
9217 ! "License"); you may not use this file except in compliance
9218 ! with the License. You may obtain a copy of the License at
9219 !
9220 ! http://www.apache.org/licenses/LICENSE-2.0
9221 !
9222 ! Unless required by applicable law or agreed to in writing,
9223 ! software distributed under the License is distributed on an
9224 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9225 ! KIND, either express or implied. See the License for the
9226 ! specific language governing permissions and limitations
9227 ! under the License.
9228 !-->
9229</div></div>
9230<div class="section">
9231<h2><a name="Comparison_Functions"></a><a name="ComparisonFunctions" id="ComparisonFunctions">Comparison Functions</a></h2>
9232<div class="section">
9233<h3><a name="greatest"></a>greatest</h3>
9234<ul>
9235
9236<li>
9237
9238<p>Syntax:</p>
9239
9240<div>
9241<div>
9242<pre class="source">greatest(numeric_value1, numeric_value2, ...)
9243</pre></div></div>
9244</li>
9245<li>
9246
9247<p>Computes the greatest value among arguments.</p>
9248</li>
9249<li>Arguments:
9250<ul>
9251
9252<li><tt>numeric_value1</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value,</li>
9253<li><tt>numeric_value2</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value,</li>
9254<li>&#x2026;.</li>
9255</ul>
9256</li>
9257<li>Return Value:
9258<ul>
9259
9260<li>the greatest values among arguments. The returning type is decided by the item type with the highest order in the numeric type promotion order (<tt>tinyint</tt>-&gt; <tt>smallint</tt>-&gt;<tt>integer</tt>-&gt;<tt>bigint</tt>-&gt;<tt>float</tt>-&gt;<tt>double</tt>) among items.</li>
9261<li><tt>null</tt> if any argument is a <tt>missing</tt> value or <tt>null</tt> value,</li>
9262<li>any other non-numeric input value will cause a type error.</li>
9263</ul>
9264</li>
9265<li>
9266
9267<p>Example:</p>
9268
9269<div>
9270<div>
9271<pre class="source">{ &quot;v1&quot;: greatest(1, 2, 3), &quot;v2&quot;: greatest(float(&quot;0.5&quot;), double(&quot;-0.5&quot;), 5000) };
9272</pre></div></div>
9273</li>
9274<li>
9275
9276<p>The expected result is:</p>
9277
9278<div>
9279<div>
9280<pre class="source">{ &quot;v1&quot;: 3, &quot;v2&quot;: 5000.0 }
9281</pre></div></div>
9282</li>
9283</ul></div>
9284<div class="section">
9285<h3><a name="least"></a>least</h3>
9286<ul>
9287
9288<li>
9289
9290<p>Syntax:</p>
9291
9292<div>
9293<div>
9294<pre class="source">least(numeric_value1, numeric_value2, ...)
9295</pre></div></div>
9296</li>
9297<li>
9298
9299<p>Computes the least value among arguments.</p>
9300</li>
9301<li>Arguments:
9302<ul>
9303
9304<li><tt>numeric_value1</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value,</li>
9305<li><tt>numeric_value2</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value,</li>
9306<li>&#x2026;.</li>
9307</ul>
9308</li>
9309<li>Return Value:
9310<ul>
9311
9312<li>the least values among arguments. The returning type is decided by the item type with the highest order in the numeric type promotion order (<tt>tinyint</tt>-&gt; <tt>smallint</tt>-&gt;<tt>integer</tt>-&gt;<tt>bigint</tt>-&gt;<tt>float</tt>-&gt;<tt>double</tt>) among items.</li>
9313<li><tt>null</tt> if any argument is a <tt>missing</tt> value or <tt>null</tt> value,</li>
9314<li>any other non-numeric input value will cause a type error.</li>
9315</ul>
9316</li>
9317<li>
9318
9319<p>Example:</p>
9320
9321<div>
9322<div>
9323<pre class="source">{ &quot;v1&quot;: least(1, 2, 3), &quot;v2&quot;: least(float(&quot;0.5&quot;), double(&quot;-0.5&quot;), 5000) };
9324</pre></div></div>
9325</li>
9326<li>
9327
9328<p>The expected result is:</p>
9329
9330<div>
9331<div>
9332<pre class="source">{ &quot;v1&quot;: 1, &quot;v2&quot;: -0.5 }
9333</pre></div></div>
9334</li>
9335</ul><!--
9336 ! Licensed to the Apache Software Foundation (ASF) under one
9337 ! or more contributor license agreements. See the NOTICE file
9338 ! distributed with this work for additional information
9339 ! regarding copyright ownership. The ASF licenses this file
9340 ! to you under the Apache License, Version 2.0 (the
9341 ! "License"); you may not use this file except in compliance
9342 ! with the License. You may obtain a copy of the License at
9343 !
9344 ! http://www.apache.org/licenses/LICENSE-2.0
9345 !
9346 ! Unless required by applicable law or agreed to in writing,
9347 ! software distributed under the License is distributed on an
9348 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9349 ! KIND, either express or implied. See the License for the
9350 ! specific language governing permissions and limitations
9351 ! under the License.
9352 !-->
9353</div></div>
9354<div class="section">
9355<h2><a name="Type_Functions"></a><a name="TypeFunctions" id="TypeFunctions">Type Functions</a></h2>
9356<div class="section">
9357<h3><a name="is_array"></a>is_array</h3>
9358<ul>
9359
9360<li>
9361
9362<p>Syntax:</p>
9363
9364<div>
9365<div>
9366<pre class="source">is_array(expr)
9367</pre></div></div>
9368</li>
9369<li>
9370
9371<p>Checks whether the given expression is evaluated to be an <tt>array</tt> value.</p>
9372</li>
9373<li>Arguments:
9374<ul>
9375
9376<li><tt>expr</tt> : an expression (any type is allowed).</li>
9377</ul>
9378</li>
9379<li>Return Value:
9380<ul>
9381
9382<li>a <tt>boolean</tt> on whether the argument is an <tt>array</tt> value or not,</li>
9383<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9384<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9385</ul>
9386</li>
9387<li>
9388
9389<p>Example:</p>
9390
9391<div>
9392<div>
9393<pre class="source">{
9394 &quot;a&quot;: is_array(true),
9395 &quot;b&quot;: is_array(false),
9396 &quot;c&quot;: isarray(null),
9397 &quot;d&quot;: isarray(missing),
9398 &quot;e&quot;: isarray(&quot;d&quot;),
9399 &quot;f&quot;: isarray(4.0),
9400 &quot;g&quot;: isarray(5),
9401 &quot;h&quot;: isarray([&quot;1&quot;, 2]),
9402 &quot;i&quot;: isarray({&quot;a&quot;:1})
9403};
9404</pre></div></div>
9405</li>
9406<li>
9407
9408<p>The expected result is:</p>
9409
9410<div>
9411<div>
9412<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: false, &quot;f&quot;: false, &quot;g&quot;: false, &quot;h&quot;: true, &quot;i&quot;: false }
9413</pre></div></div>
9414</li>
9415</ul>
9416<p>The function has an alias <tt>isarray</tt>.</p></div>
9417<div class="section">
9418<h3><a name="is_multiset"></a>is_multiset</h3>
9419<ul>
9420
9421<li>
9422
9423<p>Syntax:</p>
9424
9425<div>
9426<div>
9427<pre class="source">is_multiset(expr)
9428</pre></div></div>
9429</li>
9430<li>
9431
9432<p>Checks whether the given expression is evaluated to be an <tt>multiset</tt> value.</p>
9433</li>
9434<li>Arguments:
9435<ul>
9436
9437<li><tt>expr</tt> : an expression (any type is allowed).</li>
9438</ul>
9439</li>
9440<li>Return Value:
9441<ul>
9442
9443<li>a <tt>boolean</tt> on whether the argument is an <tt>multiset</tt> value or not,</li>
9444<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9445<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9446</ul>
9447</li>
9448<li>
9449
9450<p>Example:</p>
9451
9452<div>
9453<div>
9454<pre class="source">{
9455 &quot;a&quot;: is_multiset(true),
9456 &quot;b&quot;: is_multiset(false),
9457 &quot;c&quot;: is_multiset(null),
9458 &quot;d&quot;: is_multiset(missing),
9459 &quot;e&quot;: is_multiset(&quot;d&quot;),
9460 &quot;f&quot;: ismultiset(4.0),
9461 &quot;g&quot;: ismultiset([&quot;1&quot;, 2]),
9462 &quot;h&quot;: ismultiset({&quot;a&quot;:1}),
9463 &quot;i&quot;: ismultiset({{&quot;hello&quot;, 9328, &quot;world&quot;, [1, 2, null]}})
9464};
9465</pre></div></div>
9466</li>
9467<li>
9468
9469<p>The expected result is:</p>
9470
9471<div>
9472<div>
9473<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: false, &quot;f&quot;: false, &quot;g&quot;: false, &quot;h&quot;: false, &quot;i&quot;: true }
9474</pre></div></div>
9475</li>
9476</ul>
9477<p>The function has an alias <tt>ismultiset</tt>.</p></div>
9478<div class="section">
9479<h3><a name="is_atomic_.28is_atom.29"></a>is_atomic (is_atom)</h3>
9480<ul>
9481
9482<li>
9483
9484<p>Syntax:</p>
9485
9486<div>
9487<div>
9488<pre class="source">is_atomic(expr)
9489</pre></div></div>
9490</li>
9491<li>
9492
9493<p>Checks whether the given expression is evaluated to be a value of a <a href="../datamodel.html#PrimitiveTypes">primitive</a> type.</p>
9494</li>
9495<li>Arguments:
9496<ul>
9497
9498<li><tt>expr</tt> : an expression (any type is allowed).</li>
9499</ul>
9500</li>
9501<li>Return Value:
9502<ul>
9503
9504<li>a <tt>boolean</tt> on whether the argument is a primitive type or not,</li>
9505<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9506<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9507</ul>
9508</li>
9509<li>
9510
9511<p>Example:</p>
9512
9513<div>
9514<div>
9515<pre class="source">{
9516 &quot;a&quot;: is_atomic(true),
9517 &quot;b&quot;: is_atomic(false),
9518 &quot;c&quot;: isatomic(null),
9519 &quot;d&quot;: isatomic(missing),
9520 &quot;e&quot;: isatomic(&quot;d&quot;),
9521 &quot;f&quot;: isatom(4.0),
9522 &quot;g&quot;: isatom(5),
9523 &quot;h&quot;: isatom([&quot;1&quot;, 2]),
9524 &quot;i&quot;: isatom({&quot;a&quot;:1})
9525};
9526</pre></div></div>
9527</li>
9528<li>
9529
9530<p>The expected result is:</p>
9531
9532<div>
9533<div>
9534<pre class="source">{ &quot;a&quot;: true, &quot;b&quot;: true, &quot;c&quot;: null, &quot;e&quot;: true, &quot;f&quot;: true, &quot;g&quot;: true, &quot;h&quot;: false, &quot;i&quot;: false }
9535</pre></div></div>
9536</li>
9537</ul>
9538<p>The function has three aliases: <tt>isatomic</tt>, <tt>is_atom</tt>, and <tt>isatom</tt>.</p></div>
9539<div class="section">
9540<h3><a name="is_boolean_.28is_bool.29"></a>is_boolean (is_bool)</h3>
9541<ul>
9542
9543<li>
9544
9545<p>Syntax:</p>
9546
9547<div>
9548<div>
9549<pre class="source">is_boolean(expr)
9550</pre></div></div>
9551</li>
9552<li>
9553
9554<p>Checks whether the given expression is evaluated to be a <tt>boolean</tt> value.</p>
9555</li>
9556<li>Arguments:
9557<ul>
9558
9559<li><tt>expr</tt> : an expression (any type is allowed).</li>
9560</ul>
9561</li>
9562<li>Return Value:
9563<ul>
9564
9565<li>a <tt>boolean</tt> on whether the argument is a <tt>boolean</tt> value or not,</li>
9566<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9567<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9568</ul>
9569</li>
9570<li>
9571
9572<p>Example:</p>
9573
9574<div>
9575<div>
9576<pre class="source">{
9577 &quot;a&quot;: isboolean(true),
9578 &quot;b&quot;: isboolean(false),
9579 &quot;c&quot;: is_boolean(null),
9580 &quot;d&quot;: is_boolean(missing),
9581 &quot;e&quot;: isbool(&quot;d&quot;),
9582 &quot;f&quot;: isbool(4.0),
9583 &quot;g&quot;: isbool(5),
9584 &quot;h&quot;: isbool([&quot;1&quot;, 2]),
9585 &quot;i&quot;: isbool({&quot;a&quot;:1})
9586};
9587</pre></div></div>
9588</li>
9589<li>
9590
9591<p>The expected result is:</p>
9592
9593<div>
9594<div>
9595<pre class="source">{ &quot;a&quot;: true, &quot;b&quot;: true, &quot;c&quot;: null, &quot;e&quot;: false, &quot;f&quot;: false, &quot;g&quot;: false, &quot;h&quot;: false, &quot;i&quot;: false }
9596</pre></div></div>
9597</li>
9598</ul>
9599<p>The function has three aliases: <tt>isboolean</tt>, <tt>is_bool</tt>, and <tt>isbool</tt>.</p></div>
9600<div class="section">
9601<h3><a name="is_number_.28is_num.29"></a>is_number (is_num)</h3>
9602<ul>
9603
9604<li>
9605
9606<p>Syntax:</p>
9607
9608<div>
9609<div>
9610<pre class="source">is_number(expr)
9611</pre></div></div>
9612</li>
9613<li>
9614
9615<p>Checks whether the given expression is evaluated to be a numeric value.</p>
9616</li>
9617<li>Arguments:
9618<ul>
9619
9620<li><tt>expr</tt> : an expression (any type is allowed).</li>
9621</ul>
9622</li>
9623<li>Return Value:
9624<ul>
9625
9626<li>a <tt>boolean</tt> on whether the argument is a <tt>smallint</tt>/<tt>tinyint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value or not,</li>
9627<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9628<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9629</ul>
9630</li>
9631<li>
9632
9633<p>Example:</p>
9634
9635<div>
9636<div>
9637<pre class="source">{
9638 &quot;a&quot;: is_number(true),
9639 &quot;b&quot;: is_number(false),
9640 &quot;c&quot;: isnumber(null),
9641 &quot;d&quot;: isnumber(missing),
9642 &quot;e&quot;: isnumber(&quot;d&quot;),
9643 &quot;f&quot;: isnum(4.0),
9644 &quot;g&quot;: isnum(5),
9645 &quot;h&quot;: isnum([&quot;1&quot;, 2]),
9646 &quot;i&quot;: isnum({&quot;a&quot;:1})
9647};
9648</pre></div></div>
9649</li>
9650<li>
9651
9652<p>The expected result is:</p>
9653
9654<div>
9655<div>
9656<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: false, &quot;f&quot;: true, &quot;g&quot;: true, &quot;h&quot;: false, &quot;i&quot;: false }
9657</pre></div></div>
9658</li>
9659</ul>
9660<p>The function has three aliases: <tt>isnumber</tt>, <tt>is_num</tt>, and <tt>isnum</tt>.</p></div>
9661<div class="section">
9662<h3><a name="is_object_.28is_obj.29"></a>is_object (is_obj)</h3>
9663<ul>
9664
9665<li>
9666
9667<p>Syntax:</p>
9668
9669<div>
9670<div>
9671<pre class="source">is_object(expr)
9672</pre></div></div>
9673</li>
9674<li>
9675
9676<p>Checks whether the given expression is evaluated to be a <tt>object</tt> value.</p>
9677</li>
9678<li>Arguments:
9679<ul>
9680
9681<li><tt>expr</tt> : an expression (any type is allowed).</li>
9682</ul>
9683</li>
9684<li>Return Value:
9685<ul>
9686
9687<li>a <tt>boolean</tt> on whether the argument is a <tt>object</tt> value or not,</li>
9688<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9689<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9690</ul>
9691</li>
9692<li>
9693
9694<p>Example:</p>
9695
9696<div>
9697<div>
9698<pre class="source">{
9699 &quot;a&quot;: is_object(true),
9700 &quot;b&quot;: is_object(false),
9701 &quot;c&quot;: isobject(null),
9702 &quot;d&quot;: isobject(missing),
9703 &quot;e&quot;: isobj(&quot;d&quot;),
9704 &quot;f&quot;: isobj(4.0),
9705 &quot;g&quot;: isobj(5),
9706 &quot;h&quot;: isobj([&quot;1&quot;, 2]),
9707 &quot;i&quot;: isobj({&quot;a&quot;:1})
9708};
9709</pre></div></div>
9710</li>
9711<li>
9712
9713<p>The expected result is:</p>
9714<p>{ &#x201c;a&#x201d;: false, &#x201c;b&#x201d;: false, &#x201c;c&#x201d;: null, &#x201c;e&#x201d;: false, &#x201c;f&#x201d;: false, &#x201c;g&#x201d;: false, &#x201c;h&#x201d;: false, &#x201c;i&#x201d;: true }</p>
9715</li>
9716</ul>
9717<p>The function has three aliases: <tt>isobject</tt>, <tt>is_obj</tt>, and <tt>isobj</tt>.</p></div>
9718<div class="section">
9719<h3><a name="is_string_.28is_str.29"></a>is_string (is_str)</h3>
9720<ul>
9721
9722<li>
9723
9724<p>Syntax:</p>
9725
9726<div>
9727<div>
9728<pre class="source">is_string(expr)
9729</pre></div></div>
9730</li>
9731<li>
9732
9733<p>Checks whether the given expression is evaluated to be a <tt>string</tt> value.</p>
9734</li>
9735<li>Arguments:
9736<ul>
9737
9738<li><tt>expr</tt> : an expression (any type is allowed).</li>
9739</ul>
9740</li>
9741<li>Return Value:
9742<ul>
9743
9744<li>a <tt>boolean</tt> on whether the argument is a <tt>string</tt> value or not,</li>
9745<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9746<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9747</ul>
9748</li>
9749<li>
9750
9751<p>Example:</p>
9752
9753<div>
9754<div>
9755<pre class="source">{
9756 &quot;a&quot;: is_string(true),
9757 &quot;b&quot;: isstring(false),
9758 &quot;c&quot;: isstring(null),
9759 &quot;d&quot;: isstr(missing),
9760 &quot;e&quot;: isstr(&quot;d&quot;),
9761 &quot;f&quot;: isstr(4.0),
9762 &quot;g&quot;: isstr(5),
9763 &quot;h&quot;: isstr([&quot;1&quot;, 2]),
9764 &quot;i&quot;: isstr({&quot;a&quot;:1})
9765};
9766</pre></div></div>
9767</li>
9768<li>
9769
9770<p>The expected result is:</p>
9771
9772<div>
9773<div>
9774<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: true, &quot;f&quot;: false, &quot;g&quot;: false, &quot;h&quot;: false, &quot;i&quot;: false }
9775</pre></div></div>
9776</li>
9777</ul>
9778<p>The function has three aliases: <tt>isstring</tt>, <tt>is_str</tt>, and <tt>isstr</tt>.</p></div>
9779<div class="section">
9780<h3><a name="is_null"></a>is_null</h3>
9781<ul>
9782
9783<li>
9784
9785<p>Syntax:</p>
9786
9787<div>
9788<div>
9789<pre class="source">is_null(expr)
9790</pre></div></div>
9791</li>
9792<li>
9793
9794<p>Checks whether the given expression is evaluated to be a <tt>null</tt> value.</p>
9795</li>
9796<li>Arguments:
9797<ul>
9798
9799<li><tt>expr</tt> : an expression (any type is allowed).</li>
9800</ul>
9801</li>
9802<li>Return Value:
9803<ul>
9804
9805<li>a <tt>boolean</tt> on whether the variable is a <tt>null</tt> or not,</li>
9806<li>a <tt>missing</tt> if the input is <tt>missing</tt>.</li>
9807</ul>
9808</li>
9809<li>
9810
9811<p>Example:</p>
9812
9813<div>
9814<div>
9815<pre class="source">{ &quot;v1&quot;: is_null(null), &quot;v2&quot;: is_null(1), &quot;v3&quot;: is_null(missing) };
9816</pre></div></div>
9817</li>
9818<li>
9819
9820<p>The expected result is:</p>
9821
9822<div>
9823<div>
9824<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
9825</pre></div></div>
9826</li>
9827</ul>
9828<p>The function has an alias <tt>isnull</tt>.</p></div>
9829<div class="section">
9830<h3><a name="is_missing"></a>is_missing</h3>
9831<ul>
9832
9833<li>
9834
9835<p>Syntax:</p>
9836
9837<div>
9838<div>
9839<pre class="source">is_missing(expr)
9840</pre></div></div>
9841</li>
9842<li>
9843
9844<p>Checks whether the given expression is evaluated to be a <tt>missing</tt> value.</p>
9845</li>
9846<li>Arguments:
9847<ul>
9848
9849<li><tt>expr</tt> : an expression (any type is allowed).</li>
9850</ul>
9851</li>
9852<li>Return Value:
9853<ul>
9854
9855<li>a <tt>boolean</tt> on whether the variable is a <tt>missing</tt> or not.</li>
9856</ul>
9857</li>
9858<li>
9859
9860<p>Example:</p>
9861
9862<div>
9863<div>
9864<pre class="source">{ &quot;v1&quot;: is_missing(null), &quot;v2&quot;: is_missing(1), &quot;v3&quot;: is_missing(missing) };
9865</pre></div></div>
9866</li>
9867<li>
9868
9869<p>The expected result is:</p>
9870
9871<div>
9872<div>
9873<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: false, &quot;v3&quot;: true }
9874</pre></div></div>
9875</li>
9876</ul>
9877<p>The function has an alias <tt>ismissing</tt>.</p></div>
9878<div class="section">
9879<h3><a name="is_unknown"></a>is_unknown</h3>
9880<ul>
9881
9882<li>
9883
9884<p>Syntax:</p>
9885
9886<div>
9887<div>
9888<pre class="source">is_unknown(expr)
9889</pre></div></div>
9890</li>
9891<li>
9892
9893<p>Checks whether the given variable is a <tt>null</tt> value or a <tt>missing</tt> value.</p>
9894</li>
9895<li>Arguments:
9896<ul>
9897
9898<li><tt>expr</tt> : an expression (any type is allowed).</li>
9899</ul>
9900</li>
9901<li>Return Value:
9902<ul>
9903
9904<li>a <tt>boolean</tt> on whether the variable is a <tt>null</tt>/``missing<tt>value (</tt>true<tt>) or not (</tt>false`).</li>
9905</ul>
9906</li>
9907<li>
9908
9909<p>Example:</p>
9910
9911<div>
9912<div>
9913<pre class="source">{ &quot;v1&quot;: is_unknown(null), &quot;v2&quot;: is_unknown(1), &quot;v3&quot;: is_unknown(missing) };
9914</pre></div></div>
9915</li>
9916<li>
9917
9918<p>The expected result is:</p>
9919
9920<div>
9921<div>
9922<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false, &quot;v3&quot;: true }
9923</pre></div></div>
9924</li>
9925</ul>
9926<p>The function has an alias <tt>isunknown</tt>.</p><!--
9927 ! Licensed to the Apache Software Foundation (ASF) under one
9928 ! or more contributor license agreements. See the NOTICE file
9929 ! distributed with this work for additional information
9930 ! regarding copyright ownership. The ASF licenses this file
9931 ! to you under the Apache License, Version 2.0 (the
9932 ! "License"); you may not use this file except in compliance
9933 ! with the License. You may obtain a copy of the License at
9934 !
9935 ! http://www.apache.org/licenses/LICENSE-2.0
9936 !
9937 ! Unless required by applicable law or agreed to in writing,
9938 ! software distributed under the License is distributed on an
9939 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9940 ! KIND, either express or implied. See the License for the
9941 ! specific language governing permissions and limitations
9942 ! under the License.
9943 !-->
9944</div>
9945<div class="section">
9946<h3><a name="is_binary_.28is_bin.29"></a>is_binary (is_bin)</h3>
9947<ul>
9948
9949<li>
9950
9951<p>Syntax:</p>
9952
9953<div>
9954<div>
9955<pre class="source">is_binary(expr)
9956</pre></div></div>
9957</li>
9958<li>
9959
9960<p>Checks whether the given expression is evaluated to be a <tt>binary</tt> value.</p>
9961</li>
9962<li>Arguments:
9963<ul>
9964
9965<li><tt>expr</tt> : an expression (any type is allowed).</li>
9966</ul>
9967</li>
9968<li>Return Value:
9969<ul>
9970
9971<li>a <tt>boolean</tt> on whether the argument is a <tt>binary</tt> value or not,</li>
9972<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9973<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9974</ul>
9975</li>
9976<li>
9977
9978<p>Example:</p>
9979
9980<div>
9981<div>
9982<pre class="source">{
9983 &quot;a&quot;: is_binary(true),
9984 &quot;b&quot;: is_binary(false),
9985 &quot;c&quot;: isbinary(null),
9986 &quot;d&quot;: isbinary(missing),
9987 &quot;e&quot;: isbin(point(&quot;1,2&quot;)),
9988 &quot;f&quot;: isbin(hex(&quot;ABCDEF0123456789&quot;)),
9989 &quot;g&quot;: is_bin(sub_binary(hex(&quot;AABBCCDD&quot;), 4)),
9990 &quot;h&quot;: is_bin(2),
9991 &quot;i&quot;: is_bin({&quot;a&quot;:1})
9992};
9993</pre></div></div>
9994</li>
9995<li>
9996
9997<p>The expected result is:</p>
9998
9999<div>
10000<div>
10001<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: false, &quot;f&quot;: true, &quot;g&quot;: true, &quot;h&quot;: false, &quot;i&quot;: false }
10002</pre></div></div>
10003</li>
10004</ul>
10005<p>The function has three aliases: <tt>isbinary</tt>, <tt>is_bin</tt>, and <tt>isbin</tt>.</p></div>
10006<div class="section">
10007<h3><a name="is_uuid"></a>is_uuid</h3>
10008<ul>
10009
10010<li>
10011
10012<p>Syntax:</p>
10013
10014<div>
10015<div>
10016<pre class="source">is_uuid(expr)
10017</pre></div></div>
10018</li>
10019<li>
10020
10021<p>Checks whether the given expression is evaluated to be a <tt>uuid</tt> value.</p>
10022</li>
10023<li>Arguments:
10024<ul>
10025
10026<li><tt>expr</tt> : an expression (any type is allowed).</li>
10027</ul>
10028</li>
10029<li>Return Value:
10030<ul>
10031
10032<li>a <tt>boolean</tt> on whether the argument is a <tt>uuid</tt> value or not,</li>
10033<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10034<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10035</ul>
10036</li>
10037<li>
10038
10039<p>Example:</p>
10040
10041<div>
10042<div>
10043<pre class="source"> {
10044 &quot;a&quot;: is_uuid(true),
10045 &quot;b&quot;: is_uuid(false),
10046 &quot;c&quot;: is_uuid(null),
10047 &quot;d&quot;: is_uuid(missing),
10048 &quot;e&quot;: isuuid(4.0),
10049 &quot;f&quot;: isuuid(date(&quot;2013-01-01&quot;)),
10050 &quot;g&quot;: isuuid(uuid(&quot;5c848e5c-6b6a-498f-8452-8847a2957421&quot;))
10051};
10052</pre></div></div>
10053</li>
10054<li>
10055
10056<p>The expected result is:</p>
10057
10058<div>
10059<div>
10060<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: false, &quot;f&quot;: false, &quot;g&quot;: true }
10061</pre></div></div>
10062</li>
10063</ul>
10064<p>The function has an alias <tt>isuuid</tt>.</p></div>
10065<div class="section">
10066<h3><a name="is_point"></a>is_point</h3>
10067<ul>
10068
10069<li>
10070
10071<p>Syntax:</p>
10072
10073<div>
10074<div>
10075<pre class="source">is_point(expr)
10076</pre></div></div>
10077</li>
10078<li>
10079
10080<p>Checks whether the given expression is evaluated to be a <tt>point</tt> value.</p>
10081</li>
10082<li>Arguments:
10083<ul>
10084
10085<li><tt>expr</tt> : an expression (any type is allowed).</li>
10086</ul>
10087</li>
10088<li>Return Value:
10089<ul>
10090
10091<li>a <tt>boolean</tt> on whether the argument is a <tt>point</tt> value or not,</li>
10092<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10093<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10094</ul>
10095</li>
10096<li>
10097
10098<p>Example:</p>
10099
10100<div>
10101<div>
10102<pre class="source">{
10103 &quot;a&quot;: is_point(true),
10104 &quot;b&quot;: is_point(false),
10105 &quot;c&quot;: is_point(null),
10106 &quot;d&quot;: is_point(missing),
10107 &quot;e&quot;: is_point(point(&quot;1,2&quot;)),
10108 &quot;f&quot;: ispoint(line(&quot;30.0,70.0 50.0,90.0&quot;)),
10109 &quot;g&quot;: ispoint(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
10110 &quot;h&quot;: ispoint(circle(&quot;30.0,70.0 5.0&quot;)),
10111 &quot;i&quot;: ispoint(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
10112 &quot;j&quot;: ispoint(3)
10113};
10114</pre></div></div>
10115</li>
10116<li>
10117
10118<p>The expected result is:</p>
10119
10120<div>
10121<div>
10122<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: true, &quot;f&quot;: false, &quot;g&quot;: false, &quot;h&quot;: false, &quot;i&quot;: false, &quot;j&quot;: false }
10123</pre></div></div>
10124</li>
10125</ul>
10126<p>The function has an alias <tt>ispoint</tt>.</p></div>
10127<div class="section">
10128<h3><a name="is_line"></a>is_line</h3>
10129<ul>
10130
10131<li>
10132
10133<p>Syntax:</p>
10134
10135<div>
10136<div>
10137<pre class="source">is_line(expr)
10138</pre></div></div>
10139</li>
10140<li>
10141
10142<p>Checks whether the given expression is evaluated to be a <tt>line</tt> value.</p>
10143</li>
10144<li>Arguments:
10145<ul>
10146
10147<li><tt>expr</tt> : an expression (any type is allowed).</li>
10148</ul>
10149</li>
10150<li>Return Value:
10151<ul>
10152
10153<li>a <tt>boolean</tt> on whether the argument is a <tt>line</tt> value or not,</li>
10154<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10155<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10156</ul>
10157</li>
10158<li>
10159
10160<p>Example:</p>
10161
10162<div>
10163<div>
10164<pre class="source">{
10165 &quot;a&quot;: is_line(true),
10166 &quot;b&quot;: is_line(false),
10167 &quot;c&quot;: is_line(null),
10168 &quot;d&quot;: is_line(missing),
10169 &quot;e&quot;: is_line(point(&quot;1,2&quot;)),
10170 &quot;f&quot;: isline(line(&quot;30.0,70.0 50.0,90.0&quot;)),
10171 &quot;g&quot;: isline(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
10172 &quot;h&quot;: isline(circle(&quot;30.0,70.0 5.0&quot;)),
10173 &quot;i&quot;: isline(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
10174 &quot;j&quot;: isline(3)
10175};
10176</pre></div></div>
10177</li>
10178<li>
10179
10180<p>The expected result is:</p>
10181
10182<div>
10183<div>
10184<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: false, &quot;f&quot;: true, &quot;g&quot;: false, &quot;h&quot;: false, &quot;i&quot;: false, &quot;j&quot;: false }
10185</pre></div></div>
10186</li>
10187</ul>
10188<p>The function has an alias <tt>isline</tt>.</p></div>
10189<div class="section">
10190<h3><a name="is_rectangle"></a>is_rectangle</h3>
10191<ul>
10192
10193<li>
10194
10195<p>Syntax:</p>
10196
10197<div>
10198<div>
10199<pre class="source">is_rectangle(expr)
10200</pre></div></div>
10201</li>
10202<li>
10203
10204<p>Checks whether the given expression is evaluated to be a <tt>rectangle</tt> value.</p>
10205</li>
10206<li>Arguments:
10207<ul>
10208
10209<li><tt>expr</tt> : an expression (any type is allowed).</li>
10210</ul>
10211</li>
10212<li>Return Value:
10213<ul>
10214
10215<li>a <tt>boolean</tt> on whether the argument is a <tt>rectangle</tt> value or not,</li>
10216<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10217<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10218</ul>
10219</li>
10220<li>
10221
10222<p>Example:</p>
10223
10224<div>
10225<div>
10226<pre class="source">{
10227 &quot;a&quot;: is_rectangle(true),
10228 &quot;b&quot;: is_rectangle(false),
10229 &quot;c&quot;: is_rectangle(null),
10230 &quot;d&quot;: is_rectangle(missing),
10231 &quot;e&quot;: is_rectangle(point(&quot;1,2&quot;)),
10232 &quot;f&quot;: isrectangle(line(&quot;30.0,70.0 50.0,90.0&quot;)),
10233 &quot;g&quot;: isrectangle(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
10234 &quot;h&quot;: isrectangle(circle(&quot;30.0,70.0 5.0&quot;)),
10235 &quot;i&quot;: isrectangle(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
10236 &quot;j&quot;: isrectangle(3)
10237};
10238</pre></div></div>
10239</li>
10240<li>
10241
10242<p>The expected result is:</p>
10243
10244<div>
10245<div>
10246<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: false, &quot;f&quot;: false, &quot;g&quot;: true, &quot;h&quot;: false, &quot;i&quot;: false, &quot;j&quot;: false }
10247</pre></div></div>
10248</li>
10249</ul>
10250<p>The function has an alias <tt>isrectangle</tt>.</p></div>
10251<div class="section">
10252<h3><a name="is_circle"></a>is_circle</h3>
10253<ul>
10254
10255<li>
10256
10257<p>Syntax:</p>
10258
10259<div>
10260<div>
10261<pre class="source">is_circle(expr)
10262</pre></div></div>
10263</li>
10264<li>
10265
10266<p>Checks whether the given expression is evaluated to be a <tt>circle</tt> value.</p>
10267</li>
10268<li>Arguments:
10269<ul>
10270
10271<li><tt>expr</tt> : an expression (any type is allowed).</li>
10272</ul>
10273</li>
10274<li>Return Value:
10275<ul>
10276
10277<li>a <tt>boolean</tt> on whether the argument is a <tt>circle</tt> value or not,</li>
10278<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10279<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10280</ul>
10281</li>
10282<li>
10283
10284<p>Example:</p>
10285
10286<div>
10287<div>
10288<pre class="source">{
10289 &quot;a&quot;: is_circle(true),
10290 &quot;b&quot;: is_circle(false),
10291 &quot;c&quot;: is_circle(null),
10292 &quot;d&quot;: is_circle(missing),
10293 &quot;e&quot;: is_circle(point(&quot;1,2&quot;)),
10294 &quot;f&quot;: iscircle(line(&quot;30.0,70.0 50.0,90.0&quot;)),
10295 &quot;g&quot;: iscircle(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
10296 &quot;h&quot;: iscircle(circle(&quot;30.0,70.0 5.0&quot;)),
10297 &quot;i&quot;: iscircle(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
10298 &quot;j&quot;: iscircle(3)
10299};
10300</pre></div></div>
10301</li>
10302<li>
10303
10304<p>The expected result is:</p>
10305
10306<div>
10307<div>
10308<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: false, &quot;f&quot;: false, &quot;g&quot;: false, &quot;h&quot;: true, &quot;i&quot;: false, &quot;j&quot;: false }
10309</pre></div></div>
10310</li>
10311</ul>
10312<p>The function has an alias <tt>iscircle</tt>.</p></div>
10313<div class="section">
10314<h3><a name="is_polygon"></a>is_polygon</h3>
10315<ul>
10316
10317<li>
10318
10319<p>Syntax:</p>
10320
10321<div>
10322<div>
10323<pre class="source">is_polygon(expr)
10324</pre></div></div>
10325</li>
10326<li>
10327
10328<p>Checks whether the given expression is evaluated to be a <tt>polygon</tt> value.</p>
10329</li>
10330<li>Arguments:
10331<ul>
10332
10333<li><tt>expr</tt> : an expression (any type is allowed).</li>
10334</ul>
10335</li>
10336<li>Return Value:
10337<ul>
10338
10339<li>a <tt>boolean</tt> on whether the argument is a <tt>polygon</tt> value or not,</li>
10340<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10341<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10342</ul>
10343</li>
10344<li>
10345
10346<p>Example:</p>
10347
10348<div>
10349<div>
10350<pre class="source">{
10351 &quot;a&quot;: is_polygon(true),
10352 &quot;b&quot;: is_polygon(false),
10353 &quot;c&quot;: is_polygon(null),
10354 &quot;d&quot;: is_polygon(missing),
10355 &quot;e&quot;: is_polygon(point(&quot;1,2&quot;)),
10356 &quot;f&quot;: ispolygon(line(&quot;30.0,70.0 50.0,90.0&quot;)),
10357 &quot;g&quot;: ispolygon(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
10358 &quot;h&quot;: ispolygon(circle(&quot;30.0,70.0 5.0&quot;)),
10359 &quot;i&quot;: ispolygon(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
10360 &quot;j&quot;: ispolygon(3)
10361};
10362</pre></div></div>
10363</li>
10364<li>
10365
10366<p>The expected result is:</p>
10367
10368<div>
10369<div>
10370<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: false, &quot;f&quot;: false, &quot;g&quot;: false, &quot;h&quot;: false, &quot;i&quot;: true, &quot;j&quot;: false }
10371</pre></div></div>
10372</li>
10373</ul>
10374<p>The function has an alias <tt>ispolygon</tt>.</p></div>
10375<div class="section">
10376<h3><a name="is_spatial"></a>is_spatial</h3>
10377<ul>
10378
10379<li>
10380
10381<p>Syntax:</p>
10382
10383<div>
10384<div>
10385<pre class="source">is_spatial(expr)
10386</pre></div></div>
10387</li>
10388<li>
10389
10390<p>Checks whether the given expression is evaluated to be a spatial value.</p>
10391</li>
10392<li>Arguments:
10393<ul>
10394
10395<li><tt>expr</tt> : an expression (any type is allowed).</li>
10396</ul>
10397</li>
10398<li>Return Value:
10399<ul>
10400
10401<li>a <tt>boolean</tt> on whether the argument is a <tt>point</tt>/<tt>line</tt>/<tt>rectangle</tt>/<tt>circle</tt>/<tt>polygon</tt> value or not,</li>
10402<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10403<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10404</ul>
10405</li>
10406<li>
10407
10408<p>Example:</p>
10409
10410<div>
10411<div>
10412<pre class="source">{
10413 &quot;a&quot;: is_spatial(true),
10414 &quot;b&quot;: is_spatial(false),
10415 &quot;c&quot;: is_spatial(null),
10416 &quot;d&quot;: is_spatial(missing),
10417 &quot;e&quot;: is_spatial(point(&quot;1,2&quot;)),
10418 &quot;f&quot;: isspatial(line(&quot;30.0,70.0 50.0,90.0&quot;)),
10419 &quot;g&quot;: isspatial(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
10420 &quot;h&quot;: isspatial(circle(&quot;30.0,70.0 5.0&quot;)),
10421 &quot;i&quot;: isspatial(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
10422 &quot;j&quot;: isspatial(3)
10423};
10424</pre></div></div>
10425</li>
10426<li>
10427
10428<p>The expected result is:</p>
10429
10430<div>
10431<div>
10432<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: true, &quot;f&quot;: true, &quot;g&quot;: true, &quot;h&quot;: true, &quot;i&quot;: true, &quot;j&quot;: false }
10433</pre></div></div>
10434</li>
10435</ul>
10436<p>The function has an alias <tt>isspatial</tt>.</p></div>
10437<div class="section">
10438<h3><a name="is_date"></a>is_date</h3>
10439<ul>
10440
10441<li>
10442
10443<p>Syntax:</p>
10444
10445<div>
10446<div>
10447<pre class="source">is_date(expr)
10448</pre></div></div>
10449</li>
10450<li>
10451
10452<p>Checks whether the given expression is evaluated to be a <tt>date</tt> value.</p>
10453</li>
10454<li>Arguments:
10455<ul>
10456
10457<li><tt>expr</tt> : an expression (any type is allowed).</li>
10458</ul>
10459</li>
10460<li>Return Value:
10461<ul>
10462
10463<li>a <tt>boolean</tt> on whether the argument is a <tt>date</tt> value or not,</li>
10464<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10465<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10466</ul>
10467</li>
10468<li>
10469
10470<p>Example:</p>
10471
10472<div>
10473<div>
10474<pre class="source">{
10475 &quot;a&quot;: is_date(true),
10476 &quot;b&quot;: is_date(false),
10477 &quot;c&quot;: is_date(null),
10478 &quot;d&quot;: is_date(missing),
10479 &quot;e&quot;: is_date(date(&quot;-19700101&quot;)),
10480 &quot;f&quot;: isdate(date(&quot;2013-01-01&quot;)),
10481 &quot;g&quot;: isdate(time(&quot;12:12:12.039Z&quot;)),
10482 &quot;h&quot;: isdate(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
10483 &quot;i&quot;: isdate(duration(&quot;P100Y12MT12M&quot;)),
10484 &quot;j&quot;: isdate(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
10485 &quot;k&quot;: isdate(3)
10486};
10487</pre></div></div>
10488</li>
10489<li>
10490
10491<p>The expected result is:</p>
10492
10493<div>
10494<div>
10495<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: true, &quot;f&quot;: true, &quot;g&quot;: false, &quot;h&quot;: false, &quot;i&quot;: false, &quot;j&quot;: false, &quot;k&quot;: false }
10496</pre></div></div>
10497</li>
10498</ul>
10499<p>The function has an alias <tt>isdate</tt>.</p></div>
10500<div class="section">
10501<h3><a name="is_datetime_.28is_timestamp.29"></a>is_datetime (is_timestamp)</h3>
10502<ul>
10503
10504<li>
10505
10506<p>Syntax:</p>
10507
10508<div>
10509<div>
10510<pre class="source">is_datetime(expr)
10511</pre></div></div>
10512</li>
10513<li>
10514
10515<p>Checks whether the given expression is evaluated to be a <tt>datetime</tt> value.</p>
10516</li>
10517<li>Arguments:
10518<ul>
10519
10520<li><tt>expr</tt> : an expression (any type is allowed).</li>
10521</ul>
10522</li>
10523<li>Return Value:
10524<ul>
10525
10526<li>a <tt>boolean</tt> on whether the argument is a <tt>datetime</tt> value or not,</li>
10527<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10528<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10529</ul>
10530</li>
10531<li>
10532
10533<p>Example:</p>
10534
10535<div>
10536<div>
10537<pre class="source">{
10538 &quot;a&quot;: is_datetime(true),
10539 &quot;b&quot;: is_datetime(false),
10540 &quot;c&quot;: is_datetime(null),
10541 &quot;d&quot;: is_datetime(missing),
10542 &quot;e&quot;: is_datetime(datetime(&quot;2016-02-02T12:09:22.023Z&quot;)),
10543 &quot;f&quot;: isdatetime(datetime(&quot;2011-03-03T12:10:42.011Z&quot;)),
10544 &quot;g&quot;: isdatetime(time(&quot;12:12:12.039Z&quot;)),
10545 &quot;h&quot;: is_timestamp(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
10546 &quot;i&quot;: is_timestamp(duration(&quot;P100Y12MT12M&quot;)),
10547 &quot;j&quot;: istimestamp(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
10548 &quot;k&quot;: istimestamp(3)
10549};
10550</pre></div></div>
10551</li>
10552<li>
10553
10554<p>The expected result is:</p>
10555
10556<div>
10557<div>
10558<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: true, &quot;f&quot;: true, &quot;g&quot;: false, &quot;h&quot;: true, &quot;i&quot;: false, &quot;j&quot;: false, &quot;k&quot;: false }
10559</pre></div></div>
10560</li>
10561</ul>
10562<p>The function has three aliases: <tt>isdatetime</tt>, <tt>is_timestamp</tt>, and <tt>istimestamp</tt>.</p></div>
10563<div class="section">
10564<h3><a name="is_time"></a>is_time</h3>
10565<ul>
10566
10567<li>
10568
10569<p>Syntax:</p>
10570
10571<div>
10572<div>
10573<pre class="source">is_time(expr)
10574</pre></div></div>
10575</li>
10576<li>
10577
10578<p>Checks whether the given expression is evaluated to be a <tt>time</tt> value.</p>
10579</li>
10580<li>Arguments:
10581<ul>
10582
10583<li><tt>expr</tt> : an expression (any type is allowed).</li>
10584</ul>
10585</li>
10586<li>Return Value:
10587<ul>
10588
10589<li>a <tt>boolean</tt> on whether the argument is a <tt>time</tt> value or not,</li>
10590<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10591<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10592</ul>
10593</li>
10594<li>
10595
10596<p>Example:</p>
10597
10598<div>
10599<div>
10600<pre class="source"> {
10601 &quot;a&quot;: is_time(true),
10602 &quot;b&quot;: is_time(false),
10603 &quot;c&quot;: is_time(null),
10604 &quot;d&quot;: is_time(missing),
10605 &quot;e&quot;: is_time(time(&quot;08:00:00.000Z&quot;)),
10606 &quot;f&quot;: istime(date(&quot;2013-01-01&quot;)),
10607 &quot;g&quot;: istime(time(&quot;12:12:12.039Z&quot;)),
10608 &quot;h&quot;: istime(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
10609 &quot;i&quot;: istime(duration(&quot;P100Y12MT12M&quot;)),
10610 &quot;j&quot;: istime(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
10611 &quot;k&quot;: istime(3)
10612};
10613</pre></div></div>
10614</li>
10615<li>
10616
10617<p>The expected result is:</p>
10618
10619<div>
10620<div>
10621<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: true, &quot;f&quot;: false, &quot;g&quot;: true, &quot;h&quot;: false, &quot;i&quot;: false, &quot;j&quot;: false, &quot;k&quot;: false }
10622</pre></div></div>
10623</li>
10624</ul>
10625<p>The function has an alias <tt>istime</tt>.</p></div>
10626<div class="section">
10627<h3><a name="is_duration"></a>is_duration</h3>
10628<ul>
10629
10630<li>
10631
10632<p>Syntax:</p>
10633
10634<div>
10635<div>
10636<pre class="source">is_duration(expr)
10637</pre></div></div>
10638</li>
10639<li>
10640
10641<p>Checks whether the given expression is evaluated to be a duration value.</p>
10642</li>
10643<li>Arguments:
10644<ul>
10645
10646<li><tt>expr</tt> : an expression (any type is allowed).</li>
10647</ul>
10648</li>
10649<li>Return Value:
10650<ul>
10651
10652<li>a <tt>boolean</tt> on whether the argument is a <tt>duration/year_month_duration/day_time_duration</tt> value or not,</li>
10653<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10654<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10655</ul>
10656</li>
10657<li>
10658
10659<p>Example:</p>
10660
10661<div>
10662<div>
10663<pre class="source"> {
10664 &quot;a&quot;: is_duration(true),
10665 &quot;b&quot;: is_duration(false),
10666 &quot;c&quot;: is_duration(null),
10667 &quot;d&quot;: is_duration(missing),
10668 &quot;e&quot;: is_duration(duration(&quot;-PT20.943S&quot;)),
10669 &quot;f&quot;: isduration(date(&quot;2013-01-01&quot;)),
10670 &quot;g&quot;: isduration(time(&quot;12:12:12.039Z&quot;)),
10671 &quot;h&quot;: isduration(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
10672 &quot;i&quot;: isduration(duration(&quot;P100Y12MT12M&quot;)),
10673 &quot;j&quot;: isduration(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
10674 &quot;k&quot;: isduration(3)
10675};
10676</pre></div></div>
10677</li>
10678<li>
10679
10680<p>The expected result is:</p>
10681
10682<div>
10683<div>
10684<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: true, &quot;f&quot;: false, &quot;g&quot;: false, &quot;h&quot;: false, &quot;i&quot;: true, &quot;j&quot;: false, &quot;k&quot;: false }
10685</pre></div></div>
10686</li>
10687</ul>
10688<p>The function has an alias <tt>isduration</tt>.</p></div>
10689<div class="section">
10690<h3><a name="is_interval"></a>is_interval</h3>
10691<ul>
10692
10693<li>
10694
10695<p>Syntax:</p>
10696
10697<div>
10698<div>
10699<pre class="source">is_interval(expr)
10700</pre></div></div>
10701</li>
10702<li>
10703
10704<p>Checks whether the given expression is evaluated to be a <tt>interval</tt> value.</p>
10705</li>
10706<li>Arguments:
10707<ul>
10708
10709<li><tt>expr</tt> : an expression (any type is allowed).</li>
10710</ul>
10711</li>
10712<li>Return Value:
10713<ul>
10714
10715<li>a <tt>boolean</tt> on whether the argument is a <tt>interval</tt> value or not,</li>
10716<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10717<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10718</ul>
10719</li>
10720<li>
10721
10722<p>Example:</p>
10723
10724<div>
10725<div>
10726<pre class="source"> {
10727 &quot;a&quot;: is_interval(true),
10728 &quot;b&quot;: is_interval(false),
10729 &quot;c&quot;: is_interval(null),
10730 &quot;d&quot;: is_interval(missing),
10731 &quot;e&quot;: is_interval(interval(datetime(&quot;2013-01-01T00:01:01.000Z&quot;), datetime(&quot;2013-05-05T13:39:01.049Z&quot;))),
10732 &quot;f&quot;: isinterval(date(&quot;2013-01-01&quot;)),
10733 &quot;g&quot;: isinterval(time(&quot;12:12:12.039Z&quot;)),
10734 &quot;h&quot;: isinterval(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
10735 &quot;i&quot;: isinterval(duration(&quot;P100Y12MT12M&quot;)),
10736 &quot;j&quot;: isinterval(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
10737 &quot;k&quot;: isinterval(3)
10738};
10739</pre></div></div>
10740</li>
10741<li>
10742
10743<p>The expected result is:</p>
10744
10745<div>
10746<div>
10747<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: true, &quot;f&quot;: false, &quot;g&quot;: false, &quot;h&quot;: false, &quot;i&quot;: false, &quot;j&quot;: true, &quot;k&quot;: false }
10748</pre></div></div>
10749</li>
10750</ul>
10751<p>The function has an alias <tt>isinterval</tt>.</p></div>
10752<div class="section">
10753<h3><a name="is_temporal"></a>is_temporal</h3>
10754<ul>
10755
10756<li>
10757
10758<p>Syntax:</p>
10759
10760<div>
10761<div>
10762<pre class="source">is_temporal(expr)
10763</pre></div></div>
10764</li>
10765<li>
10766
10767<p>Checks whether the given expression is evaluated to be a temporal value.</p>
10768</li>
10769<li>Arguments:
10770<ul>
10771
10772<li><tt>expr</tt> : an expression (any type is allowed).</li>
10773</ul>
10774</li>
10775<li>Return Value:
10776<ul>
10777
10778<li>a <tt>boolean</tt> on whether the argument is a <tt>date/datetime/time/duration/year_month_duration/day_time_duration/interval</tt> value or not,</li>
10779<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10780<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10781</ul>
10782</li>
10783<li>
10784
10785<p>Example:</p>
10786
10787<div>
10788<div>
10789<pre class="source"> {
10790 &quot;a&quot;: is_temporal(true),
10791 &quot;b&quot;: is_temporal(false),
10792 &quot;c&quot;: is_temporal(null),
10793 &quot;d&quot;: is_temporal(missing),
10794 &quot;e&quot;: is_temporal(duration(&quot;-PT20.943S&quot;)),
10795 &quot;f&quot;: istemporal(date(&quot;2013-01-01&quot;)),
10796 &quot;g&quot;: istemporal(time(&quot;12:12:12.039Z&quot;)),
10797 &quot;h&quot;: istemporal(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
10798 &quot;i&quot;: istemporal(duration(&quot;P100Y12MT12M&quot;)),
10799 &quot;j&quot;: istemporal(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
10800 &quot;k&quot;: istemporal(3)
10801};
10802</pre></div></div>
10803</li>
10804<li>
10805
10806<p>The expected result is:</p>
10807
10808<div>
10809<div>
10810<pre class="source">{ &quot;a&quot;: false, &quot;b&quot;: false, &quot;c&quot;: null, &quot;e&quot;: true, &quot;f&quot;: true, &quot;g&quot;: true, &quot;h&quot;: true, &quot;i&quot;: true, &quot;j&quot;: true, &quot;k&quot;: false }
10811</pre></div></div>
10812</li>
10813</ul>
10814<p>The function has an alias <tt>istemporal</tt>.</p></div>
10815<div class="section">
10816<h3><a name="get_type"></a>get_type</h3>
10817<ul>
10818
10819<li>
10820
10821<p>Syntax:</p>
10822
10823<div>
10824<div>
10825<pre class="source">get_type(expr)
10826</pre></div></div>
10827</li>
10828<li>
10829
10830<p>Returns a string describing the type of the given <tt>expr</tt>. This includes incomplete information types (i.e. <tt>missing</tt> and <tt>null</tt>).</p>
10831</li>
10832<li>Arguments:
10833<ul>
10834
10835<li><tt>expr</tt> : an expression (any type is allowed).</li>
10836</ul>
10837</li>
10838<li>
10839
10840<p>Example:</p>
10841
10842<div>
10843<div>
10844<pre class="source">{
10845 &quot;a&quot;: get_type(true),
10846 &quot;b&quot;: get_type(false),
10847 &quot;c&quot;: get_type(null),
10848 &quot;d&quot;: get_type(missing),
10849 &quot;e&quot;: get_type(&quot;d&quot;),
10850 &quot;f&quot;: gettype(4.0),
10851 &quot;g&quot;: gettype(5),
10852 &quot;h&quot;: gettype([&quot;1&quot;, 2]),
10853 &quot;i&quot;: gettype({&quot;a&quot;:1})
10854};
10855</pre></div></div>
10856</li>
10857<li>
10858
10859<p>The expected result is:</p>
10860
10861<div>
10862<div>
10863<pre class="source">{ &quot;a&quot;: &quot;boolean&quot;, &quot;b&quot;: &quot;boolean&quot;, &quot;c&quot;: &quot;null&quot;, &quot;d&quot;: &quot;missing&quot;, &quot;e&quot;: &quot;string&quot;, &quot;f&quot;: &quot;double&quot;, &quot;g&quot;: &quot;bigint&quot;, &quot;h&quot;: &quot;array&quot;, &quot;i&quot;: &quot;object&quot; }
10864</pre></div></div>
10865</li>
10866</ul>
10867<p>The function has an alias <tt>gettype</tt>.</p><!--
10868 ! Licensed to the Apache Software Foundation (ASF) under one
10869 ! or more contributor license agreements. See the NOTICE file
10870 ! distributed with this work for additional information
10871 ! regarding copyright ownership. The ASF licenses this file
10872 ! to you under the Apache License, Version 2.0 (the
10873 ! "License"); you may not use this file except in compliance
10874 ! with the License. You may obtain a copy of the License at
10875 !
10876 ! http://www.apache.org/licenses/LICENSE-2.0
10877 !
10878 ! Unless required by applicable law or agreed to in writing,
10879 ! software distributed under the License is distributed on an
10880 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
10881 ! KIND, either express or implied. See the License for the
10882 ! specific language governing permissions and limitations
10883 ! under the License.
10884 !-->
10885</div>
10886<div class="section">
10887<h3><a name="to_array"></a>to_array</h3>
10888<ul>
10889
10890<li>
10891
10892<p>Syntax:</p>
10893
10894<div>
10895<div>
10896<pre class="source">to_array(expr)
10897</pre></div></div>
10898</li>
10899<li>
10900
10901<p>Converts input value to an <tt>array</tt> value</p>
10902</li>
10903<li>Arguments:
10904<ul>
10905
10906<li><tt>expr</tt> : an expression</li>
10907</ul>
10908</li>
10909<li>Return Value:
10910<ul>
10911
10912<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
10913<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
10914<li>if the argument is of <tt>array</tt> type then it is returned as is</li>
10915<li>if the argument is of <tt>multiset</tt> type then it is returned as an <tt>array</tt> with elements in an undefined order</li>
10916<li>otherwise an <tt>array</tt> containing the input expression as its single item is returned</li>
10917</ul>
10918</li>
10919<li>
10920
10921<p>Example:</p>
10922
10923<div>
10924<div>
10925<pre class="source">{
10926 &quot;v1&quot;: to_array(&quot;asterix&quot;),
10927 &quot;v2&quot;: to_array([&quot;asterix&quot;]),
10928};
10929</pre></div></div>
10930</li>
10931<li>
10932
10933<p>The expected result is:</p>
10934
10935<div>
10936<div>
10937<pre class="source">{ &quot;v1&quot;: [&quot;asterix&quot;], &quot;v2&quot;: [&quot;asterix&quot;] }
10938</pre></div></div>
10939</li>
10940</ul>
10941<p>The function has an alias <tt>toarray</tt>.</p></div>
10942<div class="section">
10943<h3><a name="to_atomic_.28to_atom.29"></a>to_atomic (to_atom)</h3>
10944<ul>
10945
10946<li>
10947
10948<p>Syntax:</p>
10949
10950<div>
10951<div>
10952<pre class="source">to_atomic(expr)
10953</pre></div></div>
10954</li>
10955<li>
10956
10957<p>Converts input value to a <a href="../datamodel.html#PrimitiveTypes">primitive</a> value</p>
10958</li>
10959<li>Arguments:
10960<ul>
10961
10962<li><tt>expr</tt> : an expression</li>
10963</ul>
10964</li>
10965<li>Return Value:
10966<ul>
10967
10968<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
10969<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
10970<li>if the argument is of primitive type then it is returned as is</li>
10971<li>if the argument is of <tt>array</tt> or <tt>multiset</tt> type and has only one element then the result of invoking to_atomic() on that element is returned</li>
10972<li>if the argument is of <tt>object</tt> type and has only one field then the result of invoking to_atomic() on the value of that field is returned</li>
10973<li>otherwise <tt>null</tt> is returned</li>
10974</ul>
10975</li>
10976<li>
10977
10978<p>Example:</p>
10979
10980<div>
10981<div>
10982<pre class="source">{
10983 &quot;v1&quot;: to_atomic(&quot;asterix&quot;),
10984 &quot;v2&quot;: to_atomic([&quot;asterix&quot;]),
10985 &quot;v3&quot;: to_atomic([0, 1]),
10986 &quot;v4&quot;: to_atomic({&quot;value&quot;: &quot;asterix&quot;}),
10987 &quot;v5&quot;: to_number({&quot;x&quot;: 1, &quot;y&quot;: 2})
10988};
10989</pre></div></div>
10990</li>
10991<li>
10992
10993<p>The expected result is:</p>
10994
10995<div>
10996<div>
10997<pre class="source">{ &quot;v1&quot;: &quot;asterix&quot;, &quot;v2&quot;: &quot;asterix&quot;, &quot;v3&quot;: null, &quot;v4&quot;: &quot;asterix&quot;, &quot;v5&quot;: null }
10998</pre></div></div>
10999</li>
11000</ul>
11001<p>The function has three aliases: <tt>toatomic</tt>, <tt>to_atom</tt>, and <tt>toatom</tt>.</p></div>
11002<div class="section">
11003<h3><a name="to_boolean_.28to_bool.29"></a>to_boolean (to_bool)</h3>
11004<ul>
11005
11006<li>
11007
11008<p>Syntax:</p>
11009
11010<div>
11011<div>
11012<pre class="source">to_boolean(expr)
11013</pre></div></div>
11014</li>
11015<li>
11016
11017<p>Converts input value to a <tt>boolean</tt> value</p>
11018</li>
11019<li>Arguments:
11020<ul>
11021
11022<li><tt>expr</tt> : an expression</li>
11023</ul>
11024</li>
11025<li>Return Value:
11026<ul>
11027
11028<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
11029<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
11030<li>if the argument is of <tt>boolean</tt> type then it is returned as is</li>
11031<li>if the argument is of numeric type then <tt>false</tt> is returned if it is <tt>0</tt> or <tt>NaN</tt>, otherwise <tt>true</tt></li>
11032<li>if the argument is of <tt>string</tt> type then <tt>false</tt> is returned if it&#x2019;s empty, otherwise <tt>true</tt></li>
11033<li>if the argument is of <tt>array</tt> or <tt>multiset</tt> type then <tt>false</tt> is returned if it&#x2019;s size is <tt>0</tt>, otherwise <tt>true</tt></li>
11034<li>if the argument is of <tt>object</tt> type then <tt>false</tt> is returned if it has no fields, otherwise <tt>true</tt></li>
11035<li>type error is raised for all other input types</li>
11036</ul>
11037</li>
11038<li>
11039
11040<p>Example:</p>
11041
11042<div>
11043<div>
11044<pre class="source">{
11045 &quot;v1&quot;: to_boolean(0),
11046 &quot;v2&quot;: to_boolean(1),
11047 &quot;v3&quot;: to_boolean(&quot;&quot;),
11048 &quot;v4&quot;: to_boolean(&quot;asterix&quot;)
11049};
11050</pre></div></div>
11051</li>
11052<li>
11053
11054<p>The expected result is:</p>
11055
11056<div>
11057<div>
11058<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: true, &quot;v3&quot;: false, &quot;v4&quot;: true }
11059</pre></div></div>
11060</li>
11061</ul>
11062<p>The function has three aliases: <tt>toboolean</tt>, <tt>to_bool</tt>, and <tt>tobool</tt>.</p></div>
11063<div class="section">
11064<h3><a name="to_bigint"></a>to_bigint</h3>
11065<ul>
11066
11067<li>
11068
11069<p>Syntax:</p>
11070
11071<div>
11072<div>
11073<pre class="source">to_bigint(expr)
11074</pre></div></div>
11075</li>
11076<li>
11077
11078<p>Converts input value to an integer value</p>
11079</li>
11080<li>Arguments:
11081<ul>
11082
11083<li><tt>expr</tt> : an expression</li>
11084</ul>
11085</li>
11086<li>Return Value:
11087<ul>
11088
11089<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
11090<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
11091<li>if the argument is of <tt>boolean</tt> type then <tt>1</tt> is returned if it is <tt>true</tt>, <tt>0</tt> if it is <tt>false</tt></li>
11092<li>if the argument is of numeric integer type then it is returned as the same value of <tt>bigint</tt> type</li>
11093<li>if the argument is of numeric <tt>float</tt>/<tt>double</tt> type then it is converted to <tt>bigint</tt> type</li>
11094<li>if the argument is of <tt>string</tt> type and can be parsed as integer then that integer value is returned, otherwise <tt>null</tt> is returned</li>
11095<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
11096<li>type error is raised for all other input types</li>
11097</ul>
11098</li>
11099<li>
11100
11101<p>Example:</p>
11102
11103<div>
11104<div>
11105<pre class="source">{
11106 &quot;v1&quot;: to_bigint(false),
11107 &quot;v2&quot;: to_bigint(true),
11108 &quot;v3&quot;: to_bigint(10),
11109 &quot;v4&quot;: to_bigint(float(&quot;1e100&quot;)),
11110 &quot;v5&quot;: to_bigint(double(&quot;1e1000&quot;)),
11111 &quot;v6&quot;: to_bigint(&quot;20&quot;)
11112};
11113</pre></div></div>
11114</li>
11115<li>
11116
11117<p>The expected result is:</p>
11118
11119<div>
11120<div>
11121<pre class="source">{ &quot;v1&quot;: 0, &quot;v2&quot;: 1, &quot;v3&quot;: 10, &quot;v4&quot;: 9223372036854775807, &quot;v5&quot;: 9223372036854775807, &quot;v6&quot;: 20 }
11122</pre></div></div>
11123</li>
11124</ul>
11125<p>The function has an alias <tt>tobigint</tt>.</p></div>
11126<div class="section">
11127<h3><a name="to_double"></a>to_double</h3>
11128<ul>
11129
11130<li>
11131
11132<p>Syntax:</p>
11133
11134<div>
11135<div>
11136<pre class="source">to_double(expr)
11137</pre></div></div>
11138</li>
11139<li>
11140
11141<p>Converts input value to a <tt>double</tt> value</p>
11142</li>
11143<li>Arguments:
11144<ul>
11145
11146<li><tt>expr</tt> : an expression</li>
11147</ul>
11148</li>
11149<li>Return Value:
11150<ul>
11151
11152<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
11153<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
11154<li>if the argument is of <tt>boolean</tt> type then <tt>1.0</tt> is returned if it is <tt>true</tt>, <tt>0.0</tt> if it is <tt>false</tt></li>
11155<li>if the argument is of numeric type then it is returned as the value of <tt>double</tt> type</li>
11156<li>if the argument is of <tt>string</tt> type and can be parsed as <tt>double</tt> then that <tt>double</tt> value is returned, otherwise <tt>null</tt> is returned</li>
11157<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
11158<li>type error is raised for all other input types</li>
11159</ul>
11160</li>
11161<li>
11162
11163<p>Example:</p>
11164
11165<div>
11166<div>
11167<pre class="source">{
11168 &quot;v1&quot;: to_double(false),
11169 &quot;v2&quot;: to_double(true),
11170 &quot;v3&quot;: to_double(10),
11171 &quot;v4&quot;: to_double(11.5),
11172 &quot;v5&quot;: to_double(&quot;12.5&quot;)
11173};
11174</pre></div></div>
11175</li>
11176<li>
11177
11178<p>The expected result is:</p>
11179
11180<div>
11181<div>
11182<pre class="source">{ &quot;v1&quot;: 0.0, &quot;v2&quot;: 1.0, &quot;v3&quot;: 10.0, &quot;v4&quot;: 11.5, &quot;v5&quot;: 12.5 }
11183</pre></div></div>
11184</li>
11185</ul>
11186<p>The function has an alias <tt>todouble</tt>.</p></div>
11187<div class="section">
11188<h3><a name="to_number_.28to_num.29"></a>to_number (to_num)</h3>
11189<ul>
11190
11191<li>
11192
11193<p>Syntax:</p>
11194
11195<div>
11196<div>
11197<pre class="source">to_number(expr)
11198</pre></div></div>
11199</li>
11200<li>
11201
11202<p>Converts input value to a numeric value</p>
11203</li>
11204<li>Arguments:
11205<ul>
11206
11207<li><tt>expr</tt> : an expression</li>
11208</ul>
11209</li>
11210<li>Return Value:
11211<ul>
11212
11213<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
11214<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
11215<li>if the argument is of numeric type then it is returned as is</li>
11216<li>if the argument is of <tt>boolean</tt> type then <tt>1</tt> is returned if it is <tt>true</tt>, <tt>0</tt> if it is <tt>false</tt></li>
11217<li>if the argument is of <tt>string</tt> type and can be parsed as <tt>bigint</tt> then that <tt>bigint</tt> value is returned, otherwise if it can be parsed as <tt>double</tt> then that <tt>double</tt> value is returned, otherwise <tt>null</tt> is returned</li>
11218<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
11219<li>type error is raised for all other input types</li>
11220</ul>
11221</li>
11222<li>
11223
11224<p>Example:</p>
11225
11226<div>
11227<div>
11228<pre class="source">{
11229 &quot;v1&quot;: to_number(false),
11230 &quot;v2&quot;: to_number(true),
11231 &quot;v3&quot;: to_number(10),
11232 &quot;v4&quot;: to_number(11.5),
11233 &quot;v5&quot;: to_number(&quot;12.5&quot;)
11234};
11235</pre></div></div>
11236</li>
11237<li>
11238
11239<p>The expected result is:</p>
11240
11241<div>
11242<div>
11243<pre class="source">{ &quot;v1&quot;: 0, &quot;v2&quot;: 1, &quot;v3&quot;: 10, &quot;v4&quot;: 11.5, &quot;v5&quot;: 12.5 }
11244</pre></div></div>
11245</li>
11246</ul>
11247<p>The function has three aliases: <tt>tonumber</tt>, <tt>to_num</tt>, and <tt>tonum</tt>.</p></div>
11248<div class="section">
11249<h3><a name="to_object_.28to_obj.29"></a>to_object (to_obj)</h3>
11250<ul>
11251
11252<li>
11253
11254<p>Syntax:</p>
11255
11256<div>
11257<div>
11258<pre class="source">to_object(expr)
11259</pre></div></div>
11260</li>
11261<li>
11262
11263<p>Converts input value to an <tt>object</tt> value</p>
11264</li>
11265<li>Arguments:
11266<ul>
11267
11268<li><tt>expr</tt> : an expression</li>
11269</ul>
11270</li>
11271<li>Return Value:
11272<ul>
11273
11274<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
11275<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
11276<li>if the argument is of <tt>object</tt> type then it is returned as is</li>
11277<li>otherwise an empty <tt>object</tt> is returned</li>
11278</ul>
11279</li>
11280<li>
11281
11282<p>Example:</p>
11283
11284<div>
11285<div>
11286<pre class="source">{
11287 &quot;v1&quot;: to_object({&quot;value&quot;: &quot;asterix&quot;}),
11288 &quot;v2&quot;: to_object(&quot;asterix&quot;)
11289};
11290</pre></div></div>
11291</li>
11292<li>
11293
11294<p>The expected result is:</p>
11295
11296<div>
11297<div>
11298<pre class="source">{ &quot;v1&quot;: {&quot;value&quot;: &quot;asterix&quot;}, &quot;v2&quot;: {} }
11299</pre></div></div>
11300</li>
11301</ul>
11302<p>The function has three aliases: <tt>toobject</tt>, <tt>to_obj</tt>, and <tt>toobj</tt>.</p></div>
11303<div class="section">
11304<h3><a name="to_string_.28to_str.29"></a>to_string (to_str)</h3>
11305<ul>
11306
11307<li>
11308
11309<p>Syntax:</p>
11310
11311<div>
11312<div>
11313<pre class="source">to_string(expr)
11314</pre></div></div>
11315</li>
11316<li>
11317
11318<p>Converts input value to a string value</p>
11319</li>
11320<li>Arguments:
11321<ul>
11322
11323<li><tt>expr</tt> : an expression</li>
11324</ul>
11325</li>
11326<li>Return Value:
11327<ul>
11328
11329<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
11330<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
11331<li>if the argument is of <tt>boolean</tt> type then <tt>&quot;true&quot;</tt> is returned if it is <tt>true</tt>, <tt>&quot;false&quot;</tt> if it is <tt>false</tt></li>
11332<li>if the argument is of numeric type then its string representation is returned</li>
11333<li>if the argument is of <tt>string</tt> type then it is returned as is</li>
11334<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
11335<li>type error is raised for all other input types</li>
11336</ul>
11337</li>
11338<li>
11339
11340<p>Example:</p>
11341
11342<div>
11343<div>
11344<pre class="source">{
11345 &quot;v1&quot;: to_string(false),
11346 &quot;v2&quot;: to_string(true),
11347 &quot;v3&quot;: to_string(10),
11348 &quot;v4&quot;: to_string(11.5),
11349 &quot;v5&quot;: to_string(&quot;asterix&quot;)
11350};
11351</pre></div></div>
11352</li>
11353<li>
11354
11355<p>The expected result is:</p>
11356
11357<div>
11358<div>
11359<pre class="source">{ &quot;v1&quot;: &quot;false&quot;, &quot;v2&quot;: &quot;true&quot;, &quot;v3&quot;: &quot;10&quot;, &quot;v4&quot;: &quot;11.5&quot;, &quot;v5&quot;: &quot;asterix&quot; }
11360</pre></div></div>
11361</li>
11362</ul>
11363<p>The function has three aliases: <tt>tostring</tt>, <tt>to_str</tt>, and <tt>tostr</tt>.</p><!--
11364 ! Licensed to the Apache Software Foundation (ASF) under one
11365 ! or more contributor license agreements. See the NOTICE file
11366 ! distributed with this work for additional information
11367 ! regarding copyright ownership. The ASF licenses this file
11368 ! to you under the Apache License, Version 2.0 (the
11369 ! "License"); you may not use this file except in compliance
11370 ! with the License. You may obtain a copy of the License at
11371 !
11372 ! http://www.apache.org/licenses/LICENSE-2.0
11373 !
11374 ! Unless required by applicable law or agreed to in writing,
11375 ! software distributed under the License is distributed on an
11376 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11377 ! KIND, either express or implied. See the License for the
11378 ! specific language governing permissions and limitations
11379 ! under the License.
11380 !-->
11381</div></div>
11382<div class="section">
11383<h2><a name="Conditional_Functions"></a><a name="ConditionalFunctions" id="ConditionalFunctions">Conditional Functions</a></h2>
11384<div class="section">
11385<h3><a name="if_null_.28ifnull.29"></a>if_null (ifnull)</h3>
11386<ul>
11387
11388<li>
11389
11390<p>Syntax:</p>
11391
11392<div>
11393<div>
11394<pre class="source">if_null(expression1, expression2, ... expressionN)
11395</pre></div></div>
11396</li>
11397<li>
11398
11399<p>Finds first argument which value is not <tt>null</tt> and returns that value</p>
11400</li>
11401<li>Arguments:
11402<ul>
11403
11404<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11405</ul>
11406</li>
11407<li>Return Value:
11408<ul>
11409
11410<li>a <tt>null</tt> if all arguments evaluate to <tt>null</tt> or no arguments specified</li>
11411<li>a value of the first non-<tt>null</tt> argument otherwise</li>
11412</ul>
11413</li>
11414<li>
11415
11416<p>Example:</p>
11417
11418<div>
11419<div>
11420<pre class="source">{
11421 &quot;a&quot;: if_null(),
11422 &quot;b&quot;: if_null(null),
11423 &quot;c&quot;: if_null(null, &quot;asterixdb&quot;),
11424 &quot;d&quot;: is_missing(if_null(missing))
11425};
11426</pre></div></div>
11427</li>
11428<li>
11429
11430<p>The expected result is:</p>
11431
11432<div>
11433<div>
11434<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot;, &quot;d&quot;: true }
11435</pre></div></div>
11436</li>
11437</ul>
11438<p>The function has an alias <tt>ifnull</tt>.</p></div>
11439<div class="section">
11440<h3><a name="if_missing_.28ifmissing.29"></a>if_missing (ifmissing)</h3>
11441<ul>
11442
11443<li>
11444
11445<p>Syntax:</p>
11446
11447<div>
11448<div>
11449<pre class="source">if_missing(expression1, expression2, ... expressionN)
11450</pre></div></div>
11451</li>
11452<li>
11453
11454<p>Finds first argument which value is not <tt>missing</tt> and returns that value</p>
11455</li>
11456<li>Arguments:
11457<ul>
11458
11459<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11460</ul>
11461</li>
11462<li>Return Value:
11463<ul>
11464
11465<li>a <tt>null</tt> if all arguments evaluate to <tt>missing</tt> or no arguments specified</li>
11466<li>a value of the first non-<tt>missing</tt> argument otherwise</li>
11467</ul>
11468</li>
11469<li>
11470
11471<p>Example:</p>
11472
11473<div>
11474<div>
11475<pre class="source">{
11476 &quot;a&quot;: if_missing(),
11477 &quot;b&quot;: if_missing(missing),
11478 &quot;c&quot;: if_missing(missing, &quot;asterixdb&quot;),
11479 &quot;d&quot;: if_missing(null, &quot;asterixdb&quot;)
11480};
11481</pre></div></div>
11482</li>
11483<li>
11484
11485<p>The expected result is:</p>
11486
11487<div>
11488<div>
11489<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot;, &quot;d&quot;: null }
11490</pre></div></div>
11491</li>
11492</ul>
11493<p>The function has an alias <tt>ifmissing</tt>.</p></div>
11494<div class="section">
11495<h3><a name="if_missing_or_null_.28ifmissingornull.2C_coalesce.29"></a>if_missing_or_null (ifmissingornull, coalesce)</h3>
11496<ul>
11497
11498<li>
11499
11500<p>Syntax:</p>
11501
11502<div>
11503<div>
11504<pre class="source">if_missing_or_null(expression1, expression2, ... expressionN)
11505</pre></div></div>
11506</li>
11507<li>
11508
11509<p>Finds first argument which value is not <tt>null</tt> or <tt>missing</tt> and returns that value</p>
11510</li>
11511<li>Arguments:
11512<ul>
11513
11514<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11515</ul>
11516</li>
11517<li>Return Value:
11518<ul>
11519
11520<li>a <tt>null</tt> if all arguments evaluate to either <tt>null</tt> or <tt>missing</tt>, or no arguments specified</li>
11521<li>a value of the first non-<tt>null</tt>, non-<tt>missing</tt> argument otherwise</li>
11522</ul>
11523</li>
11524<li>
11525
11526<p>Example:</p>
11527
11528<div>
11529<div>
11530<pre class="source">{
11531 &quot;a&quot;: if_missing_or_null(),
11532 &quot;b&quot;: if_missing_or_null(null, missing),
11533 &quot;c&quot;: if_missing_or_null(null, missing, &quot;asterixdb&quot;)
11534};
11535</pre></div></div>
11536</li>
11537<li>
11538
11539<p>The expected result is:</p>
11540
11541<div>
11542<div>
11543<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot; }
11544</pre></div></div>
11545</li>
11546</ul>
11547<p>The function has two aliases: <tt>ifmissingornull</tt> and <tt>coalesce</tt>.</p></div>
11548<div class="section">
11549<h3><a name="if_inf_.28ifinf.29"></a>if_inf (ifinf)</h3>
11550<ul>
11551
11552<li>
11553
11554<p>Syntax:</p>
11555
11556<div>
11557<div>
11558<pre class="source">if_inf(expression1, expression2, ... expressionN)
11559</pre></div></div>
11560</li>
11561<li>
11562
11563<p>Finds first argument which is a non-infinite (<tt>INF</tt> or<tt>-INF</tt>) number</p>
11564</li>
11565<li>Arguments:
11566<ul>
11567
11568<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11569</ul>
11570</li>
11571<li>Return Value:
11572<ul>
11573
11574<li>a <tt>missing</tt> if <tt>missing</tt> argument was encountered before the first non-infinite number argument</li>
11575<li>a <tt>null</tt> if <tt>null</tt> argument or any other non-number argument was encountered before the first non-infinite number argument</li>
11576<li>the first non-infinite number argument otherwise</li>
11577</ul>
11578</li>
11579<li>
11580
11581<p>Example:</p>
11582
11583<div>
11584<div>
11585<pre class="source">{
11586 &quot;a&quot;: is_null(if_inf(null)),
11587 &quot;b&quot;: is_missing(if_inf(missing)),
11588 &quot;c&quot;: is_null(if_inf(double(&quot;INF&quot;))),
11589 &quot;d&quot;: if_inf(1, null, missing) ],
11590 &quot;e&quot;: is_null(if_inf(null, missing, 1)) ],
11591 &quot;f&quot;: is_missing(if_inf(missing, null, 1)) ],
11592 &quot;g&quot;: if_inf(float(&quot;INF&quot;), 1) ],
11593 &quot;h&quot;: to_string(if_inf(float(&quot;INF&quot;), double(&quot;NaN&quot;), 1)) ]
11594};
11595</pre></div></div>
11596</li>
11597<li>
11598
11599<p>The expected result is:</p>
11600
11601<div>
11602<div>
11603<pre class="source">{ &quot;a&quot;: true, &quot;b&quot;: true, &quot;c&quot;: true, &quot;d&quot;: 1, &quot;e&quot;: true, &quot;f&quot;: true, &quot;g&quot;: 1, &quot;h&quot;: &quot;NaN&quot; }
11604</pre></div></div>
11605</li>
11606</ul>
11607<p>The function has an alias <tt>ifinf</tt>.</p></div>
11608<div class="section">
11609<h3><a name="if_nan_.28ifnan.29"></a>if_nan (ifnan)</h3>
11610<ul>
11611
11612<li>
11613
11614<p>Syntax:</p>
11615
11616<div>
11617<div>
11618<pre class="source">if_nan(expression1, expression2, ... expressionN)
11619</pre></div></div>
11620</li>
11621<li>
11622
11623<p>Finds first argument which is a non-<tt>NaN</tt> number</p>
11624</li>
11625<li>Arguments:
11626<ul>
11627
11628<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11629</ul>
11630</li>
11631<li>Return Value:
11632<ul>
11633
11634<li>a <tt>missing</tt> if <tt>missing</tt> argument was encountered before the first non-<tt>NaN</tt> number argument</li>
11635<li>a <tt>null</tt> if <tt>null</tt> argument or any other non-number argument was encountered before the first non-<tt>NaN</tt> number argument</li>
11636<li>the first non-<tt>NaN</tt> number argument otherwise</li>
11637</ul>
11638</li>
11639<li>
11640
11641<p>Example:</p>
11642
11643<div>
11644<div>
11645<pre class="source">{
11646 &quot;a&quot;: is_null(if_nan(null)),
11647 &quot;b&quot;: is_missing(if_nan(missing)),
11648 &quot;c&quot;: is_null(if_nan(double(&quot;NaN&quot;))),
11649 &quot;d&quot;: if_nan(1, null, missing) ],
11650 &quot;e&quot;: is_null(if_nan(null, missing, 1)) ],
11651 &quot;f&quot;: is_missing(if_nan(missing, null, 1)) ],
11652 &quot;g&quot;: if_nan(float(&quot;NaN&quot;), 1) ],
11653 &quot;h&quot;: to_string(if_nan(float(&quot;NaN&quot;), double(&quot;INF&quot;), 1)) ]
11654};
11655</pre></div></div>
11656</li>
11657<li>
11658
11659<p>The expected result is:</p>
11660
11661<div>
11662<div>
11663<pre class="source">{ &quot;a&quot;: true, &quot;b&quot;: true, &quot;c&quot;: true, &quot;d&quot;: 1, &quot;e&quot;: true, &quot;f&quot;: true, &quot;g&quot;: 1, &quot;h&quot;: &quot;INF&quot; }
11664</pre></div></div>
11665</li>
11666</ul>
11667<p>The function has an alias <tt>ifnan</tt>.</p></div>
11668<div class="section">
11669<h3><a name="if_nan_or_inf_.28ifnanorinf.29"></a>if_nan_or_inf (ifnanorinf)</h3>
11670<ul>
11671
11672<li>
11673
11674<p>Syntax:</p>
11675
11676<div>
11677<div>
11678<pre class="source">if_nan_or_inf(expression1, expression2, ... expressionN)
11679</pre></div></div>
11680</li>
11681<li>
11682
11683<p>Finds first argument which is a non-infinite (<tt>INF</tt> or<tt>-INF</tt>) and non-<tt>NaN</tt> number</p>
11684</li>
11685<li>Arguments:
11686<ul>
11687
11688<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11689</ul>
11690</li>
11691<li>Return Value:
11692<ul>
11693
11694<li>a <tt>missing</tt> if <tt>missing</tt> argument was encountered before the first non-infinite and non-<tt>NaN</tt> number argument</li>
11695<li>a <tt>null</tt> if <tt>null</tt> argument or any other non-number argument was encountered before the first non-infinite and non-<tt>NaN</tt> number argument</li>
11696<li>the first non-infinite and non-<tt>NaN</tt> number argument otherwise</li>
11697</ul>
11698</li>
11699<li>
11700
11701<p>Example:</p>
11702
11703<div>
11704<div>
11705<pre class="source">{
11706 &quot;a&quot;: is_null(if_nan_or_inf(null)),
11707 &quot;b&quot;: is_missing(if_nan_or_inf(missing)),
11708 &quot;c&quot;: is_null(if_nan_or_inf(double(&quot;NaN&quot;), double(&quot;INF&quot;))),
11709 &quot;d&quot;: if_nan_or_inf(1, null, missing) ],
11710 &quot;e&quot;: is_null(if_nan_or_inf(null, missing, 1)) ],
11711 &quot;f&quot;: is_missing(if_nan_or_inf(missing, null, 1)) ],
11712 &quot;g&quot;: if_nan_or_inf(float(&quot;NaN&quot;), float(&quot;INF&quot;), 1) ],
11713};
11714</pre></div></div>
11715</li>
11716<li>
11717
11718<p>The expected result is:</p>
11719
11720<div>
11721<div>
11722<pre class="source">{ &quot;a&quot;: true, &quot;b&quot;: true, &quot;c&quot;: true, &quot;d&quot;: 1, &quot;e&quot;: true, &quot;f&quot;: true, &quot;g&quot;: 1 }
11723</pre></div></div>
11724</li>
11725</ul>
11726<p>The function has an alias <tt>ifnanorinf</tt>.</p></div>
11727<div class="section">
11728<h3><a name="null_if_.28nullif.29"></a>null_if (nullif)</h3>
11729<ul>
11730
11731<li>
11732
11733<p>Syntax:</p>
11734
11735<div>
11736<div>
11737<pre class="source">null_if(expression1, expression2)
11738</pre></div></div>
11739</li>
11740<li>
11741
11742<p>Compares two arguments and returns <tt>null</tt> if they are equal, otherwise returns the first argument.</p>
11743</li>
11744<li>Arguments:
11745<ul>
11746
11747<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11748</ul>
11749</li>
11750<li>Return Value:
11751<ul>
11752
11753<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
11754<li><tt>null</tt> if
11755<ul>
11756
11757<li>any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value, or</li>
11758<li><tt>argument1</tt> = <tt>argument2</tt></li>
11759</ul>
11760</li>
11761<li>a value of the first argument otherwise</li>
11762</ul>
11763</li>
11764<li>
11765
11766<p>Example:</p>
11767
11768<div>
11769<div>
11770<pre class="source">{
11771 &quot;a&quot;: null_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;),
11772 &quot;b&quot;: null_if(1, 2)
11773};
11774</pre></div></div>
11775</li>
11776<li>
11777
11778<p>The expected result is:</p>
11779
11780<div>
11781<div>
11782<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: 1 }
11783</pre></div></div>
11784</li>
11785</ul>
11786<p>The function has an alias <tt>nullif</tt>.</p></div>
11787<div class="section">
11788<h3><a name="missing_if_.28missingif.29"></a>missing_if (missingif)</h3>
11789<ul>
11790
11791<li>
11792
11793<p>Syntax:</p>
11794
11795<div>
11796<div>
11797<pre class="source">missing_if(expression1, expression2)
11798</pre></div></div>
11799</li>
11800<li>
11801
11802<p>Compares two arguments and returns <tt>missing</tt> if they are equal, otherwise returns the first argument.</p>
11803</li>
11804<li>Arguments:
11805<ul>
11806
11807<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11808</ul>
11809</li>
11810<li>Return Value:
11811<ul>
11812
11813<li><tt>missing</tt> if
11814<ul>
11815
11816<li>any argument is a <tt>missing</tt> value, or</li>
11817<li>no argument is a <tt>null</tt> value and <tt>argument1</tt> = <tt>argument2</tt></li>
11818</ul>
11819</li>
11820<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
11821<li>a value of the first argument otherwise</li>
11822</ul>
11823</li>
11824<li>
11825
11826<p>Example:</p>
11827
11828<div>
11829<div>
11830<pre class="source">{
11831 &quot;a&quot;: missing_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)
11832 &quot;b&quot;: missing_if(1, 2),
11833};
11834</pre></div></div>
11835</li>
11836<li>
11837
11838<p>The expected result is:</p>
11839
11840<div>
11841<div>
11842<pre class="source">{ &quot;b&quot;: 1 }
11843</pre></div></div>
11844</li>
11845</ul>
11846<p>The function has an alias <tt>missingif</tt>.</p></div>
11847<div class="section">
11848<h3><a name="nan_if_.28nanif.29"></a>nan_if (nanif)</h3>
11849<ul>
11850
11851<li>
11852
11853<p>Syntax:</p>
11854
11855<div>
11856<div>
11857<pre class="source">nan_if(expression1, expression2)
11858</pre></div></div>
11859</li>
11860<li>
11861
11862<p>Compares two arguments and returns <tt>NaN</tt> value if they are equal, otherwise returns the first argument.</p>
11863</li>
11864<li>Arguments:
11865<ul>
11866
11867<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11868</ul>
11869</li>
11870<li>Return Value:
11871<ul>
11872
11873<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
11874<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
11875<li><tt>NaN</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
11876<li>a value of the first argument otherwise</li>
11877</ul>
11878</li>
11879<li>
11880
11881<p>Example:</p>
11882
11883<div>
11884<div>
11885<pre class="source">{
11886 &quot;a&quot;: to_string(nan_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
11887 &quot;b&quot;: nan_if(1, 2)
11888};
11889</pre></div></div>
11890</li>
11891<li>
11892
11893<p>The expected result is:</p>
11894
11895<div>
11896<div>
11897<pre class="source">{ &quot;a&quot;: &quot;NaN&quot;, &quot;b&quot;: 1 }
11898</pre></div></div>
11899</li>
11900</ul>
11901<p>The function has an alias <tt>nanif</tt>.</p></div>
11902<div class="section">
11903<h3><a name="posinf_if_.28posinfif.29"></a>posinf_if (posinfif)</h3>
11904<ul>
11905
11906<li>
11907
11908<p>Syntax:</p>
11909
11910<div>
11911<div>
11912<pre class="source">posinf_if(expression1, expression2)
11913</pre></div></div>
11914</li>
11915<li>
11916
11917<p>Compares two arguments and returns <tt>+INF</tt> value if they are equal, otherwise returns the first argument.</p>
11918</li>
11919<li>Arguments:
11920<ul>
11921
11922<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11923</ul>
11924</li>
11925<li>Return Value:
11926<ul>
11927
11928<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
11929<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
11930<li><tt>+INF</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
11931<li>a value of the first argument otherwise</li>
11932</ul>
11933</li>
11934<li>
11935
11936<p>Example:</p>
11937
11938<div>
11939<div>
11940<pre class="source">{
11941 &quot;a&quot;: to_string(posinf_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
11942 &quot;b&quot;: posinf_if(1, 2)
11943};
11944</pre></div></div>
11945</li>
11946<li>
11947
11948<p>The expected result is:</p>
11949
11950<div>
11951<div>
11952<pre class="source">{ &quot;a&quot;: &quot;+INF&quot;, &quot;b&quot;: 1 }
11953</pre></div></div>
11954</li>
11955</ul>
11956<p>The function has an alias <tt>posinfif</tt>.</p></div>
11957<div class="section">
11958<h3><a name="neginf_if_.28neginfif.29"></a>neginf_if (neginfif)</h3>
11959<ul>
11960
11961<li>
11962
11963<p>Syntax:</p>
11964
11965<div>
11966<div>
11967<pre class="source">neginf_if(expression1, expression2)
11968</pre></div></div>
11969</li>
11970<li>
11971
11972<p>Compares two arguments and returns <tt>-INF</tt> value if they are equal, otherwise returns the first argument.</p>
11973</li>
11974<li>Arguments:
11975<ul>
11976
11977<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11978</ul>
11979</li>
11980<li>Return Value:
11981<ul>
11982
11983<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
11984<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
11985<li><tt>-INF</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
11986<li>a value of the first argument otherwise</li>
11987</ul>
11988</li>
11989<li>
11990
11991<p>Example:</p>
11992
11993<div>
11994<div>
11995<pre class="source">{
11996 &quot;a&quot;: to_string(neginf_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
11997 &quot;b&quot;: neginf_if(1, 2)
11998};
11999</pre></div></div>
12000</li>
12001<li>
12002
12003<p>The expected result is:</p>
12004
12005<div>
12006<div>
12007<pre class="source">{ &quot;a&quot;: &quot;-INF&quot;, &quot;b&quot;: 1 }
12008</pre></div></div>
12009</li>
12010</ul>
12011<p>The function has an alias <tt>neginfif</tt>.</p><!--
12012 ! Licensed to the Apache Software Foundation (ASF) under one
12013 ! or more contributor license agreements. See the NOTICE file
12014 ! distributed with this work for additional information
12015 ! regarding copyright ownership. The ASF licenses this file
12016 ! to you under the Apache License, Version 2.0 (the
12017 ! "License"); you may not use this file except in compliance
12018 ! with the License. You may obtain a copy of the License at
12019 !
12020 ! http://www.apache.org/licenses/LICENSE-2.0
12021 !
12022 ! Unless required by applicable law or agreed to in writing,
12023 ! software distributed under the License is distributed on an
12024 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
12025 ! KIND, either express or implied. See the License for the
12026 ! specific language governing permissions and limitations
12027 ! under the License.
12028 !-->
12029</div></div>
12030<div class="section">
12031<h2><a name="Miscellaneous_Functions"></a><a name="MiscFunctions" id="MiscFunctions">Miscellaneous Functions</a></h2>
12032<div class="section">
12033<h3><a name="uuid"></a>uuid</h3>
12034<ul>
12035
12036<li>
12037
12038<p>Syntax:</p>
12039
12040<div>
12041<div>
12042<pre class="source">uuid()
12043</pre></div></div>
12044</li>
12045<li>
12046
12047<p>Generates a <tt>uuid</tt>.</p>
12048</li>
12049<li>Arguments:
12050<ul>
12051
12052<li>none</li>
12053</ul>
12054</li>
12055<li>Return Value:
12056<ul>
12057
12058<li>a generated, random <tt>uuid</tt>.</li>
12059</ul>
12060</li>
12061</ul></div>
12062<div class="section">
12063<h3><a name="len"></a>len</h3>
12064<ul>
12065
12066<li>
12067
12068<p>Syntax:</p>
12069<p>len(array)</p>
12070</li>
12071<li>
12072
12073<p>Returns the length of the array array.</p>
12074</li>
12075<li>Arguments:
12076<ul>
12077
12078<li><tt>array</tt> : an <tt>array</tt>, <tt>multiset</tt>, <tt>null</tt>, or <tt>missing</tt>, represents the collection that needs to be checked.</li>
12079</ul>
12080</li>
12081<li>Return Value:
12082<ul>
12083
12084<li>an <tt>integer</tt> that represents the length of input array or the size of the input multiset,</li>
12085<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
12086<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
12087</ul>
12088</li>
12089<li>
12090
12091<p>Example:</p>
12092
12093<div>
12094<div>
12095<pre class="source">len([&quot;Hello&quot;, &quot;World&quot;])
12096</pre></div></div>
12097</li>
12098<li>
12099
12100<p>The expected result is:</p>
12101
12102<div>
12103<div>
12104<pre class="source">2
12105</pre></div></div>
12106</li>
12107</ul></div>
12108<div class="section">
12109<h3><a name="not"></a>not</h3>
12110<ul>
12111
12112<li>
12113
12114<p>Syntax:</p>
12115
12116<div>
12117<div>
12118<pre class="source">not(expr)
12119</pre></div></div>
12120</li>
12121<li>
12122
12123<p>Inverts a <tt>boolean</tt> value</p>
12124</li>
12125<li>Arguments:
12126<ul>
12127
12128<li><tt>expr</tt> : an expression</li>
12129</ul>
12130</li>
12131<li>Return Value:
12132<ul>
12133
12134<li>a <tt>boolean</tt>, the inverse of <tt>expr</tt>,</li>
12135<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
12136<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
12137<li>other non-boolean argument value will cause a type error.</li>
12138</ul>
12139</li>
12140<li>Example:
12141
12142<div>
12143<div>
12144<pre class="source">{ &quot;v1&quot;: `not`(true), &quot;v2&quot;: `not`(false), &quot;v3&quot;: `not`(null), &quot;v4&quot;: `not`(missing) };
12145</pre></div></div>
12146</li>
12147<li>
12148
12149<p>The expected result is:</p>
12150
12151<div>
12152<div>
12153<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: true, &quot;v3&quot;: null }
12154</pre></div></div>
12155</li>
12156</ul></div>
12157<div class="section">
12158<h3><a name="random"></a>random</h3>
12159<ul>
12160
12161<li>
12162
12163<p>Syntax:</p>
12164
12165<div>
12166<div>
12167<pre class="source">random( [seed_value] )
12168</pre></div></div>
12169</li>
12170<li>
12171
12172<p>Returns a random number, accepting an optional seed value</p>
12173</li>
12174<li>Arguments:
12175<ul>
12176
12177<li><tt>seed_value</tt>: an optional <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt>/<tt>float</tt>/<tt>double</tt> value representing the seed number.</li>
12178</ul>
12179</li>
12180<li>Return Value:
12181<ul>
12182
12183<li>A random number of type <tt>double</tt> between 0 and 1,</li>
12184<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
12185<li><tt>null</tt> if the argument is a <tt>null</tt> value or a non-numeric value.</li>
12186</ul>
12187</li>
12188<li>
12189
12190<p>Example:</p>
12191
12192<div>
12193<div>
12194<pre class="source">{
12195 &quot;v1&quot;: random(),
12196 &quot;v2&quot;: random(unix_time_from_datetime_in_ms(current_datetime()))
12197};
12198</pre></div></div>
12199</li>
12200</ul></div>
12201<div class="section">
12202<h3><a name="range"></a>range</h3>
12203<ul>
12204
12205<li>
12206
12207<p>Syntax:</p>
12208
12209<div>
12210<div>
12211<pre class="source">range(start_numeric_value, end_numeric_value)
12212</pre></div></div>
12213</li>
12214<li>
12215
12216<p>Generates a series of <tt>bigint</tt> values based start the <tt>start_numeric_value</tt> until the <tt>end_numeric_value</tt>.</p>
12217</li>
12218<li>Arguments:</li>
12219<li><tt>start_numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value representing the start value.</li>
12220<li><tt>end_numeric_value</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value representing the max final value.</li>
12221<li>Return Value:
12222<ul>
12223
12224<li>an array that starts with the integer value of <tt>start_numeric_value</tt> and ends with the integer value of <tt>end_numeric_value</tt>, where the value of each entry in the array is the integer successor of the value in the preceding entry.</li>
12225</ul>
12226</li>
12227<li>Example:
12228
12229<div>
12230<div>
12231<pre class="source">range(0, 3);
12232</pre></div></div>
12233</li>
12234<li>
12235
12236<p>The expected result is:</p>
12237
12238<div>
12239<div>
12240<pre class="source">[ 0, 1, 2, 3 ]
12241</pre></div></div>
12242</li>
12243</ul></div>
12244<div class="section">
12245<h3><a name="switch_case"></a>switch_case</h3>
12246<ul>
12247
12248<li>
12249
12250<p>Syntax:</p>
12251
12252<div>
12253<div>
12254<pre class="source">switch_case(
12255 condition,
12256 case1, case1_result,
12257 case2, case2_result,
12258 ...,
12259 default, default_result
12260)
12261</pre></div></div>
12262</li>
12263<li>
12264
12265<p>Switches amongst a sequence of cases and returns the result of the first matching case. If no match is found, the result of the default case is returned.</p>
12266</li>
12267<li>Arguments:
12268<ul>
12269
12270<li><tt>condition</tt>: a variable (any type is allowed).</li>
12271<li><tt>caseI/default</tt>: a variable (any type is allowed).</li>
12272<li><tt>caseI/default_result</tt>: a variable (any type is allowed).</li>
12273</ul>
12274</li>
12275<li>Return Value:
12276<ul>
12277
12278<li><tt>caseI_result</tt> if <tt>condition</tt> matches <tt>caseI</tt>, otherwise <tt>default_result</tt>.</li>
12279</ul>
12280</li>
12281<li>Example 1:
12282
12283<div>
12284<div>
12285<pre class="source">switch_case(
12286 &quot;a&quot;,
12287 &quot;a&quot;, 0,
12288 &quot;x&quot;, 1,
12289 &quot;y&quot;, 2,
12290 &quot;z&quot;, 3
12291);
12292</pre></div></div>
12293</li>
12294<li>
12295
12296<p>The expected result is:</p>
12297
12298<div>
12299<div>
12300<pre class="source">0
12301</pre></div></div>
12302</li>
12303<li>
12304
12305<p>Example 2:</p>
12306
12307<div>
12308<div>
12309<pre class="source">switch_case(
12310 &quot;a&quot;,
12311 &quot;x&quot;, 1,
12312 &quot;y&quot;, 2,
12313 &quot;z&quot;, 3
12314);
12315</pre></div></div>
12316</li>
12317<li>
12318
12319<p>The expected result is:</p>
12320
12321<div>
12322<div>
12323<pre class="source">3
12324</pre></div></div>
12325</li>
12326</ul></div>
12327<div class="section">
12328<h3><a name="deep_equal"></a>deep_equal</h3>
12329<ul>
12330
12331<li>
12332
12333<p>Syntax:</p>
12334
12335<div>
12336<div>
12337<pre class="source">deep_equal(expr1, expr2)
12338</pre></div></div>
12339</li>
12340<li>
12341
12342<p>Assess the equality between two expressions of any type (e.g., object, arrays, or multiset). Two objects are deeply equal iff both their types and values are equal.</p>
12343</li>
12344<li>Arguments:
12345<ul>
12346
12347<li><tt>expr1</tt> : an expression,</li>
12348<li><tt>expr2</tt> : an expression.</li>
12349</ul>
12350</li>
12351<li>Return Value:
12352<ul>
12353
12354<li><tt>true</tt> or <tt>false</tt> depending on the data equality,</li>
12355<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
12356<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
12357</ul>
12358</li>
12359<li>
12360
12361<p>Example:</p>
12362
12363<div>
12364<div>
12365<pre class="source">deep_equal(
12366 {
12367 &quot;id&quot;:1,
12368 &quot;project&quot;:&quot;AsterixDB&quot;,
12369 &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
12370 &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
12371 },
12372 {
12373 &quot;id&quot;:1,
12374 &quot;project&quot;:&quot;AsterixDB&quot;,
12375 &quot;address&quot;:{&quot;city&quot;:&quot;San Diego&quot;, &quot;state&quot;:&quot;CA&quot;},
12376 &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
12377 }
12378);
12379</pre></div></div>
12380</li>
12381<li>
12382
12383<p>The expected result is:</p>
12384
12385<div>
12386<div>
12387<pre class="source">false
12388</pre></div></div>
12389</li>
12390</ul></div></div>
12391 </div>
12392 </div>
12393 </div>
12394 <hr/>
12395 <footer>
12396 <div class="container-fluid">
12397 <div class="row-fluid">
12398<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
12399 feather logo, and the Apache AsterixDB project logo are either
12400 registered trademarks or trademarks of The Apache Software
12401 Foundation in the United States and other countries.
12402 All other marks mentioned may be trademarks or registered
12403 trademarks of their respective owners.
12404 </div>
12405 </div>
12406 </div>
12407 </footer>
12408 </body>
12409</html>