blob: c49bdff7894257c8e578f3a8061e2dbabfef783b [file] [log] [blame]
Ian Maxon49d15b22020-12-06 16:23:00 -08001<!DOCTYPE html>
2<!--
3 | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/aql/builtins.md at 2020-12-06
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="20201206" />
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: 2020-12-06</li>
30 <li id="projectVersion" class="pull-right">Version: 0.9.6-SNAPSHOT</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="../interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
61 <li class="nav-header">Deprecated</li>
62 <li><a href="../aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
63 <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>
64 <li class="active"><a href="#"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
65</ul>
66 <hr />
67 <div id="poweredBy">
68 <div class="clear"></div>
69 <div class="clear"></div>
70 <div class="clear"></div>
71 <div class="clear"></div>
72<a href=".././" title="AsterixDB" class="builtBy"><img class="builtBy" alt="AsterixDB" src="../images/asterixlogo.png" /></a>
73 </div>
74 </div>
75 </div>
76 <div id="bodyColumn" class="span10" >
77<!--
78 ! Licensed to the Apache Software Foundation (ASF) under one
79 ! or more contributor license agreements. See the NOTICE file
80 ! distributed with this work for additional information
81 ! regarding copyright ownership. The ASF licenses this file
82 ! to you under the Apache License, Version 2.0 (the
83 ! "License"); you may not use this file except in compliance
84 ! with the License. You may obtain a copy of the License at
85 !
86 ! http://www.apache.org/licenses/LICENSE-2.0
87 !
88 ! Unless required by applicable law or agreed to in writing,
89 ! software distributed under the License is distributed on an
90 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
91 ! KIND, either express or implied. See the License for the
92 ! specific language governing permissions and limitations
93 ! under the License.
94 !-->
95<h1>Builtin Functions</h1><!--
96 ! Licensed to the Apache Software Foundation (ASF) under one
97 ! or more contributor license agreements. See the NOTICE file
98 ! distributed with this work for additional information
99 ! regarding copyright ownership. The ASF licenses this file
100 ! to you under the Apache License, Version 2.0 (the
101 ! "License"); you may not use this file except in compliance
102 ! with the License. You may obtain a copy of the License at
103 !
104 ! http://www.apache.org/licenses/LICENSE-2.0
105 !
106 ! Unless required by applicable law or agreed to in writing,
107 ! software distributed under the License is distributed on an
108 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
109 ! KIND, either express or implied. See the License for the
110 ! specific language governing permissions and limitations
111 ! under the License.
112 !-->
113
114<div class="section">
115<h2><a name="Table_of_Contents"></a><a name="toc" id="toc">Table of Contents</a></h2>
116<ul>
117
118<li><a href="#NumericFunctions">Numeric Functions</a></li>
119<li><a href="#StringFunctions">String Functions</a></li>
120<li><a href="#BinaryFunctions">Binary Functions</a></li>
121<li><a href="#SpatialFunctions">Spatial Functions</a></li>
122<li><a href="#SimilarityFunctions">Similarity Functions</a></li>
123<li><a href="#TokenizingFunctions">Tokenizing Functions</a></li>
124<li><a href="#TemporalFunctions">Temporal Functions</a></li>
125<li><a href="#ObjectFunctions">Object Functions</a></li>
126<li><a href="#AggregateFunctions">Aggregate Functions (Array Functions)</a></li>
127<li><a href="#ComparisonFunctions">Comparison Functions</a></li>
128<li><a href="#TypeFunctions">Type Functions</a></li>
129<li><a href="#ConditionalFunctions">Conditional Functions</a></li>
130<li><a href="#MiscFunctions">Miscellaneous Functions</a></li>
131</ul><!--
132 ! Licensed to the Apache Software Foundation (ASF) under one
133 ! or more contributor license agreements. See the NOTICE file
134 ! distributed with this work for additional information
135 ! regarding copyright ownership. The ASF licenses this file
136 ! to you under the Apache License, Version 2.0 (the
137 ! "License"); you may not use this file except in compliance
138 ! with the License. You may obtain a copy of the License at
139 !
140 ! http://www.apache.org/licenses/LICENSE-2.0
141 !
142 ! Unless required by applicable law or agreed to in writing,
143 ! software distributed under the License is distributed on an
144 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
145 ! KIND, either express or implied. See the License for the
146 ! specific language governing permissions and limitations
147 ! under the License.
148 !-->
149
150<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><!--
151 ! Licensed to the Apache Software Foundation (ASF) under one
152 ! or more contributor license agreements. See the NOTICE file
153 ! distributed with this work for additional information
154 ! regarding copyright ownership. The ASF licenses this file
155 ! to you under the Apache License, Version 2.0 (the
156 ! "License"); you may not use this file except in compliance
157 ! with the License. You may obtain a copy of the License at
158 !
159 ! http://www.apache.org/licenses/LICENSE-2.0
160 !
161 ! Unless required by applicable law or agreed to in writing,
162 ! software distributed under the License is distributed on an
163 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
164 ! KIND, either express or implied. See the License for the
165 ! specific language governing permissions and limitations
166 ! under the License.
167 !-->
168</div>
169<div class="section">
170<h2><a name="Numeric_Functions"></a><a name="NumericFunctions" id="NumericFunctions">Numeric Functions</a></h2>
171<div class="section">
172<h3><a name="abs"></a>abs</h3>
173<ul>
174
175<li>
176
177<p>Syntax:</p>
178
179<div>
180<div>
181<pre class="source">abs(numeric_value)
182</pre></div></div>
183</li>
184<li>
185
186<p>Computes the absolute value of the argument.</p>
187</li>
188<li>Arguments:
189<ul>
190
191<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>
192</ul>
193</li>
194<li>Return Value:
195<ul>
196
197<li>The absolute value of the argument with the same type as the input argument,</li>
198<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
199<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
200<li>any other non-numeric input value will cause a type error.</li>
201</ul>
202</li>
203<li>
204
205<p>Example:</p>
206
207<div>
208<div>
209<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;)) };
210</pre></div></div>
211</li>
212<li>
213
214<p>The expected result is:</p>
215
216<div>
217<div>
218<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 }
219</pre></div></div>
220</li>
221</ul></div>
222<div class="section">
223<h3><a name="acos"></a>acos</h3>
224<ul>
225
226<li>
227
228<p>Syntax:</p>
229
230<div>
231<div>
232<pre class="source">acos(numeric_value)
233</pre></div></div>
234</li>
235<li>
236
237<p>Computes the arc cosine value of the argument.</p>
238</li>
239<li>Arguments:
240<ul>
241
242<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>
243</ul>
244</li>
245<li>Return Value:
246<ul>
247
248<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>
249<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
250<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
251<li>any other non-numeric input value will cause a type error,</li>
252<li>&#x201c;NaN&#x201d; for other legitimate numeric values.</li>
253</ul>
254</li>
255<li>
256
257<p>Example:</p>
258
259<div>
260<div>
261<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;)) };
262</pre></div></div>
263</li>
264<li>
265
266<p>The expected result is:</p>
267
268<div>
269<div>
270<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 }
271</pre></div></div>
272</li>
273</ul></div>
274<div class="section">
275<h3><a name="asin"></a>asin</h3>
276<ul>
277
278<li>
279
280<p>Syntax:</p>
281
282<div>
283<div>
284<pre class="source">asin(numeric_value)
285</pre></div></div>
286</li>
287<li>
288
289<p>Computes the arc sine value of the argument.</p>
290</li>
291<li>Arguments:
292<ul>
293
294<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>
295</ul>
296</li>
297<li>Return Value:
298<ul>
299
300<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>
301<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
302<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
303<li>any other non-numeric input value will cause a type error,</li>
304<li>&#x201c;NaN&#x201d; for other legitimate numeric values.</li>
305</ul>
306</li>
307<li>
308
309<p>Example:</p>
310
311<div>
312<div>
313<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;)) };
314</pre></div></div>
315</li>
316<li>
317
318<p>The expected result is:</p>
319
320<div>
321<div>
322<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 }
323</pre></div></div>
324</li>
325</ul></div>
326<div class="section">
327<h3><a name="atan"></a>atan</h3>
328<ul>
329
330<li>
331
332<p>Syntax:</p>
333
334<div>
335<div>
336<pre class="source">atan(numeric_value)
337</pre></div></div>
338</li>
339<li>
340
341<p>Computes the arc tangent value of the argument.</p>
342</li>
343<li>Arguments:
344<ul>
345
346<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>
347</ul>
348</li>
349<li>Return Value:
350<ul>
351
352<li>the <tt>double</tt> arc tangent in radians for the argument,</li>
353<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
354<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
355<li>any other non-numeric input value will cause a type error.</li>
356</ul>
357</li>
358<li>
359
360<p>Example:</p>
361
362<div>
363<div>
364<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;)) };
365</pre></div></div>
366</li>
367<li>
368
369<p>The expected result is:</p>
370
371<div>
372<div>
373<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 }
374</pre></div></div>
375</li>
376</ul></div>
377<div class="section">
378<h3><a name="atan2"></a>atan2</h3>
379<ul>
380
381<li>
382
383<p>Syntax:</p>
384
385<div>
386<div>
387<pre class="source">atan2(numeric_value1, numeric_value2)
388</pre></div></div>
389</li>
390<li>
391
392<p>Computes the arc tangent value of numeric_value2/numeric_value1.</p>
393</li>
394<li>Arguments:
395<ul>
396
397<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>
398<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>
399</ul>
400</li>
401<li>Return Value:
402<ul>
403
404<li>the <tt>double</tt> arc tangent in radians for <tt>numeric_value1</tt> and <tt>numeric_value2</tt>,</li>
405<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
406<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
407<li>any other non-numeric input value will cause a type error.</li>
408</ul>
409</li>
410<li>
411
412<p>Example:</p>
413
414<div>
415<div>
416<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;)) };
417</pre></div></div>
418</li>
419<li>
420
421<p>The expected result is:</p>
422
423<div>
424<div>
425<pre class="source">{ &quot;v1&quot;: 0.4636476090008061, &quot;v2&quot;: 0.0, &quot;v3&quot;: 2.356194490192345 }
426</pre></div></div>
427</li>
428</ul></div>
429<div class="section">
430<h3><a name="ceil"></a>ceil</h3>
431<ul>
432
433<li>
434
435<p>Syntax:</p>
436
437<div>
438<div>
439<pre class="source">ceil(numeric_value)
440</pre></div></div>
441</li>
442<li>
443
444<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>
445</li>
446<li>Arguments:
447<ul>
448
449<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>
450</ul>
451</li>
452<li>Return Value:
453<ul>
454
455<li>The ceiling value for the given number in the same type as the input argument,</li>
456<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
457<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
458<li>any other non-numeric input value will cause a type error.</li>
459</ul>
460</li>
461<li>
462
463<p>Example:</p>
464
465<div>
466<div>
467<pre class="source">{
468 &quot;v1&quot;: ceil(2013),
469 &quot;v2&quot;: ceil(-4036),
470 &quot;v3&quot;: ceil(0.3),
471 &quot;v4&quot;: ceil(float(&quot;-2013.2&quot;)),
472 &quot;v5&quot;: ceil(double(&quot;-2013.893823748327284&quot;))
473};
474</pre></div></div>
475</li>
476<li>
477
478<p>The expected result is:</p>
479
480<div>
481<div>
482<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 }
483</pre></div></div>
484</li>
485</ul></div>
486<div class="section">
487<h3><a name="cos"></a>cos</h3>
488<ul>
489
490<li>
491
492<p>Syntax:</p>
493
494<div>
495<div>
496<pre class="source">cos(numeric_value)
497</pre></div></div>
498</li>
499<li>
500
501<p>Computes the cosine value of the argument.</p>
502</li>
503<li>Arguments:
504<ul>
505
506<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>
507</ul>
508</li>
509<li>Return Value:
510<ul>
511
512<li>the <tt>double</tt> cosine value for the argument,</li>
513<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
514<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
515<li>any other non-numeric input value will cause a type error.</li>
516</ul>
517</li>
518<li>
519
520<p>Example:</p>
521
522<div>
523<div>
524<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;)) };
525</pre></div></div>
526</li>
527<li>
528
529<p>The expected result is:</p>
530
531<div>
532<div>
533<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 }
534</pre></div></div>
535</li>
536</ul></div>
537<div class="section">
538<h3><a name="cosh"></a>cosh</h3>
539<ul>
540
541<li>
542
543<p>Syntax:</p>
544
545<div>
546<div>
547<pre class="source">cosh(numeric_value)
548</pre></div></div>
549</li>
550<li>
551
552<p>Computes the hyperbolic cosine value of the argument.</p>
553</li>
554<li>Arguments:
555<ul>
556
557<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>
558</ul>
559</li>
560<li>Return Value:
561<ul>
562
563<li>the <tt>double</tt> hyperbolic cosine value for the argument,</li>
564<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
565<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
566<li>any other non-numeric input value will cause a type error.</li>
567</ul>
568</li>
569<li>
570
571<p>Example:</p>
572
573<div>
574<div>
575<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;)) };
576</pre></div></div>
577</li>
578<li>
579
580<p>The expected result is:</p>
581
582<div>
583<div>
584<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 }
585</pre></div></div>
586</li>
587</ul></div>
588<div class="section">
589<h3><a name="degrees"></a>degrees</h3>
590<ul>
591
592<li>
593
594<p>Syntax:</p>
595
596<div>
597<div>
598<pre class="source">degrees(numeric_value)
599</pre></div></div>
600</li>
601<li>
602
603<p>Converts radians to degrees</p>
604</li>
605<li>Arguments:
606<ul>
607
608<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>
609</ul>
610</li>
611<li>Return Value:
612<ul>
613
614<li>The degrees value for the given radians value. The returned value has type <tt>double</tt>,</li>
615<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
616<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
617<li>any other non-numeric input value will cause a type error.</li>
618</ul>
619</li>
620<li>
621
622<p>Example:</p>
623
624<div>
625<div>
626<pre class="source">{ &quot;v1&quot;: degrees(pi()) };
627</pre></div></div>
628</li>
629<li>
630
631<p>The expected result is:</p>
632
633<div>
634<div>
635<pre class="source">{ &quot;v1&quot;: 180.0 }
636</pre></div></div>
637</li>
638</ul></div>
639<div class="section">
640<h3><a name="e"></a>e</h3>
641<ul>
642
643<li>
644
645<p>Syntax:</p>
646
647<div>
648<div>
649<pre class="source">e()
650</pre></div></div>
651</li>
652<li>
653
654<p>Return Value:</p>
655<ul>
656
657<li>e (base of the natural logarithm)</li>
658</ul>
659</li>
660<li>
661
662<p>Example:</p>
663
664<div>
665<div>
666<pre class="source">{ &quot;v1&quot;: e() };
667</pre></div></div>
668</li>
669<li>
670
671<p>The expected result is:</p>
672
673<div>
674<div>
675<pre class="source">{ &quot;v1&quot;: 2.718281828459045 }
676</pre></div></div>
677</li>
678</ul></div>
679<div class="section">
680<h3><a name="exp"></a>exp</h3>
681<ul>
682
683<li>
684
685<p>Syntax:</p>
686
687<div>
688<div>
689<pre class="source">exp(numeric_value)
690</pre></div></div>
691</li>
692<li>
693
694<p>Computes e<sup>numeric_value</sup>.</p>
695</li>
696<li>Arguments:
697<ul>
698
699<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>
700</ul>
701</li>
702<li>Return Value:
703<ul>
704
705<li>e<sup>numeric_value</sup>,</li>
706<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
707<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
708<li>any other non-numeric input value will cause a type error.</li>
709</ul>
710</li>
711<li>
712
713<p>Example:</p>
714
715<div>
716<div>
717<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;)) };
718</pre></div></div>
719</li>
720<li>
721
722<p>The expected result is:</p>
723
724<div>
725<div>
726<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; }
727</pre></div></div>
728</li>
729</ul></div>
730<div class="section">
731<h3><a name="floor"></a>floor</h3>
732<ul>
733
734<li>
735
736<p>Syntax:</p>
737
738<div>
739<div>
740<pre class="source">floor(numeric_value)
741</pre></div></div>
742</li>
743<li>
744
745<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>
746</li>
747<li>Arguments:
748<ul>
749
750<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>
751</ul>
752</li>
753<li>Return Value:
754<ul>
755
756<li>The floor value for the given number in the same type as the input argument,</li>
757<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
758<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
759<li>any other non-numeric input value will cause a type error.</li>
760</ul>
761</li>
762<li>
763
764<p>Example:</p>
765
766<div>
767<div>
768<pre class="source">{
769 &quot;v1&quot;: floor(2013),
770 &quot;v2&quot;: floor(-4036),
771 &quot;v3&quot;: floor(0.8),
772 &quot;v4&quot;: floor(float(&quot;-2013.2&quot;)),
773 &quot;v5&quot;: floor(double(&quot;-2013.893823748327284&quot;))
774};
775</pre></div></div>
776</li>
777<li>
778
779<p>The expected result is:</p>
780
781<div>
782<div>
783<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 }
784</pre></div></div>
785</li>
786</ul></div>
787<div class="section">
788<h3><a name="ln"></a>ln</h3>
789<ul>
790
791<li>
792
793<p>Syntax:</p>
794
795<div>
796<div>
797<pre class="source">ln(numeric_value)
798</pre></div></div>
799</li>
800<li>
801
802<p>Computes log<sub>e</sub>numeric_value.</p>
803</li>
804<li>Arguments:
805<ul>
806
807<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>
808</ul>
809</li>
810<li>Return Value:
811<ul>
812
813<li>log<sub>e</sub>numeric_value,</li>
814<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
815<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
816<li>any other non-numeric input value will cause a type error.</li>
817</ul>
818</li>
819<li>
820
821<p>Example:</p>
822
823<div>
824<div>
825<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;)) };
826</pre></div></div>
827</li>
828<li>
829
830<p>The expected result is:</p>
831
832<div>
833<div>
834<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 }
835</pre></div></div>
836</li>
837</ul></div>
838<div class="section">
839<h3><a name="log"></a>log</h3>
840<ul>
841
842<li>
843
844<p>Syntax:</p>
845
846<div>
847<div>
848<pre class="source">log(numeric_value)
849</pre></div></div>
850</li>
851<li>
852
853<p>Computes log<sub>10</sub>numeric_value.</p>
854</li>
855<li>Arguments:
856<ul>
857
858<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>
859</ul>
860</li>
861<li>Return Value:
862<ul>
863
864<li>log<sub>10</sub>numeric_value,</li>
865<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
866<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
867<li>any other non-numeric input value will cause a type error.</li>
868</ul>
869</li>
870<li>
871
872<p>Example:</p>
873
874<div>
875<div>
876<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;)) };
877</pre></div></div>
878</li>
879<li>
880
881<p>The expected result is:</p>
882
883<div>
884<div>
885<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 }
886</pre></div></div>
887</li>
888</ul></div>
889<div class="section">
890<h3><a name="pi"></a>pi</h3>
891<ul>
892
893<li>
894
895<p>Syntax:</p>
896
897<div>
898<div>
899<pre class="source">pi()
900</pre></div></div>
901</li>
902<li>
903
904<p>Return Value:</p>
905<ul>
906
907<li>Pi</li>
908</ul>
909</li>
910<li>
911
912<p>Example:</p>
913
914<div>
915<div>
916<pre class="source">{ &quot;v1&quot;: pi() };
917</pre></div></div>
918</li>
919<li>
920
921<p>The expected result is:</p>
922
923<div>
924<div>
925<pre class="source">{ &quot;v1&quot;: 3.141592653589793 }
926</pre></div></div>
927</li>
928</ul></div>
929<div class="section">
930<h3><a name="power"></a>power</h3>
931<ul>
932
933<li>
934
935<p>Syntax:</p>
936
937<div>
938<div>
939<pre class="source">power(numeric_value1, numeric_value2)
940</pre></div></div>
941</li>
942<li>
943
944<p>Computes numeric_value1<sup>numeric_value2</sup>.</p>
945</li>
946<li>Arguments:
947<ul>
948
949<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>
950<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>
951</ul>
952</li>
953<li>Return Value:
954<ul>
955
956<li>numeric_value1<sup>numeric_value2</sup>,</li>
957<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
958<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
959<li>any other non-numeric input value will cause a type error.</li>
960</ul>
961</li>
962<li>
963
964<p>Example:</p>
965
966<div>
967<div>
968<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;)) };
969</pre></div></div>
970</li>
971<li>
972
973<p>The expected result is:</p>
974
975<div>
976<div>
977<pre class="source">{ &quot;v1&quot;: 1, &quot;v3&quot;: 0, &quot;v4&quot;: 1.4142135623730951 }
978</pre></div></div>
979</li>
980</ul></div>
981<div class="section">
982<h3><a name="radians"></a>radians</h3>
983<ul>
984
985<li>
986
987<p>Syntax:</p>
988
989<div>
990<div>
991<pre class="source">radians(numeric_value)
992</pre></div></div>
993</li>
994<li>
995
996<p>Converts degrees to radians</p>
997</li>
998<li>Arguments:
999<ul>
1000
1001<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>
1002</ul>
1003</li>
1004<li>Return Value:
1005<ul>
1006
1007<li>The radians value for the given degrees value. The returned value has type <tt>double</tt>,</li>
1008<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1009<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1010<li>any other non-numeric input value will cause a type error.</li>
1011</ul>
1012</li>
1013<li>
1014
1015<p>Example:</p>
1016
1017<div>
1018<div>
1019<pre class="source">{ &quot;v1&quot;: radians(180) };
1020</pre></div></div>
1021</li>
1022<li>
1023
1024<p>The expected result is:</p>
1025
1026<div>
1027<div>
1028<pre class="source">{ &quot;v1&quot;: 3.141592653589793 }
1029</pre></div></div>
1030</li>
1031</ul></div>
1032<div class="section">
1033<h3><a name="round"></a>round</h3>
1034<ul>
1035
1036<li>
1037
1038<p>Syntax:</p>
1039
1040<div>
1041<div>
1042<pre class="source">round(numeric_value[, round_digit])
1043</pre></div></div>
1044</li>
1045<li>
1046
1047<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>
1048</li>
1049<li>
1050
1051<p>Arguments:</p>
1052<ul>
1053
1054<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>
1055<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>
1056</ul>
1057</li>
1058<li>Return Value:
1059<ul>
1060
1061<li>The rounded value for the given number. The returned value has the following type:
1062<ul>
1063
1064<li><tt>bigint</tt> if the input value has type <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt> or <tt>bigint</tt>,</li>
1065<li><tt>float</tt> if the input value has type <tt>float</tt>,</li>
1066<li><tt>double</tt> if the input value has type <tt>double</tt>;</li>
1067</ul>
1068</li>
1069<li><tt>missing</tt> if the input value is a <tt>missing</tt> value,</li>
1070<li><tt>null</tt> if the input value is a <tt>null</tt> value,</li>
1071<li>any other non-numeric input value will return a <tt>null</tt> value.</li>
1072</ul>
1073</li>
1074<li>
1075
1076<p>Example:</p>
1077
1078<div>
1079<div>
1080<pre class="source">{
1081 &quot;v1&quot;: round(2013),
1082 &quot;v2&quot;: round(-4036),
1083 &quot;v3&quot;: round(0.8),
1084 &quot;v4&quot;: round(float(&quot;-2013.256&quot;)),
1085 &quot;v5&quot;: round(double(&quot;-2013.893823748327284&quot;))
1086 &quot;v6&quot;: round(123456, -1),
1087 &quot;v7&quot;: round(456.456, 2),
1088 &quot;v8&quot;: round(456.456, -1),
1089 &quot;v9&quot;: round(-456.456, -2)
1090};
1091</pre></div></div>
1092</li>
1093<li>
1094
1095<p>The expected result is:</p>
1096
1097<div>
1098<div>
1099<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 }
1100</pre></div></div>
1101</li>
1102</ul></div>
1103<div class="section">
1104<h3><a name="sign"></a>sign</h3>
1105<ul>
1106
1107<li>
1108
1109<p>Syntax:</p>
1110
1111<div>
1112<div>
1113<pre class="source">sign(numeric_value)
1114</pre></div></div>
1115</li>
1116<li>
1117
1118<p>Computes the sign of the argument.</p>
1119</li>
1120<li>Arguments:
1121<ul>
1122
1123<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>
1124</ul>
1125</li>
1126<li>Return Value:
1127<ul>
1128
1129<li>the sign (a <tt>tinyint</tt>) of the argument, -1 for negative values, 0 for 0, and 1 for positive values,</li>
1130<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1131<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1132<li>any other non-numeric input value will cause a type error.</li>
1133</ul>
1134</li>
1135<li>
1136
1137<p>Example:</p>
1138
1139<div>
1140<div>
1141<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;)) };
1142</pre></div></div>
1143</li>
1144<li>
1145
1146<p>The expected result is:</p>
1147
1148<div>
1149<div>
1150<pre class="source">{ &quot;v1&quot;: 1, &quot;v2&quot;: 1, &quot;v3&quot;: 0, &quot;v4&quot;: 1, &quot;v5&quot;: -1 }
1151</pre></div></div>
1152</li>
1153</ul></div>
1154<div class="section">
1155<h3><a name="sin"></a>sin</h3>
1156<ul>
1157
1158<li>
1159
1160<p>Syntax:</p>
1161
1162<div>
1163<div>
1164<pre class="source">sin(numeric_value)
1165</pre></div></div>
1166</li>
1167<li>
1168
1169<p>Computes the sine value of the argument.</p>
1170</li>
1171<li>Arguments:
1172<ul>
1173
1174<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>
1175</ul>
1176</li>
1177<li>Return Value:
1178<ul>
1179
1180<li>the <tt>double</tt> sine value for the argument,</li>
1181<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1182<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1183<li>any other non-numeric input value will cause a type error.</li>
1184</ul>
1185</li>
1186<li>
1187
1188<p>Example:</p>
1189
1190<div>
1191<div>
1192<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;)) };
1193</pre></div></div>
1194</li>
1195<li>
1196
1197<p>The expected result is:</p>
1198
1199<div>
1200<div>
1201<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 }
1202</pre></div></div>
1203</li>
1204</ul></div>
1205<div class="section">
1206<h3><a name="sinh"></a>sinh</h3>
1207<ul>
1208
1209<li>
1210
1211<p>Syntax:</p>
1212
1213<div>
1214<div>
1215<pre class="source">sinh(numeric_value)
1216</pre></div></div>
1217</li>
1218<li>
1219
1220<p>Computes the hyperbolic sine value of the argument.</p>
1221</li>
1222<li>Arguments:
1223<ul>
1224
1225<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>
1226</ul>
1227</li>
1228<li>Return Value:
1229<ul>
1230
1231<li>the <tt>double</tt> hyperbolic sine value for the argument,</li>
1232<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1233<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1234<li>any other non-numeric input value will cause a type error.</li>
1235</ul>
1236</li>
1237<li>
1238
1239<p>Example:</p>
1240
1241<div>
1242<div>
1243<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;)) };
1244</pre></div></div>
1245</li>
1246<li>
1247
1248<p>The expected result is:</p>
1249
1250<div>
1251<div>
1252<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 }
1253</pre></div></div>
1254</li>
1255</ul></div>
1256<div class="section">
1257<h3><a name="sqrt"></a>sqrt</h3>
1258<ul>
1259
1260<li>
1261
1262<p>Syntax:</p>
1263
1264<div>
1265<div>
1266<pre class="source">sqrt(numeric_value)
1267</pre></div></div>
1268</li>
1269<li>
1270
1271<p>Computes the square root of the argument.</p>
1272</li>
1273<li>Arguments:
1274<ul>
1275
1276<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>
1277</ul>
1278</li>
1279<li>Return Value:
1280<ul>
1281
1282<li>the <tt>double</tt> square root value for the argument,</li>
1283<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1284<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1285<li>any other non-numeric input value will cause a type error.</li>
1286</ul>
1287</li>
1288<li>
1289
1290<p>Example:</p>
1291
1292<div>
1293<div>
1294<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;)) };
1295</pre></div></div>
1296</li>
1297<li>
1298
1299<p>The expected result is:</p>
1300
1301<div>
1302<div>
1303<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 }
1304</pre></div></div>
1305</li>
1306</ul></div>
1307<div class="section">
1308<h3><a name="tan"></a>tan</h3>
1309<ul>
1310
1311<li>
1312
1313<p>Syntax:</p>
1314
1315<div>
1316<div>
1317<pre class="source">tan(numeric_value)
1318</pre></div></div>
1319</li>
1320<li>
1321
1322<p>Computes the tangent value of the argument.</p>
1323</li>
1324<li>Arguments:
1325<ul>
1326
1327<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>
1328</ul>
1329</li>
1330<li>Return Value:
1331<ul>
1332
1333<li>the <tt>double</tt> tangent value for the argument,</li>
1334<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1335<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1336<li>any other non-numeric input value will cause a type error.</li>
1337</ul>
1338</li>
1339<li>
1340
1341<p>Example:</p>
1342
1343<div>
1344<div>
1345<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;)) };
1346</pre></div></div>
1347</li>
1348<li>
1349
1350<p>The expected result is:</p>
1351
1352<div>
1353<div>
1354<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 }
1355</pre></div></div>
1356</li>
1357</ul></div>
1358<div class="section">
1359<h3><a name="tanh"></a>tanh</h3>
1360<ul>
1361
1362<li>
1363
1364<p>Syntax:</p>
1365
1366<div>
1367<div>
1368<pre class="source">tanh(numeric_value)
1369</pre></div></div>
1370</li>
1371<li>
1372
1373<p>Computes the hyperbolic tangent value of the argument.</p>
1374</li>
1375<li>Arguments:
1376<ul>
1377
1378<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>
1379</ul>
1380</li>
1381<li>Return Value:
1382<ul>
1383
1384<li>the <tt>double</tt> hyperbolic tangent value for the argument,</li>
1385<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1386<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1387<li>any other non-numeric input value will cause a type error.</li>
1388</ul>
1389</li>
1390<li>
1391
1392<p>Example:</p>
1393
1394<div>
1395<div>
1396<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;)) };
1397</pre></div></div>
1398</li>
1399<li>
1400
1401<p>The expected result is:</p>
1402
1403<div>
1404<div>
1405<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 }
1406</pre></div></div>
1407</li>
1408</ul></div>
1409<div class="section">
1410<h3><a name="trunc"></a>trunc</h3>
1411<ul>
1412
1413<li>
1414
1415<p>Syntax:</p>
1416
1417<div>
1418<div>
1419<pre class="source">trunc(numeric_value, number_digits)
1420</pre></div></div>
1421</li>
1422<li>
1423
1424<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>
1425</li>
1426<li>Arguments:
1427<ul>
1428
1429<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>
1430<li><tt>number_digits</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value.</li>
1431</ul>
1432</li>
1433<li>Return Value:
1434<ul>
1435
1436<li>the <tt>double</tt> tangent value for the argument,</li>
1437<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
1438<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is <tt>missing</tt>,</li>
1439<li>a type error will be raised if:
1440<ul>
1441
1442<li>the first argument is any other non-numeric value,</li>
1443<li>the second argument is any other non-tinyint, non-smallint, non-integer, and non-bigint value.</li>
1444</ul>
1445</li>
1446</ul>
1447</li>
1448<li>
1449
1450<p>Example:</p>
1451
1452<div>
1453<div>
1454<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) };
1455</pre></div></div>
1456</li>
1457<li>
1458
1459<p>The expected result is:</p>
1460
1461<div>
1462<div>
1463<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 }
1464</pre></div></div>
1465</li>
1466</ul><!--
1467 ! Licensed to the Apache Software Foundation (ASF) under one
1468 ! or more contributor license agreements. See the NOTICE file
1469 ! distributed with this work for additional information
1470 ! regarding copyright ownership. The ASF licenses this file
1471 ! to you under the Apache License, Version 2.0 (the
1472 ! "License"); you may not use this file except in compliance
1473 ! with the License. You may obtain a copy of the License at
1474 !
1475 ! http://www.apache.org/licenses/LICENSE-2.0
1476 !
1477 ! Unless required by applicable law or agreed to in writing,
1478 ! software distributed under the License is distributed on an
1479 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1480 ! KIND, either express or implied. See the License for the
1481 ! specific language governing permissions and limitations
1482 ! under the License.
1483 !-->
1484</div>
1485<div class="section">
1486<h3><a name="round_half_to_even"></a>round_half_to_even</h3>
1487<ul>
1488
1489<li>
1490
1491<p>Syntax:</p>
1492
1493<div>
1494<div>
1495<pre class="source">round_half_to_even(numeric_value, [precision])
1496</pre></div></div>
1497</li>
1498<li>
1499
1500<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>
1501</li>
1502<li>Arguments:
1503<ul>
1504
1505<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>
1506<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>
1507</ul>
1508</li>
1509<li>Return Value:
1510<ul>
1511
1512<li>The rounded value for the given number in the same type as the input argument,</li>
1513<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
1514<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
1515<li>a type error will be raised if:
1516<ul>
1517
1518<li>the first argument is any other non-numeric value,</li>
1519<li>or, the second argument is any other non-tinyint, non-smallint, non-integer, or non-bigint value.</li>
1520</ul>
1521</li>
1522</ul>
1523</li>
1524<li>
1525
1526<p>Example:</p>
1527
1528<div>
1529<div>
1530<pre class="source">{
1531 &quot;v1&quot;: round_half_to_even(2013),
1532 &quot;v2&quot;: round_half_to_even(-4036),
1533 &quot;v3&quot;: round_half_to_even(0.8),
1534 &quot;v4&quot;: round_half_to_even(float(&quot;-2013.256&quot;)),
1535 &quot;v5&quot;: round_half_to_even(double(&quot;-2013.893823748327284&quot;)),
1536 &quot;v6&quot;: round_half_to_even(double(&quot;-2013.893823748327284&quot;), 2),
1537 &quot;v7&quot;: round_half_to_even(2013, 4),
1538 &quot;v8&quot;: round_half_to_even(float(&quot;-2013.256&quot;), 5)
1539};
1540</pre></div></div>
1541</li>
1542<li>
1543
1544<p>The expected result is:</p>
1545
1546<div>
1547<div>
1548<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 }
1549</pre></div></div>
1550</li>
1551</ul><!--
1552 ! Licensed to the Apache Software Foundation (ASF) under one
1553 ! or more contributor license agreements. See the NOTICE file
1554 ! distributed with this work for additional information
1555 ! regarding copyright ownership. The ASF licenses this file
1556 ! to you under the Apache License, Version 2.0 (the
1557 ! "License"); you may not use this file except in compliance
1558 ! with the License. You may obtain a copy of the License at
1559 !
1560 ! http://www.apache.org/licenses/LICENSE-2.0
1561 !
1562 ! Unless required by applicable law or agreed to in writing,
1563 ! software distributed under the License is distributed on an
1564 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1565 ! KIND, either express or implied. See the License for the
1566 ! specific language governing permissions and limitations
1567 ! under the License.
1568 !-->
1569</div></div>
1570<div class="section">
1571<h2><a name="String_Functions"></a><a name="StringFunctions" id="StringFunctions">String Functions</a></h2>
1572<div class="section">
1573<h3><a name="concat"></a>concat</h3>
1574<ul>
1575
1576<li>
1577
1578<p>Syntax:</p>
1579
1580<div>
1581<div>
1582<pre class="source">concat(string1, string2, ...)
1583</pre></div></div>
1584</li>
1585<li>
1586
1587<p>Returns a concatenated string from arguments.</p>
1588</li>
1589<li>Arguments:
1590<ul>
1591
1592<li><tt>string1</tt>: a string value,</li>
1593<li><tt>string2</tt>: a string value,</li>
1594<li>&#x2026;.</li>
1595</ul>
1596</li>
1597<li>Return Value:
1598<ul>
1599
1600<li>a concatenated string from arguments,</li>
1601<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
1602<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
1603<li>any other non-string input value will cause a type error.</li>
1604</ul>
1605</li>
1606<li>
1607
1608<p>Example:</p>
1609
1610<div>
1611<div>
1612<pre class="source">concat(&quot;test &quot;, &quot;driven &quot;, &quot;development&quot;);
1613</pre></div></div>
1614</li>
1615<li>
1616
1617<p>The expected result is:</p>
1618
1619<div>
1620<div>
1621<pre class="source">&quot;test driven development&quot;
1622</pre></div></div>
1623</li>
1624</ul></div>
1625<div class="section">
1626<h3><a name="contains"></a>contains</h3>
1627<ul>
1628
1629<li>
1630
1631<p>Syntax:</p>
1632
1633<div>
1634<div>
1635<pre class="source">contains(string, substring_to_contain)
1636</pre></div></div>
1637</li>
1638<li>
1639
1640<p>Checks whether the string <tt>string</tt> contains the string <tt>substring_to_contain</tt></p>
1641</li>
1642<li>Arguments:
1643<ul>
1644
1645<li><tt>string</tt> : a <tt>string</tt> that might contain the given substring,</li>
1646<li><tt>substring_to_contain</tt> : a target <tt>string</tt> that might be contained.</li>
1647</ul>
1648</li>
1649<li>Return Value:
1650<ul>
1651
1652<li>a <tt>boolean</tt> value, <tt>true</tt> if <tt>string</tt> contains <tt>substring_to_contain</tt>,</li>
1653<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
1654<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
1655<li>any other non-string input value will cause a type error,</li>
1656<li><tt>false</tt> otherwise.</li>
1657</ul>
1658</li>
1659<li>
1660
1661<p>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</p>
1662</li>
1663<li>Example:
1664
1665<div>
1666<div>
1667<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;) };
1668</pre></div></div>
1669</li>
1670<li>
1671
1672<p>The expected result is:</p>
1673
1674<div>
1675<div>
1676<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
1677</pre></div></div>
1678</li>
1679</ul></div>
1680<div class="section">
1681<h3><a name="ends_with"></a>ends_with</h3>
1682<ul>
1683
1684<li>
1685
1686<p>Syntax:</p>
1687
1688<div>
1689<div>
1690<pre class="source">ends_with(string, substring_to_end_with)
1691</pre></div></div>
1692</li>
1693<li>
1694
1695<p>Checks whether the string <tt>string</tt> ends with the string <tt>substring_to_end_with</tt>.</p>
1696</li>
1697<li>Arguments:
1698<ul>
1699
1700<li><tt>string</tt> : a <tt>string</tt> that might end with the given string,</li>
1701<li><tt>substring_to_end_with</tt> : a <tt>string</tt> that might be contained as the ending substring.</li>
1702</ul>
1703</li>
1704<li>Return Value:
1705<ul>
1706
1707<li>a <tt>boolean</tt> value, <tt>true</tt> if <tt>string</tt> contains <tt>substring_to_contain</tt>,</li>
1708<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
1709<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
1710<li>any other non-string input value will cause a type error,</li>
1711<li><tt>false</tt> otherwise.</li>
1712</ul>
1713</li>
1714<li>
1715
1716<p>Example:</p>
1717
1718<div>
1719<div>
1720<pre class="source">{
1721 &quot;v1&quot;: ends_with(&quot; love product-b its shortcut_menu is awesome:)&quot;, &quot;:)&quot;),
1722 &quot;v2&quot;: ends_with(&quot; awsome:)&quot;, &quot;:-)&quot;)
1723};
1724</pre></div></div>
1725</li>
1726<li>
1727
1728<p>The expected result is:</p>
1729
1730<div>
1731<div>
1732<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
1733</pre></div></div>
1734</li>
1735</ul></div>
1736<div class="section">
1737<h3><a name="initcap_.28or_title.29"></a>initcap (or title)</h3>
1738<ul>
1739
1740<li>
1741
1742<p>Syntax:</p>
1743
1744<div>
1745<div>
1746<pre class="source">initcap(string)
1747</pre></div></div>
1748</li>
1749<li>
1750
1751<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>
1752</li>
1753<li>Arguments:
1754<ul>
1755
1756<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
1757</ul>
1758</li>
1759<li>Return Value:
1760<ul>
1761
1762<li>a <tt>string</tt> as the title form of the given <tt>string</tt>,</li>
1763<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1764<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1765<li>any other non-string input value will cause a type error.</li>
1766</ul>
1767</li>
1768<li>
1769
1770<p>Example:</p>
1771
1772<div>
1773<div>
1774<pre class="source">{ &quot;v1&quot;: initcap(&quot;ASTERIXDB is here!&quot;), &quot;v2&quot;: title(&quot;ASTERIXDB is here!&quot;) };
1775</pre></div></div>
1776</li>
1777<li>
1778
1779<p>The expected result is:</p>
1780
1781<div>
1782<div>
1783<pre class="source">{ &quot;v1&quot;: &quot;Asterixdb Is Here!&quot;, &quot;v2&quot;: &quot;Asterixdb Is Here!&quot; }
1784</pre></div></div>
1785</li>
1786</ul></div>
1787<div class="section">
1788<h3><a name="length"></a>length</h3>
1789<ul>
1790
1791<li>
1792
1793<p>Syntax:</p>
1794
1795<div>
1796<div>
1797<pre class="source">length(string)
1798</pre></div></div>
1799</li>
1800<li>
1801
1802<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>
1803</li>
1804<li>Arguments:
1805<ul>
1806
1807<li><tt>string</tt> : a <tt>string</tt> or <tt>null</tt> that represents the string to be checked.</li>
1808</ul>
1809</li>
1810<li>Return Value:
1811<ul>
1812
1813<li>an <tt>bigint</tt> that represents the length of <tt>string</tt>,</li>
1814<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1815<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1816<li>any other non-string input value will cause a type error.</li>
1817</ul>
1818</li>
1819<li>
1820
1821<p>Example:</p>
1822
1823<div>
1824<div>
1825<pre class="source">length(&quot;test string&quot;);
1826</pre></div></div>
1827</li>
1828<li>
1829
1830<p>The expected result is:</p>
1831
1832<div>
1833<div>
1834<pre class="source">11
1835</pre></div></div>
1836</li>
1837<li>
1838
1839<p>Example:</p>
1840
1841<div>
1842<div>
1843<pre class="source">length(&quot;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;);
1844</pre></div></div>
1845</li>
1846<li>
1847
1848<p>The expected result is (the emoji character &#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466; has 7 code points):</p>
1849
1850<div>
1851<div>
1852<pre class="source">7
1853</pre></div></div>
1854</li>
1855</ul></div>
1856<div class="section">
1857<h3><a name="lower"></a>lower</h3>
1858<ul>
1859
1860<li>
1861
1862<p>Syntax:</p>
1863
1864<div>
1865<div>
1866<pre class="source">lower(string)
1867</pre></div></div>
1868</li>
1869<li>
1870
1871<p>Converts a given string <tt>string</tt> to its lowercase form.</p>
1872</li>
1873<li>Arguments:
1874<ul>
1875
1876<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
1877</ul>
1878</li>
1879<li>Return Value:
1880<ul>
1881
1882<li>a <tt>string</tt> as the lowercase form of the given <tt>string</tt>,</li>
1883<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
1884<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
1885<li>any other non-string input value will cause a type error.</li>
1886</ul>
1887</li>
1888<li>
1889
1890<p>Example:</p>
1891
1892<div>
1893<div>
1894<pre class="source">lower(&quot;ASTERIXDB&quot;);
1895</pre></div></div>
1896</li>
1897<li>
1898
1899<p>The expected result is:</p>
1900
1901<div>
1902<div>
1903<pre class="source">&quot;asterixdb&quot;
1904</pre></div></div>
1905</li>
1906</ul></div>
1907<div class="section">
1908<h3><a name="ltrim"></a>ltrim</h3>
1909<ul>
1910
1911<li>
1912
1913<p>Syntax:</p>
1914
1915<div>
1916<div>
1917<pre class="source">ltrim(string[, chars]);
1918</pre></div></div>
1919</li>
1920<li>
1921
1922<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>
1923</li>
1924<li>Arguments:
1925<ul>
1926
1927<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
1928<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
1929</ul>
1930</li>
1931<li>Return Value:
1932<ul>
1933
1934<li>a trimmed, new <tt>string</tt>,</li>
1935<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
1936<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
1937<li>any other non-string input value will cause a type error.</li>
1938</ul>
1939</li>
1940<li>Related functions: see <tt>trim()</tt>, <tt>rtrim()</tt></li>
1941<li>
1942
1943<p>Example:</p>
1944
1945<div>
1946<div>
1947<pre class="source">ltrim(&quot;me like x-phone&quot;, &quot;eml&quot;);
1948</pre></div></div>
1949</li>
1950<li>
1951
1952<p>The expected result is:</p>
1953
1954<div>
1955<div>
1956<pre class="source">&quot; like x-phone&quot;
1957</pre></div></div>
1958</li>
1959<li>
1960
1961<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
1962
1963<div>
1964<div>
1965<pre class="source">ltrim(&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;, &quot;&#x1f468;&#x200d;&#x1f466;&quot;)
1966</pre></div></div>
1967</li>
1968<li>
1969
1970<p>The expected result is (only woman, girl and boy are left in the family):</p>
1971
1972<div>
1973<div>
1974<pre class="source">&quot;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;
1975</pre></div></div>
1976</li>
1977</ul></div>
1978<div class="section">
1979<h3><a name="position"></a>position</h3>
1980<ul>
1981
1982<li>
1983
1984<p>Syntax:</p>
1985
1986<div>
1987<div>
1988<pre class="source">position(string, string_pattern)
1989</pre></div></div>
1990</li>
1991<li>
1992
1993<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>
1994</li>
1995<li>
1996
1997<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>
1998<ul>
1999
2000<li>0-based: <tt>position</tt>, <tt>pos</tt>, <tt>position0</tt>, <tt>pos0</tt>.</li>
2001<li>1-based: <tt>position1</tt>, <tt>pos1</tt>.</li>
2002</ul>
2003</li>
2004<li>
2005
2006<p>Arguments:</p>
2007<ul>
2008
2009<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
2010<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
2011</ul>
2012</li>
2013<li>Return Value:
2014<ul>
2015
2016<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>
2017<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2018<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2019<li>any other non-string input value will return a <tt>null</tt>.</li>
2020</ul>
2021</li>
2022<li>
2023
2024<p>Example:</p>
2025
2026<div>
2027<div>
2028<pre class="source">{
2029 &quot;v1&quot;: position(&quot;ppphonepp&quot;, &quot;phone&quot;),
2030 &quot;v2&quot;: position(&quot;hone&quot;, &quot;phone&quot;),
2031 &quot;v3&quot;: position1(&quot;ppphonepp&quot;, &quot;phone&quot;),
2032 &quot;v4&quot;: position1(&quot;hone&quot;, &quot;phone&quot;)
2033};
2034</pre></div></div>
2035</li>
2036<li>
2037
2038<p>The expected result is:</p>
2039
2040<div>
2041<div>
2042<pre class="source">{ &quot;v1&quot;: 2, &quot;v2&quot;: -1, v3&quot;: 3, &quot;v4&quot;: -1 }
2043</pre></div></div>
2044</li>
2045<li>
2046
2047<p>Example of multi-code-point character:</p>
2048
2049<div>
2050<div>
2051<pre class="source">position(&quot;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x1f3c0;&quot;, &quot;&#x1f3c0;&quot;);
2052</pre></div></div>
2053</li>
2054<li>
2055
2056<p>The expected result is (the emoji family character has 7 code points):</p>
2057
2058<div>
2059<div>
2060<pre class="source">7
2061</pre></div></div>
2062</li>
2063</ul></div>
2064<div class="section">
2065<h3><a name="regexp_contains"></a>regexp_contains</h3>
2066<ul>
2067
2068<li>
2069
2070<p>Syntax:</p>
2071
2072<div>
2073<div>
2074<pre class="source">regexp_contains(string, string_pattern[, string_flags])
2075</pre></div></div>
2076</li>
2077<li>
2078
2079<p>Checks whether the strings <tt>string</tt> contains the regular expression pattern <tt>string_pattern</tt> (a Java regular expression pattern).</p>
2080</li>
2081<li>
2082
2083<p>Aliases:</p>
2084<ul>
2085
2086<li><tt>regexp_contains</tt>, <tt>regex_contains</tt>, <tt>contains_regexp</tt>, <tt>contains_regex</tt>.</li>
2087</ul>
2088</li>
2089<li>
2090
2091<p>Arguments:</p>
2092<ul>
2093
2094<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
2095<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
2096<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
2097<ul>
2098
2099<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
2100</ul>
2101</li>
2102</ul>
2103</li>
2104<li>Return Value:
2105<ul>
2106
2107<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>
2108<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
2109<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
2110<li>any other non-string input value will return a <tt>null</tt>.</li>
2111</ul>
2112</li>
2113<li>
2114
2115<p>Example:</p>
2116
2117<div>
2118<div>
2119<pre class="source">{
2120 &quot;v1&quot;: regexp_contains(&quot;pphonepp&quot;, &quot;p*hone&quot;),
2121 &quot;v2&quot;: regexp_contains(&quot;hone&quot;, &quot;p+hone&quot;)
2122};
2123</pre></div></div>
2124</li>
2125<li>
2126
2127<p>The expected result is:</p>
2128
2129<div>
2130<div>
2131<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
2132</pre></div></div>
2133</li>
2134</ul></div>
2135<div class="section">
2136<h3><a name="regexp_like"></a>regexp_like</h3>
2137<ul>
2138
2139<li>
2140
2141<p>Syntax:</p>
2142
2143<div>
2144<div>
2145<pre class="source">regexp_like(string, string_pattern[, string_flags])
2146</pre></div></div>
2147</li>
2148<li>
2149
2150<p>Checks whether the string <tt>string</tt> exactly matches the regular expression pattern <tt>string_pattern</tt> (a Java regular expression pattern).</p>
2151</li>
2152<li>
2153
2154<p>Aliases:</p>
2155<ul>
2156
2157<li><tt>regexp_like</tt>, <tt>regex_like</tt>.</li>
2158</ul>
2159</li>
2160<li>
2161
2162<p>Arguments:</p>
2163<ul>
2164
2165<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
2166<li><tt>string_pattern</tt> : a pattern <tt>string</tt> that might be contained.</li>
2167<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
2168<ul>
2169
2170<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
2171</ul>
2172</li>
2173</ul>
2174</li>
2175<li>Return Value:
2176<ul>
2177
2178<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>
2179<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
2180<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
2181<li>any other non-string input value will return a <tt>null</tt>.</li>
2182</ul>
2183</li>
2184<li>
2185
2186<p>Example:</p>
2187
2188<div>
2189<div>
2190<pre class="source">{
2191 &quot;v1&quot;: regexp_like(&quot; can't stand acast the network is horrible:(&quot;, &quot;.*acast.*&quot;),
2192 &quot;v2&quot;: regexp_like(&quot;acast&quot;, &quot;.*acst.*&quot;)
2193};
2194</pre></div></div>
2195</li>
2196<li>
2197
2198<p>The expected result is:</p>
2199
2200<div>
2201<div>
2202<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
2203</pre></div></div>
2204</li>
2205</ul></div>
2206<div class="section">
2207<h3><a name="regexp_position"></a>regexp_position</h3>
2208<ul>
2209
2210<li>
2211
2212<p>Syntax:</p>
2213
2214<div>
2215<div>
2216<pre class="source">regexp_position(string, string_pattern[, string_flags])
2217</pre></div></div>
2218</li>
2219<li>
2220
2221<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>
2222</li>
2223<li>
2224
2225<p>Aliases:</p>
2226<ul>
2227
2228<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>
2229<li>1-Based: <tt>regexp_position1</tt>, <tt>regexp_pos1</tt>, <tt>regex_position1</tt> <tt>regex_pos1</tt>.</li>
2230</ul>
2231</li>
2232<li>
2233
2234<p>Arguments:</p>
2235<ul>
2236
2237<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
2238<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
2239<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
2240<ul>
2241
2242<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
2243</ul>
2244</li>
2245</ul>
2246</li>
2247<li>Return Value:
2248<ul>
2249
2250<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>
2251<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2252<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2253<li>any other non-string input value will return a <tt>null</tt>.</li>
2254</ul>
2255</li>
2256<li>
2257
2258<p>Example:</p>
2259
2260<div>
2261<div>
2262<pre class="source">{
2263 &quot;v1&quot;: regexp_position(&quot;pphonepp&quot;, &quot;p*hone&quot;),
2264 &quot;v2&quot;: regexp_position(&quot;hone&quot;, &quot;p+hone&quot;),
2265 &quot;v3&quot;: regexp_position1(&quot;pphonepp&quot;, &quot;p*hone&quot;),
2266 &quot;v4&quot;: regexp_position1(&quot;hone&quot;, &quot;p+hone&quot;)
2267};
2268</pre></div></div>
2269</li>
2270<li>
2271
2272<p>The expected result is:</p>
2273
2274<div>
2275<div>
2276<pre class="source">{ &quot;v1&quot;: 0, &quot;v2&quot;: -1, &quot;v3&quot;: 1, &quot;v4&quot;: -1 }
2277</pre></div></div>
2278</li>
2279</ul></div>
2280<div class="section">
2281<h3><a name="regexp_replace"></a>regexp_replace</h3>
2282<ul>
2283
2284<li>
2285
2286<p>Syntax:</p>
2287
2288<div>
2289<div>
2290<pre class="source">regexp_replace(string, string_pattern, string_replacement[, string_flags])
2291regexp_replace(string, string_pattern, string_replacement[, replacement_limit])
2292</pre></div></div>
2293</li>
2294<li>
2295
2296<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>
2297</li>
2298<li>
2299
2300<p>Aliases:</p>
2301<ul>
2302
2303<li><tt>regexp_replace</tt>, <tt>regex_replace</tt>.</li>
2304</ul>
2305</li>
2306<li>
2307
2308<p>Arguments:</p>
2309<ul>
2310
2311<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
2312<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
2313<li><tt>string_replacement</tt> : a pattern <tt>string</tt> to be used as the replacement.</li>
2314<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during replace.
2315<ul>
2316
2317<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
2318</ul>
2319</li>
2320<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>
2321</ul>
2322</li>
2323<li>Return Value:
2324<ul>
2325
2326<li>Returns a <tt>string</tt> that is obtained after the replacements.</li>
2327<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
2328<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
2329<li>any other non-string input value will return a <tt>null</tt>.</li>
2330</ul>
2331</li>
2332<li>
2333
2334<p>Example:</p>
2335
2336<div>
2337<div>
2338<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;);
2339</pre></div></div>
2340</li>
2341<li>
2342
2343<p>The expected result is:</p>
2344
2345<div>
2346<div>
2347<pre class="source">&quot;like product-a the voicemail_service is awesome&quot;
2348</pre></div></div>
2349</li>
2350</ul></div>
2351<div class="section">
2352<h3><a name="repeat"></a>repeat</h3>
2353<ul>
2354
2355<li>
2356
2357<p>Syntax:</p>
2358
2359<div>
2360<div>
2361<pre class="source">repeat(string, n)
2362</pre></div></div>
2363</li>
2364<li>
2365
2366<p>Returns a string formed by repeating the input <tt>string</tt> <tt>n</tt> times.</p>
2367</li>
2368<li>Arguments:
2369<ul>
2370
2371<li><tt>string</tt> : a <tt>string</tt> to be repeated,</li>
2372<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>
2373</ul>
2374</li>
2375<li>Return Value:
2376<ul>
2377
2378<li>a string that repeats the input <tt>string</tt> <tt>n</tt> times,</li>
2379<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2380<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2381<li>a type error will be raised if:
2382<ul>
2383
2384<li>the first argument is any other non-string value,</li>
2385<li>or, the second argument is not a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt>.</li>
2386</ul>
2387</li>
2388</ul>
2389</li>
2390<li>
2391
2392<p>Example:</p>
2393
2394<div>
2395<div>
2396<pre class="source">repeat(&quot;test&quot;, 3);
2397</pre></div></div>
2398</li>
2399<li>
2400
2401<p>The expected result is:</p>
2402
2403<div>
2404<div>
2405<pre class="source">&quot;testtesttest&quot;
2406</pre></div></div>
2407</li>
2408</ul></div>
2409<div class="section">
2410<h3><a name="replace"></a>replace</h3>
2411<ul>
2412
2413<li>
2414
2415<p>Syntax:</p>
2416
2417<div>
2418<div>
2419<pre class="source">replace(string, search_string, replacement_string[, limit])
2420</pre></div></div>
2421</li>
2422<li>
2423
2424<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>
2425</li>
2426<li>Arguments:
2427<ul>
2428
2429<li><tt>string</tt> : an input <tt>string</tt>,</li>
2430<li><tt>search_string</tt> : a <tt>string</tt> substring to be searched for,</li>
2431<li><tt>replacement_string</tt> : a <tt>string</tt> to be used as the replacement,</li>
2432<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>
2433</ul>
2434</li>
2435<li>Return Value:
2436<ul>
2437
2438<li>Returns a <tt>string</tt> that is obtained after the replacements,</li>
2439<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2440<li>any other non-string input value or non-integer <tt>limit</tt> will cause a type error,</li>
2441<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
2442</ul>
2443</li>
2444<li>
2445
2446<p>Example:</p>
2447
2448<div>
2449<div>
2450<pre class="source">{
2451 &quot;v1&quot;: replace(&quot; like x-phone the voicemail_service is awesome&quot;, &quot; like x-phone&quot;, &quot;like product-a&quot;),
2452 &quot;v2&quot;: replace(&quot;x-phone and x-phone&quot;, &quot;x-phone&quot;, &quot;product-a&quot;, 1)
2453};
2454</pre></div></div>
2455</li>
2456<li>
2457
2458<p>The expected result is:</p>
2459
2460<div>
2461<div>
2462<pre class="source">{
2463 &quot;v1&quot;: &quot;like product-a the voicemail_service is awesome&quot;,
2464 &quot;v2&quot;: &quot;product-a and x-phone&quot;
2465}
2466</pre></div></div>
2467</li>
2468</ul></div>
2469<div class="section">
2470<h3><a name="reverse"></a>reverse</h3>
2471<ul>
2472
2473<li>
2474
2475<p>Syntax:</p>
2476
2477<div>
2478<div>
2479<pre class="source">reverse(string)
2480</pre></div></div>
2481</li>
2482<li>
2483
2484<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>
2485</li>
2486<li>Arguments:
2487<ul>
2488
2489<li><tt>string</tt> : a <tt>string</tt> to be reversed</li>
2490</ul>
2491</li>
2492<li>Return Value:
2493<ul>
2494
2495<li>a string containing characters from the the input <tt>string</tt> in the reverse order,</li>
2496<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2497<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2498<li>a type error will be raised if:
2499<ul>
2500
2501<li>the first argument is any other non-string value</li>
2502</ul>
2503</li>
2504</ul>
2505</li>
2506<li>
2507
2508<p>Example:</p>
2509
2510<div>
2511<div>
2512<pre class="source">reverse(&quot;hello&quot;);
2513</pre></div></div>
2514</li>
2515<li>
2516
2517<p>The expected result is:</p>
2518
2519<div>
2520<div>
2521<pre class="source">&quot;olleh&quot;
2522</pre></div></div>
2523</li>
2524<li>
2525
2526<p>Example of multi-code-point character (Korean):</p>
2527
2528<div>
2529<div>
2530<pre class="source">reverse(&quot;&#x1112;&#x1161;&#x11ab;&#x1100;&#x1173;&#x11af;&quot;);
2531</pre></div></div>
2532</li>
2533<li>
2534
2535<p>The expected result is (the Korean characters are splitted into code points and then the code points are reversed):</p>
2536
2537<div>
2538<div>
2539<pre class="source">&quot;&#x11af;&#x1173;&#x1100;&#x11ab;&#x1161;&#x1112;&quot;
2540</pre></div></div>
2541</li>
2542</ul></div>
2543<div class="section">
2544<h3><a name="rtrim"></a>rtrim</h3>
2545<ul>
2546
2547<li>
2548
2549<p>Syntax:</p>
2550
2551<div>
2552<div>
2553<pre class="source">rtrim(string[, chars]);
2554</pre></div></div>
2555</li>
2556<li>
2557
2558<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>
2559</li>
2560<li>Arguments:
2561<ul>
2562
2563<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
2564<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
2565</ul>
2566</li>
2567<li>Return Value:
2568<ul>
2569
2570<li>a trimmed, new <tt>string</tt>,</li>
2571<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2572<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2573<li>any other non-string input value will cause a type error.</li>
2574</ul>
2575</li>
2576<li>Related functions: see <tt>trim()</tt>, <tt>ltrim()</tt></li>
2577<li>
2578
2579<p>Example:</p>
2580
2581<div>
2582<div>
2583<pre class="source">{
2584 &quot;v1&quot;: rtrim(&quot;i like x-phone&quot;, &quot;x-phone&quot;),
2585 &quot;v2&quot;: rtrim(&quot;i like x-phone&quot;, &quot;onexph&quot;)
2586};
2587</pre></div></div>
2588</li>
2589<li>
2590
2591<p>The expected result is:</p>
2592
2593<div>
2594<div>
2595<pre class="source">{ &quot;v1&quot;: &quot;i like &quot;, &quot;v2&quot;: &quot;i like x-&quot; }
2596</pre></div></div>
2597</li>
2598<li>
2599
2600<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
2601
2602<div>
2603<div>
2604<pre class="source">rtrim(&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;, &quot;&#x1f468;&#x200d;&#x1f466;&quot;)
2605</pre></div></div>
2606</li>
2607<li>
2608
2609<p>The expected result is (only man, woman and girl are left in the family):</p>
2610
2611<div>
2612<div>
2613<pre class="source">&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&quot;
2614</pre></div></div>
2615</li>
2616</ul></div>
2617<div class="section">
2618<h3><a name="split"></a>split</h3>
2619<ul>
2620
2621<li>
2622
2623<p>Syntax:</p>
2624
2625<div>
2626<div>
2627<pre class="source">split(string, sep)
2628</pre></div></div>
2629</li>
2630<li>
2631
2632<p>Splits the input <tt>string</tt> into an array of substrings separated by the string <tt>sep</tt>.</p>
2633</li>
2634<li>Arguments:
2635<ul>
2636
2637<li><tt>string</tt> : a <tt>string</tt> to be split.</li>
2638</ul>
2639</li>
2640<li>Return Value:
2641<ul>
2642
2643<li>an array of substrings by splitting the input <tt>string</tt> by <tt>sep</tt>,</li>
2644<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>
2645<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
2646<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
2647<li>any other non-string input value will cause a type error.</li>
2648</ul>
2649</li>
2650<li>
2651
2652<p>Example:</p>
2653
2654<div>
2655<div>
2656<pre class="source">split(&quot;test driven development&quot;, &quot; &quot;);
2657</pre></div></div>
2658</li>
2659<li>
2660
2661<p>The expected result is:</p>
2662
2663<div>
2664<div>
2665<pre class="source">[ &quot;test&quot;, &quot;driven&quot;, &quot;development&quot; ]
2666</pre></div></div>
2667</li>
2668<li>
2669
2670<p>Example with two consecutive <tt>sep</tt>s in the <tt>string</tt>:</p>
2671
2672<div>
2673<div>
2674<pre class="source">split(&quot;123//456&quot;, &quot;/&quot;);
2675</pre></div></div>
2676</li>
2677<li>
2678
2679<p>The expected result is:</p>
2680
2681<div>
2682<div>
2683<pre class="source">[ &quot;123&quot;, &quot;&quot;, &quot;456&quot; ]
2684</pre></div></div>
2685</li>
2686</ul></div>
2687<div class="section">
2688<h3><a name="starts_with"></a>starts_with</h3>
2689<ul>
2690
2691<li>
2692
2693<p>Syntax:</p>
2694
2695<div>
2696<div>
2697<pre class="source">starts_with(string, substring_to_start_with)
2698</pre></div></div>
2699</li>
2700<li>
2701
2702<p>Checks whether the string <tt>string</tt> starts with the string <tt>substring_to_start_with</tt>.</p>
2703</li>
2704<li>Arguments:
2705<ul>
2706
2707<li><tt>string</tt> : a <tt>string</tt> that might start with the given string.</li>
2708<li><tt>substring_to_start_with</tt> : a <tt>string</tt> that might be contained as the starting substring.</li>
2709</ul>
2710</li>
2711<li>Return Value:
2712<ul>
2713
2714<li>a <tt>boolean</tt>, returns <tt>true</tt> if <tt>string</tt> starts with the string <tt>substring_to_start_with</tt>,</li>
2715<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2716<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2717<li>any other non-string input value will cause a type error,</li>
2718<li><tt>false</tt> otherwise.</li>
2719</ul>
2720</li>
2721<li>
2722
2723<p>Example:</p>
2724
2725<div>
2726<div>
2727<pre class="source">{
2728 &quot;v1&quot; : starts_with(&quot; like the plan, amazing&quot;, &quot; like&quot;),
2729 &quot;v2&quot; : starts_with(&quot;I like the plan, amazing&quot;, &quot; like&quot;)
2730};
2731</pre></div></div>
2732</li>
2733<li>
2734
2735<p>The expected result is:</p>
2736
2737<div>
2738<div>
2739<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
2740</pre></div></div>
2741</li>
2742</ul></div>
2743<div class="section">
2744<h3><a name="substr"></a>substr</h3>
2745<ul>
2746
2747<li>
2748
2749<p>Syntax:</p>
2750
2751<div>
2752<div>
2753<pre class="source">substr(string, offset[, length])
2754</pre></div></div>
2755</li>
2756<li>
2757
2758<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>
2759</li>
2760<li>
2761
2762<p>Aliases:</p>
2763<ul>
2764
2765<li>0-Based: <tt>substring</tt>, <tt>substr</tt>, <tt>substring0</tt>, <tt>substr0</tt>.</li>
2766<li>1-Based: <tt>substring1</tt>, <tt>substr1</tt>.</li>
2767</ul>
2768</li>
2769<li>
2770
2771<p>Arguments:</p>
2772<ul>
2773
2774<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
2775<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>
2776<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>
2777</ul>
2778</li>
2779<li>Return Value:
2780<ul>
2781
2782<li>a <tt>string</tt> that represents the substring,</li>
2783<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2784<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>
2785<li>a <tt>null</tt> will be returned if:
2786<ul>
2787
2788<li>the first argument is any other non-string value.</li>
2789<li>the second argument is not a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt>.</li>
2790<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>
2791</ul>
2792</li>
2793</ul>
2794</li>
2795<li>
2796
2797<p>Example:</p>
2798
2799<div>
2800<div>
2801<pre class="source">{ &quot;v1&quot;: substr(&quot;test string&quot;, 6, 3), &quot;v2&quot;: substr1(&quot;test string&quot;, 6, 3) };
2802</pre></div></div>
2803</li>
2804<li>
2805
2806<p>The expected result is:</p>
2807
2808<div>
2809<div>
2810<pre class="source">{ &quot;v1&quot;: &quot;tri&quot;, &quot;v2&quot;: &quot;str&quot; }
2811</pre></div></div>
2812</li>
2813</ul>
2814<p>The function has an alias <tt>substring</tt>.</p></div>
2815<div class="section">
2816<h3><a name="trim"></a>trim</h3>
2817<ul>
2818
2819<li>
2820
2821<p>Syntax:</p>
2822
2823<div>
2824<div>
2825<pre class="source">trim(string[, chars]);
2826</pre></div></div>
2827</li>
2828<li>
2829
2830<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>
2831</li>
2832<li>Arguments:
2833<ul>
2834
2835<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
2836<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
2837</ul>
2838</li>
2839<li>Return Value:
2840<ul>
2841
2842<li>a trimmed, new <tt>string</tt>,</li>
2843<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
2844<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2845<li>any other non-string input value will cause a type error.</li>
2846</ul>
2847</li>
2848<li>Related functions: see <tt>ltrim()</tt>, <tt>rtrim()</tt></li>
2849<li>
2850
2851<p>Example:</p>
2852
2853<div>
2854<div>
2855<pre class="source">trim(&quot;i like x-phone&quot;, &quot;xphoen&quot;);
2856</pre></div></div>
2857</li>
2858<li>
2859
2860<p>The expected result is:</p>
2861
2862<div>
2863<div>
2864<pre class="source">&quot; like &quot;
2865</pre></div></div>
2866</li>
2867<li>
2868
2869<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
2870<p>trim(&#x201c;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x201d;, &#x201c;&#x1f468;&#x200d;&#x1f466;&#x201d;)</p>
2871</li>
2872<li>
2873
2874<p>The expected result is (only woman and girl are left in the family):</p>
2875
2876<div>
2877<div>
2878<pre class="source"> &quot;&#x1f469;&#x200d;&#x1f467;&quot;
2879</pre></div></div>
2880</li>
2881</ul></div>
2882<div class="section">
2883<h3><a name="upper"></a>upper</h3>
2884<ul>
2885
2886<li>
2887
2888<p>Syntax:</p>
2889
2890<div>
2891<div>
2892<pre class="source">upper(string)
2893</pre></div></div>
2894</li>
2895<li>
2896
2897<p>Converts a given string <tt>string</tt> to its uppercase form.</p>
2898</li>
2899<li>Arguments:
2900<ul>
2901
2902<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
2903</ul>
2904</li>
2905<li>Return Value:
2906<ul>
2907
2908<li>a <tt>string</tt> as the uppercase form of the given <tt>string</tt>,</li>
2909<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
2910<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
2911<li>any other non-string input value will cause a type error.</li>
2912</ul>
2913</li>
2914<li>
2915
2916<p>Example:</p>
2917
2918<div>
2919<div>
2920<pre class="source">upper(&quot;hello&quot;)
2921</pre></div></div>
2922</li>
2923<li>
2924
2925<p>The expected result is:</p>
2926
2927<div>
2928<div>
2929<pre class="source">&quot;HELLO&quot;
2930</pre></div></div>
2931</li>
2932</ul><!--
2933 ! Licensed to the Apache Software Foundation (ASF) under one
2934 ! or more contributor license agreements. See the NOTICE file
2935 ! distributed with this work for additional information
2936 ! regarding copyright ownership. The ASF licenses this file
2937 ! to you under the Apache License, Version 2.0 (the
2938 ! "License"); you may not use this file except in compliance
2939 ! with the License. You may obtain a copy of the License at
2940 !
2941 ! http://www.apache.org/licenses/LICENSE-2.0
2942 !
2943 ! Unless required by applicable law or agreed to in writing,
2944 ! software distributed under the License is distributed on an
2945 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
2946 ! KIND, either express or implied. See the License for the
2947 ! specific language governing permissions and limitations
2948 ! under the License.
2949 !-->
2950</div>
2951<div class="section">
2952<h3><a name="string_concat"></a>string_concat</h3>
2953<ul>
2954
2955<li>
2956
2957<p>Syntax:</p>
2958
2959<div>
2960<div>
2961<pre class="source">string_concat(array)
2962</pre></div></div>
2963</li>
2964<li>
2965
2966<p>Concatenates an array of strings <tt>array</tt> into a single string.</p>
2967</li>
2968<li>Arguments:
2969<ul>
2970
2971<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>
2972</ul>
2973</li>
2974<li>Return Value:
2975<ul>
2976
2977<li>the concatenated <tt>string</tt> value,</li>
2978<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
2979<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
2980<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
2981<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>
2982<li>any other non-array input value or non-integer element in the input array will cause a type error.</li>
2983</ul>
2984</li>
2985<li>
2986
2987<p>Example:</p>
2988
2989<div>
2990<div>
2991<pre class="source">string_concat([&quot;ASTERIX&quot;, &quot; &quot;, &quot;ROCKS!&quot;]);
2992</pre></div></div>
2993</li>
2994<li>
2995
2996<p>The expected result is:</p>
2997
2998<div>
2999<div>
3000<pre class="source">&quot;ASTERIX ROCKS!&quot;
3001</pre></div></div>
3002</li>
3003</ul></div>
3004<div class="section">
3005<h3><a name="string_join"></a>string_join</h3>
3006<ul>
3007
3008<li>
3009
3010<p>Syntax:</p>
3011
3012<div>
3013<div>
3014<pre class="source">string_join(array, string)
3015</pre></div></div>
3016</li>
3017<li>
3018
3019<p>Joins an array or multiset of strings <tt>array</tt> with the given separator <tt>string</tt> into a single string.</p>
3020</li>
3021<li>Arguments:
3022<ul>
3023
3024<li><tt>array</tt> : an <tt>array</tt> or <tt>multiset</tt> of strings (could be <tt>null</tt>) to be joined.</li>
3025<li><tt>string</tt> : a <tt>string</tt> to serve as the separator.</li>
3026</ul>
3027</li>
3028<li>Return Value:
3029<ul>
3030
3031<li>the joined <tt>string</tt>,</li>
3032<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3033<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3034<li><tt>missing</tt> if the first argument array contains a <tt>missing</tt>,</li>
3035<li><tt>null</tt> if the first argument array contains a <tt>null</tt> but does not contain a <tt>missing</tt>,</li>
3036<li>a type error will be raised if:
3037<ul>
3038
3039<li>the first argument is any other non-array value, or contains any other non-string value,</li>
3040<li>or, the second argument is any other non-string value.</li>
3041</ul>
3042</li>
3043</ul>
3044</li>
3045<li>
3046
3047<p>Example:</p>
3048
3049<div>
3050<div>
3051<pre class="source">string_join([&quot;ASTERIX&quot;, &quot;ROCKS~&quot;], &quot;!! &quot;);
3052</pre></div></div>
3053</li>
3054<li>
3055
3056<p>The expected result is:</p>
3057
3058<div>
3059<div>
3060<pre class="source">&quot;ASTERIX!! ROCKS~&quot;
3061</pre></div></div>
3062</li>
3063</ul></div>
3064<div class="section">
3065<h3><a name="string_to_codepoint"></a>string_to_codepoint</h3>
3066<ul>
3067
3068<li>
3069
3070<p>Syntax:</p>
3071
3072<div>
3073<div>
3074<pre class="source">string_to_codepoint(string)
3075</pre></div></div>
3076</li>
3077<li>
3078
3079<p>Converts the string <tt>string</tt> to its code_based representation.</p>
3080</li>
3081<li>Arguments:
3082<ul>
3083
3084<li><tt>string</tt> : a <tt>string</tt> that will be converted.</li>
3085</ul>
3086</li>
3087<li>Return Value:
3088<ul>
3089
3090<li>an <tt>array</tt> of the code points for the string <tt>string</tt>,</li>
3091<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3092<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3093<li>any other non-string input value will cause a type error.</li>
3094</ul>
3095</li>
3096<li>
3097
3098<p>Example:</p>
3099
3100<div>
3101<div>
3102<pre class="source">string_to_codepoint(&quot;Hello ASTERIX!&quot;);
3103</pre></div></div>
3104</li>
3105<li>
3106
3107<p>The expected result is:</p>
3108
3109<div>
3110<div>
3111<pre class="source">[ 72, 101, 108, 108, 111, 32, 65, 83, 84, 69, 82, 73, 88, 33 ]
3112</pre></div></div>
3113</li>
3114</ul></div>
3115<div class="section">
3116<h3><a name="codepoint_to_string"></a>codepoint_to_string</h3>
3117<ul>
3118
3119<li>
3120
3121<p>Syntax:</p>
3122
3123<div>
3124<div>
3125<pre class="source">codepoint_to_string(array)
3126</pre></div></div>
3127</li>
3128<li>
3129
3130<p>Converts the ordered code_based representation <tt>array</tt> to the corresponding string.</p>
3131</li>
3132<li>Arguments:
3133<ul>
3134
3135<li><tt>array</tt> : an <tt>array</tt> of integer code_points.</li>
3136</ul>
3137</li>
3138<li>Return Value:
3139<ul>
3140
3141<li>a <tt>string</tt> representation of <tt>array</tt>.</li>
3142<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3143<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3144<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
3145<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>
3146<li>any other non-array input value or non-integer element in the input array will cause a type error.</li>
3147</ul>
3148</li>
3149<li>
3150
3151<p>Example:</p>
3152
3153<div>
3154<div>
3155<pre class="source">codepoint_to_string([72, 101, 108, 108, 111, 32, 65, 83, 84, 69, 82, 73, 88, 33]);
3156</pre></div></div>
3157</li>
3158<li>
3159
3160<p>The expected result is:</p>
3161
3162<div>
3163<div>
3164<pre class="source">&quot;Hello ASTERIX!&quot;
3165</pre></div></div>
3166</li>
3167</ul></div>
3168<div class="section">
3169<h3><a name="substring_before"></a>substring_before</h3>
3170<ul>
3171
3172<li>
3173
3174<p>Syntax:</p>
3175
3176<div>
3177<div>
3178<pre class="source">substring_before(string, string_pattern)
3179</pre></div></div>
3180</li>
3181<li>
3182
3183<p>Returns the substring from the given string <tt>string</tt> before the given pattern <tt>string_pattern</tt>.</p>
3184</li>
3185<li>Arguments:
3186<ul>
3187
3188<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
3189<li><tt>string_pattern</tt> : a <tt>string</tt> pattern to be searched.</li>
3190</ul>
3191</li>
3192<li>Return Value:
3193<ul>
3194
3195<li>a <tt>string</tt> that represents the substring,</li>
3196<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3197<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3198<li>any other non-string input value will cause a type error.</li>
3199</ul>
3200</li>
3201<li>
3202
3203<p>Example:</p>
3204
3205<div>
3206<div>
3207<pre class="source">substring_before(&quot; like x-phone&quot;, &quot;x-phone&quot;);
3208</pre></div></div>
3209</li>
3210<li>
3211
3212<p>The expected result is:</p>
3213
3214<div>
3215<div>
3216<pre class="source">&quot; like &quot;
3217</pre></div></div>
3218</li>
3219</ul></div>
3220<div class="section">
3221<h3><a name="substring_after"></a>substring_after</h3>
3222<ul>
3223
3224<li>
3225
3226<p>Syntax:</p>
3227<p>substring_after(string, string_pattern);</p>
3228</li>
3229<li>
3230
3231<p>Returns the substring from the given string <tt>string</tt> after the given pattern <tt>string_pattern</tt>.</p>
3232</li>
3233<li>Arguments:
3234<ul>
3235
3236<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
3237<li><tt>string_pattern</tt> : a <tt>string</tt> pattern to be searched.</li>
3238</ul>
3239</li>
3240<li>Return Value:
3241<ul>
3242
3243<li>a <tt>string</tt> that represents the substring,</li>
3244<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3245<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3246<li>any other non-string input value will cause a type error.</li>
3247</ul>
3248</li>
3249<li>
3250
3251<p>Example:</p>
3252
3253<div>
3254<div>
3255<pre class="source">substring_after(&quot; like x-phone&quot;, &quot;xph&quot;);
3256</pre></div></div>
3257</li>
3258<li>
3259
3260<p>The expected result is:</p>
3261
3262<div>
3263<div>
3264<pre class="source">&quot;one&quot;
3265</pre></div></div>
3266</li>
3267</ul><!--
3268 ! Licensed to the Apache Software Foundation (ASF) under one
3269 ! or more contributor license agreements. See the NOTICE file
3270 ! distributed with this work for additional information
3271 ! regarding copyright ownership. The ASF licenses this file
3272 ! to you under the Apache License, Version 2.0 (the
3273 ! "License"); you may not use this file except in compliance
3274 ! with the License. You may obtain a copy of the License at
3275 !
3276 ! http://www.apache.org/licenses/LICENSE-2.0
3277 !
3278 ! Unless required by applicable law or agreed to in writing,
3279 ! software distributed under the License is distributed on an
3280 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
3281 ! KIND, either express or implied. See the License for the
3282 ! specific language governing permissions and limitations
3283 ! under the License.
3284 !-->
3285</div></div>
3286<div class="section">
3287<h2><a name="Binary_Functions"></a><a name="BinaryFunctions" id="BinaryFunctions">Binary Functions</a></h2>
3288<div class="section">
3289<h3><a name="parse_binary"></a>parse_binary</h3>
3290<ul>
3291
3292<li>
3293
3294<p>Syntax:</p>
3295<p>parse_binary(string, encoding)</p>
3296</li>
3297<li>
3298
3299<p>Creates a <tt>binary</tt> from an string encoded in <tt>encoding</tt> format.</p>
3300</li>
3301<li>Arguments:
3302<ul>
3303
3304<li><tt>string</tt> : an encoded <tt>string</tt>,</li>
3305<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>
3306</ul>
3307</li>
3308<li>Return Value:
3309<ul>
3310
3311<li>a <tt>binary</tt> that is decoded from the given <tt>string</tt>,</li>
3312<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3313<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3314<li>any other non-string input value will cause a type error.</li>
3315</ul>
3316</li>
3317<li>
3318
3319<p>Example:</p>
3320<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>
3321</li>
3322<li>
3323
3324<p>The expected result is:</p>
3325<p>[ hex(&#x201c;ABCDEF0123456789&#x201d;), hex(&#x201c;ABCDEF0123456789&#x201d;), hex(&#x201c;4173746572697801&#x201d;) ]</p>
3326</li>
3327</ul></div>
3328<div class="section">
3329<h3><a name="print_binary"></a>print_binary</h3>
3330<ul>
3331
3332<li>
3333
3334<p>Syntax:</p>
3335<p>print_binary(binary, encoding)</p>
3336</li>
3337<li>
3338
3339<p>Prints a <tt>binary</tt> to the required encoding <tt>string</tt> format.</p>
3340</li>
3341<li>Arguments:
3342<ul>
3343
3344<li><tt>binary</tt> : a <tt>binary</tt> data need to be printed.</li>
3345<li><tt>encoding</tt> : a string notation specifies the expected encoding type. Currently we support <tt>hex</tt> and <tt>base64</tt> format.</li>
3346</ul>
3347</li>
3348<li>Return Value:
3349<ul>
3350
3351<li>a <tt>string</tt> that represents the encoded format of a <tt>binary</tt>,</li>
3352<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3353<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3354<li>any other non-string input value will cause a type error.</li>
3355</ul>
3356</li>
3357<li>
3358
3359<p>Example:</p>
3360
3361<div>
3362<div>
3363<pre class="source">[ print_binary(hex(&quot;ABCDEF0123456789&quot;), &quot;base64&quot;), print_binary(base64(&quot;q83vASNFZ4k=&quot;), &quot;hex&quot;) ]
3364</pre></div></div>
3365</li>
3366<li>
3367
3368<p>The expected result are:</p>
3369
3370<div>
3371<div>
3372<pre class="source">[ &quot;q83vASNFZ4k=&quot;, &quot;ABCDEF0123456789&quot; ]
3373</pre></div></div>
3374</li>
3375</ul></div>
3376<div class="section">
3377<h3><a name="binary_length"></a>binary_length</h3>
3378<ul>
3379
3380<li>
3381
3382<p>Syntax:</p>
3383<p>binary_length(binary)</p>
3384</li>
3385<li>
3386
3387<p>Returns the number of bytes storing the binary data.</p>
3388</li>
3389<li>Arguments:
3390<ul>
3391
3392<li><tt>binary</tt> : a <tt>binary</tt> value to be checked.</li>
3393</ul>
3394</li>
3395<li>Return Value:
3396<ul>
3397
3398<li>an <tt>bigint</tt> that represents the number of bytes,</li>
3399<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3400<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3401<li>any other non-binary input value will cause a type error.</li>
3402</ul>
3403</li>
3404<li>
3405
3406<p>Example:</p>
3407
3408<div>
3409<div>
3410<pre class="source">binary_length(hex(&quot;00AA&quot;))
3411</pre></div></div>
3412</li>
3413<li>
3414
3415<p>The expected result is:</p>
3416<p>2</p>
3417</li>
3418</ul></div>
3419<div class="section">
3420<h3><a name="sub_binary"></a>sub_binary</h3>
3421<ul>
3422
3423<li>
3424
3425<p>Syntax:</p>
3426<p>sub_binary(binary, offset[, length])</p>
3427</li>
3428<li>
3429
3430<p>Returns the sub binary from the given <tt>binary</tt> based on the given start offset with the optional <tt>length</tt>.</p>
3431</li>
3432<li>Arguments:
3433<ul>
3434
3435<li><tt>binary</tt> : a <tt>binary</tt> to be extracted,</li>
3436<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>
3437<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>
3438</ul>
3439</li>
3440<li>Return Value:
3441<ul>
3442
3443<li>a <tt>binary</tt> that represents the sub binary,</li>
3444<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3445<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3446<li>a type error will be raised if:
3447<ul>
3448
3449<li>the first argument is any other non-binary value,</li>
3450<li>or, the second argument is any other non-integer value,</li>
3451<li>or, the third argument is any other non-integer value, if it is present.</li>
3452</ul>
3453</li>
3454</ul>
3455</li>
3456<li>
3457
3458<p>Example:</p>
3459
3460<div>
3461<div>
3462<pre class="source">sub_binary(hex(&quot;AABBCCDD&quot;), 4);
3463</pre></div></div>
3464</li>
3465<li>
3466
3467<p>The expected result is</p>
3468
3469<div>
3470<div>
3471<pre class="source">hex(&quot;DD&quot;)
3472</pre></div></div>
3473</li>
3474</ul></div>
3475<div class="section">
3476<h3><a name="binary_concat"></a>binary_concat</h3>
3477<ul>
3478
3479<li>
3480
3481<p>Syntax:</p>
3482<p>binary_concat(array)</p>
3483</li>
3484<li>
3485
3486<p>Concatenates a binary <tt>array</tt> or <tt>multiset</tt> into a single binary.</p>
3487</li>
3488<li>Arguments:
3489<ul>
3490
3491<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>
3492</ul>
3493</li>
3494<li>Return Value :
3495<ul>
3496
3497<li>the concatenated <tt>binary</tt> value,</li>
3498<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3499<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3500<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
3501<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>
3502<li>any other non-array input value or non-binary element in the input array will cause a type error.</li>
3503</ul>
3504</li>
3505<li>
3506
3507<p>Example:</p>
3508<p>binary_concat([hex(&#x201c;42&#x201d;), hex(&quot;&quot;), hex(&#x2018;42&#x2019;)]);</p>
3509</li>
3510<li>
3511
3512<p>The expected result is</p>
3513<p>hex(&#x201c;4242&#x201d;)</p>
3514</li>
3515</ul><!--
3516 ! Licensed to the Apache Software Foundation (ASF) under one
3517 ! or more contributor license agreements. See the NOTICE file
3518 ! distributed with this work for additional information
3519 ! regarding copyright ownership. The ASF licenses this file
3520 ! to you under the Apache License, Version 2.0 (the
3521 ! "License"); you may not use this file except in compliance
3522 ! with the License. You may obtain a copy of the License at
3523 !
3524 ! http://www.apache.org/licenses/LICENSE-2.0
3525 !
3526 ! Unless required by applicable law or agreed to in writing,
3527 ! software distributed under the License is distributed on an
3528 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
3529 ! KIND, either express or implied. See the License for the
3530 ! specific language governing permissions and limitations
3531 ! under the License.
3532 !-->
3533</div></div>
3534<div class="section">
3535<h2><a name="Spatial_Functions"></a><a name="SpatialFunctions" id="SpatialFunctions">Spatial Functions</a></h2>
3536<div class="section">
3537<h3><a name="create_point"></a>create_point</h3>
3538<ul>
3539
3540<li>
3541
3542<p>Syntax:</p>
3543
3544<div>
3545<div>
3546<pre class="source">create_point(x, y)
3547</pre></div></div>
3548</li>
3549<li>
3550
3551<p>Creates the primitive type <tt>point</tt> using an <tt>x</tt> and <tt>y</tt> value.</p>
3552</li>
3553<li>Arguments:</li>
3554<li><tt>x</tt> : a <tt>double</tt> that represents the x-coordinate,</li>
3555<li><tt>y</tt> : a <tt>double</tt> that represents the y-coordinate.</li>
3556<li>Return Value:</li>
3557<li>a <tt>point</tt> representing the ordered pair (<tt>x</tt>, <tt>y</tt>),</li>
3558<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3559<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3560<li>any other non-double input value will cause a type error.</li>
3561<li>
3562
3563<p>Example:</p>
3564
3565<div>
3566<div>
3567<pre class="source">{ &quot;point&quot;: create_point(30.0,70.0) };
3568</pre></div></div>
3569</li>
3570<li>
3571
3572<p>The expected result is:</p>
3573
3574<div>
3575<div>
3576<pre class="source">{ &quot;point&quot;: point(&quot;30.0,70.0&quot;) }
3577</pre></div></div>
3578</li>
3579</ul></div>
3580<div class="section">
3581<h3><a name="create_line"></a>create_line</h3>
3582<ul>
3583
3584<li>
3585
3586<p>Syntax:</p>
3587
3588<div>
3589<div>
3590<pre class="source">create_line(point1, point2)
3591</pre></div></div>
3592</li>
3593<li>
3594
3595<p>Creates the primitive type <tt>line</tt> using <tt>point1</tt> and <tt>point2</tt>.</p>
3596</li>
3597<li>Arguments:
3598<ul>
3599
3600<li><tt>point1</tt> : a <tt>point</tt> that represents the start point of the line.</li>
3601<li><tt>point2</tt> : a <tt>point</tt> that represents the end point of the line.</li>
3602</ul>
3603</li>
3604<li>Return Value:
3605<ul>
3606
3607<li>a spatial <tt>line</tt> created using the points provided in <tt>point1</tt> and <tt>point2</tt>,</li>
3608<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3609<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3610<li>any other non-point input value will cause a type error.</li>
3611</ul>
3612</li>
3613<li>
3614
3615<p>Example:</p>
3616
3617<div>
3618<div>
3619<pre class="source">{ &quot;line&quot;: create_line(create_point(30.0,70.0), create_point(50.0,90.0)) };
3620</pre></div></div>
3621</li>
3622<li>
3623
3624<p>The expected result is:</p>
3625
3626<div>
3627<div>
3628<pre class="source">{ &quot;line&quot;: line(&quot;30.0,70.0 50.0,90.0&quot;) }
3629</pre></div></div>
3630</li>
3631</ul></div>
3632<div class="section">
3633<h3><a name="create_rectangle"></a>create_rectangle</h3>
3634<ul>
3635
3636<li>
3637
3638<p>Syntax:</p>
3639
3640<div>
3641<div>
3642<pre class="source">create_rectangle(point1, point2)
3643</pre></div></div>
3644</li>
3645<li>
3646
3647<p>Creates the primitive type <tt>rectangle</tt> using <tt>point1</tt> and <tt>point2</tt>.</p>
3648</li>
3649<li>Arguments:
3650<ul>
3651
3652<li><tt>point1</tt> : a <tt>point</tt> that represents the lower_left point of the rectangle.</li>
3653<li><tt>point2</tt> : a <tt>point</tt> that represents the upper_right point of the rectangle.</li>
3654</ul>
3655</li>
3656<li>Return Value:
3657<ul>
3658
3659<li>a spatial <tt>rectangle</tt> created using the points provided in <tt>point1</tt> and <tt>point2</tt>,</li>
3660<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3661<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3662<li>any other non-point input value will cause a type error.</li>
3663</ul>
3664</li>
3665<li>
3666
3667<p>Example:</p>
3668
3669<div>
3670<div>
3671<pre class="source">{ &quot;rectangle&quot;: create_rectangle(create_point(30.0,70.0), create_point(50.0,90.0)) };
3672</pre></div></div>
3673</li>
3674<li>
3675
3676<p>The expected result is:</p>
3677
3678<div>
3679<div>
3680<pre class="source">{ &quot;rectangle&quot;: rectangle(&quot;30.0,70.0 50.0,90.0&quot;) }
3681</pre></div></div>
3682</li>
3683</ul></div>
3684<div class="section">
3685<h3><a name="create_circle"></a>create_circle</h3>
3686<ul>
3687
3688<li>
3689
3690<p>Syntax:</p>
3691
3692<div>
3693<div>
3694<pre class="source">create_circle(point, radius)
3695</pre></div></div>
3696</li>
3697<li>
3698
3699<p>Creates the primitive type <tt>circle</tt> using <tt>point</tt> and <tt>radius</tt>.</p>
3700</li>
3701<li>Arguments:
3702<ul>
3703
3704<li><tt>point</tt> : a <tt>point</tt> that represents the center of the circle.</li>
3705<li><tt>radius</tt> : a <tt>double</tt> that represents the radius of the circle.</li>
3706</ul>
3707</li>
3708<li>Return Value:
3709<ul>
3710
3711<li>a spatial <tt>circle</tt> created using the center point and the radius provided in <tt>point</tt> and <tt>radius</tt>.</li>
3712<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3713<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3714<li>a type error will be raised if:
3715<ul>
3716
3717<li>the first argument is any other non-point value,</li>
3718<li>or, the second argument is any other non-double value.</li>
3719</ul>
3720</li>
3721</ul>
3722</li>
3723<li>
3724
3725<p>Example:</p>
3726
3727<div>
3728<div>
3729<pre class="source">{ &quot;circle&quot;: create_circle(create_point(30.0,70.0), 5.0) }
3730</pre></div></div>
3731</li>
3732<li>
3733
3734<p>The expected result is:</p>
3735
3736<div>
3737<div>
3738<pre class="source">{ &quot;circle&quot;: circle(&quot;30.0,70.0 5.0&quot;) }
3739</pre></div></div>
3740</li>
3741</ul></div>
3742<div class="section">
3743<h3><a name="create_polygon"></a>create_polygon</h3>
3744<ul>
3745
3746<li>
3747
3748<p>Syntax:</p>
3749
3750<div>
3751<div>
3752<pre class="source">create_polygon(array)
3753</pre></div></div>
3754</li>
3755<li>
3756
3757<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>
3758</li>
3759<li>Arguments:
3760<ul>
3761
3762<li><tt>array</tt> : an array of doubles representing the points of the polygon.</li>
3763</ul>
3764</li>
3765<li>Return Value:
3766<ul>
3767
3768<li>a <tt>polygon</tt>, represents a spatial simple polygon created using the points provided in <tt>array</tt>.</li>
3769<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3770<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3771<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
3772<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>
3773<li>any other non-array input value or non-double element in the input array will cause a type error.</li>
3774</ul>
3775</li>
3776<li>
3777
3778<p>Example:</p>
3779
3780<div>
3781<div>
3782<pre class="source">{ &quot;polygon&quot;: create_polygon([1.0,1.0,2.0,2.0,3.0,3.0,4.0,4.0]) };
3783</pre></div></div>
3784</li>
3785<li>
3786
3787<p>The expected result is:</p>
3788
3789<div>
3790<div>
3791<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;) }
3792</pre></div></div>
3793</li>
3794</ul></div>
3795<div class="section">
3796<h3><a name="get_x.2Fget_y"></a>get_x/get_y</h3>
3797<ul>
3798
3799<li>
3800
3801<p>Syntax:</p>
3802
3803<div>
3804<div>
3805<pre class="source">get_x(point) or get_y(point)
3806</pre></div></div>
3807</li>
3808<li>
3809
3810<p>Returns the x or y coordinates of a point <tt>point</tt>.</p>
3811</li>
3812<li>Arguments:
3813<ul>
3814
3815<li><tt>point</tt> : a <tt>point</tt>.</li>
3816</ul>
3817</li>
3818<li>Return Value:
3819<ul>
3820
3821<li>a <tt>double</tt> representing the x or y coordinates of the point <tt>point</tt>,</li>
3822<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3823<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3824<li>any other non-point input value will cause a type error.</li>
3825</ul>
3826</li>
3827<li>
3828
3829<p>Example:</p>
3830
3831<div>
3832<div>
3833<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)) };
3834</pre></div></div>
3835</li>
3836<li>
3837
3838<p>The expected result is:</p>
3839
3840<div>
3841<div>
3842<pre class="source">{ &quot;x_coordinate&quot;: 2.3, &quot;y_coordinate&quot;: 5.0 }
3843</pre></div></div>
3844</li>
3845</ul></div>
3846<div class="section">
3847<h3><a name="get_points"></a>get_points</h3>
3848<ul>
3849
3850<li>
3851
3852<p>Syntax:</p>
3853
3854<div>
3855<div>
3856<pre class="source">get_points(spatial_object)
3857</pre></div></div>
3858</li>
3859<li>
3860
3861<p>Returns an ordered array of the points forming the spatial object <tt>spatial_object</tt>.</p>
3862</li>
3863<li>Arguments:
3864<ul>
3865
3866<li><tt>spatial_object</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
3867</ul>
3868</li>
3869<li>Return Value:
3870<ul>
3871
3872<li>an <tt>array</tt> of the points forming the spatial object <tt>spatial_object</tt>,</li>
3873<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3874<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3875<li>any other non-spatial-object input value will cause a type error.</li>
3876</ul>
3877</li>
3878<li>
3879
3880<p>Example:</p>
3881
3882<div>
3883<div>
3884<pre class="source">get_points(create_polygon([1.0,1.0,2.0,2.0,3.0,3.0,4.0,4.0]))
3885</pre></div></div>
3886</li>
3887<li>
3888
3889<p>The expected result is:</p>
3890
3891<div>
3892<div>
3893<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;) ]
3894</pre></div></div>
3895</li>
3896</ul></div>
3897<div class="section">
3898<h3><a name="get_center.2Fget_radius"></a>get_center/get_radius</h3>
3899<ul>
3900
3901<li>
3902
3903<p>Syntax:</p>
3904
3905<div>
3906<div>
3907<pre class="source">get_center(circle_expression) or get_radius(circle_expression)
3908</pre></div></div>
3909</li>
3910<li>
3911
3912<p>Returns the center and the radius of a circle <tt>circle_expression</tt>, respectively.</p>
3913</li>
3914<li>Arguments:
3915<ul>
3916
3917<li><tt>circle_expression</tt> : a <tt>circle</tt>.</li>
3918</ul>
3919</li>
3920<li>Return Value:
3921<ul>
3922
3923<li>a <tt>point</tt> or <tt>double</tt>, represent the center or radius of the circle <tt>circle_expression</tt>.</li>
3924<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
3925<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
3926<li>any other non-circle input value will cause a type error.</li>
3927</ul>
3928</li>
3929<li>
3930
3931<p>Example:</p>
3932
3933<div>
3934<div>
3935<pre class="source">{
3936 &quot;circle_radius&quot;: get_radius(create_circle(create_point(6.0,3.0), 1.0)),
3937 &quot;circle_center&quot;: get_center(create_circle(create_point(6.0,3.0), 1.0))
3938};
3939</pre></div></div>
3940</li>
3941<li>
3942
3943<p>The expected result is:</p>
3944
3945<div>
3946<div>
3947<pre class="source">{ &quot;circle_radius&quot;: 1.0, &quot;circle_center&quot;: point(&quot;6.0,3.0&quot;) }
3948</pre></div></div>
3949</li>
3950</ul></div>
3951<div class="section">
3952<h3><a name="spatial_distance"></a>spatial_distance</h3>
3953<ul>
3954
3955<li>
3956
3957<p>Syntax:</p>
3958
3959<div>
3960<div>
3961<pre class="source">spatial_distance(point1, point2)
3962</pre></div></div>
3963</li>
3964<li>
3965
3966<p>Returns the Euclidean distance between <tt>point1</tt> and <tt>point2</tt>.</p>
3967</li>
3968<li>Arguments:
3969<ul>
3970
3971<li><tt>point1</tt> : a <tt>point</tt>.</li>
3972<li><tt>point2</tt> : a <tt>point</tt>.</li>
3973</ul>
3974</li>
3975<li>Return Value:
3976<ul>
3977
3978<li>a <tt>double</tt> as the Euclidean distance between <tt>point1</tt> and <tt>point2</tt>.</li>
3979<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
3980<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
3981<li>any other non-point input value will cause a type error.</li>
3982</ul>
3983</li>
3984<li>
3985
3986<p>Example:</p>
3987
3988<div>
3989<div>
3990<pre class="source">spatial_distance(point(&quot;47.44,80.65&quot;), create_point(30.0,70.0));
3991</pre></div></div>
3992</li>
3993<li>
3994
3995<p>The expected result is:</p>
3996
3997<div>
3998<div>
3999<pre class="source">20.434678857275934
4000</pre></div></div>
4001</li>
4002</ul></div>
4003<div class="section">
4004<h3><a name="spatial_area"></a>spatial_area</h3>
4005<ul>
4006
4007<li>
4008
4009<p>Syntax:</p>
4010
4011<div>
4012<div>
4013<pre class="source">spatial_area(spatial_2d_expression)
4014</pre></div></div>
4015</li>
4016<li>
4017
4018<p>Returns the spatial area of <tt>spatial_2d_expression</tt>.</p>
4019</li>
4020<li>Arguments:
4021<ul>
4022
4023<li><tt>spatial_2d_expression</tt> : a <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
4024</ul>
4025</li>
4026<li>Return Value:
4027<ul>
4028
4029<li>a <tt>double</tt> representing the area of <tt>spatial_2d_expression</tt>.</li>
4030<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
4031<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
4032<li>any other non-2d-spatial-object will cause a type error.</li>
4033</ul>
4034</li>
4035<li>
4036
4037<p>Example:</p>
4038
4039<div>
4040<div>
4041<pre class="source">spatial_area(create_circle(create_point(0.0,0.0), 5.0));
4042</pre></div></div>
4043</li>
4044<li>
4045
4046<p>The expected result is:</p>
4047
4048<div>
4049<div>
4050<pre class="source">78.53981625
4051</pre></div></div>
4052</li>
4053</ul></div>
4054<div class="section">
4055<h3><a name="spatial_intersect"></a>spatial_intersect</h3>
4056<ul>
4057
4058<li>
4059
4060<p>Syntax:</p>
4061
4062<div>
4063<div>
4064<pre class="source">spatial_intersect(spatial_object1, spatial_object2)
4065</pre></div></div>
4066</li>
4067<li>
4068
4069<p>Checks whether <tt>@arg1</tt> and <tt>@arg2</tt> spatially intersect each other.</p>
4070</li>
4071<li>Arguments:
4072<ul>
4073
4074<li><tt>spatial_object1</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
4075<li><tt>spatial_object2</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
4076</ul>
4077</li>
4078<li>Return Value:
4079<ul>
4080
4081<li>a <tt>boolean</tt> representing whether <tt>spatial_object1</tt> and <tt>spatial_object2</tt> spatially overlap with each other,</li>
4082<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4083<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4084<li>any other non-spatial-object input value will cause a type error.</li>
4085</ul>
4086</li>
4087<li>
4088
4089<p>Example:</p>
4090
4091<div>
4092<div>
4093<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)));
4094</pre></div></div>
4095</li>
4096<li>
4097
4098<p>The expected result is:</p>
4099
4100<div>
4101<div>
4102<pre class="source">true
4103</pre></div></div>
4104</li>
4105</ul></div>
4106<div class="section">
4107<h3><a name="spatial_cell"></a>spatial_cell</h3>
4108<ul>
4109
4110<li>
4111
4112<p>Syntax:</p>
4113
4114<div>
4115<div>
4116<pre class="source">spatial_cell(point1, point2, x_increment, y_increment)
4117</pre></div></div>
4118</li>
4119<li>
4120
4121<p>Returns the grid cell that <tt>point1</tt> belongs to.</p>
4122</li>
4123<li>Arguments:
4124<ul>
4125
4126<li><tt>point1</tt> : a <tt>point</tt> representing the point of interest that its grid cell will be returned.</li>
4127<li><tt>point2</tt> : a <tt>point</tt> representing the origin of the grid.</li>
4128<li><tt>x_increment</tt> : a <tt>double</tt>, represents X increments.</li>
4129<li><tt>y_increment</tt> : a <tt>double</tt>, represents Y increments.</li>
4130</ul>
4131</li>
4132<li>Return Value:
4133<ul>
4134
4135<li>a <tt>rectangle</tt> representing the grid cell that <tt>point1</tt> belongs to,</li>
4136<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4137<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4138<li>a type error will be raised if:
4139<ul>
4140
4141<li>the first or second argument is any other non-point value,</li>
4142<li>or, the second or third argument is any other non-double value.</li>
4143</ul>
4144</li>
4145</ul>
4146</li>
4147<li>
4148
4149<p>Example:</p>
4150
4151<div>
4152<div>
4153<pre class="source">spatial_cell(point(&quot;39.28,70.48&quot;), create_point(20.0,50.0), 5.5, 6.0);
4154</pre></div></div>
4155</li>
4156<li>
4157
4158<p>The expected result is:</p>
4159
4160<div>
4161<div>
4162<pre class="source">rectangle(&quot;36.5,68.0 42.0,74.0&quot;);
4163</pre></div></div>
4164</li>
4165</ul><!--
4166 ! Licensed to the Apache Software Foundation (ASF) under one
4167 ! or more contributor license agreements. See the NOTICE file
4168 ! distributed with this work for additional information
4169 ! regarding copyright ownership. The ASF licenses this file
4170 ! to you under the Apache License, Version 2.0 (the
4171 ! "License"); you may not use this file except in compliance
4172 ! with the License. You may obtain a copy of the License at
4173 !
4174 ! http://www.apache.org/licenses/LICENSE-2.0
4175 !
4176 ! Unless required by applicable law or agreed to in writing,
4177 ! software distributed under the License is distributed on an
4178 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4179 ! KIND, either express or implied. See the License for the
4180 ! specific language governing permissions and limitations
4181 ! under the License.
4182 !-->
4183</div></div>
4184<div class="section">
4185<h2><a name="Similarity_Functions"></a><a name="SimilarityFunctions" id="SimilarityFunctions">Similarity Functions</a></h2>
4186<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>
4187<div class="section">
4188<h3><a name="edit_distance"></a>edit_distance</h3>
4189<ul>
4190
4191<li>
4192
4193<p>Syntax:</p>
4194
4195<div>
4196<div>
4197<pre class="source">edit_distance(expression1, expression2)
4198</pre></div></div>
4199</li>
4200<li>
4201
4202<p>Returns the edit distance of <tt>expression1</tt> and <tt>expression2</tt>.</p>
4203</li>
4204<li>Arguments:
4205<ul>
4206
4207<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
4208<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
4209</ul>
4210</li>
4211<li>Return Value:
4212<ul>
4213
4214<li>an <tt>bigint</tt> that represents the edit distance between <tt>expression1</tt> and <tt>expression2</tt>,</li>
4215<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4216<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4217<li>any other non-string input value will cause a type error.</li>
4218</ul>
4219</li>
4220<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
4221<li>Example:
4222
4223<div>
4224<div>
4225<pre class="source">edit_distance(&quot;SuzannaTillson&quot;, &quot;Suzanna Tilson&quot;);
4226</pre></div></div>
4227</li>
4228<li>
4229
4230<p>The expected result is:</p>
4231
4232<div>
4233<div>
4234<pre class="source">2
4235</pre></div></div>
4236</li>
4237</ul></div>
4238<div class="section">
4239<h3><a name="edit_distance_check"></a>edit_distance_check</h3>
4240<ul>
4241
4242<li>
4243
4244<p>Syntax:</p>
4245
4246<div>
4247<div>
4248<pre class="source">edit_distance_check(expression1, expression2, threshold)
4249</pre></div></div>
4250</li>
4251<li>
4252
4253<p>Checks whether the edit distance of <tt>expression1</tt> and <tt>expression2</tt> is within a given threshold.</p>
4254</li>
4255<li>
4256
4257<p>Arguments:</p>
4258<ul>
4259
4260<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
4261<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
4262<li><tt>threshold</tt> : a <tt>bigint</tt> that represents the distance threshold.</li>
4263</ul>
4264</li>
4265<li>Return Value:
4266<ul>
4267
4268<li>an <tt>array</tt> with two items:
4269<ul>
4270
4271<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>
4272<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>
4273<li>If the first item is false, then the second item is set to 2147483647.</li>
4274</ul>
4275</li>
4276<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4277<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4278<li>a type error will be raised if:
4279<ul>
4280
4281<li>the first or second argument is any other non-string value,</li>
4282<li>or, the third argument is any other non-bigint value.</li>
4283</ul>
4284</li>
4285</ul>
4286</li>
4287<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
4288<li>Example:
4289
4290<div>
4291<div>
4292<pre class="source">edit_distance_check(&quot;happy&quot;,&quot;hapr&quot;,2);
4293</pre></div></div>
4294</li>
4295<li>
4296
4297<p>The expected result is:</p>
4298
4299<div>
4300<div>
4301<pre class="source">[ true, 2 ]
4302</pre></div></div>
4303</li>
4304</ul></div>
4305<div class="section">
4306<h3><a name="edit_distance_contains"></a>edit_distance_contains</h3>
4307<ul>
4308
4309<li>
4310
4311<p>Syntax:</p>
4312
4313<div>
4314<div>
4315<pre class="source">edit_distance_contains(expression1, expression2, threshold)
4316</pre></div></div>
4317</li>
4318<li>
4319
4320<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>
4321</li>
4322<li>
4323
4324<p>Arguments:</p>
4325<ul>
4326
4327<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
4328<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
4329<li><tt>threshold</tt> : a <tt>bigint</tt> that represents the distance threshold.</li>
4330</ul>
4331</li>
4332<li>Return Value:
4333<ul>
4334
4335<li>an <tt>array</tt> with two items:
4336<ul>
4337
4338<li>The first item contains a <tt>boolean</tt> value representing whether <tt>expression1</tt> can contain <tt>expression2</tt>.</li>
4339<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>
4340</ul>
4341</li>
4342<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4343<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4344<li>a type error will be raised if:
4345<ul>
4346
4347<li>the first or second argument is any other non-string value,</li>
4348<li>or, the third argument is any other non-bigint value.</li>
4349</ul>
4350</li>
4351</ul>
4352</li>
4353<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
4354<li>Example:
4355
4356<div>
4357<div>
4358<pre class="source">edit_distance_contains(&quot;happy&quot;,&quot;hapr&quot;,2);
4359</pre></div></div>
4360</li>
4361<li>
4362
4363<p>The expected result is:</p>
4364
4365<div>
4366<div>
4367<pre class="source">[ true, 1 ]
4368</pre></div></div>
4369</li>
4370</ul></div>
4371<div class="section">
4372<h3><a name="similarity_jaccard"></a>similarity_jaccard</h3>
4373<ul>
4374
4375<li>
4376
4377<p>Syntax:</p>
4378
4379<div>
4380<div>
4381<pre class="source">similarity_jaccard(array1, array2)
4382</pre></div></div>
4383</li>
4384<li>
4385
4386<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>
4387</li>
4388<li>Arguments:
4389<ul>
4390
4391<li><tt>array1</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
4392<li><tt>array2</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
4393</ul>
4394</li>
4395<li>Return Value:
4396<ul>
4397
4398<li>a <tt>float</tt> that represents the Jaccard similarity of <tt>array1</tt> and <tt>array2</tt>,</li>
4399<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4400<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4401<li><tt>missing</tt> if any element in any input array is <tt>missing</tt>,</li>
4402<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>
4403<li>any other non-array input value or non-integer element in any input array will cause a type error.</li>
4404</ul>
4405</li>
4406<li>
4407
4408<p>Note: a <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">keyword index</a> can be utilized for this function.</p>
4409</li>
4410<li>Example:
4411
4412<div>
4413<div>
4414<pre class="source">similarity_jaccard([1,5,8,9], [1,5,9,10]);
4415</pre></div></div>
4416</li>
4417<li>
4418
4419<p>The expected result is:</p>
4420
4421<div>
4422<div>
4423<pre class="source">0.6
4424</pre></div></div>
4425</li>
4426</ul></div>
4427<div class="section">
4428<h3><a name="similarity_jaccard_check"></a>similarity_jaccard_check</h3>
4429<ul>
4430
4431<li>
4432
4433<p>Syntax:</p>
4434
4435<div>
4436<div>
4437<pre class="source">similarity_jaccard_check(array1, array2, threshold)
4438</pre></div></div>
4439</li>
4440<li>
4441
4442<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>
4443</li>
4444<li>
4445
4446<p>Arguments:</p>
4447<ul>
4448
4449<li><tt>array1</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
4450<li><tt>array2</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
4451<li><tt>threshold</tt> : a <tt>double</tt> that represents the similarity threshold.</li>
4452</ul>
4453</li>
4454<li>Return Value:
4455<ul>
4456
4457<li>an <tt>array</tt> with two items:
4458<ul>
4459
4460<li>The first item contains a <tt>boolean</tt> value representing whether <tt>array1</tt> and <tt>array2</tt> are similar.</li>
4461<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>
4462</ul>
4463</li>
4464<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4465<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4466<li><tt>missing</tt> if any element in any input array is <tt>missing</tt>,</li>
4467<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>
4468<li>a type error will be raised if:
4469<ul>
4470
4471<li>the first or second argument is any other non-array value,
4472<ul>
4473
4474<li>or, the third argument is any other non-double value.</li>
4475</ul>
4476</li>
4477</ul>
4478</li>
4479</ul>
4480</li>
4481<li>
4482
4483<p>Note: a <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">keyword index</a> can be utilized for this function.</p>
4484</li>
4485<li>Example:
4486
4487<div>
4488<div>
4489<pre class="source">similarity_jaccard_check([1,5,8,9], [1,5,9,10], 0.6);
4490</pre></div></div>
4491</li>
4492<li>
4493
4494<p>The expected result is:</p>
4495
4496<div>
4497<div>
4498<pre class="source">[ false, 0.0 ]
4499</pre></div></div>
4500</li>
4501</ul><!--
4502 ! Licensed to the Apache Software Foundation (ASF) under one
4503 ! or more contributor license agreements. See the NOTICE file
4504 ! distributed with this work for additional information
4505 ! regarding copyright ownership. The ASF licenses this file
4506 ! to you under the Apache License, Version 2.0 (the
4507 ! "License"); you may not use this file except in compliance
4508 ! with the License. You may obtain a copy of the License at
4509 !
4510 ! http://www.apache.org/licenses/LICENSE-2.0
4511 !
4512 ! Unless required by applicable law or agreed to in writing,
4513 ! software distributed under the License is distributed on an
4514 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4515 ! KIND, either express or implied. See the License for the
4516 ! specific language governing permissions and limitations
4517 ! under the License.
4518 !-->
4519</div></div>
4520<div class="section">
4521<h2><a name="Tokenizing_Functions"></a><a name="TokenizingFunctions" id="TokenizingFunctions">Tokenizing Functions</a></h2>
4522<div class="section">
4523<h3><a name="word_tokens"></a>word_tokens</h3>
4524<ul>
4525
4526<li>
4527
4528<p>Syntax:</p>
4529
4530<div>
4531<div>
4532<pre class="source">word_tokens(string)
4533</pre></div></div>
4534</li>
4535<li>
4536
4537<p>Returns an array of word tokens of <tt>string</tt> using non_alphanumeric characters as delimiters.</p>
4538</li>
4539<li>Arguments:
4540<ul>
4541
4542<li><tt>string</tt> : a <tt>string</tt> that will be tokenized.</li>
4543</ul>
4544</li>
4545<li>Return Value:
4546<ul>
4547
4548<li>an <tt>array</tt> of <tt>string</tt> word tokens,</li>
4549<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
4550<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
4551<li>any other non-string input value will cause a type error.</li>
4552</ul>
4553</li>
4554<li>
4555
4556<p>Example:</p>
4557
4558<div>
4559<div>
4560<pre class="source">word_tokens(&quot;I like the phone, awesome!&quot;);
4561</pre></div></div>
4562</li>
4563<li>
4564
4565<p>The expected result is:</p>
4566
4567<div>
4568<div>
4569<pre class="source">[ &quot;i&quot;, &quot;like&quot;, &quot;the&quot;, &quot;phone&quot;, &quot;awesome&quot; ]
4570</pre></div></div>
4571</li>
4572</ul><!--
4573 ! Licensed to the Apache Software Foundation (ASF) under one
4574 ! or more contributor license agreements. See the NOTICE file
4575 ! distributed with this work for additional information
4576 ! regarding copyright ownership. The ASF licenses this file
4577 ! to you under the Apache License, Version 2.0 (the
4578 ! "License"); you may not use this file except in compliance
4579 ! with the License. You may obtain a copy of the License at
4580 !
4581 ! http://www.apache.org/licenses/LICENSE-2.0
4582 !
4583 ! Unless required by applicable law or agreed to in writing,
4584 ! software distributed under the License is distributed on an
4585 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
4586 ! KIND, either express or implied. See the License for the
4587 ! specific language governing permissions and limitations
4588 ! under the License.
4589 !-->
4590</div></div>
4591<div class="section">
4592<h2><a name="Temporal_Functions"></a><a name="TemporalFunctions" id="TemporalFunctions">Temporal Functions</a></h2>
4593<div class="section">
4594<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>
4595<ul>
4596
4597<li>
4598
4599<p>Syntax:</p>
4600
4601<div>
4602<div>
4603<pre class="source">get_year/get_month/get_day/get_hour/get_minute/get_second/get_millisecond(temporal_value)
4604</pre></div></div>
4605</li>
4606<li>
4607
4608<p>Accessors for accessing fields in a temporal value</p>
4609</li>
4610<li>Arguments:
4611<ul>
4612
4613<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>
4614</ul>
4615</li>
4616<li>Return Value:
4617<ul>
4618
4619<li>an <tt>bigint</tt> value representing the field to be extracted,</li>
4620<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
4621<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4622<li>any other non-interval input value will cause a type error.</li>
4623</ul>
4624</li>
4625<li>
4626
4627<p>Example:</p>
4628
4629<div>
4630<div>
4631<pre class="source">{
4632 &quot;year&quot;: get_year(date(&quot;2010-10-30&quot;)),
4633 &quot;month&quot;: get_month(datetime(&quot;1987-11-19T23:49:23.938&quot;)),
4634 &quot;day&quot;: get_day(date(&quot;2010-10-30&quot;)),
4635 &quot;hour&quot;: get_hour(time(&quot;12:23:34.930+07:00&quot;)),
4636 &quot;min&quot;: get_minute(duration(&quot;P3Y73M632DT49H743M3948.94S&quot;)),
4637 &quot;second&quot;: get_second(datetime(&quot;1987-11-19T23:49:23.938&quot;)),
4638 &quot;ms&quot;: get_millisecond(duration(&quot;P3Y73M632DT49H743M3948.94S&quot;))
4639};
4640</pre></div></div>
4641</li>
4642<li>
4643
4644<p>The expected result is:</p>
4645
4646<div>
4647<div>
4648<pre class="source">{ &quot;year&quot;: 2010, &quot;month&quot;: 11, &quot;day&quot;: 30, &quot;hour&quot;: 5, &quot;min&quot;: 28, &quot;second&quot;: 23, &quot;ms&quot;: 94 }
4649</pre></div></div>
4650</li>
4651</ul></div>
4652<div class="section">
4653<h3><a name="adjust_datetime_for_timezone"></a>adjust_datetime_for_timezone</h3>
4654<ul>
4655
4656<li>
4657
4658<p>Syntax:</p>
4659
4660<div>
4661<div>
4662<pre class="source">adjust_datetime_for_timezone(datetime, string)
4663</pre></div></div>
4664</li>
4665<li>
4666
4667<p>Adjusts the given datetime <tt>datetime</tt> by applying the timezone information <tt>string</tt>.</p>
4668</li>
4669<li>Arguments:
4670<ul>
4671
4672<li><tt>datetime</tt> : a <tt>datetime</tt> value to be adjusted.</li>
4673<li><tt>string</tt> : a <tt>string</tt> representing the timezone information.</li>
4674</ul>
4675</li>
4676<li>Return Value:
4677<ul>
4678
4679<li>a <tt>string</tt> value representing the new datetime after being adjusted by the timezone information,</li>
4680<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4681<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4682<li>a type error will be raised if:
4683<ul>
4684
4685<li>the first argument is any other non-datetime value,</li>
4686<li>or, the second argument is any other non-string value.</li>
4687</ul>
4688</li>
4689</ul>
4690</li>
4691<li>
4692
4693<p>Example:</p>
4694
4695<div>
4696<div>
4697<pre class="source">adjust_datetime_for_timezone(datetime(&quot;2008-04-26T10:10:00&quot;), &quot;+08:00&quot;);
4698</pre></div></div>
4699</li>
4700<li>
4701
4702<p>The expected result is:</p>
4703
4704<div>
4705<div>
4706<pre class="source">&quot;2008-04-26T18:10:00.000+08:00&quot;
4707</pre></div></div>
4708</li>
4709</ul></div>
4710<div class="section">
4711<h3><a name="adjust_time_for_timezone"></a>adjust_time_for_timezone</h3>
4712<ul>
4713
4714<li>
4715
4716<p>Syntax:</p>
4717
4718<div>
4719<div>
4720<pre class="source">adjust_time_for_timezone(time, string)
4721</pre></div></div>
4722</li>
4723<li>
4724
4725<p>Adjusts the given time <tt>time</tt> by applying the timezone information <tt>string</tt>.</p>
4726</li>
4727<li>Arguments:
4728<ul>
4729
4730<li><tt>time</tt> : a <tt>time</tt> value to be adjusted.</li>
4731<li><tt>string</tt> : a <tt>string</tt> representing the timezone information.</li>
4732</ul>
4733</li>
4734<li>Return Value:
4735<ul>
4736
4737<li>a <tt>string</tt> value representing the new time after being adjusted by the timezone information,</li>
4738<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4739<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4740<li>a type error will be raised if:
4741<ul>
4742
4743<li>the first argument is any other non-time value,</li>
4744<li>or, the second argument is any other non-string value.</li>
4745</ul>
4746</li>
4747</ul>
4748</li>
4749<li>
4750
4751<p>Example:</p>
4752
4753<div>
4754<div>
4755<pre class="source">adjust_time_for_timezone(get_time_from_datetime(datetime(&quot;2008-04-26T10:10:00&quot;)), &quot;+08:00&quot;);
4756</pre></div></div>
4757</li>
4758<li>
4759
4760<p>The expected result is:</p>
4761
4762<div>
4763<div>
4764<pre class="source">&quot;18:10:00.000+08:00&quot;
4765</pre></div></div>
4766</li>
4767</ul></div>
4768<div class="section">
4769<h3><a name="calendar_duration_from_datetime"></a>calendar_duration_from_datetime</h3>
4770<ul>
4771
4772<li>
4773
4774<p>Syntax:</p>
4775
4776<div>
4777<div>
4778<pre class="source">calendar_duration_from_datetime(datetime, duration_value)
4779</pre></div></div>
4780</li>
4781<li>
4782
4783<p>Gets a user_friendly representation of the duration <tt>duration_value</tt> based on the given datetime <tt>datetime</tt>.</p>
4784</li>
4785<li>Arguments:
4786<ul>
4787
4788<li><tt>datetime</tt> : a <tt>datetime</tt> value to be used as the reference time point.</li>
4789<li><tt>duration_value</tt> : a <tt>duration</tt> value to be converted.</li>
4790</ul>
4791</li>
4792<li>Return Value:
4793<ul>
4794
4795<li>a <tt>duration</tt> value with the duration as <tt>duration_value</tt> but with a user_friendly representation,</li>
4796<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
4797<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
4798<li>a type error will be raised if:
4799<ul>
4800
4801<li>the first argument is any other non-datetime value,</li>
4802<li>or, the second argument is any other non-duration input value.</li>
4803</ul>
4804</li>
4805</ul>
4806</li>
4807<li>
4808
4809<p>Example:</p>
4810
4811<div>
4812<div>
4813<pre class="source">calendar_duration_from_datetime(
4814 datetime(&quot;2016-03-26T10:10:00&quot;),
4815 datetime(&quot;2016-03-26T10:10:00&quot;) - datetime(&quot;2011-01-01T00:00:00&quot;)
4816);
4817</pre></div></div>
4818</li>
4819<li>
4820
4821<p>The expected result is:</p>
4822
4823<div>
4824<div>
4825<pre class="source">duration(&quot;P5Y2M24DT10H10M&quot;)
4826</pre></div></div>
4827</li>
4828</ul></div>
4829<div class="section">
4830<h3><a name="get_year_month_duration.2Fget_day_time_duration"></a>get_year_month_duration/get_day_time_duration</h3>
4831<ul>
4832
4833<li>
4834
4835<p>Syntax:</p>
4836
4837<div>
4838<div>
4839<pre class="source">get_year_month_duration/get_day_time_duration(duration_value)
4840</pre></div></div>
4841</li>
4842<li>
4843
4844<p>Extracts the correct <tt>duration</tt> subtype from <tt>duration_value</tt>.</p>
4845</li>
4846<li>Arguments:
4847<ul>
4848
4849<li><tt>duration_value</tt> : a <tt>duration</tt> value to be converted.</li>
4850</ul>
4851</li>
4852<li>Return Value:
4853<ul>
4854
4855<li>a <tt>year_month_duration</tt> value or a <tt>day_time_duration</tt> value,</li>
4856<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
4857<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
4858<li>any other non-duration input value will cause a type error.</li>
4859</ul>
4860</li>
4861<li>
4862
4863<p>Example:</p>
4864
4865<div>
4866<div>
4867<pre class="source">get_year_month_duration(duration(&quot;P12M50DT10H&quot;));
4868</pre></div></div>
4869</li>
4870<li>
4871
4872<p>The expected result is:</p>
4873
4874<div>
4875<div>
4876<pre class="source">year_month_duration(&quot;P1Y&quot;)
4877</pre></div></div>
4878</li>
4879</ul></div>
4880<div class="section">
4881<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>
4882<ul>
4883
4884<li>
4885
4886<p>Syntax:</p>
4887
4888<div>
4889<div>
4890<pre class="source">months_from_year_month_duration/ms_from_day_time_duration(duration_value)
4891</pre></div></div>
4892</li>
4893<li>
4894
4895<p>Extracts the number of months or the number of milliseconds from the <tt>duration</tt> subtype.</p>
4896</li>
4897<li>Arguments:
4898<ul>
4899
4900<li><tt>duration_value</tt> : a <tt>duration</tt> of the correct subtype.</li>
4901</ul>
4902</li>
4903<li>Return Value:
4904<ul>
4905
4906<li>a <tt>bigint</tt> representing the number of months/milliseconds,</li>
4907<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
4908<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
4909<li>any other non-duration input value will cause a type error.</li>
4910</ul>
4911</li>
4912<li>
4913
4914<p>Example:</p>
4915
4916<div>
4917<div>
4918<pre class="source">{
4919 &quot;months&quot;: months_from_year_month_duration(get_year_month_duration(duration(&quot;P5Y7MT50M&quot;))),
4920 &quot;milliseconds&quot;: ms_from_day_time_duration(get_day_time_duration(duration(&quot;P5Y7MT50M&quot;)))
4921};
4922</pre></div></div>
4923</li>
4924<li>
4925
4926<p>The expected result is:</p>
4927
4928<div>
4929<div>
4930<pre class="source">{&quot;months&quot;: 67, &quot;milliseconds&quot;: 3000000}
4931</pre></div></div>
4932</li>
4933</ul></div>
4934<div class="section">
4935<h3><a name="duration_from_months.2Fduration_from_ms"></a>duration_from_months/duration_from_ms</h3>
4936<ul>
4937
4938<li>
4939
4940<p>Syntax:</p>
4941
4942<div>
4943<div>
4944<pre class="source">duration_from_months/duration_from_ms(number_value)
4945</pre></div></div>
4946</li>
4947<li>
4948
4949<p>Creates a <tt>duration</tt> from <tt>number_value</tt>.</p>
4950</li>
4951<li>Arguments:
4952<ul>
4953
4954<li><tt>number_value</tt> : a <tt>bigint</tt> representing the number of months/milliseconds</li>
4955</ul>
4956</li>
4957<li>Return Value:
4958<ul>
4959
4960<li>a <tt>duration</tt> containing <tt>number_value</tt> value for months/milliseconds,</li>
4961<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
4962<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
4963<li>any other non-duration input value will cause a type error.</li>
4964</ul>
4965</li>
4966<li>
4967
4968<p>Example:</p>
4969
4970<div>
4971<div>
4972<pre class="source">duration_from_months(8);
4973</pre></div></div>
4974</li>
4975<li>
4976
4977<p>The expected result is:</p>
4978
4979<div>
4980<div>
4981<pre class="source">duration(&quot;P8M&quot;)
4982</pre></div></div>
4983</li>
4984</ul></div>
4985<div class="section">
4986<h3><a name="duration_from_interval"></a>duration_from_interval</h3>
4987<ul>
4988
4989<li>
4990
4991<p>Syntax:</p>
4992
4993<div>
4994<div>
4995<pre class="source">duration_from_interval(interval_value)
4996</pre></div></div>
4997</li>
4998<li>
4999
5000<p>Creates a <tt>duration</tt> from <tt>interval_value</tt>.</p>
5001</li>
5002<li>Arguments:
5003<ul>
5004
5005<li><tt>interval_value</tt> : an <tt>interval</tt> value</li>
5006</ul>
5007</li>
5008<li>Return Value:
5009<ul>
5010
5011<li>a <tt>duration</tt> representing the time in the <tt>interval_value</tt></li>
5012<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5013<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5014<li>any other non-duration input value will cause a type error.</li>
5015</ul>
5016</li>
5017<li>
5018
5019<p>Example:</p>
5020
5021<div>
5022<div>
5023<pre class="source">{
5024 &quot;dr1&quot; : duration_from_interval(interval(date(&quot;2010-10-30&quot;), date(&quot;2010-12-21&quot;))),
5025 &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;))),
5026 &quot;dr3&quot; : duration_from_interval(interval(time(&quot;12:32:38&quot;), time(&quot;20:29:20&quot;))),
5027 &quot;dr4&quot; : duration_from_interval(null)
5028};
5029</pre></div></div>
5030</li>
5031<li>
5032
5033<p>The expected result is:</p>
5034
5035<div>
5036<div>
5037<pre class="source">{
5038 &quot;dr1&quot;: day_time_duration(&quot;P52D&quot;),
5039 &quot;dr2&quot;: day_time_duration(&quot;P31DT1H1M1.111S&quot;),
5040 &quot;dr3&quot;: day_time_duration(&quot;PT7H56M42S&quot;),
5041 &quot;dr4&quot;: null
5042}
5043</pre></div></div>
5044</li>
5045</ul></div>
5046<div class="section">
5047<h3><a name="current_date"></a>current_date</h3>
5048<ul>
5049
5050<li>
5051
5052<p>Syntax:</p>
5053
5054<div>
5055<div>
5056<pre class="source">current_date()
5057</pre></div></div>
5058</li>
5059<li>
5060
5061<p>Gets the current date.</p>
5062</li>
5063<li>Arguments: None</li>
5064<li>Return Value:
5065<ul>
5066
5067<li>a <tt>date</tt> value of the date when the function is called.</li>
5068</ul>
5069</li>
5070</ul></div>
5071<div class="section">
5072<h3><a name="current_time"></a>current_time</h3>
5073<ul>
5074
5075<li>
5076
5077<p>Syntax:</p>
5078
5079<div>
5080<div>
5081<pre class="source">current_time()
5082</pre></div></div>
5083</li>
5084<li>
5085
5086<p>Get the current time</p>
5087</li>
5088<li>Arguments: None</li>
5089<li>Return Value:
5090<ul>
5091
5092<li>a <tt>time</tt> value of the time when the function is called.</li>
5093</ul>
5094</li>
5095</ul></div>
5096<div class="section">
5097<h3><a name="current_datetime"></a>current_datetime</h3>
5098<ul>
5099
5100<li>
5101
5102<p>Syntax:</p>
5103
5104<div>
5105<div>
5106<pre class="source">current_datetime()
5107</pre></div></div>
5108</li>
5109<li>
5110
5111<p>Get the current datetime</p>
5112</li>
5113<li>Arguments: None</li>
5114<li>Return Value:
5115<ul>
5116
5117<li>a <tt>datetime</tt> value of the datetime when the function is called.</li>
5118</ul>
5119</li>
5120</ul></div>
5121<div class="section">
5122<h3><a name="get_date_from_datetime"></a>get_date_from_datetime</h3>
5123<ul>
5124
5125<li>
5126
5127<p>Syntax:</p>
5128
5129<div>
5130<div>
5131<pre class="source">get_date_from_datetime(datetime)
5132</pre></div></div>
5133</li>
5134<li>
5135
5136<p>Gets the date value from the given datetime value <tt>datetime</tt>.</p>
5137</li>
5138<li>Arguments:
5139<ul>
5140
5141<li><tt>datetime</tt>: a <tt>datetime</tt> value to be extracted from.</li>
5142</ul>
5143</li>
5144<li>Return Value:
5145<ul>
5146
5147<li>a <tt>date</tt> value from the datetime,</li>
5148<li>any other non-datetime input value will cause a type error.</li>
5149</ul>
5150</li>
5151</ul></div>
5152<div class="section">
5153<h3><a name="get_time_from_datetime"></a>get_time_from_datetime</h3>
5154<ul>
5155
5156<li>
5157
5158<p>Syntax:</p>
5159
5160<div>
5161<div>
5162<pre class="source">get_time_from_datetime(datetime)
5163</pre></div></div>
5164</li>
5165<li>
5166
5167<p>Get the time value from the given datetime value <tt>datetime</tt></p>
5168</li>
5169<li>Arguments:
5170<ul>
5171
5172<li><tt>datetime</tt>: a <tt>datetime</tt> value to be extracted from.</li>
5173</ul>
5174</li>
5175<li>Return Value:
5176<ul>
5177
5178<li>a <tt>time</tt> value from the datetime.</li>
5179<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5180<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5181<li>any other non-datetime input value will cause a type error.</li>
5182</ul>
5183</li>
5184<li>
5185
5186<p>Example:</p>
5187
5188<div>
5189<div>
5190<pre class="source">get_time_from_datetime(datetime(&quot;2016-03-26T10:10:00&quot;));
5191</pre></div></div>
5192</li>
5193<li>
5194
5195<p>The expected result is:</p>
5196
5197<div>
5198<div>
5199<pre class="source">time(&quot;10:10:00.000Z&quot;)
5200</pre></div></div>
5201</li>
5202</ul></div>
5203<div class="section">
5204<h3><a name="day_of_week"></a>day_of_week</h3>
5205<ul>
5206
5207<li>
5208
5209<p>Syntax:</p>
5210
5211<div>
5212<div>
5213<pre class="source">day_of_week(date)
5214</pre></div></div>
5215</li>
5216<li>
5217
5218<p>Finds the day of the week for a given date (1_7)</p>
5219</li>
5220<li>Arguments:
5221<ul>
5222
5223<li><tt>date</tt>: a <tt>date</tt> value (Can also be a <tt>datetime</tt>)</li>
5224</ul>
5225</li>
5226<li>Return Value:
5227<ul>
5228
5229<li>an <tt>tinyint</tt> representing the day of the week (1_7),</li>
5230<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5231<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5232<li>any other non-date input value will cause a type error.</li>
5233</ul>
5234</li>
5235<li>
5236
5237<p>Example:</p>
5238
5239<div>
5240<div>
5241<pre class="source">day_of_week(datetime(&quot;2012-12-30T12:12:12.039Z&quot;));
5242</pre></div></div>
5243</li>
5244<li>
5245
5246<p>The expected result is:</p>
5247
5248<div>
5249<div>
5250<pre class="source">7
5251</pre></div></div>
5252</li>
5253</ul></div>
5254<div class="section">
5255<h3><a name="date_from_unix_time_in_days"></a>date_from_unix_time_in_days</h3>
5256<ul>
5257
5258<li>
5259
5260<p>Syntax:</p>
5261
5262<div>
5263<div>
5264<pre class="source">date_from_unix_time_in_days(numeric_value)
5265</pre></div></div>
5266</li>
5267<li>
5268
5269<p>Gets a date representing the time after <tt>numeric_value</tt> days since 1970_01_01.</p>
5270</li>
5271<li>Arguments:
5272<ul>
5273
5274<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>
5275</ul>
5276</li>
5277<li>Return Value:
5278<ul>
5279
5280<li>a <tt>date</tt> value as the time after <tt>numeric_value</tt> days since 1970-01-01,</li>
5281<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5282<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5283<li>any other non-numeric input value will cause a type error.</li>
5284</ul>
5285</li>
5286</ul></div>
5287<div class="section">
5288<h3><a name="datetime_from_unix_time_in_ms"></a>datetime_from_unix_time_in_ms</h3>
5289<ul>
5290
5291<li>
5292
5293<p>Syntax:</p>
5294
5295<div>
5296<div>
5297<pre class="source">datetime_from_unix_time_in_ms(numeric_value)
5298</pre></div></div>
5299</li>
5300<li>
5301
5302<p>Gets a datetime representing the time after <tt>numeric_value</tt> milliseconds since 1970_01_01T00:00:00Z.</p>
5303</li>
5304<li>Arguments:
5305<ul>
5306
5307<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>
5308</ul>
5309</li>
5310<li>Return Value:
5311<ul>
5312
5313<li>a <tt>datetime</tt> value as the time after <tt>numeric_value</tt> milliseconds since 1970-01-01T00:00:00Z,</li>
5314<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5315<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5316<li>any other non-numeric input value will cause a type error.</li>
5317</ul>
5318</li>
5319</ul></div>
5320<div class="section">
5321<h3><a name="datetime_from_unix_time_in_secs"></a>datetime_from_unix_time_in_secs</h3>
5322<ul>
5323
5324<li>
5325
5326<p>Syntax:</p>
5327
5328<div>
5329<div>
5330<pre class="source">datetime_from_unix_time_in_secs(numeric_value)
5331</pre></div></div>
5332</li>
5333<li>
5334
5335<p>Gets a datetime representing the time after <tt>numeric_value</tt> seconds since 1970_01_01T00:00:00Z.</p>
5336</li>
5337<li>Arguments:
5338<ul>
5339
5340<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>
5341</ul>
5342</li>
5343<li>Return Value:
5344<ul>
5345
5346<li>a <tt>datetime</tt> value as the time after <tt>numeric_value</tt> seconds since 1970_01_01T00:00:00Z,</li>
5347<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5348<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5349<li>any other non-numeric input value will cause a type error.</li>
5350</ul>
5351</li>
5352</ul></div>
5353<div class="section">
5354<h3><a name="datetime_from_date_time"></a>datetime_from_date_time</h3>
5355<ul>
5356
5357<li>Syntax:</li>
5358</ul>
5359<p>datetime_from_date_time(date,time)</p>
5360<ul>
5361
5362<li>Gets a datetime representing the combination of <tt>date</tt> and <tt>time</tt>
5363<ul>
5364
5365<li>Arguments:</li>
5366<li><tt>date</tt>: a <tt>date</tt> value</li>
5367<li><tt>time</tt> a <tt>time</tt> value</li>
5368</ul>
5369</li>
5370<li>Return Value:
5371<ul>
5372
5373<li>a <tt>datetime</tt> value by combining <tt>date</tt> and <tt>time</tt>,</li>
5374<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
5375<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
5376<li>a type error will be raised if
5377<ul>
5378
5379<li>the first argument is any other non-date value,</li>
5380<li>or, the second argument is any other non-time value.</li>
5381</ul>
5382</li>
5383</ul>
5384</li>
5385</ul></div>
5386<div class="section">
5387<h3><a name="time_from_unix_time_in_ms"></a>time_from_unix_time_in_ms</h3>
5388<ul>
5389
5390<li>
5391
5392<p>Syntax:</p>
5393
5394<div>
5395<div>
5396<pre class="source">time_from_unix_time_in_ms(numeric_value)
5397</pre></div></div>
5398</li>
5399<li>
5400
5401<p>Gets a time representing the time after <tt>numeric_value</tt> milliseconds since 00:00:00.000Z.</p>
5402</li>
5403<li>Arguments:
5404<ul>
5405
5406<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>
5407</ul>
5408</li>
5409<li>Return Value:
5410<ul>
5411
5412<li>a <tt>time</tt> value as the time after <tt>numeric_value</tt> milliseconds since 00:00:00.000Z,</li>
5413<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5414<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5415<li>any other non-numeric input value will cause a type error.</li>
5416</ul>
5417</li>
5418<li>
5419
5420<p>Example:</p>
5421
5422<div>
5423<div>
5424<pre class="source">{
5425 &quot;date&quot;: date_from_unix_time_in_days(15800),
5426 &quot;datetime&quot;: datetime_from_unix_time_in_ms(1365139700000),
5427 &quot;time&quot;: time_from_unix_time_in_ms(3748)
5428};
5429</pre></div></div>
5430</li>
5431<li>
5432
5433<p>The expected result is:</p>
5434
5435<div>
5436<div>
5437<pre class="source">{ &quot;date&quot;: date(&quot;2013-04-05&quot;), &quot;datetime&quot;: datetime(&quot;2013-04-05T05:28:20.000Z&quot;), &quot;time&quot;: time(&quot;00:00:03.748Z&quot;) }
5438</pre></div></div>
5439</li>
5440</ul></div>
5441<div class="section">
5442<h3><a name="unix_time_from_date_in_days"></a>unix_time_from_date_in_days</h3>
5443<ul>
5444
5445<li>
5446
5447<p>Syntax:</p>
5448
5449<div>
5450<div>
5451<pre class="source">unix_time_from_date_in_days(date_value)
5452</pre></div></div>
5453</li>
5454<li>
5455
5456<p>Gets an integer value representing the number of days since 1970_01_01 for <tt>date_value</tt>.</p>
5457</li>
5458<li>Arguments:
5459<ul>
5460
5461<li><tt>date_value</tt>: a <tt>date</tt> value.</li>
5462</ul>
5463</li>
5464<li>Return Value:
5465<ul>
5466
5467<li>a <tt>bigint</tt> value representing the number of days,</li>
5468<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5469<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5470<li>any other non-date input value will cause a type error.</li>
5471</ul>
5472</li>
5473</ul></div>
5474<div class="section">
5475<h3><a name="unix_time_from_datetime_in_ms"></a>unix_time_from_datetime_in_ms</h3>
5476<ul>
5477
5478<li>
5479
5480<p>Syntax:</p>
5481
5482<div>
5483<div>
5484<pre class="source">unix_time_from_datetime_in_ms(datetime_value)
5485</pre></div></div>
5486</li>
5487<li>
5488
5489<p>Gets an integer value representing the time in milliseconds since 1970_01_01T00:00:00Z for <tt>datetime_value</tt>.</p>
5490</li>
5491<li>Arguments:
5492<ul>
5493
5494<li><tt>datetime_value</tt> : a <tt>datetime</tt> value.</li>
5495</ul>
5496</li>
5497<li>Return Value:
5498<ul>
5499
5500<li>a <tt>bigint</tt> value representing the number of milliseconds,</li>
5501<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5502<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5503<li>any other non-datetime input value will cause a type error.</li>
5504</ul>
5505</li>
5506</ul></div>
5507<div class="section">
5508<h3><a name="unix_time_from_datetime_in_secs"></a>unix_time_from_datetime_in_secs</h3>
5509<ul>
5510
5511<li>
5512
5513<p>Syntax:</p>
5514
5515<div>
5516<div>
5517<pre class="source">unix_time_from_datetime_in_secs(datetime_value)
5518</pre></div></div>
5519</li>
5520<li>
5521
5522<p>Gets an integer value representing the time in seconds since 1970_01_01T00:00:00Z for <tt>datetime_value</tt>.</p>
5523</li>
5524<li>Arguments:
5525<ul>
5526
5527<li><tt>datetime_value</tt> : a <tt>datetime</tt> value.</li>
5528</ul>
5529</li>
5530<li>Return Value:
5531<ul>
5532
5533<li>a <tt>bigint</tt> value representing the number of seconds,</li>
5534<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5535<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5536<li>any other non-datetime input value will cause a type error.</li>
5537</ul>
5538</li>
5539</ul></div>
5540<div class="section">
5541<h3><a name="unix_time_from_time_in_ms"></a>unix_time_from_time_in_ms</h3>
5542<ul>
5543
5544<li>
5545
5546<p>Syntax:</p>
5547
5548<div>
5549<div>
5550<pre class="source">unix_time_from_time_in_ms(time_value)
5551</pre></div></div>
5552</li>
5553<li>
5554
5555<p>Gets an integer value representing the time the milliseconds since 00:00:00.000Z for <tt>time_value</tt>.</p>
5556</li>
5557<li>Arguments:
5558<ul>
5559
5560<li><tt>time_value</tt> : a <tt>time</tt> value.</li>
5561</ul>
5562</li>
5563<li>Return Value:
5564<ul>
5565
5566<li>a <tt>bigint</tt> value representing the number of milliseconds,</li>
5567<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5568<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5569<li>any other non-datetime input value will cause a type error.</li>
5570</ul>
5571</li>
5572<li>
5573
5574<p>Example:</p>
5575
5576<div>
5577<div>
5578<pre class="source">{
5579 &quot;date&quot;: date_from_unix_time_in_days(15800),
5580 &quot;datetime&quot;: datetime_from_unix_time_in_ms(1365139700000),
5581 &quot;time&quot;: time_from_unix_time_in_ms(3748)
5582}
5583</pre></div></div>
5584</li>
5585<li>
5586
5587<p>The expected result is:</p>
5588
5589<div>
5590<div>
5591<pre class="source">{ &quot;date&quot;: date(&quot;2013-04-05&quot;), &quot;datetime&quot;: datetime(&quot;2013-04-05T05:28:20.000Z&quot;), &quot;time&quot;: time(&quot;00:00:03.748Z&quot;) }
5592</pre></div></div>
5593</li>
5594</ul></div>
5595<div class="section">
5596<h3><a name="parse_date.2Fparse_time.2Fparse_datetime"></a>parse_date/parse_time/parse_datetime</h3>
5597<ul>
5598
5599<li>Syntax:</li>
5600</ul>
5601<p>parse_date/parse_time/parse_datetime(date,formatting_expression)</p>
5602<ul>
5603
5604<li>Creates a <tt>date/time/date_time</tt> value by treating <tt>date</tt> with formatting <tt>formatting_expression</tt></li>
5605<li>Arguments:
5606<ul>
5607
5608<li><tt>date</tt>: a <tt>string</tt> value representing the <tt>date/time/datetime</tt>.</li>
5609<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>
5610<li><tt>h</tt> hours</li>
5611<li><tt>m</tt> minutes</li>
5612<li><tt>s</tt> seconds</li>
5613<li><tt>n</tt> milliseconds</li>
5614<li><tt>a</tt> am/pm</li>
5615<li><tt>z</tt> timezone</li>
5616<li><tt>Y</tt> year</li>
5617<li><tt>M</tt> month</li>
5618<li><tt>D</tt> day</li>
5619<li><tt>W</tt> weekday</li>
5620<li><tt>_</tt>, <tt>'</tt>, <tt>/</tt>, <tt>.</tt>, <tt>,</tt>, <tt>T</tt> seperators for both time and date</li>
5621</ul>
5622</li>
5623<li>Return Value:
5624<ul>
5625
5626<li>a <tt>date/time/date_time</tt> value corresponding to <tt>date</tt>,</li>
5627<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
5628<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
5629<li>a type error will be raised if:</li>
5630<li>the first argument is any other non-date value,</li>
5631<li>the second argument is any other non-string value.</li>
5632</ul>
5633</li>
5634<li>
5635
5636<p>Example:</p>
5637
5638<div>
5639<div>
5640<pre class="source">parse_time(&quot;30:30&quot;,&quot;m:s&quot;);
5641</pre></div></div>
5642</li>
5643<li>
5644
5645<p>The expected result is:</p>
5646
5647<div>
5648<div>
5649<pre class="source">time(&quot;00:30:30.000Z&quot;)
5650</pre></div></div>
5651</li>
5652</ul></div>
5653<div class="section">
5654<h3><a name="print_date.2Fprint_time.2Fprint_datetime"></a>print_date/print_time/print_datetime</h3>
5655<ul>
5656
5657<li>
5658
5659<p>Syntax:</p>
5660
5661<div>
5662<div>
5663<pre class="source">print_date/print_time/print_datetime(date,formatting_expression)
5664</pre></div></div>
5665</li>
5666<li>
5667
5668<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>
5669</li>
5670<li>Arguments:
5671<ul>
5672
5673<li><tt>date</tt>: a <tt>date/time/datetime</tt> value.</li>
5674<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>
5675<li><tt>h</tt> hours</li>
5676<li><tt>m</tt> minutes</li>
5677<li><tt>s</tt> seconds</li>
5678<li><tt>n</tt> milliseconds</li>
5679<li><tt>a</tt> am/pm</li>
5680<li><tt>z</tt> timezone</li>
5681<li><tt>Y</tt> year</li>
5682<li><tt>M</tt> month</li>
5683<li><tt>D</tt> day</li>
5684<li><tt>W</tt> weekday</li>
5685<li><tt>_</tt>, <tt>'</tt>, <tt>/</tt>, <tt>.</tt>, <tt>,</tt>, <tt>T</tt> seperators for both time and date</li>
5686</ul>
5687</li>
5688<li>Return Value:
5689<ul>
5690
5691<li>a <tt>string</tt> value corresponding to <tt>date</tt>,</li>
5692<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
5693<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
5694<li>a type error will be raised if:
5695<ul>
5696
5697<li>the first argument is any other non-date value,</li>
5698<li>the second argument is any other non-string value.</li>
5699</ul>
5700</li>
5701</ul>
5702</li>
5703<li>
5704
5705<p>Example:</p>
5706
5707<div>
5708<div>
5709<pre class="source">print_time(time(&quot;00:30:30.000Z&quot;),&quot;m:s&quot;);
5710</pre></div></div>
5711</li>
5712<li>
5713
5714<p>The expected result is:</p>
5715
5716<div>
5717<div>
5718<pre class="source">&quot;30:30&quot;
5719</pre></div></div>
5720</li>
5721</ul></div>
5722<div class="section">
5723<h3><a name="get_interval_start.2C_get_interval_end"></a>get_interval_start, get_interval_end</h3>
5724<ul>
5725
5726<li>
5727
5728<p>Syntax:</p>
5729
5730<div>
5731<div>
5732<pre class="source">get_interval_start/get_interval_end(interval)
5733</pre></div></div>
5734</li>
5735<li>
5736
5737<p>Gets the start/end of the given interval.</p>
5738</li>
5739<li>Arguments:
5740<ul>
5741
5742<li><tt>interval</tt>: the interval to be accessed.</li>
5743</ul>
5744</li>
5745<li>Return Value:
5746<ul>
5747
5748<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>
5749<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5750<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5751<li>any other non-interval value will cause a type error.</li>
5752</ul>
5753</li>
5754<li>
5755
5756<p>Example:</p>
5757
5758<div>
5759<div>
5760<pre class="source">{
5761 &quot;start&quot;: get_interval_start(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
5762 &quot;end&quot;: get_interval_end(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;))
5763};
5764</pre></div></div>
5765</li>
5766<li>
5767
5768<p>The expected result is:</p>
5769
5770<div>
5771<div>
5772<pre class="source">{ &quot;start&quot;: date(&quot;1984_01_01&quot;), &quot;end&quot;: date(&quot;1985_01_01&quot;) }
5773</pre></div></div>
5774</li>
5775</ul></div>
5776<div class="section">
5777<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>
5778<ul>
5779
5780<li>
5781
5782<p>Syntax:</p>
5783
5784<div>
5785<div>
5786<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)
5787</pre></div></div>
5788</li>
5789<li>
5790
5791<p>Gets the start/end of the given interval for the specific date/datetime/time type.</p>
5792</li>
5793<li>Arguments:
5794<ul>
5795
5796<li><tt>interval</tt>: the interval to be accessed.</li>
5797</ul>
5798</li>
5799<li>Return Value:
5800<ul>
5801
5802<li>a <tt>time</tt>, <tt>date</tt>, or <tt>datetime</tt> (depending on the function) representing the starting or ending time,</li>
5803<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
5804<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
5805<li>any other non-interval value will cause a type error.</li>
5806</ul>
5807</li>
5808<li>
5809
5810<p>Example:</p>
5811
5812<div>
5813<div>
5814<pre class="source">{
5815 &quot;start1&quot;: get_interval_start_date(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
5816 &quot;end1&quot;: get_interval_end_date(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
5817 &quot;start2&quot;: get_interval_start_datetime(interval_start_from_datetime(&quot;1984-01-01T08:30:00.000&quot;, &quot;P1Y1H&quot;)),
5818 &quot;end2&quot;: get_interval_end_datetime(interval_start_from_datetime(&quot;1984-01-01T08:30:00.000&quot;, &quot;P1Y1H&quot;)),
5819 &quot;start3&quot;: get_interval_start_time(interval_start_from_time(&quot;08:30:00.000&quot;, &quot;P1H&quot;)),
5820 &quot;end3&quot;: get_interval_end_time(interval_start_from_time(&quot;08:30:00.000&quot;, &quot;P1H&quot;))
5821};
5822</pre></div></div>
5823</li>
5824<li>
5825
5826<p>The expected result is:</p>
5827
5828<div>
5829<div>
5830<pre class="source">{
5831 &quot;start1&quot;: date(&quot;1984-01-01&quot;),
5832 &quot;end1&quot;: date(&quot;1985-01-01&quot;),
5833 &quot;start2&quot;: datetime(&quot;1984-01-01T08:30:00.000Z&quot;),
5834 &quot;end2&quot;: datetime(&quot;1985-01-01T09:30:00.000Z&quot;),
5835 &quot;start3&quot;: time(&quot;08:30:00.000Z&quot;),
5836 &quot;end3&quot;: time(&quot;09:30:00.000Z&quot;)
5837}
5838</pre></div></div>
5839</li>
5840</ul></div>
5841<div class="section">
5842<h3><a name="get_overlapping_interval"></a>get_overlapping_interval</h3>
5843<ul>
5844
5845<li>
5846
5847<p>Syntax:</p>
5848
5849<div>
5850<div>
5851<pre class="source">get_overlapping_interval(interval1, interval2)
5852</pre></div></div>
5853</li>
5854<li>
5855
5856<p>Gets the start/end of the given interval for the specific date/datetime/time type.</p>
5857</li>
5858<li>Arguments:
5859<ul>
5860
5861<li><tt>interval1</tt>: an <tt>interval</tt> value</li>
5862<li><tt>interval2</tt>: an <tt>interval</tt> value</li>
5863</ul>
5864</li>
5865<li>Return Value:
5866<ul>
5867
5868<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>
5869<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
5870<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
5871<li>any other non-interval input value will cause a type error.</li>
5872</ul>
5873</li>
5874<li>
5875
5876<p>Example:</p>
5877
5878<div>
5879<div>
5880<pre class="source">{ &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;))),
5881 &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;))),
5882 &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;))),
5883 &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;))),
5884 &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;))),
5885 &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;)))
5886};
5887</pre></div></div>
5888</li>
5889<li>
5890
5891<p>The expected result is:</p>
5892
5893<div>
5894<div>
5895<pre class="source">{ &quot;overlap1&quot;: interval(time(&quot;12:23:39.000Z&quot;), time(&quot;18:27:19.000Z&quot;)),
5896 &quot;overlap2&quot;: null,
5897 &quot;overlap3&quot;: null,
5898 &quot;overlap4&quot;: interval(date(&quot;2013-01-01&quot;), date(&quot;2014_01_01&quot;)),
5899 &quot;overlap5&quot;: interval(datetime(&quot;1989-03-04T12:23:39.000Z&quot;), datetime(&quot;2000-10-30T18:27:19.000Z&quot;)),
5900 &quot;overlap6&quot;: null
5901}
5902</pre></div></div>
5903</li>
5904</ul></div>
5905<div class="section">
5906<h3><a name="interval_bin"></a>interval_bin</h3>
5907<ul>
5908
5909<li>
5910
5911<p>Syntax:</p>
5912
5913<div>
5914<div>
5915<pre class="source">interval_bin(time_to_bin, time_bin_anchor, duration_bin_size)
5916</pre></div></div>
5917</li>
5918<li>
5919
5920<p>Returns the <tt>interval</tt> value representing the bin containing the <tt>time_to_bin</tt> value.</p>
5921</li>
5922<li>Arguments:
5923<ul>
5924
5925<li><tt>time_to_bin</tt>: a date/time/datetime value representing the time to be binned.</li>
5926<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>
5927<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:
5928<ul>
5929
5930<li>datetime +|_ year_month_duration</li>
5931<li>datetime +|_ day_time_duration</li>
5932<li>date +|_ year_month_duration</li>
5933<li>date +|_ day_time_duration</li>
5934<li>time +|_ day_time_duration</li>
5935</ul>
5936</li>
5937</ul>
5938</li>
5939<li>Return Value:
5940<ul>
5941
5942<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>
5943<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
5944<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
5945<li>a type error will be raised if:
5946<ul>
5947
5948<li>the first argument or the second argument is any other non-date/non-time/non-datetime value,</li>
5949<li>or, the second argument is any other non-year_month_duration/non-day_time_duration value.</li>
5950</ul>
5951</li>
5952</ul>
5953</li>
5954<li>
5955
5956<p>Example:</p>
5957
5958<div>
5959<div>
5960<pre class="source">{
5961 &quot;bin1&quot;: interval_bin(date(&quot;2010-10-30&quot;), date(&quot;1990-01-01&quot;), year_month_duration(&quot;P1Y&quot;)),
5962 &quot;bin2&quot;: interval_bin(datetime(&quot;1987-11-19T23:49:23.938&quot;), datetime(&quot;1990-01-01T00:00:00.000Z&quot;), year_month_duration(&quot;P6M&quot;)),
5963 &quot;bin3&quot;: interval_bin(time(&quot;12:23:34.930+07:00&quot;), time(&quot;00:00:00&quot;), day_time_duration(&quot;PT1M&quot;)),
5964 &quot;bin4&quot;: interval_bin(datetime(&quot;1987-11-19T23:49:23.938&quot;), datetime(&quot;2013-01-01T00:00:00.000&quot;), day_time_duration(&quot;PT24H&quot;))
5965};
5966</pre></div></div>
5967</li>
5968<li>
5969
5970<p>The expected result is:</p>
5971
5972<div>
5973<div>
5974<pre class="source">{
5975 &quot;bin1&quot;: interval(date(&quot;2010-01-01&quot;),date(&quot;2011-01-01&quot;)),
5976 &quot;bin2&quot;: interval(datetime(&quot;1987-07-01T00:00:00.000Z&quot;), datetime(&quot;1988-01-01T00:00:00.000Z&quot;)),
5977 &quot;bin3&quot;: interval(time(&quot;05:23:00.000Z&quot;), time(&quot;05:24:00.000Z&quot;)),
5978 &quot;bin4&quot;: interval(datetime(&quot;1987-11-19T00:00:00.000Z&quot;), datetime(&quot;1987-11-20T00:00:00.000Z&quot;))
5979}
5980</pre></div></div>
5981</li>
5982</ul></div>
5983<div class="section">
5984<h3><a name="interval_start_from_date.2Ftime.2Fdatetime"></a>interval_start_from_date/time/datetime</h3>
5985<ul>
5986
5987<li>
5988
5989<p>Syntax:</p>
5990
5991<div>
5992<div>
5993<pre class="source">interval_start_from_date/time/datetime(date/time/datetime, duration)
5994</pre></div></div>
5995</li>
5996<li>
5997
5998<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>
5999</li>
6000<li>Arguments:
6001<ul>
6002
6003<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>
6004<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>
6005</ul>
6006</li>
6007<li>Return Value:
6008<ul>
6009
6010<li>an <tt>interval</tt> value representing the interval starting from the given time point with the length of duration,</li>
6011<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
6012<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6013<li>a type error will be raised if:
6014<ul>
6015
6016<li>the first argument or the second argument is any other non-date/non-time/non-datetime value,</li>
6017<li>or, the second argument is any other non-duration value.</li>
6018</ul>
6019</li>
6020</ul>
6021</li>
6022<li>
6023
6024<p>Example:</p>
6025
6026<div>
6027<div>
6028<pre class="source">{
6029 &quot;interval1&quot;: interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;),
6030 &quot;interval2&quot;: interval_start_from_time(time(&quot;02:23:28.394&quot;), &quot;PT3H24M&quot;),
6031 &quot;interval3&quot;: interval_start_from_datetime(&quot;1999-09-09T09:09:09.999&quot;, duration(&quot;P2M30D&quot;))
6032};
6033</pre></div></div>
6034</li>
6035<li>
6036
6037<p>The expectecd result is:</p>
6038
6039<div>
6040<div>
6041<pre class="source">{
6042 &quot;interval1&quot;: interval(date(&quot;1984-01-01&quot;), date(&quot;1985-01-01&quot;)),
6043 &quot;interval2&quot;: interval(time(&quot;02:23:28.394Z&quot;), time(&quot;05:47:28.394Z&quot;)),
6044 &quot;interval3&quot;: interval(datetime(&quot;1999-09-09T09:09:09.999Z&quot;), datetime(&quot;1999-12-09T09:09:09.999Z&quot;))
6045}
6046</pre></div></div>
6047</li>
6048</ul></div>
6049<div class="section">
6050<h3><a name="overlap_bins"></a>overlap_bins</h3>
6051<ul>
6052
6053<li>
6054
6055<p>Return Value:</p>
6056<ul>
6057
6058<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>
6059</ul>
6060</li>
6061<li>
6062
6063<p>Syntax:</p>
6064
6065<div>
6066<div>
6067<pre class="source">overlap_bins(interval, time_bin_anchor, duration_bin_size)
6068</pre></div></div>
6069</li>
6070<li>
6071
6072<p>Returns an ordered list of <tt>interval</tt> values representing each bin that is overlapping the <tt>interval</tt>.</p>
6073</li>
6074<li>Arguments:
6075<ul>
6076
6077<li><tt>interval</tt>: an <tt>interval</tt> value</li>
6078<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>
6079<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:
6080<ul>
6081
6082<li>datetime +|_ year_month_duration</li>
6083<li>datetime +|_ day_time_duration</li>
6084<li>date +|_ year_month_duration</li>
6085<li>date +|_ day_time_duration</li>
6086<li>time +|_ day_time_duration</li>
6087</ul>
6088</li>
6089</ul>
6090</li>
6091<li>Return Value:
6092<ul>
6093
6094<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>
6095<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
6096<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6097<li>a type error will be raised if:
6098<ul>
6099
6100<li>the first arugment is any other non-interval value,</li>
6101<li>or, the second argument is any other non-date/non-time/non-datetime value,</li>
6102<li>or, the second argument is any other non-year_month_duration/non-day_time_duration value.</li>
6103</ul>
6104</li>
6105</ul>
6106</li>
6107<li>
6108
6109<p>Example:</p>
6110
6111<div>
6112<div>
6113<pre class="source">{
6114 &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;)),
6115 &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;)),
6116 &quot;datetimebins&quot;: overlap_bins(interval(datetime(&quot;1800-01-01T23:59:48.938&quot;), datetime(&quot;2015-07-26T13:28:30.218&quot;)),
6117 datetime(&quot;1900-01-01T00:00:00.000&quot;), year_month_duration(&quot;P100Y&quot;))
6118};
6119</pre></div></div>
6120</li>
6121<li>
6122
6123<p>The expected result is:</p>
6124
6125<div>
6126<div>
6127<pre class="source">{
6128 &quot;timebins&quot;: [
6129 interval(time(&quot;17:00:00.000Z&quot;), time(&quot;17:30:00.000Z&quot;)),
6130 interval(time(&quot;17:30:00.000Z&quot;), time(&quot;18:00:00.000Z&quot;)),
6131 interval(time(&quot;18:00:00.000Z&quot;), time(&quot;18:30:00.000Z&quot;)),
6132 interval(time(&quot;18:30:00.000Z&quot;), time(&quot;19:00:00.000Z&quot;))
6133 ],
6134 &quot;datebins&quot;: [
6135 interval(date(&quot;1980-01-01&quot;), date(&quot;1990-01-01&quot;)),
6136 interval(date(&quot;1990-01-01&quot;), date(&quot;2000-01-01&quot;)),
6137 interval(date(&quot;2000-01-01&quot;), date(&quot;2010-01-01&quot;)),
6138 interval(date(&quot;2010-01-01&quot;), date(&quot;2020-01-01&quot;))
6139 ],
6140 &quot;datetimebins&quot;: [
6141 interval(datetime(&quot;1800-01-01T00:00:00.000Z&quot;), datetime(&quot;1900-01-01T00:00:00.000Z&quot;)),
6142 interval(datetime(&quot;1900-01-01T00:00:00.000Z&quot;), datetime(&quot;2000-01-01T00:00:00.000Z&quot;)),
6143 interval(datetime(&quot;2000-01-01T00:00:00.000Z&quot;), datetime(&quot;2100-01-01T00:00:00.000Z&quot;))
6144 ]
6145};
6146</pre></div></div>
6147</li>
6148</ul><!--
6149 ! Licensed to the Apache Software Foundation (ASF) under one
6150 ! or more contributor license agreements. See the NOTICE file
6151 ! distributed with this work for additional information
6152 ! regarding copyright ownership. The ASF licenses this file
6153 ! to you under the Apache License, Version 2.0 (the
6154 ! "License"); you may not use this file except in compliance
6155 ! with the License. You may obtain a copy of the License at
6156 !
6157 ! http://www.apache.org/licenses/LICENSE-2.0
6158 !
6159 ! Unless required by applicable law or agreed to in writing,
6160 ! software distributed under the License is distributed on an
6161 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
6162 ! KIND, either express or implied. See the License for the
6163 ! specific language governing permissions and limitations
6164 ! under the License.
6165 !-->
6166</div>
6167<div class="section">
6168<h3><a name="interval_before.2C_interval_after"></a>interval_before, interval_after</h3>
6169<ul>
6170
6171<li>
6172
6173<p>Syntax:</p>
6174
6175<div>
6176<div>
6177<pre class="source">interval_before(interval1, interval2)
6178interval_after(interval1, interval2)
6179</pre></div></div>
6180</li>
6181<li>
6182
6183<p>These two functions check whether an interval happens before/after another interval.</p>
6184</li>
6185<li>Arguments:
6186<ul>
6187
6188<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6189</ul>
6190</li>
6191<li>Return Value:
6192<ul>
6193
6194<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>
6195<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
6196<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6197<li>any other non-interval input value will cause a type error.</li>
6198</ul>
6199</li>
6200<li>
6201
6202<p>Examples:</p>
6203
6204<div>
6205<div>
6206<pre class="source">{
6207 &quot;interval_before&quot;: interval_before(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6208 interval(date(&quot;2005-05-01&quot;), date(&quot;2012-09-09&quot;))),
6209 &quot;interval_after&quot;: interval_after(interval(date(&quot;2005-05-01&quot;), date(&quot;2012-09-09&quot;)),
6210 interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)))
6211};
6212</pre></div></div>
6213</li>
6214<li>
6215
6216<p>The expected result is:</p>
6217
6218<div>
6219<div>
6220<pre class="source">{ &quot;interval_before&quot;: true, &quot;interval_after&quot;: true }
6221</pre></div></div>
6222</li>
6223</ul></div>
6224<div class="section">
6225<h3><a name="interval_covers.2C_interval_covered_by"></a>interval_covers, interval_covered_by</h3>
6226<ul>
6227
6228<li>
6229
6230<p>Syntax:</p>
6231
6232<div>
6233<div>
6234<pre class="source">interval_covers(interval1, interval2)
6235interval_covered_by(interval1, interval2)
6236</pre></div></div>
6237</li>
6238<li>
6239
6240<p>These two functions check whether one interval covers the other interval.</p>
6241</li>
6242<li>Arguments:
6243<ul>
6244
6245<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6246</ul>
6247</li>
6248<li>Return Value:
6249<ul>
6250
6251<li>
6252
6253<p>a <tt>boolean</tt> value. Specifically, <tt>interval_covers(interval1, interval2)</tt> is true if and only if</p>
6254<p>interval1.start &lt;= interval2.start AND interval1.end &gt;= interval2.end</p>
6255<p><tt>interval_covered_by(interval1, interval2)</tt> is true if and only if</p>
6256<p>interval2.start &lt;= interval1.start AND interval2.end &gt;= interval1.end</p>
6257</li>
6258<li>
6259
6260<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
6261</li>
6262<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6263<li>any other non-interval input value will cause a type error.</li>
6264</ul>
6265</li>
6266<li>
6267
6268<p>Examples:</p>
6269
6270<div>
6271<div>
6272<pre class="source">{
6273 &quot;interval_covers&quot;: interval_covers(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6274 interval(date(&quot;2000-03-01&quot;), date(&quot;2004-09-09&quot;))),
6275 &quot;interval_covered_by&quot;: interval_covered_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
6276 interval(date(&quot;2004-09-10&quot;), date(&quot;2012-08-01&quot;)))
6277};
6278</pre></div></div>
6279</li>
6280<li>
6281
6282<p>The expected result is:</p>
6283
6284<div>
6285<div>
6286<pre class="source">{ &quot;interval_covers&quot;: true, &quot;interval_covered_by&quot;: true }
6287</pre></div></div>
6288</li>
6289</ul></div>
6290<div class="section">
6291<h3><a name="interval_overlaps.2C_interval_overlapped_by"></a>interval_overlaps, interval_overlapped_by</h3>
6292<ul>
6293
6294<li>
6295
6296<p>Syntax:</p>
6297
6298<div>
6299<div>
6300<pre class="source">interval_overlaps(interval1, interval2)
6301interval_overlapped_by(interval1, interval2)
6302</pre></div></div>
6303</li>
6304<li>
6305
6306<p>These functions check whether two intervals overlap with each other.</p>
6307</li>
6308<li>Arguments:
6309<ul>
6310
6311<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6312</ul>
6313</li>
6314<li>Return Value:
6315<ul>
6316
6317<li>a <tt>boolean</tt> value. Specifically, <tt>interval_overlaps(interval1, interval2)</tt> is true if and only if
6318<p>interval1.start &lt; interval2.start AND interval2.end &gt; interval1.end AND interval1.end &gt; interval2.start</p></li>
6319</ul>
6320<p><tt>interval_overlapped_by(interval1, interval2)</tt> is true if and only if</p>
6321
6322<div>
6323<div>
6324<pre class="source">interval2.start &lt; interval1.start
6325AND interval1.end &gt; interval2.end
6326AND interval2.end &gt; interval1.start
6327</pre></div></div>
6328
6329<ul>
6330
6331<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
6332<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6333<li>any other non-interval input value will cause a type error.</li>
6334</ul>
6335<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>
6336</li>
6337<li>
6338
6339<p>Examples:</p>
6340
6341<div>
6342<div>
6343<pre class="source">{
6344 &quot;overlaps&quot;: interval_overlaps(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6345 interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))),
6346 &quot;overlapped_by&quot;: interval_overlapped_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
6347 interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))))
6348};
6349</pre></div></div>
6350</li>
6351<li>
6352
6353<p>The expected result is:</p>
6354
6355<div>
6356<div>
6357<pre class="source">{ &quot;overlaps&quot;: true, &quot;overlapped_by&quot;: true }
6358</pre></div></div>
6359</li>
6360</ul></div>
6361<div class="section">
6362<h3><a name="interval_overlapping"></a>interval_overlapping</h3>
6363<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>
6364<ul>
6365
6366<li>
6367
6368<p>Syntax:</p>
6369
6370<div>
6371<div>
6372<pre class="source">interval_overlapping(interval1, interval2)
6373</pre></div></div>
6374</li>
6375<li>
6376
6377<p>This functions check whether two intervals share any points with each other.</p>
6378</li>
6379<li>Arguments:
6380<ul>
6381
6382<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6383</ul>
6384</li>
6385<li>Return Value:
6386<ul>
6387
6388<li>
6389
6390<p>a <tt>boolean</tt> value. Specifically, <tt>interval_overlapping(interval1, interval2)</tt> is true if</p>
6391<p>interval1.start &lt; interval2.end AND interval1.end &gt; interval2.start</p>
6392</li>
6393<li>
6394
6395<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
6396</li>
6397<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6398<li>any other non-interval input value will cause a type error.</li>
6399</ul>
6400</li>
6401<li>
6402
6403<p>Examples:</p>
6404
6405<div>
6406<div>
6407<pre class="source">{
6408 &quot;overlapping1&quot;: interval_overlapping(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6409 interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))),
6410 &quot;overlapping2&quot;: interval_overlapping(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
6411 interval(date(&quot;2004-09-10&quot;), date(&quot;2006-12-31&quot;)))
6412};
6413</pre></div></div>
6414</li>
6415<li>
6416
6417<p>The expected result is:</p>
6418
6419<div>
6420<div>
6421<pre class="source">{ &quot;overlapping1&quot;: true, &quot;overlapping2&quot;: true }
6422</pre></div></div>
6423</li>
6424</ul></div>
6425<div class="section">
6426<h3><a name="interval_meets.2C_interval_met_by"></a>interval_meets, interval_met_by</h3>
6427<ul>
6428
6429<li>
6430
6431<p>Syntax:</p>
6432
6433<div>
6434<div>
6435<pre class="source">interval_meets(interval1, interval2)
6436interval_met_by(interval1, interval2)
6437</pre></div></div>
6438</li>
6439<li>
6440
6441<p>These two functions check whether an interval meets with another interval.</p>
6442</li>
6443<li>Arguments:
6444<ul>
6445
6446<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6447</ul>
6448</li>
6449<li>Return Value:
6450<ul>
6451
6452<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>
6453<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
6454<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6455<li>any other non-interval input value will cause a type error.</li>
6456</ul>
6457</li>
6458<li>
6459
6460<p>Examples:</p>
6461
6462<div>
6463<div>
6464<pre class="source">{
6465 &quot;meets&quot;: interval_meets(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6466 interval(date(&quot;2005-01-01&quot;), date(&quot;2012-09-09&quot;))),
6467 &quot;metby&quot;: interval_met_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
6468 interval(date(&quot;2004-09-10&quot;), date(&quot;2006-08-01&quot;)))
6469};
6470</pre></div></div>
6471</li>
6472<li>
6473
6474<p>The expected result is:</p>
6475
6476<div>
6477<div>
6478<pre class="source">{ &quot;meets&quot;: true, &quot;metby&quot;: true }
6479</pre></div></div>
6480</li>
6481</ul></div>
6482<div class="section">
6483<h3><a name="interval_starts.2C_interval_started_by"></a>interval_starts, interval_started_by</h3>
6484<ul>
6485
6486<li>
6487
6488<p>Syntax:</p>
6489
6490<div>
6491<div>
6492<pre class="source">interval_starts(interval1, interval2)
6493interval_started_by(interval1, interval2)
6494</pre></div></div>
6495</li>
6496<li>
6497
6498<p>These two functions check whether one interval starts with the other interval.</p>
6499</li>
6500<li>Arguments:
6501<ul>
6502
6503<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6504</ul>
6505</li>
6506<li>Return Value:
6507<ul>
6508
6509<li>a <tt>boolean</tt> value. Specifically, <tt>interval_starts(interval1, interval2)</tt> returns true if and only if
6510<p>interval1.start = interval2.start AND interval1.end &lt;= interval2.end</p></li>
6511</ul>
6512<p><tt>interval_started_by(interval1, interval2)</tt> returns true if and only if</p>
6513
6514<div>
6515<div>
6516<pre class="source">interval1.start = interval2.start
6517AND interval2.end &lt;= interval1.end
6518</pre></div></div>
6519
6520<ul>
6521
6522<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
6523<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6524<li>any other non-interval input value will cause a type error.</li>
6525</ul>
6526</li>
6527<li>
6528
6529<p>Examples:</p>
6530
6531<div>
6532<div>
6533<pre class="source">{
6534 &quot;interval_starts&quot;: interval_starts(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6535 interval(date(&quot;2000-01-01&quot;), date(&quot;2012-09-09&quot;))),
6536 &quot;interval_started_by&quot;: interval_started_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
6537 interval(date(&quot;2006-08-01&quot;), date(&quot;2006-08-02&quot;)))
6538};
6539</pre></div></div>
6540</li>
6541<li>
6542
6543<p>The expected result is:</p>
6544
6545<div>
6546<div>
6547<pre class="source">{ &quot;interval_starts&quot;: true, &quot;interval_started_by&quot;: true }
6548</pre></div></div>
6549</li>
6550</ul></div>
6551<div class="section">
6552<h3><a name="interval_ends.2C_interval_ended_by"></a>interval_ends, interval_ended_by</h3>
6553<ul>
6554
6555<li>
6556
6557<p>Syntax:</p>
6558
6559<div>
6560<div>
6561<pre class="source">interval_ends(interval1, interval2)
6562interval_ended_by(interval1, interval2)
6563</pre></div></div>
6564</li>
6565<li>
6566
6567<p>These two functions check whether one interval ends with the other interval.</p>
6568</li>
6569<li>Arguments:
6570<ul>
6571
6572<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
6573</ul>
6574</li>
6575<li>Return Value:
6576<ul>
6577
6578<li>
6579
6580<p>a <tt>boolean</tt> value. Specifically, <tt>interval_ends(interval1, interval2)</tt> returns true if and only if</p>
6581<p>interval1.end = interval2.end AND interval1.start &gt;= interval2.start</p>
6582<p><tt>interval_ended_by(interval1, interval2)</tt> returns true if and only if</p>
6583<p>interval2.end = interval1.end AND interval2.start &gt;= interval1.start</p>
6584</li>
6585<li>
6586
6587<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
6588</li>
6589<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6590<li>any other non-interval input value will cause a type error.</li>
6591</ul>
6592</li>
6593<li>
6594
6595<p>Examples:</p>
6596
6597<div>
6598<div>
6599<pre class="source">{
6600 &quot;interval_ends&quot;: interval_ends(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
6601 interval(date(&quot;1998-01-01&quot;), date(&quot;2005-01-01&quot;))),
6602 &quot;interval_ended_by&quot;: interval_ended_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
6603 interval(date(&quot;2006-09-10&quot;), date(&quot;2007-03-01&quot;)))
6604};
6605</pre></div></div>
6606</li>
6607<li>
6608
6609<p>The expected result is:</p>
6610
6611<div>
6612<div>
6613<pre class="source">{ &quot;interval_ends&quot;: true, &quot;interval_ended_by&quot;: true }
6614</pre></div></div>
6615</li>
6616</ul><!--
6617 ! Licensed to the Apache Software Foundation (ASF) under one
6618 ! or more contributor license agreements. See the NOTICE file
6619 ! distributed with this work for additional information
6620 ! regarding copyright ownership. The ASF licenses this file
6621 ! to you under the Apache License, Version 2.0 (the
6622 ! "License"); you may not use this file except in compliance
6623 ! with the License. You may obtain a copy of the License at
6624 !
6625 ! http://www.apache.org/licenses/LICENSE-2.0
6626 !
6627 ! Unless required by applicable law or agreed to in writing,
6628 ! software distributed under the License is distributed on an
6629 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
6630 ! KIND, either express or implied. See the License for the
6631 ! specific language governing permissions and limitations
6632 ! under the License.
6633 !-->
6634</div></div>
6635<div class="section">
6636<h2><a name="Object_Functions"></a><a name="ObjectFunctions" id="ObjectFunctions">Object Functions</a></h2>
6637<div class="section">
6638<h3><a name="get_object_fields"></a>get_object_fields</h3>
6639<ul>
6640
6641<li>
6642
6643<p>Syntax:</p>
6644
6645<div>
6646<div>
6647<pre class="source">get_object_fields(input_object)
6648</pre></div></div>
6649</li>
6650<li>
6651
6652<p>Access the object field names, type and open status for a given object.</p>
6653</li>
6654<li>Arguments:
6655<ul>
6656
6657<li><tt>input_object</tt> : a object value.</li>
6658</ul>
6659</li>
6660<li>Return Value:
6661<ul>
6662
6663<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>
6664<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
6665<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
6666<li>any other non-object input value will cause a type error.</li>
6667</ul>
6668</li>
6669<li>
6670
6671<p>Example:</p>
6672
6673<div>
6674<div>
6675<pre class="source">get_object_fields(
6676 {
6677 &quot;id&quot;: 1,
6678 &quot;project&quot;: &quot;AsterixDB&quot;,
6679 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
6680 &quot;related&quot;: [&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
6681 }
6682 );
6683</pre></div></div>
6684</li>
6685<li>
6686
6687<p>The expected result is:</p>
6688
6689<div>
6690<div>
6691<pre class="source">[
6692 { &quot;field-name&quot;: &quot;id&quot;, &quot;field-type&quot;: &quot;INT64&quot;, &quot;is-open&quot;: false },
6693 { &quot;field-name&quot;: &quot;project&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false },
6694 { &quot;field-name&quot;: &quot;address&quot;, &quot;field-type&quot;: &quot;RECORD&quot;, &quot;is-open&quot;: false,
6695 &quot;nested&quot;: [
6696 { &quot;field-name&quot;: &quot;city&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false },
6697 { &quot;field-name&quot;: &quot;state&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false }
6698 ]
6699 },
6700 { &quot;field-name&quot;:
6701 &quot;related&quot;,
6702 &quot;field-type&quot;: &quot;ORDEREDLIST&quot;,
6703 &quot;is-open&quot;: false,
6704 &quot;list&quot;: [
6705 { &quot;field-type&quot;: &quot;STRING&quot; },
6706 { &quot;field-type&quot;: &quot;STRING&quot; },
6707 { &quot;field-type&quot;: &quot;STRING&quot; }
6708 ]
6709 }
6710]
6711</pre></div></div>
6712</li>
6713</ul>
6714<p>]</p></div>
6715<div class="section">
6716<h3><a name="get_object_field_value"></a>get_object_field_value</h3>
6717<ul>
6718
6719<li>
6720
6721<p>Syntax:</p>
6722
6723<div>
6724<div>
6725<pre class="source">get_object_field_value(input_object, string)
6726</pre></div></div>
6727</li>
6728<li>
6729
6730<p>Access the field name given in the <tt>string_expression</tt> from the <tt>object_expression</tt>.</p>
6731</li>
6732<li>Arguments:
6733<ul>
6734
6735<li><tt>input_object</tt> : a <tt>object</tt> value.</li>
6736<li><tt>string</tt> : a <tt>string</tt> representing the top level field name.</li>
6737</ul>
6738</li>
6739<li>Return Value:
6740<ul>
6741
6742<li>an <tt>any</tt> value saved in the designated field of the object,</li>
6743<li><tt>missing</tt> if any 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>a type error will be raised if:
6746<ul>
6747
6748<li>the first argument is any other non-object value,</li>
6749<li>or, the second argument is any other non-string value.</li>
6750</ul>
6751</li>
6752</ul>
6753</li>
6754<li>
6755
6756<p>Example:</p>
6757
6758<div>
6759<div>
6760<pre class="source">get_object_field_value({
6761 &quot;id&quot;: 1,
6762 &quot;project&quot;: &quot;AsterixDB&quot;,
6763 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
6764 &quot;related&quot;: [&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
6765 },
6766 &quot;project&quot;
6767 );
6768</pre></div></div>
6769</li>
6770<li>
6771
6772<p>The expected result is:</p>
6773
6774<div>
6775<div>
6776<pre class="source">&quot;AsterixDB&quot;
6777</pre></div></div>
6778</li>
6779</ul></div>
6780<div class="section">
6781<h3><a name="object_remove_fields"></a>object_remove_fields</h3>
6782<ul>
6783
6784<li>
6785
6786<p>Syntax:</p>
6787
6788<div>
6789<div>
6790<pre class="source">object_remove_fields(input_object, field_names)
6791</pre></div></div>
6792</li>
6793<li>
6794
6795<p>Remove indicated fields from a object given a list of field names.</p>
6796</li>
6797<li>Arguments:
6798<ul>
6799
6800<li><tt>input_object</tt>: a object value.</li>
6801<li><tt>field_names</tt>: an array of strings and/or array of array of strings.</li>
6802</ul>
6803</li>
6804<li>
6805
6806<p>Return Value:</p>
6807<ul>
6808
6809<li>a new object value without the fields listed in the second argument,</li>
6810<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
6811<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6812<li>a type error will be raised if:
6813<ul>
6814
6815<li>the first argument is any other non-object value,</li>
6816<li>or, the second argument is any other non-array value or recursively contains non-string items.</li>
6817</ul>
6818</li>
6819</ul>
6820</li>
6821<li>
6822
6823<p>Example:</p>
6824
6825<div>
6826<div>
6827<pre class="source">object_remove_fields(
6828 {
6829 &quot;id&quot;:1,
6830 &quot;project&quot;:&quot;AsterixDB&quot;,
6831 &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
6832 &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
6833 },
6834 [[&quot;address&quot;, &quot;city&quot;], &quot;related&quot;]
6835 );
6836</pre></div></div>
6837</li>
6838<li>
6839
6840<p>The expected result is:</p>
6841
6842<div>
6843<div>
6844<pre class="source">{
6845 &quot;id&quot;:1,
6846 &quot;project&quot;:&quot;AsterixDB&quot;,
6847 &quot;address&quot;:{ &quot;state&quot;: &quot;CA&quot; }
6848}
6849</pre></div></div>
6850</li>
6851</ul></div>
6852<div class="section">
6853<h3><a name="object_add_fields"></a>object_add_fields</h3>
6854<ul>
6855
6856<li>
6857
6858<p>Syntax:</p>
6859
6860<div>
6861<div>
6862<pre class="source">object_add_fields(input_object, fields)
6863</pre></div></div>
6864</li>
6865<li>
6866
6867<p>Add fields to a object given a list of field names.</p>
6868</li>
6869<li>Arguments:
6870<ul>
6871
6872<li><tt>input_object</tt> : a object value.</li>
6873<li><tt>fields</tt>: an array of field descriptor objects where each object has field_name and field_value.</li>
6874</ul>
6875</li>
6876<li>Return Value:
6877<ul>
6878
6879<li>a new object value with the new fields included,</li>
6880<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
6881<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6882<li>a type error will be raised if:
6883<ul>
6884
6885<li>the first argument is any other non-object value,</li>
6886<li>the second argument is any other non-array value, or contains non-object items.</li>
6887</ul>
6888</li>
6889</ul>
6890</li>
6891<li>
6892
6893<p>Example:</p>
6894
6895<div>
6896<div>
6897<pre class="source">object_add_fields(
6898 {
6899 &quot;id&quot;:1,
6900 &quot;project&quot;:&quot;AsterixDB&quot;,
6901 &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
6902 &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
6903 },
6904 [{&quot;field-name&quot;:&quot;employment_location&quot;, &quot;field-value&quot;:create_point(30.0,70.0)}]
6905 );
6906</pre></div></div>
6907</li>
6908<li>
6909
6910<p>The expected result is:</p>
6911
6912<div>
6913<div>
6914<pre class="source">{
6915 &quot;id&quot;:1,
6916 &quot;project&quot;:&quot;AsterixDB&quot;,
6917 &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
6918 &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
6919 &quot;employment_location&quot;: point(&quot;30.0,70.0&quot;)
6920 }
6921</pre></div></div>
6922</li>
6923</ul></div>
6924<div class="section">
6925<h3><a name="object_merge"></a>object_merge</h3>
6926<ul>
6927
6928<li>
6929
6930<p>Syntax:</p>
6931
6932<div>
6933<div>
6934<pre class="source">object_merge(object1, object2)
6935</pre></div></div>
6936</li>
6937<li>
6938
6939<p>Merge two different objects into a new object.</p>
6940</li>
6941<li>Arguments:
6942<ul>
6943
6944<li><tt>object1</tt> : a object value.</li>
6945<li><tt>object2</tt> : a object value.</li>
6946</ul>
6947</li>
6948<li>Return Value:
6949<ul>
6950
6951<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>
6952<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
6953<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
6954<li>any other non-object input value will cause a type error.</li>
6955</ul>
6956</li>
6957<li>
6958
6959<p>Example:</p>
6960
6961<div>
6962<div>
6963<pre class="source">object_merge(
6964 {
6965 &quot;id&quot;:1,
6966 &quot;project&quot;:&quot;AsterixDB&quot;,
6967 &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
6968 &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
6969 },
6970 {
6971 &quot;user_id&quot;: 22,
6972 &quot;employer&quot;: &quot;UC Irvine&quot;,
6973 &quot;employment_type&quot;: &quot;visitor&quot;
6974 }
6975 );
6976</pre></div></div>
6977</li>
6978<li>
6979
6980<p>The expected result is:</p>
6981
6982<div>
6983<div>
6984<pre class="source">{
6985 &quot;employment_type&quot;: &quot;visitor&quot;,
6986 &quot;address&quot;: {
6987 &quot;city&quot;: &quot;Irvine&quot;,
6988 &quot;state&quot;: &quot;CA&quot;
6989 },
6990 &quot;related&quot;: [
6991 &quot;Hivestrix&quot;,
6992 &quot;Preglix&quot;,
6993 &quot;Apache VXQuery&quot;
6994 ],
6995 &quot;user_id&quot;: 22,
6996 &quot;project&quot;: &quot;AsterixDB&quot;,
6997 &quot;employer&quot;: &quot;UC Irvine&quot;,
6998 &quot;id&quot;: 1
6999}
7000</pre></div></div>
7001</li>
7002</ul></div>
7003<div class="section">
7004<h3><a name="object_length"></a>object_length</h3>
7005<ul>
7006
7007<li>
7008
7009<p>Syntax:</p>
7010
7011<div>
7012<div>
7013<pre class="source">object_length(input_object)
7014</pre></div></div>
7015</li>
7016<li>
7017
7018<p>Returns number of top-level fields in the given object</p>
7019</li>
7020<li>Arguments:
7021<ul>
7022
7023<li><tt>input_object</tt> : an object value.</li>
7024</ul>
7025</li>
7026<li>Return Value:
7027<ul>
7028
7029<li>an integer that represents the number of top-level fields in the given object,</li>
7030<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
7031<li><tt>null</tt> if the argument is a <tt>null</tt> value or any other non-object value</li>
7032</ul>
7033</li>
7034<li>
7035
7036<p>Example:</p>
7037
7038<div>
7039<div>
7040<pre class="source">object_length(
7041 {
7042 &quot;id&quot;: 1,
7043 &quot;project&quot;: &quot;AsterixDB&quot;,
7044 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
7045 }
7046 );
7047</pre></div></div>
7048</li>
7049<li>
7050
7051<p>The expected result is:</p>
7052
7053<div>
7054<div>
7055<pre class="source">3
7056</pre></div></div>
7057</li>
7058</ul></div>
7059<div class="section">
7060<h3><a name="object_names"></a>object_names</h3>
7061<ul>
7062
7063<li>
7064
7065<p>Syntax:</p>
7066
7067<div>
7068<div>
7069<pre class="source">object_names(input_object)
7070</pre></div></div>
7071</li>
7072<li>
7073
7074<p>Returns names of top-level fields in the given object</p>
7075</li>
7076<li>Arguments:
7077<ul>
7078
7079<li><tt>input_object</tt> : an object value.</li>
7080</ul>
7081</li>
7082<li>Return Value:
7083<ul>
7084
7085<li>an array with top-level field names of the given object,</li>
7086<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
7087<li><tt>null</tt> if the argument is a <tt>null</tt> value or any other non-object value</li>
7088</ul>
7089</li>
7090<li>
7091
7092<p>Example:</p>
7093
7094<div>
7095<div>
7096<pre class="source">object_names(
7097 {
7098 &quot;id&quot;: 1,
7099 &quot;project&quot;: &quot;AsterixDB&quot;,
7100 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
7101 }
7102 );
7103</pre></div></div>
7104</li>
7105<li>
7106
7107<p>The expected result is:</p>
7108
7109<div>
7110<div>
7111<pre class="source">[ &quot;id&quot;, &quot;project&quot;, &quot;address&quot; ]
7112</pre></div></div>
7113</li>
7114</ul></div>
7115<div class="section">
7116<h3><a name="object_remove"></a>object_remove</h3>
7117<ul>
7118
7119<li>
7120
7121<p>Syntax:</p>
7122
7123<div>
7124<div>
7125<pre class="source">object_remove(input_object, field_name)
7126</pre></div></div>
7127</li>
7128<li>
7129
7130<p>Returns a new object that has the same fields as the input object except the field to be removed</p>
7131</li>
7132<li>Arguments:
7133<ul>
7134
7135<li><tt>input_object</tt> : an object value.</li>
7136<li><tt>field_name</tt> : a string field name.</li>
7137</ul>
7138</li>
7139<li>Return Value:
7140<ul>
7141
7142<li>A new object that has the same fields as <tt>input_object</tt> except the field <tt>field_name</tt>,</li>
7143<li><tt>missing</tt> if the argument <tt>input_object</tt> or <tt>field_name</tt> is missing,</li>
7144<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>
7145</ul>
7146</li>
7147<li>
7148
7149<p>Example:</p>
7150
7151<div>
7152<div>
7153<pre class="source">object_remove(
7154 {
7155 &quot;id&quot;: 1,
7156 &quot;project&quot;: &quot;AsterixDB&quot;,
7157 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7158 }
7159 , &quot;address&quot;
7160 );
7161</pre></div></div>
7162</li>
7163<li>
7164
7165<p>The expected result is:</p>
7166
7167<div>
7168<div>
7169<pre class="source">{
7170 &quot;id&quot;: 1,
7171 &quot;project&quot;: &quot;AsterixDB&quot;,
7172}
7173</pre></div></div>
7174</li>
7175</ul></div>
7176<div class="section">
7177<h3><a name="object_rename"></a>object_rename</h3>
7178<ul>
7179
7180<li>
7181
7182<p>Syntax:</p>
7183
7184<div>
7185<div>
7186<pre class="source">object_rename(input_object, old_field, new_field)
7187</pre></div></div>
7188</li>
7189<li>
7190
7191<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>
7192</li>
7193<li>Arguments:
7194<ul>
7195
7196<li><tt>input_object</tt> : an object value.</li>
7197<li><tt>old_field</tt> : a string representing the old (original) field name inside the object <tt>input_object</tt>.</li>
7198<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>
7199</ul>
7200</li>
7201<li>Return Value:
7202<ul>
7203
7204<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>
7205<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
7206<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>
7207</ul>
7208</li>
7209<li>
7210
7211<p>Example:</p>
7212
7213<div>
7214<div>
7215<pre class="source">object_rename(
7216 {
7217 &quot;id&quot;: 1,
7218 &quot;project&quot;: &quot;AsterixDB&quot;,
7219 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7220 }
7221 , &quot;address&quot;
7222 , &quot;location&quot;
7223 );
7224</pre></div></div>
7225</li>
7226<li>
7227
7228<p>The expected result is:</p>
7229
7230<div>
7231<div>
7232<pre class="source">{
7233 &quot;id&quot;: 1,
7234 &quot;project&quot;: &quot;AsterixDB&quot;,
7235 &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7236}
7237</pre></div></div>
7238</li>
7239</ul></div>
7240<div class="section">
7241<h3><a name="object_unwrap"></a>object_unwrap</h3>
7242<ul>
7243
7244<li>
7245
7246<p>Syntax:</p>
7247
7248<div>
7249<div>
7250<pre class="source">object_unwrap(input_object)
7251</pre></div></div>
7252</li>
7253<li>
7254
7255<p>Returns the value of the single name-value pair that appears in <tt>input_object</tt>.</p>
7256</li>
7257<li>Arguments:
7258<ul>
7259
7260<li><tt>input_object</tt> : an object value that consists of exactly one name-value pair.</li>
7261</ul>
7262</li>
7263<li>Return Value:
7264<ul>
7265
7266<li>The value of the single name-value pair that appears in <tt>input_object</tt>,</li>
7267<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
7268<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>
7269</ul>
7270</li>
7271<li>
7272
7273<p>Example:</p>
7274
7275<div>
7276<div>
7277<pre class="source">object_unwrap(
7278 {
7279 &quot;id&quot;: 1
7280 }
7281 );
7282</pre></div></div>
7283</li>
7284<li>
7285
7286<p>The expected result is:</p>
7287
7288<div>
7289<div>
7290<pre class="source">{
7291 1
7292}
7293</pre></div></div>
7294</li>
7295</ul></div>
7296<div class="section">
7297<h3><a name="object_replace"></a>object_replace</h3>
7298<ul>
7299
7300<li>
7301
7302<p>Syntax:</p>
7303
7304<div>
7305<div>
7306<pre class="source">object_replace(input_object, old_value, new_value)
7307</pre></div></div>
7308</li>
7309<li>
7310
7311<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>
7312</li>
7313<li>Arguments:
7314<ul>
7315
7316<li><tt>input_object</tt> : an object value.</li>
7317<li><tt>old_value</tt> : a primitive type value to be replaced by <tt>new_value</tt>.</li>
7318<li><tt>new_value</tt> : a value to replace <tt>old_value</tt>.</li>
7319</ul>
7320</li>
7321<li>Return Value:
7322<ul>
7323
7324<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>
7325<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
7326<li><tt>null</tt> if <tt>input_object</tt> or <tt>old_value</tt> is null,</li>
7327<li>a type error will be raised if:
7328<ul>
7329
7330<li><tt>old_value</tt> is not a primitive type value.</li>
7331</ul>
7332</li>
7333</ul>
7334</li>
7335<li>
7336
7337<p>Example:</p>
7338
7339<div>
7340<div>
7341<pre class="source">object_replace(
7342 {
7343 &quot;id&quot;: 1,
7344 &quot;project&quot;: &quot;AsterixDB&quot;,
7345 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7346 }
7347 , &quot;AsterixDB&quot;
7348 , &quot;Apache AsterixDB&quot;
7349 );
7350</pre></div></div>
7351</li>
7352<li>
7353
7354<p>The expected result is:</p>
7355
7356<div>
7357<div>
7358<pre class="source">{
7359 &quot;id&quot;: 1,
7360 &quot;project&quot;: &quot;Apache AsterixDB&quot;,
7361 &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7362}
7363</pre></div></div>
7364</li>
7365</ul></div>
7366<div class="section">
7367<h3><a name="object_add"></a>object_add</h3>
7368<ul>
7369
7370<li>
7371
7372<p>Syntax:</p>
7373
7374<div>
7375<div>
7376<pre class="source">object_add(input_object, field_name, field_value)
7377</pre></div></div>
7378</li>
7379<li>
7380
7381<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>
7382</li>
7383<li>Arguments:
7384<ul>
7385
7386<li><tt>input_object</tt> : an object value.</li>
7387<li><tt>field_name</tt> : a string representing a field name to be added.</li>
7388<li><tt>field_value</tt> : a value to be assigned to the new field <tt>field_name</tt>.</li>
7389</ul>
7390</li>
7391<li>Return Value:
7392<ul>
7393
7394<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>
7395<li><tt>missing</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>missing</tt>,</li>
7396<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>
7397<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>
7398</ul>
7399</li>
7400<li>
7401
7402<p>Example:</p>
7403
7404<div>
7405<div>
7406<pre class="source">object_add(
7407 {
7408 &quot;id&quot;: 1,
7409 &quot;project&quot;: &quot;AsterixDB&quot;,
7410 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7411 }
7412 , &quot;company&quot;
7413 , &quot;Apache&quot;
7414 );
7415</pre></div></div>
7416</li>
7417<li>
7418
7419<p>The expected result is:</p>
7420
7421<div>
7422<div>
7423<pre class="source">{
7424 &quot;id&quot;: 1,
7425 &quot;project&quot;: &quot;AsterixDB&quot;,
7426 &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
7427 &quot;company&quot;: &quot;Apache&quot;
7428}
7429</pre></div></div>
7430</li>
7431</ul></div>
7432<div class="section">
7433<h3><a name="object_put"></a>object_put</h3>
7434<ul>
7435
7436<li>
7437
7438<p>Syntax:</p>
7439
7440<div>
7441<div>
7442<pre class="source">object_put(input_object, field_name, field_value)
7443</pre></div></div>
7444</li>
7445<li>
7446
7447<p>Adds, modifies, or removes a field of an object.</p>
7448</li>
7449<li>Arguments:
7450<ul>
7451
7452<li><tt>input_object</tt> : an object value.</li>
7453<li><tt>field_name</tt> : a string representing a field name to be added.</li>
7454<li><tt>field_value</tt> : a value to be assigned to the new field <tt>field_name</tt>.</li>
7455</ul>
7456</li>
7457<li>Return Value:
7458<ul>
7459
7460<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>
7461<li><tt>missing</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>missing</tt>,</li>
7462<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>
7463</ul>
7464</li>
7465<li>
7466
7467<p>Example:</p>
7468
7469<div>
7470<div>
7471<pre class="source">object_put(
7472 {
7473 &quot;id&quot;: 1,
7474 &quot;project&quot;: &quot;AsterixDB&quot;,
7475 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7476 }
7477 , &quot;project&quot;
7478 , &quot;Apache AsterixDB&quot;
7479 );
7480</pre></div></div>
7481</li>
7482<li>
7483
7484<p>The expected result is:</p>
7485
7486<div>
7487<div>
7488<pre class="source">{
7489 &quot;id&quot;: 1,
7490 &quot;project&quot;: &quot;Apache AsterixDB&quot;,
7491 &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7492}
7493</pre></div></div>
7494</li>
7495</ul></div>
7496<div class="section">
7497<h3><a name="object_values"></a>object_values</h3>
7498<ul>
7499
7500<li>
7501
7502<p>Syntax:</p>
7503
7504<div>
7505<div>
7506<pre class="source">object_values(input_object)
7507</pre></div></div>
7508</li>
7509<li>
7510
7511<p>Returns an array of the values of the fields in <tt>input_object</tt>.</p>
7512</li>
7513<li>Arguments:
7514<ul>
7515
7516<li><tt>input_object</tt> : an object value.</li>
7517</ul>
7518</li>
7519<li>Return Value:
7520<ul>
7521
7522<li>An array of the values of the fields in <tt>input_object</tt>,</li>
7523<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
7524<li><tt>null</tt> if <tt>input_object</tt> is null or any non-object value.</li>
7525</ul>
7526</li>
7527<li>
7528
7529<p>Example:</p>
7530
7531<div>
7532<div>
7533<pre class="source">object_values(
7534 {
7535 &quot;id&quot;: 1,
7536 &quot;project&quot;: &quot;AsterixDB&quot;,
7537 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7538 }
7539 );
7540</pre></div></div>
7541</li>
7542<li>
7543
7544<p>The expected result is:</p>
7545
7546<div>
7547<div>
7548<pre class="source">[
7549 1,
7550 &quot;AsterixDB&quot;,
7551 {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7552]
7553</pre></div></div>
7554</li>
7555</ul></div>
7556<div class="section">
7557<h3><a name="object_pairs"></a>object_pairs</h3>
7558<ul>
7559
7560<li>
7561
7562<p>Syntax:</p>
7563
7564<div>
7565<div>
7566<pre class="source">object_pairs(input_object)
7567</pre></div></div>
7568</li>
7569<li>
7570
7571<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>
7572</li>
7573<li>
7574
7575<p>Arguments:</p>
7576<ul>
7577
7578<li><tt>input_object</tt> : an object value.</li>
7579</ul>
7580</li>
7581<li>Return Value:
7582<ul>
7583
7584<li>An array of the <tt>name</tt>/<tt>value</tt> pairs of the fields in <tt>input_object</tt>,</li>
7585<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
7586<li><tt>null</tt> if <tt>input_object</tt> is null or any non-object value.</li>
7587</ul>
7588</li>
7589<li>
7590
7591<p>Example:</p>
7592
7593<div>
7594<div>
7595<pre class="source">object_pairs(
7596 {
7597 &quot;id&quot;: 1,
7598 &quot;project&quot;: &quot;AsterixDB&quot;,
7599 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7600 }
7601 );
7602</pre></div></div>
7603</li>
7604<li>
7605
7606<p>The expected result is:</p>
7607
7608<div>
7609<div>
7610<pre class="source">[
7611 { &quot;name&quot;: &quot;id&quot;, &quot;value&quot;: 1 },
7612 { &quot;name&quot;: &quot;project&quot;, &quot;value&quot;: &quot;AsterixDB&quot; },
7613 { &quot;name&quot;: &quot;address&quot;, &quot;value&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;} }
7614]
7615</pre></div></div>
7616</li>
7617</ul></div>
7618<div class="section">
7619<h3><a name="pairs"></a>pairs</h3>
7620<ul>
7621
7622<li>
7623
7624<p>Syntax:</p>
7625
7626<div>
7627<div>
7628<pre class="source">pairs(input_object)
7629</pre></div></div>
7630</li>
7631<li>
7632
7633<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>
7634</li>
7635<li>
7636
7637<p>Arguments:</p>
7638<ul>
7639
7640<li><tt>input_object</tt> : an object value (or an array or a multiset)</li>
7641</ul>
7642</li>
7643<li>Return Value:
7644<ul>
7645
7646<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>
7647<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
7648<li><tt>null</tt> if <tt>input_object</tt> is null or a value of a primitive data type.</li>
7649</ul>
7650</li>
7651<li>
7652
7653<p>Example:</p>
7654
7655<div>
7656<div>
7657<pre class="source">pairs(
7658 {
7659 &quot;id&quot;: 1,
7660 &quot;project&quot;: &quot;AsterixDB&quot;,
7661 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
7662 }
7663 );
7664</pre></div></div>
7665</li>
7666<li>
7667
7668<p>The expected result is:</p>
7669
7670<div>
7671<div>
7672<pre class="source">[
7673 [ &quot;id&quot;, 1 ],
7674 [ &quot;project&quot;, &quot;AsterixDB&quot; ],
7675 [ &quot;address&quot;, { &quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot; } ],
7676 [ &quot;city&quot;, &quot;Irvine&quot; ],
7677 [ &quot;state&quot;, &quot;CA&quot; ]
7678]
7679</pre></div></div>
7680</li>
7681</ul><!--
7682 ! Licensed to the Apache Software Foundation (ASF) under one
7683 ! or more contributor license agreements. See the NOTICE file
7684 ! distributed with this work for additional information
7685 ! regarding copyright ownership. The ASF licenses this file
7686 ! to you under the Apache License, Version 2.0 (the
7687 ! "License"); you may not use this file except in compliance
7688 ! with the License. You may obtain a copy of the License at
7689 !
7690 ! http://www.apache.org/licenses/LICENSE-2.0
7691 !
7692 ! Unless required by applicable law or agreed to in writing,
7693 ! software distributed under the License is distributed on an
7694 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
7695 ! KIND, either express or implied. See the License for the
7696 ! specific language governing permissions and limitations
7697 ! under the License.
7698 !-->
7699</div></div>
7700<div class="section">
7701<h2><a name="Aggregate_Functions_.28Array_Functions.29"></a><a name="AggregateFunctions" id="AggregateFunctions">Aggregate Functions (Array Functions) </a></h2>
7702<p>This section contains detailed descriptions of the built-in aggregate functions in the query language.</p>
7703<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#SQL-92_aggregation_functions">SQL-92 Aggregation Functions</a> for details.</p>
7704<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#Aggregation_functions">Aggregation Functions</a> for details.</p>
7705<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>
7706<div class="section">
7707<h3><a name="array_count"></a>array_count</h3>
7708<ul>
7709
7710<li>
7711
7712<p>Syntax:</p>
7713
7714<div>
7715<div>
7716<pre class="source">array_count(collection)
7717</pre></div></div>
7718</li>
7719<li>
7720
7721<p>Gets the number of non-null and non-missing items in the given collection.</p>
7722</li>
7723<li>Arguments:
7724<ul>
7725
7726<li><tt>collection</tt> could be:
7727<ul>
7728
7729<li>an <tt>array</tt> or <tt>multiset</tt> to be counted,</li>
7730<li>or, a <tt>null</tt> value,</li>
7731<li>or, a <tt>missing</tt> value.</li>
7732</ul>
7733</li>
7734</ul>
7735</li>
7736<li>Return Value:
7737<ul>
7738
7739<li>a <tt>bigint</tt> value representing the number of non-null and non-missing items in the given collection,</li>
7740<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
7741<li>any other non-array and non-multiset input value will cause an error.</li>
7742</ul>
7743</li>
7744<li>
7745
7746<p>Example:</p>
7747
7748<div>
7749<div>
7750<pre class="source">array_count( ['hello', 'world', 1, 2, 3, null, missing] );
7751</pre></div></div>
7752</li>
7753<li>
7754
7755<p>The expected result is:</p>
7756
7757<div>
7758<div>
7759<pre class="source">5
7760</pre></div></div>
7761</li>
7762</ul></div>
7763<div class="section">
7764<h3><a name="array_avg"></a>array_avg</h3>
7765<ul>
7766
7767<li>
7768
7769<p>Syntax:</p>
7770
7771<div>
7772<div>
7773<pre class="source">array_avg(num_collection)
7774</pre></div></div>
7775</li>
7776<li>
7777
7778<p>Gets the average value of the non-null and non-missing numeric items in the given collection.</p>
7779</li>
7780<li>Arguments:
7781<ul>
7782
7783<li><tt>num_collection</tt> could be:
7784<ul>
7785
7786<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
7787<li>or, a <tt>null</tt> value,</li>
7788<li>or, a <tt>missing</tt> value.</li>
7789</ul>
7790</li>
7791</ul>
7792</li>
7793<li>Return Value:
7794<ul>
7795
7796<li>a <tt>double</tt> value representing the average of the non-null and non-missing numbers in the given collection,</li>
7797<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
7798<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
7799<li>any other non-array and non-multiset input value will cause a type error,</li>
7800<li>any other non-numeric value in the input collection will cause a type error.</li>
7801</ul>
7802</li>
7803<li>
7804
7805<p>Example:</p>
7806
7807<div>
7808<div>
7809<pre class="source">array_avg( [1.2, 2.3, 3.4, 0, null] );
7810</pre></div></div>
7811</li>
7812<li>
7813
7814<p>The expected result is:</p>
7815
7816<div>
7817<div>
7818<pre class="source">1.725
7819</pre></div></div>
7820</li>
7821</ul></div>
7822<div class="section">
7823<h3><a name="array_sum"></a>array_sum</h3>
7824<ul>
7825
7826<li>
7827
7828<p>Syntax:</p>
7829
7830<div>
7831<div>
7832<pre class="source">array_sum(num_collection)
7833</pre></div></div>
7834</li>
7835<li>
7836
7837<p>Gets the sum of non-null and non-missing items in the given collection.</p>
7838</li>
7839<li>Arguments:
7840<ul>
7841
7842<li><tt>num_collection</tt> could be:
7843<ul>
7844
7845<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
7846<li>or, a <tt>null</tt> value,</li>
7847<li>or, a <tt>missing</tt> value.</li>
7848</ul>
7849</li>
7850</ul>
7851</li>
7852<li>Return Value:
7853<ul>
7854
7855<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>
7856<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
7857<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
7858<li>any other non-array and non-multiset input value will cause a type error,</li>
7859<li>any other non-numeric value in the input collection will cause a type error.</li>
7860</ul>
7861</li>
7862<li>
7863
7864<p>Example:</p>
7865
7866<div>
7867<div>
7868<pre class="source">array_sum( [1.2, 2.3, 3.4, 0, null, missing] );
7869</pre></div></div>
7870</li>
7871<li>
7872
7873<p>The expected result is:</p>
7874
7875<div>
7876<div>
7877<pre class="source">6.9
7878</pre></div></div>
7879</li>
7880</ul></div>
7881<div class="section">
7882<h3><a name="array_min"></a>array_min</h3>
7883<ul>
7884
7885<li>
7886
7887<p>Syntax:</p>
7888
7889<div>
7890<div>
7891<pre class="source">array_min(num_collection)
7892</pre></div></div>
7893</li>
7894<li>
7895
7896<p>Gets the min value of non-null and non-missing comparable items in the given collection.</p>
7897</li>
7898<li>Arguments:
7899<ul>
7900
7901<li><tt>num_collection</tt> could be:
7902<ul>
7903
7904<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
7905<li>or, a <tt>null</tt> value,</li>
7906<li>or, a <tt>missing</tt> value.</li>
7907</ul>
7908</li>
7909</ul>
7910</li>
7911<li>Return Value:
7912<ul>
7913
7914<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>
7915<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
7916<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
7917<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
7918<li>any other non-array and non-multiset input value will cause a type error.</li>
7919</ul>
7920</li>
7921<li>
7922
7923<p>Example:</p>
7924
7925<div>
7926<div>
7927<pre class="source">array_min( [1.2, 2.3, 3.4, 0, null, missing] );
7928</pre></div></div>
7929</li>
7930<li>
7931
7932<p>The expected result is:</p>
7933
7934<div>
7935<div>
7936<pre class="source">0.0
7937</pre></div></div>
7938</li>
7939</ul></div>
7940<div class="section">
7941<h3><a name="array_max"></a>array_max</h3>
7942<ul>
7943
7944<li>
7945
7946<p>Syntax:</p>
7947
7948<div>
7949<div>
7950<pre class="source">array_max(num_collection)
7951</pre></div></div>
7952</li>
7953<li>
7954
7955<p>Gets the max value of the non-null and non-missing comparable items in the given collection.</p>
7956</li>
7957<li>Arguments:
7958<ul>
7959
7960<li><tt>num_collection</tt> could be:
7961<ul>
7962
7963<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
7964<li>or, a <tt>null</tt> value,</li>
7965<li>or, a <tt>missing</tt> value.</li>
7966</ul>
7967</li>
7968</ul>
7969</li>
7970<li>Return Value:
7971<ul>
7972
7973<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>
7974<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
7975<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
7976<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
7977<li>any other non-array and non-multiset input value will cause a type error.</li>
7978</ul>
7979</li>
7980<li>
7981
7982<p>Example:</p>
7983
7984<div>
7985<div>
7986<pre class="source">array_max( [1.2, 2.3, 3.4, 0, null, missing] );
7987</pre></div></div>
7988</li>
7989<li>
7990
7991<p>The expected result is:</p>
7992
7993<div>
7994<div>
7995<pre class="source">3.4
7996</pre></div></div>
7997</li>
7998</ul></div>
7999<div class="section">
8000<h3><a name="array_stddev_samp"></a>array_stddev_samp</h3>
8001<ul>
8002
8003<li>
8004
8005<p>Syntax:</p>
8006
8007<div>
8008<div>
8009<pre class="source">array_stddev_samp(num_collection)
8010</pre></div></div>
8011</li>
8012<li>
8013
8014<p>Gets the sample standard deviation value of the non-null and non-missing numeric items in the given collection.</p>
8015</li>
8016<li>Arguments:
8017<ul>
8018
8019<li><tt>num_collection</tt> could be:
8020<ul>
8021
8022<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8023<li>or, a <tt>null</tt> value,</li>
8024<li>or, a <tt>missing</tt> value.</li>
8025</ul>
8026</li>
8027</ul>
8028</li>
8029<li>Return Value:
8030<ul>
8031
8032<li>a <tt>double</tt> value representing the sample standard deviation of the non-null and non-missing numbers in the given collection,</li>
8033<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8034<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8035<li>any other non-array and non-multiset input value will cause a type error,</li>
8036<li>any other non-numeric value in the input collection will cause a type error.</li>
8037</ul>
8038</li>
8039<li>
8040
8041<p>Example:</p>
8042
8043<div>
8044<div>
8045<pre class="source">array_stddev_samp( [1.2, 2.3, 3.4, 0, null] );
8046</pre></div></div>
8047</li>
8048<li>
8049
8050<p>The expected result is:</p>
8051
8052<div>
8053<div>
8054<pre class="source">1.4591664287073858
8055</pre></div></div>
8056</li>
8057</ul></div>
8058<div class="section">
8059<h3><a name="array_stddev_pop"></a>array_stddev_pop</h3>
8060<ul>
8061
8062<li>
8063
8064<p>Syntax:</p>
8065
8066<div>
8067<div>
8068<pre class="source">array_stddev_pop(num_collection)
8069</pre></div></div>
8070</li>
8071<li>
8072
8073<p>Gets the population standard deviation value of the non-null and non-missing numeric items in the given collection.</p>
8074</li>
8075<li>Arguments:
8076<ul>
8077
8078<li><tt>num_collection</tt> could be:
8079<ul>
8080
8081<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8082<li>or, a <tt>null</tt> value,</li>
8083<li>or, a <tt>missing</tt> value.</li>
8084</ul>
8085</li>
8086</ul>
8087</li>
8088<li>Return Value:
8089<ul>
8090
8091<li>a <tt>double</tt> value representing the population standard deviation of the non-null and non-missing numbers in the given collection,</li>
8092<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8093<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8094<li>any other non-array and non-multiset input value will cause a type error,</li>
8095<li>any other non-numeric value in the input collection will cause a type error.</li>
8096</ul>
8097</li>
8098<li>
8099
8100<p>Example:</p>
8101
8102<div>
8103<div>
8104<pre class="source">array_stddev_pop( [1.2, 2.3, 3.4, 0, null] );
8105</pre></div></div>
8106</li>
8107<li>
8108
8109<p>The expected result is:</p>
8110
8111<div>
8112<div>
8113<pre class="source">1.2636751956100112
8114</pre></div></div>
8115</li>
8116</ul></div>
8117<div class="section">
8118<h3><a name="array_var_samp"></a>array_var_samp</h3>
8119<ul>
8120
8121<li>
8122
8123<p>Syntax:</p>
8124
8125<div>
8126<div>
8127<pre class="source">array_var_samp(num_collection)
8128</pre></div></div>
8129</li>
8130<li>
8131
8132<p>Gets the sample variance value of the non-null and non-missing numeric items in the given collection.</p>
8133</li>
8134<li>Arguments:
8135<ul>
8136
8137<li><tt>num_collection</tt> could be:
8138<ul>
8139
8140<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8141<li>or, a <tt>null</tt> value,</li>
8142<li>or, a <tt>missing</tt> value.</li>
8143</ul>
8144</li>
8145</ul>
8146</li>
8147<li>Return Value:
8148<ul>
8149
8150<li>a <tt>double</tt> value representing the sample variance of the non-null and non-missing numbers in the given collection,</li>
8151<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8152<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8153<li>any other non-array and non-multiset input value will cause a type error,</li>
8154<li>any other non-numeric value in the input collection will cause a type error.</li>
8155</ul>
8156</li>
8157<li>
8158
8159<p>Example:</p>
8160
8161<div>
8162<div>
8163<pre class="source">array_var_samp( [1.2, 2.3, 3.4, 0, null] );
8164</pre></div></div>
8165</li>
8166<li>
8167
8168<p>The expected result is:</p>
8169
8170<div>
8171<div>
8172<pre class="source">2.1291666666666664
8173</pre></div></div>
8174</li>
8175</ul></div>
8176<div class="section">
8177<h3><a name="array_var_pop"></a>array_var_pop</h3>
8178<ul>
8179
8180<li>
8181
8182<p>Syntax:</p>
8183
8184<div>
8185<div>
8186<pre class="source">array_var_pop(num_collection)
8187</pre></div></div>
8188</li>
8189<li>
8190
8191<p>Gets the population variance value of the non-null and non-missing numeric items in the given collection.</p>
8192</li>
8193<li>Arguments:
8194<ul>
8195
8196<li><tt>num_collection</tt> could be:
8197<ul>
8198
8199<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8200<li>or, a <tt>null</tt> value,</li>
8201<li>or, a <tt>missing</tt> value.</li>
8202</ul>
8203</li>
8204</ul>
8205</li>
8206<li>Return Value:
8207<ul>
8208
8209<li>a <tt>double</tt> value representing the population variance of the non-null and non-missing numbers in the given collection,</li>
8210<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8211<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8212<li>any other non-array and non-multiset input value will cause a type error,</li>
8213<li>any other non-numeric value in the input collection will cause a type error.</li>
8214</ul>
8215</li>
8216<li>
8217
8218<p>Example:</p>
8219
8220<div>
8221<div>
8222<pre class="source">array_var_pop( [1.2, 2.3, 3.4, 0, null] );
8223</pre></div></div>
8224</li>
8225<li>
8226
8227<p>The expected result is:</p>
8228
8229<div>
8230<div>
8231<pre class="source">1.5968749999999998
8232</pre></div></div>
8233</li>
8234</ul></div>
8235<div class="section">
8236<h3><a name="array_skewness"></a>array_skewness</h3>
8237<ul>
8238
8239<li>
8240
8241<p>Syntax:</p>
8242
8243<div>
8244<div>
8245<pre class="source">array_skewness(num_collection)
8246</pre></div></div>
8247</li>
8248<li>
8249
8250<p>Gets the skewness value of the non-null and non-missing numeric items in the given collection.</p>
8251</li>
8252<li>Arguments:
8253<ul>
8254
8255<li><tt>num_collection</tt> could be:
8256<ul>
8257
8258<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8259<li>or, a <tt>null</tt> value,</li>
8260<li>or, a <tt>missing</tt> value.</li>
8261</ul>
8262</li>
8263</ul>
8264</li>
8265<li>Return Value:
8266<ul>
8267
8268<li>a <tt>double</tt> value representing the skewness of the non-null and non-missing numbers in the given collection,</li>
8269<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8270<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8271<li>any other non-array and non-multiset input value will cause a type error,</li>
8272<li>any other non-numeric value in the input collection will cause a type error.</li>
8273</ul>
8274</li>
8275<li>
8276
8277<p>Example:</p>
8278
8279<div>
8280<div>
8281<pre class="source">array_skewness( [1.2, 2.3, 3.4, 0, null] );
8282</pre></div></div>
8283</li>
8284<li>
8285
8286<p>The expected result is:</p>
8287
8288<div>
8289<div>
8290<pre class="source">-0.04808451539164242
8291</pre></div></div>
8292</li>
8293</ul></div>
8294<div class="section">
8295<h3><a name="array_kurtosis"></a>array_kurtosis</h3>
8296<ul>
8297
8298<li>
8299
8300<p>Syntax:</p>
8301
8302<div>
8303<div>
8304<pre class="source">array_kurtosis(num_collection)
8305</pre></div></div>
8306</li>
8307<li>
8308
8309<p>Gets the kurtosis value from the normal distribution of the non-null and non-missing numeric items in the given collection.</p>
8310</li>
8311<li>Arguments:
8312<ul>
8313
8314<li><tt>num_collection</tt> could be:
8315<ul>
8316
8317<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8318<li>or, a <tt>null</tt> value,</li>
8319<li>or, a <tt>missing</tt> value.</li>
8320</ul>
8321</li>
8322</ul>
8323</li>
8324<li>Return Value:
8325<ul>
8326
8327<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>
8328<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8329<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
8330<li>any other non-array and non-multiset input value will cause a type error,</li>
8331<li>any other non-numeric value in the input collection will cause a type error.</li>
8332</ul>
8333</li>
8334<li>
8335
8336<p>Example:</p>
8337
8338<div>
8339<div>
8340<pre class="source">array_kurtosis( [1.2, 2.3, 3.4, 0, null] );
8341</pre></div></div>
8342</li>
8343<li>
8344
8345<p>The expected result is:</p>
8346
8347<div>
8348<div>
8349<pre class="source">-1.342049701096427
8350</pre></div></div>
8351</li>
8352</ul></div>
8353<div class="section">
8354<h3><a name="strict_count"></a>strict_count</h3>
8355<ul>
8356
8357<li>
8358
8359<p>Syntax:</p>
8360
8361<div>
8362<div>
8363<pre class="source">strict_count(collection)
8364</pre></div></div>
8365</li>
8366<li>
8367
8368<p>Gets the number of items in the given collection.</p>
8369</li>
8370<li>Arguments:
8371<ul>
8372
8373<li><tt>collection</tt> could be:
8374<ul>
8375
8376<li>an <tt>array</tt> or <tt>multiset</tt> containing the items to be counted,</li>
8377<li>or a <tt>null</tt> value,</li>
8378<li>or a <tt>missing</tt> value.</li>
8379</ul>
8380</li>
8381</ul>
8382</li>
8383<li>Return Value:
8384<ul>
8385
8386<li>a <tt>bigint</tt> value representing the number of items in the given collection,</li>
8387<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>.</li>
8388</ul>
8389</li>
8390<li>
8391
8392<p>Example:</p>
8393
8394<div>
8395<div>
8396<pre class="source">strict_count( [1, 2, null, missing] );
8397</pre></div></div>
8398</li>
8399<li>
8400
8401<p>The expected result is:</p>
8402
8403<div>
8404<div>
8405<pre class="source">4
8406</pre></div></div>
8407</li>
8408</ul></div>
8409<div class="section">
8410<h3><a name="strict_avg"></a>strict_avg</h3>
8411<ul>
8412
8413<li>
8414
8415<p>Syntax:</p>
8416
8417<div>
8418<div>
8419<pre class="source">strict_avg(num_collection)
8420</pre></div></div>
8421</li>
8422<li>
8423
8424<p>Gets the average value of the numeric items in the given collection.</p>
8425</li>
8426<li>Arguments:
8427<ul>
8428
8429<li><tt>num_collection</tt> could be:
8430<ul>
8431
8432<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8433<li>or, a <tt>null</tt> value,</li>
8434<li>or, a <tt>missing</tt> value.</li>
8435</ul>
8436</li>
8437</ul>
8438</li>
8439<li>Return Value:
8440<ul>
8441
8442<li>a <tt>double</tt> value representing the average of the numbers in the given collection,</li>
8443<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8444<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8445<li>any other non-numeric value in the input collection will cause a type error.</li>
8446</ul>
8447</li>
8448<li>
8449
8450<p>Example:</p>
8451
8452<div>
8453<div>
8454<pre class="source">strict_avg( [100, 200, 300] );
8455</pre></div></div>
8456</li>
8457<li>
8458
8459<p>The expected result is:</p>
8460
8461<div>
8462<div>
8463<pre class="source">200.0
8464</pre></div></div>
8465</li>
8466</ul></div>
8467<div class="section">
8468<h3><a name="strict_sum"></a>strict_sum</h3>
8469<ul>
8470
8471<li>
8472
8473<p>Syntax:</p>
8474
8475<div>
8476<div>
8477<pre class="source">strict_sum(num_collection)
8478</pre></div></div>
8479</li>
8480<li>
8481
8482<p>Gets the sum of the items in the given collection.</p>
8483</li>
8484<li>Arguments:
8485<ul>
8486
8487<li><tt>num_collection</tt> could be:
8488<ul>
8489
8490<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8491<li>or, a <tt>null</tt> value,</li>
8492<li>or, a <tt>missing</tt> value.</li>
8493</ul>
8494</li>
8495</ul>
8496</li>
8497<li>Return Value:
8498<ul>
8499
8500<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>
8501<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8502<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8503<li>any other non-numeric value in the input collection will cause a type error.</li>
8504</ul>
8505</li>
8506<li>
8507
8508<p>Example:</p>
8509
8510<div>
8511<div>
8512<pre class="source">strict_sum( [100, 200, 300] );
8513</pre></div></div>
8514</li>
8515<li>
8516
8517<p>The expected result is:</p>
8518
8519<div>
8520<div>
8521<pre class="source">600
8522</pre></div></div>
8523</li>
8524</ul></div>
8525<div class="section">
8526<h3><a name="strict_min"></a>strict_min</h3>
8527<ul>
8528
8529<li>
8530
8531<p>Syntax:</p>
8532
8533<div>
8534<div>
8535<pre class="source">strict_min(num_collection)
8536</pre></div></div>
8537</li>
8538<li>
8539
8540<p>Gets the min value of comparable items in the given collection.</p>
8541</li>
8542<li>Arguments:
8543<ul>
8544
8545<li><tt>num_collection</tt> could be:
8546<ul>
8547
8548<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
8549<li>or, a <tt>null</tt> value,</li>
8550<li>or, a <tt>missing</tt> value.</li>
8551</ul>
8552</li>
8553</ul>
8554</li>
8555<li>Return Value:
8556<ul>
8557
8558<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>
8559<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8560<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8561<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
8562<li>any other non-array and non-multiset input value will cause a type error.</li>
8563</ul>
8564</li>
8565<li>
8566
8567<p>Example:</p>
8568
8569<div>
8570<div>
8571<pre class="source">strict_min( [10.2, 100, 5] );
8572</pre></div></div>
8573</li>
8574<li>
8575
8576<p>The expected result is:</p>
8577
8578<div>
8579<div>
8580<pre class="source">5.0
8581</pre></div></div>
8582</li>
8583</ul></div>
8584<div class="section">
8585<h3><a name="strict_max"></a>strict_max</h3>
8586<ul>
8587
8588<li>
8589
8590<p>Syntax:</p>
8591
8592<div>
8593<div>
8594<pre class="source">strict_max(num_collection)
8595</pre></div></div>
8596</li>
8597<li>
8598
8599<p>Gets the max value of numeric items in the given collection.</p>
8600</li>
8601<li>Arguments:
8602<ul>
8603
8604<li><tt>num_collection</tt> could be:
8605<ul>
8606
8607<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
8608<li>or, a <tt>null</tt> value,</li>
8609<li>or, a <tt>missing</tt> value.</li>
8610</ul>
8611</li>
8612</ul>
8613</li>
8614<li>Return Value:
8615<ul>
8616
8617<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>
8618<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8619<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8620<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
8621<li>any other non-array and non-multiset input value will cause a type error.</li>
8622</ul>
8623</li>
8624<li>
8625
8626<p>Example:</p>
8627
8628<div>
8629<div>
8630<pre class="source">strict_max( [10.2, 100, 5] );
8631</pre></div></div>
8632</li>
8633<li>
8634
8635<p>The expected result is:</p>
8636
8637<div>
8638<div>
8639<pre class="source">100.0
8640</pre></div></div>
8641</li>
8642</ul></div>
8643<div class="section">
8644<h3><a name="strict_stddev_samp"></a>strict_stddev_samp</h3>
8645<ul>
8646
8647<li>
8648
8649<p>Syntax:</p>
8650
8651<div>
8652<div>
8653<pre class="source">strict_stddev_samp(num_collection)
8654</pre></div></div>
8655</li>
8656<li>
8657
8658<p>Gets the sample standard deviation value of the numeric items in the given collection.</p>
8659</li>
8660<li>Arguments:
8661<ul>
8662
8663<li><tt>num_collection</tt> could be:
8664<ul>
8665
8666<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8667<li>or, a <tt>null</tt> value,</li>
8668<li>or, a <tt>missing</tt> value.</li>
8669</ul>
8670</li>
8671</ul>
8672</li>
8673<li>Return Value:
8674<ul>
8675
8676<li>a <tt>double</tt> value representing the sample standard deviation of the numbers in the given collection,</li>
8677<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8678<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8679<li>any other non-numeric value in the input collection will cause a type error.</li>
8680</ul>
8681</li>
8682<li>
8683
8684<p>Example:</p>
8685
8686<div>
8687<div>
8688<pre class="source">strict_stddev_samp( [100, 200, 300] );
8689</pre></div></div>
8690</li>
8691<li>
8692
8693<p>The expected result is:</p>
8694
8695<div>
8696<div>
8697<pre class="source">100.0
8698</pre></div></div>
8699</li>
8700</ul></div>
8701<div class="section">
8702<h3><a name="strict_stddev_pop"></a>strict_stddev_pop</h3>
8703<ul>
8704
8705<li>
8706
8707<p>Syntax:</p>
8708
8709<div>
8710<div>
8711<pre class="source">strict_stddev_pop(num_collection)
8712</pre></div></div>
8713</li>
8714<li>
8715
8716<p>Gets the population standard deviation value of the numeric items in the given collection.</p>
8717</li>
8718<li>Arguments:
8719<ul>
8720
8721<li><tt>num_collection</tt> could be:
8722<ul>
8723
8724<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8725<li>or, a <tt>null</tt> value,</li>
8726<li>or, a <tt>missing</tt> value.</li>
8727</ul>
8728</li>
8729</ul>
8730</li>
8731<li>Return Value:
8732<ul>
8733
8734<li>a <tt>double</tt> value representing the population standard deviation of the numbers in the given collection,</li>
8735<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8736<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8737<li>any other non-numeric value in the input collection will cause a type error.</li>
8738</ul>
8739</li>
8740<li>
8741
8742<p>Example:</p>
8743
8744<div>
8745<div>
8746<pre class="source">strict_stddev_pop( [100, 200, 300] );
8747</pre></div></div>
8748</li>
8749<li>
8750
8751<p>The expected result is:</p>
8752
8753<div>
8754<div>
8755<pre class="source">81.64965809277261
8756</pre></div></div>
8757</li>
8758</ul></div>
8759<div class="section">
8760<h3><a name="strict_var_samp"></a>strict_var_samp</h3>
8761<ul>
8762
8763<li>
8764
8765<p>Syntax:</p>
8766
8767<div>
8768<div>
8769<pre class="source">strict_var_samp(num_collection)
8770</pre></div></div>
8771</li>
8772<li>
8773
8774<p>Gets the sample variance value of the numeric items in the given collection.</p>
8775</li>
8776<li>Arguments:
8777<ul>
8778
8779<li><tt>num_collection</tt> could be:
8780<ul>
8781
8782<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8783<li>or, a <tt>null</tt> value,</li>
8784<li>or, a <tt>missing</tt> value.</li>
8785</ul>
8786</li>
8787</ul>
8788</li>
8789<li>Return Value:
8790<ul>
8791
8792<li>a <tt>double</tt> value representing the sample variance of the numbers in the given collection,</li>
8793<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8794<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8795<li>any other non-numeric value in the input collection will cause a type error.</li>
8796</ul>
8797</li>
8798<li>
8799
8800<p>Example:</p>
8801
8802<div>
8803<div>
8804<pre class="source">strict_var_samp( [100, 200, 300] );
8805</pre></div></div>
8806</li>
8807<li>
8808
8809<p>The expected result is:</p>
8810
8811<div>
8812<div>
8813<pre class="source">10000.0
8814</pre></div></div>
8815</li>
8816</ul></div>
8817<div class="section">
8818<h3><a name="strict_var_pop"></a>strict_var_pop</h3>
8819<ul>
8820
8821<li>
8822
8823<p>Syntax:</p>
8824
8825<div>
8826<div>
8827<pre class="source">strict_var_pop(num_collection)
8828</pre></div></div>
8829</li>
8830<li>
8831
8832<p>Gets the population variance value of the numeric items in the given collection.</p>
8833</li>
8834<li>Arguments:
8835<ul>
8836
8837<li><tt>num_collection</tt> could be:
8838<ul>
8839
8840<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8841<li>or, a <tt>null</tt> value,</li>
8842<li>or, a <tt>missing</tt> value.</li>
8843</ul>
8844</li>
8845</ul>
8846</li>
8847<li>Return Value:
8848<ul>
8849
8850<li>a <tt>double</tt> value representing the population variance of the numbers in the given collection,</li>
8851<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8852<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8853<li>any other non-numeric value in the input collection will cause a type error.</li>
8854</ul>
8855</li>
8856<li>
8857
8858<p>Example:</p>
8859
8860<div>
8861<div>
8862<pre class="source">strict_var_pop( [100, 200, 300] );
8863</pre></div></div>
8864</li>
8865<li>
8866
8867<p>The expected result is:</p>
8868
8869<div>
8870<div>
8871<pre class="source">6666.666666666667
8872</pre></div></div>
8873</li>
8874</ul></div>
8875<div class="section">
8876<h3><a name="strict_skewness"></a>strict_skewness</h3>
8877<ul>
8878
8879<li>
8880
8881<p>Syntax:</p>
8882
8883<div>
8884<div>
8885<pre class="source">strict_skewness(num_collection)
8886</pre></div></div>
8887</li>
8888<li>
8889
8890<p>Gets the skewness value of the numeric items in the given collection.</p>
8891</li>
8892<li>Arguments:
8893<ul>
8894
8895<li><tt>num_collection</tt> could be:
8896<ul>
8897
8898<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8899<li>or, a <tt>null</tt> value,</li>
8900<li>or, a <tt>missing</tt> value.</li>
8901</ul>
8902</li>
8903</ul>
8904</li>
8905<li>Return Value:
8906<ul>
8907
8908<li>a <tt>double</tt> value representing the skewness of the numbers in the given collection,</li>
8909<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8910<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8911<li>any other non-numeric value in the input collection will cause a type error.</li>
8912</ul>
8913</li>
8914<li>
8915
8916<p>Example:</p>
8917
8918<div>
8919<div>
8920<pre class="source">strict_skewness( [100, 200, 300] );
8921</pre></div></div>
8922</li>
8923<li>
8924
8925<p>The expected result is:</p>
8926
8927<div>
8928<div>
8929<pre class="source">0.0
8930</pre></div></div>
8931</li>
8932</ul></div>
8933<div class="section">
8934<h3><a name="strict_kurtosis"></a>strict_kurtosis</h3>
8935<ul>
8936
8937<li>
8938
8939<p>Syntax:</p>
8940
8941<div>
8942<div>
8943<pre class="source">strict_kurtosis(num_collection)
8944</pre></div></div>
8945</li>
8946<li>
8947
8948<p>Gets the kurtosis value from the normal distribution of the numeric items in the given collection.</p>
8949</li>
8950<li>Arguments:
8951<ul>
8952
8953<li><tt>num_collection</tt> could be:
8954<ul>
8955
8956<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
8957<li>or, a <tt>null</tt> value,</li>
8958<li>or, a <tt>missing</tt> value.</li>
8959</ul>
8960</li>
8961</ul>
8962</li>
8963<li>Return Value:
8964<ul>
8965
8966<li>a <tt>double</tt> value representing the kurtosis from a normal distribution of the numbers in the given collection,</li>
8967<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
8968<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
8969<li>any other non-numeric value in the input collection will cause a type error.</li>
8970</ul>
8971</li>
8972<li>
8973
8974<p>Example:</p>
8975
8976<div>
8977<div>
8978<pre class="source">strict_kurtosis( [100, 200, 300] );
8979</pre></div></div>
8980</li>
8981<li>
8982
8983<p>The expected result is:</p>
8984
8985<div>
8986<div>
8987<pre class="source">-1.5
8988</pre></div></div>
8989</li>
8990</ul><!--
8991 ! Licensed to the Apache Software Foundation (ASF) under one
8992 ! or more contributor license agreements. See the NOTICE file
8993 ! distributed with this work for additional information
8994 ! regarding copyright ownership. The ASF licenses this file
8995 ! to you under the Apache License, Version 2.0 (the
8996 ! "License"); you may not use this file except in compliance
8997 ! with the License. You may obtain a copy of the License at
8998 !
8999 ! http://www.apache.org/licenses/LICENSE-2.0
9000 !
9001 ! Unless required by applicable law or agreed to in writing,
9002 ! software distributed under the License is distributed on an
9003 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9004 ! KIND, either express or implied. See the License for the
9005 ! specific language governing permissions and limitations
9006 ! under the License.
9007 !-->
9008</div></div>
9009<div class="section">
9010<h2><a name="Comparison_Functions"></a><a name="ComparisonFunctions" id="ComparisonFunctions">Comparison Functions</a></h2>
9011<div class="section">
9012<h3><a name="greatest"></a>greatest</h3>
9013<ul>
9014
9015<li>
9016
9017<p>Syntax:</p>
9018
9019<div>
9020<div>
9021<pre class="source">greatest(numeric_value1, numeric_value2, ...)
9022</pre></div></div>
9023</li>
9024<li>
9025
9026<p>Computes the greatest value among arguments.</p>
9027</li>
9028<li>Arguments:
9029<ul>
9030
9031<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>
9032<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>
9033<li>&#x2026;.</li>
9034</ul>
9035</li>
9036<li>Return Value:
9037<ul>
9038
9039<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>
9040<li><tt>null</tt> if any argument is a <tt>missing</tt> value or <tt>null</tt> value,</li>
9041<li>any other non-numeric input value will cause a type error.</li>
9042</ul>
9043</li>
9044<li>
9045
9046<p>Example:</p>
9047
9048<div>
9049<div>
9050<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) };
9051</pre></div></div>
9052</li>
9053<li>
9054
9055<p>The expected result is:</p>
9056
9057<div>
9058<div>
9059<pre class="source">{ &quot;v1&quot;: 3, &quot;v2&quot;: 5000.0 }
9060</pre></div></div>
9061</li>
9062</ul></div>
9063<div class="section">
9064<h3><a name="least"></a>least</h3>
9065<ul>
9066
9067<li>
9068
9069<p>Syntax:</p>
9070
9071<div>
9072<div>
9073<pre class="source">least(numeric_value1, numeric_value2, ...)
9074</pre></div></div>
9075</li>
9076<li>
9077
9078<p>Computes the least value among arguments.</p>
9079</li>
9080<li>Arguments:
9081<ul>
9082
9083<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>
9084<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>
9085<li>&#x2026;.</li>
9086</ul>
9087</li>
9088<li>Return Value:
9089<ul>
9090
9091<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>
9092<li><tt>null</tt> if any argument is a <tt>missing</tt> value or <tt>null</tt> value,</li>
9093<li>any other non-numeric input value will cause a type error.</li>
9094</ul>
9095</li>
9096<li>
9097
9098<p>Example:</p>
9099
9100<div>
9101<div>
9102<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) };
9103</pre></div></div>
9104</li>
9105<li>
9106
9107<p>The expected result is:</p>
9108
9109<div>
9110<div>
9111<pre class="source">{ &quot;v1&quot;: 1, &quot;v2&quot;: -0.5 }
9112</pre></div></div>
9113</li>
9114</ul><!--
9115 ! Licensed to the Apache Software Foundation (ASF) under one
9116 ! or more contributor license agreements. See the NOTICE file
9117 ! distributed with this work for additional information
9118 ! regarding copyright ownership. The ASF licenses this file
9119 ! to you under the Apache License, Version 2.0 (the
9120 ! "License"); you may not use this file except in compliance
9121 ! with the License. You may obtain a copy of the License at
9122 !
9123 ! http://www.apache.org/licenses/LICENSE-2.0
9124 !
9125 ! Unless required by applicable law or agreed to in writing,
9126 ! software distributed under the License is distributed on an
9127 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9128 ! KIND, either express or implied. See the License for the
9129 ! specific language governing permissions and limitations
9130 ! under the License.
9131 !-->
9132</div></div>
9133<div class="section">
9134<h2><a name="Type_Functions"></a><a name="TypeFunctions" id="TypeFunctions">Type Functions</a></h2>
9135<div class="section">
9136<h3><a name="get_type"></a>get_type</h3>
9137<ul>
9138
9139<li>
9140
9141<p>Syntax:</p>
9142
9143<div>
9144<div>
9145<pre class="source">get_type(expr)
9146</pre></div></div>
9147</li>
9148<li>
9149
9150<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>
9151</li>
9152<li>Arguments:
9153<ul>
9154
9155<li><tt>expr</tt> : an expression (any type is allowed).</li>
9156</ul>
9157</li>
9158<li>
9159
9160<p>Example:</p>
9161
9162<div>
9163<div>
9164<pre class="source">{
9165 &quot;a&quot;: get_type(true),
9166 &quot;b&quot;: get_type(false),
9167 &quot;c&quot;: get_type(null),
9168 &quot;d&quot;: get_type(missing),
9169 &quot;e&quot;: get_type(&quot;d&quot;),
9170 &quot;f&quot;: gettype(4.0),
9171 &quot;g&quot;: gettype(5),
9172 &quot;h&quot;: gettype([&quot;1&quot;, 2]),
9173 &quot;i&quot;: gettype({&quot;a&quot;:1})
9174};
9175</pre></div></div>
9176</li>
9177<li>
9178
9179<p>The expected result is:</p>
9180
9181<div>
9182<div>
9183<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; }
9184</pre></div></div>
9185</li>
9186</ul>
9187<p>The function has an alias <tt>gettype</tt>.</p></div>
9188<div class="section">
9189<h3><a name="is_array"></a>is_array</h3>
9190<ul>
9191
9192<li>
9193
9194<p>Syntax:</p>
9195
9196<div>
9197<div>
9198<pre class="source">is_array(expr)
9199</pre></div></div>
9200</li>
9201<li>
9202
9203<p>Checks whether the given expression is evaluated to be an <tt>array</tt> value.</p>
9204</li>
9205<li>Arguments:
9206<ul>
9207
9208<li><tt>expr</tt> : an expression (any type is allowed).</li>
9209</ul>
9210</li>
9211<li>Return Value:
9212<ul>
9213
9214<li>a <tt>boolean</tt> on whether the argument is an <tt>array</tt> value or not,</li>
9215<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9216<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9217</ul>
9218</li>
9219<li>
9220
9221<p>Example:</p>
9222
9223<div>
9224<div>
9225<pre class="source">{
9226 &quot;a&quot;: is_array(true),
9227 &quot;b&quot;: is_array(false),
9228 &quot;c&quot;: isarray(null),
9229 &quot;d&quot;: isarray(missing),
9230 &quot;e&quot;: isarray(&quot;d&quot;),
9231 &quot;f&quot;: isarray(4.0),
9232 &quot;g&quot;: isarray(5),
9233 &quot;h&quot;: isarray([&quot;1&quot;, 2]),
9234 &quot;i&quot;: isarray({&quot;a&quot;:1})
9235};
9236</pre></div></div>
9237</li>
9238<li>
9239
9240<p>The expected result is:</p>
9241
9242<div>
9243<div>
9244<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 }
9245</pre></div></div>
9246</li>
9247</ul>
9248<p>The function has an alias <tt>isarray</tt>.</p></div>
9249<div class="section">
9250<h3><a name="is_multiset"></a>is_multiset</h3>
9251<ul>
9252
9253<li>
9254
9255<p>Syntax:</p>
9256
9257<div>
9258<div>
9259<pre class="source">is_multiset(expr)
9260</pre></div></div>
9261</li>
9262<li>
9263
9264<p>Checks whether the given expression is evaluated to be an <tt>multiset</tt> value.</p>
9265</li>
9266<li>Arguments:
9267<ul>
9268
9269<li><tt>expr</tt> : an expression (any type is allowed).</li>
9270</ul>
9271</li>
9272<li>Return Value:
9273<ul>
9274
9275<li>a <tt>boolean</tt> on whether the argument is an <tt>multiset</tt> value or not,</li>
9276<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9277<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9278</ul>
9279</li>
9280<li>
9281
9282<p>Example:</p>
9283
9284<div>
9285<div>
9286<pre class="source">{
9287 &quot;a&quot;: is_multiset(true),
9288 &quot;b&quot;: is_multiset(false),
9289 &quot;c&quot;: is_multiset(null),
9290 &quot;d&quot;: is_multiset(missing),
9291 &quot;e&quot;: is_multiset(&quot;d&quot;),
9292 &quot;f&quot;: ismultiset(4.0),
9293 &quot;g&quot;: ismultiset([&quot;1&quot;, 2]),
9294 &quot;h&quot;: ismultiset({&quot;a&quot;:1}),
9295 &quot;i&quot;: ismultiset({{&quot;hello&quot;, 9328, &quot;world&quot;, [1, 2, null]}})
9296};
9297</pre></div></div>
9298</li>
9299<li>
9300
9301<p>The expected result is:</p>
9302
9303<div>
9304<div>
9305<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 }
9306</pre></div></div>
9307</li>
9308</ul>
9309<p>The function has an alias <tt>ismultiset</tt>.</p></div>
9310<div class="section">
9311<h3><a name="is_atomic_.28is_atom.29"></a>is_atomic (is_atom)</h3>
9312<ul>
9313
9314<li>
9315
9316<p>Syntax:</p>
9317
9318<div>
9319<div>
9320<pre class="source">is_atomic(expr)
9321</pre></div></div>
9322</li>
9323<li>
9324
9325<p>Checks whether the given expression is evaluated to be a value of a <a href="../datamodel.html#PrimitiveTypes">primitive</a> type.</p>
9326</li>
9327<li>Arguments:
9328<ul>
9329
9330<li><tt>expr</tt> : an expression (any type is allowed).</li>
9331</ul>
9332</li>
9333<li>Return Value:
9334<ul>
9335
9336<li>a <tt>boolean</tt> on whether the argument is a primitive type or not,</li>
9337<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9338<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9339</ul>
9340</li>
9341<li>
9342
9343<p>Example:</p>
9344
9345<div>
9346<div>
9347<pre class="source">{
9348 &quot;a&quot;: is_atomic(true),
9349 &quot;b&quot;: is_atomic(false),
9350 &quot;c&quot;: isatomic(null),
9351 &quot;d&quot;: isatomic(missing),
9352 &quot;e&quot;: isatomic(&quot;d&quot;),
9353 &quot;f&quot;: isatom(4.0),
9354 &quot;g&quot;: isatom(5),
9355 &quot;h&quot;: isatom([&quot;1&quot;, 2]),
9356 &quot;i&quot;: isatom({&quot;a&quot;:1})
9357};
9358</pre></div></div>
9359</li>
9360<li>
9361
9362<p>The expected result is:</p>
9363
9364<div>
9365<div>
9366<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 }
9367</pre></div></div>
9368</li>
9369</ul>
9370<p>The function has three aliases: <tt>isatomic</tt>, <tt>is_atom</tt>, and <tt>isatom</tt>.</p></div>
9371<div class="section">
9372<h3><a name="is_boolean_.28is_bool.29"></a>is_boolean (is_bool)</h3>
9373<ul>
9374
9375<li>
9376
9377<p>Syntax:</p>
9378
9379<div>
9380<div>
9381<pre class="source">is_boolean(expr)
9382</pre></div></div>
9383</li>
9384<li>
9385
9386<p>Checks whether the given expression is evaluated to be a <tt>boolean</tt> value.</p>
9387</li>
9388<li>Arguments:
9389<ul>
9390
9391<li><tt>expr</tt> : an expression (any type is allowed).</li>
9392</ul>
9393</li>
9394<li>Return Value:
9395<ul>
9396
9397<li>a <tt>boolean</tt> on whether the argument is a <tt>boolean</tt> value or not,</li>
9398<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9399<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9400</ul>
9401</li>
9402<li>
9403
9404<p>Example:</p>
9405
9406<div>
9407<div>
9408<pre class="source">{
9409 &quot;a&quot;: isboolean(true),
9410 &quot;b&quot;: isboolean(false),
9411 &quot;c&quot;: is_boolean(null),
9412 &quot;d&quot;: is_boolean(missing),
9413 &quot;e&quot;: isbool(&quot;d&quot;),
9414 &quot;f&quot;: isbool(4.0),
9415 &quot;g&quot;: isbool(5),
9416 &quot;h&quot;: isbool([&quot;1&quot;, 2]),
9417 &quot;i&quot;: isbool({&quot;a&quot;:1})
9418};
9419</pre></div></div>
9420</li>
9421<li>
9422
9423<p>The expected result is:</p>
9424
9425<div>
9426<div>
9427<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 }
9428</pre></div></div>
9429</li>
9430</ul>
9431<p>The function has three aliases: <tt>isboolean</tt>, <tt>is_bool</tt>, and <tt>isbool</tt>.</p></div>
9432<div class="section">
9433<h3><a name="is_binary_.28is_bin.29"></a>is_binary (is_bin)</h3>
9434<ul>
9435
9436<li>
9437
9438<p>Syntax:</p>
9439
9440<div>
9441<div>
9442<pre class="source">is_binary(expr)
9443</pre></div></div>
9444</li>
9445<li>
9446
9447<p>Checks whether the given expression is evaluated to be a <tt>binary</tt> value.</p>
9448</li>
9449<li>Arguments:
9450<ul>
9451
9452<li><tt>expr</tt> : an expression (any type is allowed).</li>
9453</ul>
9454</li>
9455<li>Return Value:
9456<ul>
9457
9458<li>a <tt>boolean</tt> on whether the argument is a <tt>binary</tt> value or not,</li>
9459<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9460<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9461</ul>
9462</li>
9463<li>
9464
9465<p>Example:</p>
9466
9467<div>
9468<div>
9469<pre class="source">{
9470 &quot;a&quot;: is_binary(true),
9471 &quot;b&quot;: is_binary(false),
9472 &quot;c&quot;: isbinary(null),
9473 &quot;d&quot;: isbinary(missing),
9474 &quot;e&quot;: isbin(point(&quot;1,2&quot;)),
9475 &quot;f&quot;: isbin(hex(&quot;ABCDEF0123456789&quot;)),
9476 &quot;g&quot;: is_bin(sub_binary(hex(&quot;AABBCCDD&quot;), 4)),
9477 &quot;h&quot;: is_bin(2),
9478 &quot;i&quot;: is_bin({&quot;a&quot;:1})
9479};
9480</pre></div></div>
9481</li>
9482<li>
9483
9484<p>The expected result is:</p>
9485
9486<div>
9487<div>
9488<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 }
9489</pre></div></div>
9490</li>
9491</ul>
9492<p>The function has three aliases: <tt>isbinary</tt>, <tt>is_bin</tt>, and <tt>isbin</tt>.</p></div>
9493<div class="section">
9494<h3><a name="is_number_.28is_num.29"></a>is_number (is_num)</h3>
9495<ul>
9496
9497<li>
9498
9499<p>Syntax:</p>
9500
9501<div>
9502<div>
9503<pre class="source">is_number(expr)
9504</pre></div></div>
9505</li>
9506<li>
9507
9508<p>Checks whether the given expression is evaluated to be a numeric value.</p>
9509</li>
9510<li>Arguments:
9511<ul>
9512
9513<li><tt>expr</tt> : an expression (any type is allowed).</li>
9514</ul>
9515</li>
9516<li>Return Value:
9517<ul>
9518
9519<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>
9520<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9521<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9522</ul>
9523</li>
9524<li>
9525
9526<p>Example:</p>
9527
9528<div>
9529<div>
9530<pre class="source">{
9531 &quot;a&quot;: is_number(true),
9532 &quot;b&quot;: is_number(false),
9533 &quot;c&quot;: isnumber(null),
9534 &quot;d&quot;: isnumber(missing),
9535 &quot;e&quot;: isnumber(&quot;d&quot;),
9536 &quot;f&quot;: isnum(4.0),
9537 &quot;g&quot;: isnum(5),
9538 &quot;h&quot;: isnum([&quot;1&quot;, 2]),
9539 &quot;i&quot;: isnum({&quot;a&quot;:1})
9540};
9541</pre></div></div>
9542</li>
9543<li>
9544
9545<p>The expected result is:</p>
9546
9547<div>
9548<div>
9549<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 }
9550</pre></div></div>
9551</li>
9552</ul>
9553<p>The function has three aliases: <tt>isnumber</tt>, <tt>is_num</tt>, and <tt>isnum</tt>.</p></div>
9554<div class="section">
9555<h3><a name="is_point"></a>is_point</h3>
9556<ul>
9557
9558<li>
9559
9560<p>Syntax:</p>
9561
9562<div>
9563<div>
9564<pre class="source">is_point(expr)
9565</pre></div></div>
9566</li>
9567<li>
9568
9569<p>Checks whether the given expression is evaluated to be a <tt>point</tt> value.</p>
9570</li>
9571<li>Arguments:
9572<ul>
9573
9574<li><tt>expr</tt> : an expression (any type is allowed).</li>
9575</ul>
9576</li>
9577<li>Return Value:
9578<ul>
9579
9580<li>a <tt>boolean</tt> on whether the argument is a <tt>point</tt> value or not,</li>
9581<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9582<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9583</ul>
9584</li>
9585<li>
9586
9587<p>Example:</p>
9588
9589<div>
9590<div>
9591<pre class="source">{
9592 &quot;a&quot;: is_point(true),
9593 &quot;b&quot;: is_point(false),
9594 &quot;c&quot;: is_point(null),
9595 &quot;d&quot;: is_point(missing),
9596 &quot;e&quot;: is_point(point(&quot;1,2&quot;)),
9597 &quot;f&quot;: ispoint(line(&quot;30.0,70.0 50.0,90.0&quot;)),
9598 &quot;g&quot;: ispoint(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
9599 &quot;h&quot;: ispoint(circle(&quot;30.0,70.0 5.0&quot;)),
9600 &quot;i&quot;: ispoint(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
9601 &quot;j&quot;: ispoint(3)
9602};
9603</pre></div></div>
9604</li>
9605<li>
9606
9607<p>The expected result is:</p>
9608
9609<div>
9610<div>
9611<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 }
9612</pre></div></div>
9613</li>
9614</ul>
9615<p>The function has an alias <tt>ispoint</tt>.</p></div>
9616<div class="section">
9617<h3><a name="is_line"></a>is_line</h3>
9618<ul>
9619
9620<li>
9621
9622<p>Syntax:</p>
9623
9624<div>
9625<div>
9626<pre class="source">is_line(expr)
9627</pre></div></div>
9628</li>
9629<li>
9630
9631<p>Checks whether the given expression is evaluated to be a <tt>line</tt> value.</p>
9632</li>
9633<li>Arguments:
9634<ul>
9635
9636<li><tt>expr</tt> : an expression (any type is allowed).</li>
9637</ul>
9638</li>
9639<li>Return Value:
9640<ul>
9641
9642<li>a <tt>boolean</tt> on whether the argument is a <tt>line</tt> value or not,</li>
9643<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9644<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9645</ul>
9646</li>
9647<li>
9648
9649<p>Example:</p>
9650
9651<div>
9652<div>
9653<pre class="source">{
9654 &quot;a&quot;: is_line(true),
9655 &quot;b&quot;: is_line(false),
9656 &quot;c&quot;: is_line(null),
9657 &quot;d&quot;: is_line(missing),
9658 &quot;e&quot;: is_line(point(&quot;1,2&quot;)),
9659 &quot;f&quot;: isline(line(&quot;30.0,70.0 50.0,90.0&quot;)),
9660 &quot;g&quot;: isline(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
9661 &quot;h&quot;: isline(circle(&quot;30.0,70.0 5.0&quot;)),
9662 &quot;i&quot;: isline(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
9663 &quot;j&quot;: isline(3)
9664};
9665</pre></div></div>
9666</li>
9667<li>
9668
9669<p>The expected result is:</p>
9670
9671<div>
9672<div>
9673<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 }
9674</pre></div></div>
9675</li>
9676</ul>
9677<p>The function has an alias <tt>isline</tt>.</p></div>
9678<div class="section">
9679<h3><a name="is_rectangle"></a>is_rectangle</h3>
9680<ul>
9681
9682<li>
9683
9684<p>Syntax:</p>
9685
9686<div>
9687<div>
9688<pre class="source">is_rectangle(expr)
9689</pre></div></div>
9690</li>
9691<li>
9692
9693<p>Checks whether the given expression is evaluated to be a <tt>rectangle</tt> value.</p>
9694</li>
9695<li>Arguments:
9696<ul>
9697
9698<li><tt>expr</tt> : an expression (any type is allowed).</li>
9699</ul>
9700</li>
9701<li>Return Value:
9702<ul>
9703
9704<li>a <tt>boolean</tt> on whether the argument is a <tt>rectangle</tt> value or not,</li>
9705<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9706<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9707</ul>
9708</li>
9709<li>
9710
9711<p>Example:</p>
9712
9713<div>
9714<div>
9715<pre class="source">{
9716 &quot;a&quot;: is_rectangle(true),
9717 &quot;b&quot;: is_rectangle(false),
9718 &quot;c&quot;: is_rectangle(null),
9719 &quot;d&quot;: is_rectangle(missing),
9720 &quot;e&quot;: is_rectangle(point(&quot;1,2&quot;)),
9721 &quot;f&quot;: isrectangle(line(&quot;30.0,70.0 50.0,90.0&quot;)),
9722 &quot;g&quot;: isrectangle(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
9723 &quot;h&quot;: isrectangle(circle(&quot;30.0,70.0 5.0&quot;)),
9724 &quot;i&quot;: isrectangle(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
9725 &quot;j&quot;: isrectangle(3)
9726};
9727</pre></div></div>
9728</li>
9729<li>
9730
9731<p>The expected result is:</p>
9732
9733<div>
9734<div>
9735<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 }
9736</pre></div></div>
9737</li>
9738</ul>
9739<p>The function has an alias <tt>isrectangle</tt>.</p></div>
9740<div class="section">
9741<h3><a name="is_circle"></a>is_circle</h3>
9742<ul>
9743
9744<li>
9745
9746<p>Syntax:</p>
9747
9748<div>
9749<div>
9750<pre class="source">is_circle(expr)
9751</pre></div></div>
9752</li>
9753<li>
9754
9755<p>Checks whether the given expression is evaluated to be a <tt>circle</tt> value.</p>
9756</li>
9757<li>Arguments:
9758<ul>
9759
9760<li><tt>expr</tt> : an expression (any type is allowed).</li>
9761</ul>
9762</li>
9763<li>Return Value:
9764<ul>
9765
9766<li>a <tt>boolean</tt> on whether the argument is a <tt>circle</tt> value or not,</li>
9767<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9768<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9769</ul>
9770</li>
9771<li>
9772
9773<p>Example:</p>
9774
9775<div>
9776<div>
9777<pre class="source">{
9778 &quot;a&quot;: is_circle(true),
9779 &quot;b&quot;: is_circle(false),
9780 &quot;c&quot;: is_circle(null),
9781 &quot;d&quot;: is_circle(missing),
9782 &quot;e&quot;: is_circle(point(&quot;1,2&quot;)),
9783 &quot;f&quot;: iscircle(line(&quot;30.0,70.0 50.0,90.0&quot;)),
9784 &quot;g&quot;: iscircle(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
9785 &quot;h&quot;: iscircle(circle(&quot;30.0,70.0 5.0&quot;)),
9786 &quot;i&quot;: iscircle(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
9787 &quot;j&quot;: iscircle(3)
9788};
9789</pre></div></div>
9790</li>
9791<li>
9792
9793<p>The expected result is:</p>
9794
9795<div>
9796<div>
9797<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 }
9798</pre></div></div>
9799</li>
9800</ul>
9801<p>The function has an alias <tt>iscircle</tt>.</p></div>
9802<div class="section">
9803<h3><a name="is_polygon"></a>is_polygon</h3>
9804<ul>
9805
9806<li>
9807
9808<p>Syntax:</p>
9809
9810<div>
9811<div>
9812<pre class="source">is_polygon(expr)
9813</pre></div></div>
9814</li>
9815<li>
9816
9817<p>Checks whether the given expression is evaluated to be a <tt>polygon</tt> value.</p>
9818</li>
9819<li>Arguments:
9820<ul>
9821
9822<li><tt>expr</tt> : an expression (any type is allowed).</li>
9823</ul>
9824</li>
9825<li>Return Value:
9826<ul>
9827
9828<li>a <tt>boolean</tt> on whether the argument is a <tt>polygon</tt> value or not,</li>
9829<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9830<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9831</ul>
9832</li>
9833<li>
9834
9835<p>Example:</p>
9836
9837<div>
9838<div>
9839<pre class="source">{
9840 &quot;a&quot;: is_polygon(true),
9841 &quot;b&quot;: is_polygon(false),
9842 &quot;c&quot;: is_polygon(null),
9843 &quot;d&quot;: is_polygon(missing),
9844 &quot;e&quot;: is_polygon(point(&quot;1,2&quot;)),
9845 &quot;f&quot;: ispolygon(line(&quot;30.0,70.0 50.0,90.0&quot;)),
9846 &quot;g&quot;: ispolygon(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
9847 &quot;h&quot;: ispolygon(circle(&quot;30.0,70.0 5.0&quot;)),
9848 &quot;i&quot;: ispolygon(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
9849 &quot;j&quot;: ispolygon(3)
9850};
9851</pre></div></div>
9852</li>
9853<li>
9854
9855<p>The expected result is:</p>
9856
9857<div>
9858<div>
9859<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 }
9860</pre></div></div>
9861</li>
9862</ul>
9863<p>The function has an alias <tt>ispolygon</tt>.</p></div>
9864<div class="section">
9865<h3><a name="is_spatial"></a>is_spatial</h3>
9866<ul>
9867
9868<li>
9869
9870<p>Syntax:</p>
9871
9872<div>
9873<div>
9874<pre class="source">is_spatial(expr)
9875</pre></div></div>
9876</li>
9877<li>
9878
9879<p>Checks whether the given expression is evaluated to be a spatial value.</p>
9880</li>
9881<li>Arguments:
9882<ul>
9883
9884<li><tt>expr</tt> : an expression (any type is allowed).</li>
9885</ul>
9886</li>
9887<li>Return Value:
9888<ul>
9889
9890<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>
9891<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9892<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9893</ul>
9894</li>
9895<li>
9896
9897<p>Example:</p>
9898
9899<div>
9900<div>
9901<pre class="source">{
9902 &quot;a&quot;: is_spatial(true),
9903 &quot;b&quot;: is_spatial(false),
9904 &quot;c&quot;: is_spatial(null),
9905 &quot;d&quot;: is_spatial(missing),
9906 &quot;e&quot;: is_spatial(point(&quot;1,2&quot;)),
9907 &quot;f&quot;: isspatial(line(&quot;30.0,70.0 50.0,90.0&quot;)),
9908 &quot;g&quot;: isspatial(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
9909 &quot;h&quot;: isspatial(circle(&quot;30.0,70.0 5.0&quot;)),
9910 &quot;i&quot;: isspatial(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
9911 &quot;j&quot;: isspatial(3)
9912};
9913</pre></div></div>
9914</li>
9915<li>
9916
9917<p>The expected result is:</p>
9918
9919<div>
9920<div>
9921<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 }
9922</pre></div></div>
9923</li>
9924</ul>
9925<p>The function has an alias <tt>isspatial</tt>.</p></div>
9926<div class="section">
9927<h3><a name="is_date"></a>is_date</h3>
9928<ul>
9929
9930<li>
9931
9932<p>Syntax:</p>
9933
9934<div>
9935<div>
9936<pre class="source">is_date(expr)
9937</pre></div></div>
9938</li>
9939<li>
9940
9941<p>Checks whether the given expression is evaluated to be a <tt>date</tt> value.</p>
9942</li>
9943<li>Arguments:
9944<ul>
9945
9946<li><tt>expr</tt> : an expression (any type is allowed).</li>
9947</ul>
9948</li>
9949<li>Return Value:
9950<ul>
9951
9952<li>a <tt>boolean</tt> on whether the argument is a <tt>date</tt> value or not,</li>
9953<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
9954<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
9955</ul>
9956</li>
9957<li>
9958
9959<p>Example:</p>
9960
9961<div>
9962<div>
9963<pre class="source">{
9964 &quot;a&quot;: is_date(true),
9965 &quot;b&quot;: is_date(false),
9966 &quot;c&quot;: is_date(null),
9967 &quot;d&quot;: is_date(missing),
9968 &quot;e&quot;: is_date(date(&quot;-19700101&quot;)),
9969 &quot;f&quot;: isdate(date(&quot;2013-01-01&quot;)),
9970 &quot;g&quot;: isdate(time(&quot;12:12:12.039Z&quot;)),
9971 &quot;h&quot;: isdate(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
9972 &quot;i&quot;: isdate(duration(&quot;P100Y12MT12M&quot;)),
9973 &quot;j&quot;: isdate(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
9974 &quot;k&quot;: isdate(3)
9975};
9976</pre></div></div>
9977</li>
9978<li>
9979
9980<p>The expected result is:</p>
9981
9982<div>
9983<div>
9984<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 }
9985</pre></div></div>
9986</li>
9987</ul>
9988<p>The function has an alias <tt>isdate</tt>.</p></div>
9989<div class="section">
9990<h3><a name="is_datetime_.28is_timestamp.29"></a>is_datetime (is_timestamp)</h3>
9991<ul>
9992
9993<li>
9994
9995<p>Syntax:</p>
9996
9997<div>
9998<div>
9999<pre class="source">is_datetime(expr)
10000</pre></div></div>
10001</li>
10002<li>
10003
10004<p>Checks whether the given expression is evaluated to be a <tt>datetime</tt> value.</p>
10005</li>
10006<li>Arguments:
10007<ul>
10008
10009<li><tt>expr</tt> : an expression (any type is allowed).</li>
10010</ul>
10011</li>
10012<li>Return Value:
10013<ul>
10014
10015<li>a <tt>boolean</tt> on whether the argument is a <tt>datetime</tt> value or not,</li>
10016<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10017<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10018</ul>
10019</li>
10020<li>
10021
10022<p>Example:</p>
10023
10024<div>
10025<div>
10026<pre class="source">{
10027 &quot;a&quot;: is_datetime(true),
10028 &quot;b&quot;: is_datetime(false),
10029 &quot;c&quot;: is_datetime(null),
10030 &quot;d&quot;: is_datetime(missing),
10031 &quot;e&quot;: is_datetime(datetime(&quot;2016-02-02T12:09:22.023Z&quot;)),
10032 &quot;f&quot;: isdatetime(datetime(&quot;2011-03-03T12:10:42.011Z&quot;)),
10033 &quot;g&quot;: isdatetime(time(&quot;12:12:12.039Z&quot;)),
10034 &quot;h&quot;: is_timestamp(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
10035 &quot;i&quot;: is_timestamp(duration(&quot;P100Y12MT12M&quot;)),
10036 &quot;j&quot;: istimestamp(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
10037 &quot;k&quot;: istimestamp(3)
10038};
10039</pre></div></div>
10040</li>
10041<li>
10042
10043<p>The expected result is:</p>
10044
10045<div>
10046<div>
10047<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 }
10048</pre></div></div>
10049</li>
10050</ul>
10051<p>The function has three aliases: <tt>isdatetime</tt>, <tt>is_timestamp</tt>, and <tt>istimestamp</tt>.</p></div>
10052<div class="section">
10053<h3><a name="is_time"></a>is_time</h3>
10054<ul>
10055
10056<li>
10057
10058<p>Syntax:</p>
10059
10060<div>
10061<div>
10062<pre class="source">is_time(expr)
10063</pre></div></div>
10064</li>
10065<li>
10066
10067<p>Checks whether the given expression is evaluated to be a <tt>time</tt> value.</p>
10068</li>
10069<li>Arguments:
10070<ul>
10071
10072<li><tt>expr</tt> : an expression (any type is allowed).</li>
10073</ul>
10074</li>
10075<li>Return Value:
10076<ul>
10077
10078<li>a <tt>boolean</tt> on whether the argument is a <tt>time</tt> value or not,</li>
10079<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10080<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10081</ul>
10082</li>
10083<li>
10084
10085<p>Example:</p>
10086
10087<div>
10088<div>
10089<pre class="source"> {
10090 &quot;a&quot;: is_time(true),
10091 &quot;b&quot;: is_time(false),
10092 &quot;c&quot;: is_time(null),
10093 &quot;d&quot;: is_time(missing),
10094 &quot;e&quot;: is_time(time(&quot;08:00:00.000Z&quot;)),
10095 &quot;f&quot;: istime(date(&quot;2013-01-01&quot;)),
10096 &quot;g&quot;: istime(time(&quot;12:12:12.039Z&quot;)),
10097 &quot;h&quot;: istime(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
10098 &quot;i&quot;: istime(duration(&quot;P100Y12MT12M&quot;)),
10099 &quot;j&quot;: istime(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
10100 &quot;k&quot;: istime(3)
10101};
10102</pre></div></div>
10103</li>
10104<li>
10105
10106<p>The expected result is:</p>
10107
10108<div>
10109<div>
10110<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 }
10111</pre></div></div>
10112</li>
10113</ul>
10114<p>The function has an alias <tt>istime</tt>.</p></div>
10115<div class="section">
10116<h3><a name="is_duration"></a>is_duration</h3>
10117<ul>
10118
10119<li>
10120
10121<p>Syntax:</p>
10122
10123<div>
10124<div>
10125<pre class="source">is_duration(expr)
10126</pre></div></div>
10127</li>
10128<li>
10129
10130<p>Checks whether the given expression is evaluated to be a duration value.</p>
10131</li>
10132<li>Arguments:
10133<ul>
10134
10135<li><tt>expr</tt> : an expression (any type is allowed).</li>
10136</ul>
10137</li>
10138<li>Return Value:
10139<ul>
10140
10141<li>a <tt>boolean</tt> on whether the argument is a <tt>duration/year_month_duration/day_time_duration</tt> value or not,</li>
10142<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10143<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10144</ul>
10145</li>
10146<li>
10147
10148<p>Example:</p>
10149
10150<div>
10151<div>
10152<pre class="source"> {
10153 &quot;a&quot;: is_duration(true),
10154 &quot;b&quot;: is_duration(false),
10155 &quot;c&quot;: is_duration(null),
10156 &quot;d&quot;: is_duration(missing),
10157 &quot;e&quot;: is_duration(duration(&quot;-PT20.943S&quot;)),
10158 &quot;f&quot;: isduration(date(&quot;2013-01-01&quot;)),
10159 &quot;g&quot;: isduration(time(&quot;12:12:12.039Z&quot;)),
10160 &quot;h&quot;: isduration(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
10161 &quot;i&quot;: isduration(duration(&quot;P100Y12MT12M&quot;)),
10162 &quot;j&quot;: isduration(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
10163 &quot;k&quot;: isduration(3)
10164};
10165</pre></div></div>
10166</li>
10167<li>
10168
10169<p>The expected result is:</p>
10170
10171<div>
10172<div>
10173<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 }
10174</pre></div></div>
10175</li>
10176</ul>
10177<p>The function has an alias <tt>isduration</tt>.</p></div>
10178<div class="section">
10179<h3><a name="is_interval"></a>is_interval</h3>
10180<ul>
10181
10182<li>
10183
10184<p>Syntax:</p>
10185
10186<div>
10187<div>
10188<pre class="source">is_interval(expr)
10189</pre></div></div>
10190</li>
10191<li>
10192
10193<p>Checks whether the given expression is evaluated to be a <tt>interval</tt> value.</p>
10194</li>
10195<li>Arguments:
10196<ul>
10197
10198<li><tt>expr</tt> : an expression (any type is allowed).</li>
10199</ul>
10200</li>
10201<li>Return Value:
10202<ul>
10203
10204<li>a <tt>boolean</tt> on whether the argument is a <tt>interval</tt> value or not,</li>
10205<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10206<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10207</ul>
10208</li>
10209<li>
10210
10211<p>Example:</p>
10212
10213<div>
10214<div>
10215<pre class="source"> {
10216 &quot;a&quot;: is_interval(true),
10217 &quot;b&quot;: is_interval(false),
10218 &quot;c&quot;: is_interval(null),
10219 &quot;d&quot;: is_interval(missing),
10220 &quot;e&quot;: is_interval(interval(datetime(&quot;2013-01-01T00:01:01.000Z&quot;), datetime(&quot;2013-05-05T13:39:01.049Z&quot;))),
10221 &quot;f&quot;: isinterval(date(&quot;2013-01-01&quot;)),
10222 &quot;g&quot;: isinterval(time(&quot;12:12:12.039Z&quot;)),
10223 &quot;h&quot;: isinterval(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
10224 &quot;i&quot;: isinterval(duration(&quot;P100Y12MT12M&quot;)),
10225 &quot;j&quot;: isinterval(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
10226 &quot;k&quot;: isinterval(3)
10227};
10228</pre></div></div>
10229</li>
10230<li>
10231
10232<p>The expected result is:</p>
10233
10234<div>
10235<div>
10236<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 }
10237</pre></div></div>
10238</li>
10239</ul>
10240<p>The function has an alias <tt>isinterval</tt>.</p></div>
10241<div class="section">
10242<h3><a name="is_temporal"></a>is_temporal</h3>
10243<ul>
10244
10245<li>
10246
10247<p>Syntax:</p>
10248
10249<div>
10250<div>
10251<pre class="source">is_temporal(expr)
10252</pre></div></div>
10253</li>
10254<li>
10255
10256<p>Checks whether the given expression is evaluated to be a temporal value.</p>
10257</li>
10258<li>Arguments:
10259<ul>
10260
10261<li><tt>expr</tt> : an expression (any type is allowed).</li>
10262</ul>
10263</li>
10264<li>Return Value:
10265<ul>
10266
10267<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>
10268<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10269<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10270</ul>
10271</li>
10272<li>
10273
10274<p>Example:</p>
10275
10276<div>
10277<div>
10278<pre class="source"> {
10279 &quot;a&quot;: is_temporal(true),
10280 &quot;b&quot;: is_temporal(false),
10281 &quot;c&quot;: is_temporal(null),
10282 &quot;d&quot;: is_temporal(missing),
10283 &quot;e&quot;: is_temporal(duration(&quot;-PT20.943S&quot;)),
10284 &quot;f&quot;: istemporal(date(&quot;2013-01-01&quot;)),
10285 &quot;g&quot;: istemporal(time(&quot;12:12:12.039Z&quot;)),
10286 &quot;h&quot;: istemporal(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
10287 &quot;i&quot;: istemporal(duration(&quot;P100Y12MT12M&quot;)),
10288 &quot;j&quot;: istemporal(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
10289 &quot;k&quot;: istemporal(3)
10290};
10291</pre></div></div>
10292</li>
10293<li>
10294
10295<p>The expected result is:</p>
10296
10297<div>
10298<div>
10299<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 }
10300</pre></div></div>
10301</li>
10302</ul>
10303<p>The function has an alias <tt>istemporal</tt>.</p></div>
10304<div class="section">
10305<h3><a name="is_object_.28is_obj.29"></a>is_object (is_obj)</h3>
10306<ul>
10307
10308<li>
10309
10310<p>Syntax:</p>
10311
10312<div>
10313<div>
10314<pre class="source">is_object(expr)
10315</pre></div></div>
10316</li>
10317<li>
10318
10319<p>Checks whether the given expression is evaluated to be a <tt>object</tt> value.</p>
10320</li>
10321<li>Arguments:
10322<ul>
10323
10324<li><tt>expr</tt> : an expression (any type is allowed).</li>
10325</ul>
10326</li>
10327<li>Return Value:
10328<ul>
10329
10330<li>a <tt>boolean</tt> on whether the argument is a <tt>object</tt> value or not,</li>
10331<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10332<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10333</ul>
10334</li>
10335<li>
10336
10337<p>Example:</p>
10338
10339<div>
10340<div>
10341<pre class="source">{
10342 &quot;a&quot;: is_object(true),
10343 &quot;b&quot;: is_object(false),
10344 &quot;c&quot;: isobject(null),
10345 &quot;d&quot;: isobject(missing),
10346 &quot;e&quot;: isobj(&quot;d&quot;),
10347 &quot;f&quot;: isobj(4.0),
10348 &quot;g&quot;: isobj(5),
10349 &quot;h&quot;: isobj([&quot;1&quot;, 2]),
10350 &quot;i&quot;: isobj({&quot;a&quot;:1})
10351};
10352</pre></div></div>
10353</li>
10354<li>
10355
10356<p>The expected result is:</p>
10357<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>
10358</li>
10359</ul>
10360<p>The function has three aliases: <tt>isobject</tt>, <tt>is_obj</tt>, and <tt>isobj</tt>.</p></div>
10361<div class="section">
10362<h3><a name="is_string_.28is_str.29"></a>is_string (is_str)</h3>
10363<ul>
10364
10365<li>
10366
10367<p>Syntax:</p>
10368
10369<div>
10370<div>
10371<pre class="source">is_string(expr)
10372</pre></div></div>
10373</li>
10374<li>
10375
10376<p>Checks whether the given expression is evaluated to be a <tt>string</tt> value.</p>
10377</li>
10378<li>Arguments:
10379<ul>
10380
10381<li><tt>expr</tt> : an expression (any type is allowed).</li>
10382</ul>
10383</li>
10384<li>Return Value:
10385<ul>
10386
10387<li>a <tt>boolean</tt> on whether the argument is a <tt>string</tt> value or not,</li>
10388<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10389<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10390</ul>
10391</li>
10392<li>
10393
10394<p>Example:</p>
10395
10396<div>
10397<div>
10398<pre class="source">{
10399 &quot;a&quot;: is_string(true),
10400 &quot;b&quot;: isstring(false),
10401 &quot;c&quot;: isstring(null),
10402 &quot;d&quot;: isstr(missing),
10403 &quot;e&quot;: isstr(&quot;d&quot;),
10404 &quot;f&quot;: isstr(4.0),
10405 &quot;g&quot;: isstr(5),
10406 &quot;h&quot;: isstr([&quot;1&quot;, 2]),
10407 &quot;i&quot;: isstr({&quot;a&quot;:1})
10408};
10409</pre></div></div>
10410</li>
10411<li>
10412
10413<p>The expected result is:</p>
10414
10415<div>
10416<div>
10417<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 }
10418</pre></div></div>
10419</li>
10420</ul>
10421<p>The function has three aliases: <tt>isstring</tt>, <tt>is_str</tt>, and <tt>isstr</tt>.</p></div>
10422<div class="section">
10423<h3><a name="is_uuid"></a>is_uuid</h3>
10424<ul>
10425
10426<li>
10427
10428<p>Syntax:</p>
10429
10430<div>
10431<div>
10432<pre class="source">is_uuid(expr)
10433</pre></div></div>
10434</li>
10435<li>
10436
10437<p>Checks whether the given expression is evaluated to be a <tt>uuid</tt> value.</p>
10438</li>
10439<li>Arguments:
10440<ul>
10441
10442<li><tt>expr</tt> : an expression (any type is allowed).</li>
10443</ul>
10444</li>
10445<li>Return Value:
10446<ul>
10447
10448<li>a <tt>boolean</tt> on whether the argument is a <tt>uuid</tt> value or not,</li>
10449<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
10450<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
10451</ul>
10452</li>
10453<li>
10454
10455<p>Example:</p>
10456
10457<div>
10458<div>
10459<pre class="source"> {
10460 &quot;a&quot;: is_uuid(true),
10461 &quot;b&quot;: is_uuid(false),
10462 &quot;c&quot;: is_uuid(null),
10463 &quot;d&quot;: is_uuid(missing),
10464 &quot;e&quot;: isuuid(4.0),
10465 &quot;f&quot;: isuuid(date(&quot;2013-01-01&quot;)),
10466 &quot;g&quot;: isuuid(uuid(&quot;5c848e5c-6b6a-498f-8452-8847a2957421&quot;))
10467};
10468</pre></div></div>
10469</li>
10470<li>
10471
10472<p>The expected result is:</p>
10473
10474<div>
10475<div>
10476<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 }
10477</pre></div></div>
10478</li>
10479</ul>
10480<p>The function has an alias <tt>isuuid</tt>.</p></div>
10481<div class="section">
10482<h3><a name="is_null"></a>is_null</h3>
10483<ul>
10484
10485<li>
10486
10487<p>Syntax:</p>
10488
10489<div>
10490<div>
10491<pre class="source">is_null(expr)
10492</pre></div></div>
10493</li>
10494<li>
10495
10496<p>Checks whether the given expression is evaluated to be a <tt>null</tt> value.</p>
10497</li>
10498<li>Arguments:
10499<ul>
10500
10501<li><tt>expr</tt> : an expression (any type is allowed).</li>
10502</ul>
10503</li>
10504<li>Return Value:
10505<ul>
10506
10507<li>a <tt>boolean</tt> on whether the variable is a <tt>null</tt> or not,</li>
10508<li>a <tt>missing</tt> if the input is <tt>missing</tt>.</li>
10509</ul>
10510</li>
10511<li>
10512
10513<p>Example:</p>
10514
10515<div>
10516<div>
10517<pre class="source">{ &quot;v1&quot;: is_null(null), &quot;v2&quot;: is_null(1), &quot;v3&quot;: is_null(missing) };
10518</pre></div></div>
10519</li>
10520<li>
10521
10522<p>The expected result is:</p>
10523
10524<div>
10525<div>
10526<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
10527</pre></div></div>
10528</li>
10529</ul>
10530<p>The function has an alias <tt>isnull</tt>.</p></div>
10531<div class="section">
10532<h3><a name="is_missing"></a>is_missing</h3>
10533<ul>
10534
10535<li>
10536
10537<p>Syntax:</p>
10538
10539<div>
10540<div>
10541<pre class="source">is_missing(expr)
10542</pre></div></div>
10543</li>
10544<li>
10545
10546<p>Checks whether the given expression is evaluated to be a <tt>missing</tt> value.</p>
10547</li>
10548<li>Arguments:
10549<ul>
10550
10551<li><tt>expr</tt> : an expression (any type is allowed).</li>
10552</ul>
10553</li>
10554<li>Return Value:
10555<ul>
10556
10557<li>a <tt>boolean</tt> on whether the variable is a <tt>missing</tt> or not.</li>
10558</ul>
10559</li>
10560<li>
10561
10562<p>Example:</p>
10563
10564<div>
10565<div>
10566<pre class="source">{ &quot;v1&quot;: is_missing(null), &quot;v2&quot;: is_missing(1), &quot;v3&quot;: is_missing(missing) };
10567</pre></div></div>
10568</li>
10569<li>
10570
10571<p>The expected result is:</p>
10572
10573<div>
10574<div>
10575<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: false, &quot;v3&quot;: true }
10576</pre></div></div>
10577</li>
10578</ul>
10579<p>The function has an alias <tt>ismissing</tt>.</p></div>
10580<div class="section">
10581<h3><a name="is_unknown"></a>is_unknown</h3>
10582<ul>
10583
10584<li>
10585
10586<p>Syntax:</p>
10587
10588<div>
10589<div>
10590<pre class="source">is_unknown(expr)
10591</pre></div></div>
10592</li>
10593<li>
10594
10595<p>Checks whether the given variable is a <tt>null</tt> value or a <tt>missing</tt> value.</p>
10596</li>
10597<li>Arguments:
10598<ul>
10599
10600<li><tt>expr</tt> : an expression (any type is allowed).</li>
10601</ul>
10602</li>
10603<li>Return Value:
10604<ul>
10605
10606<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>
10607</ul>
10608</li>
10609<li>
10610
10611<p>Example:</p>
10612
10613<div>
10614<div>
10615<pre class="source">{ &quot;v1&quot;: is_unknown(null), &quot;v2&quot;: is_unknown(1), &quot;v3&quot;: is_unknown(missing) };
10616</pre></div></div>
10617</li>
10618<li>
10619
10620<p>The expected result is:</p>
10621
10622<div>
10623<div>
10624<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false, &quot;v3&quot;: true }
10625</pre></div></div>
10626</li>
10627</ul>
10628<p>The function has an alias <tt>isunknown</tt>.</p></div>
10629<div class="section">
10630<h3><a name="to_array"></a>to_array</h3>
10631<ul>
10632
10633<li>
10634
10635<p>Syntax:</p>
10636
10637<div>
10638<div>
10639<pre class="source">to_array(expr)
10640</pre></div></div>
10641</li>
10642<li>
10643
10644<p>Converts input value to an <tt>array</tt> value</p>
10645</li>
10646<li>Arguments:
10647<ul>
10648
10649<li><tt>expr</tt> : an expression</li>
10650</ul>
10651</li>
10652<li>Return Value:
10653<ul>
10654
10655<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
10656<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
10657<li>if the argument is of <tt>array</tt> type then it is returned as is</li>
10658<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>
10659<li>otherwise an <tt>array</tt> containing the input expression as its single item is returned</li>
10660</ul>
10661</li>
10662<li>
10663
10664<p>Example:</p>
10665
10666<div>
10667<div>
10668<pre class="source">{
10669 &quot;v1&quot;: to_array(&quot;asterix&quot;),
10670 &quot;v2&quot;: to_array([&quot;asterix&quot;]),
10671};
10672</pre></div></div>
10673</li>
10674<li>
10675
10676<p>The expected result is:</p>
10677
10678<div>
10679<div>
10680<pre class="source">{ &quot;v1&quot;: [&quot;asterix&quot;], &quot;v2&quot;: [&quot;asterix&quot;] }
10681</pre></div></div>
10682</li>
10683</ul>
10684<p>The function has an alias <tt>toarray</tt>.</p></div>
10685<div class="section">
10686<h3><a name="to_atomic_.28to_atom.29"></a>to_atomic (to_atom)</h3>
10687<ul>
10688
10689<li>
10690
10691<p>Syntax:</p>
10692
10693<div>
10694<div>
10695<pre class="source">to_atomic(expr)
10696</pre></div></div>
10697</li>
10698<li>
10699
10700<p>Converts input value to a <a href="../datamodel.html#PrimitiveTypes">primitive</a> value</p>
10701</li>
10702<li>Arguments:
10703<ul>
10704
10705<li><tt>expr</tt> : an expression</li>
10706</ul>
10707</li>
10708<li>Return Value:
10709<ul>
10710
10711<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
10712<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
10713<li>if the argument is of primitive type then it is returned as is</li>
10714<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>
10715<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>
10716<li>otherwise <tt>null</tt> is returned</li>
10717</ul>
10718</li>
10719<li>
10720
10721<p>Example:</p>
10722
10723<div>
10724<div>
10725<pre class="source">{
10726 &quot;v1&quot;: to_atomic(&quot;asterix&quot;),
10727 &quot;v2&quot;: to_atomic([&quot;asterix&quot;]),
10728 &quot;v3&quot;: to_atomic([0, 1]),
10729 &quot;v4&quot;: to_atomic({&quot;value&quot;: &quot;asterix&quot;}),
10730 &quot;v5&quot;: to_number({&quot;x&quot;: 1, &quot;y&quot;: 2})
10731};
10732</pre></div></div>
10733</li>
10734<li>
10735
10736<p>The expected result is:</p>
10737
10738<div>
10739<div>
10740<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 }
10741</pre></div></div>
10742</li>
10743</ul>
10744<p>The function has three aliases: <tt>toatomic</tt>, <tt>to_atom</tt>, and <tt>toatom</tt>.</p></div>
10745<div class="section">
10746<h3><a name="to_boolean_.28to_bool.29"></a>to_boolean (to_bool)</h3>
10747<ul>
10748
10749<li>
10750
10751<p>Syntax:</p>
10752
10753<div>
10754<div>
10755<pre class="source">to_boolean(expr)
10756</pre></div></div>
10757</li>
10758<li>
10759
10760<p>Converts input value to a <tt>boolean</tt> value</p>
10761</li>
10762<li>Arguments:
10763<ul>
10764
10765<li><tt>expr</tt> : an expression</li>
10766</ul>
10767</li>
10768<li>Return Value:
10769<ul>
10770
10771<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
10772<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
10773<li>if the argument is of <tt>boolean</tt> type then it is returned as is</li>
10774<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>
10775<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>
10776<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>
10777<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>
10778<li>type error is raised for all other input types</li>
10779</ul>
10780</li>
10781<li>
10782
10783<p>Example:</p>
10784
10785<div>
10786<div>
10787<pre class="source">{
10788 &quot;v1&quot;: to_boolean(0),
10789 &quot;v2&quot;: to_boolean(1),
10790 &quot;v3&quot;: to_boolean(&quot;&quot;),
10791 &quot;v4&quot;: to_boolean(&quot;asterix&quot;)
10792};
10793</pre></div></div>
10794</li>
10795<li>
10796
10797<p>The expected result is:</p>
10798
10799<div>
10800<div>
10801<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: true, &quot;v3&quot;: false, &quot;v4&quot;: true }
10802</pre></div></div>
10803</li>
10804</ul>
10805<p>The function has three aliases: <tt>toboolean</tt>, <tt>to_bool</tt>, and <tt>tobool</tt>.</p></div>
10806<div class="section">
10807<h3><a name="to_bigint"></a>to_bigint</h3>
10808<ul>
10809
10810<li>
10811
10812<p>Syntax:</p>
10813
10814<div>
10815<div>
10816<pre class="source">to_bigint(expr)
10817</pre></div></div>
10818</li>
10819<li>
10820
10821<p>Converts input value to an integer value</p>
10822</li>
10823<li>Arguments:
10824<ul>
10825
10826<li><tt>expr</tt> : an expression</li>
10827</ul>
10828</li>
10829<li>Return Value:
10830<ul>
10831
10832<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
10833<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
10834<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>
10835<li>if the argument is of numeric integer type then it is returned as the same value of <tt>bigint</tt> type</li>
10836<li>if the argument is of numeric <tt>float</tt>/<tt>double</tt> type then it is converted to <tt>bigint</tt> type</li>
10837<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>
10838<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
10839<li>type error is raised for all other input types</li>
10840</ul>
10841</li>
10842<li>
10843
10844<p>Example:</p>
10845
10846<div>
10847<div>
10848<pre class="source">{
10849 &quot;v1&quot;: to_bigint(false),
10850 &quot;v2&quot;: to_bigint(true),
10851 &quot;v3&quot;: to_bigint(10),
10852 &quot;v4&quot;: to_bigint(float(&quot;1e100&quot;)),
10853 &quot;v5&quot;: to_bigint(double(&quot;1e1000&quot;)),
10854 &quot;v6&quot;: to_bigint(&quot;20&quot;)
10855};
10856</pre></div></div>
10857</li>
10858<li>
10859
10860<p>The expected result is:</p>
10861
10862<div>
10863<div>
10864<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 }
10865</pre></div></div>
10866</li>
10867</ul>
10868<p>The function has an alias <tt>tobigint</tt>.</p></div>
10869<div class="section">
10870<h3><a name="to_double"></a>to_double</h3>
10871<ul>
10872
10873<li>
10874
10875<p>Syntax:</p>
10876
10877<div>
10878<div>
10879<pre class="source">to_double(expr)
10880</pre></div></div>
10881</li>
10882<li>
10883
10884<p>Converts input value to a <tt>double</tt> value</p>
10885</li>
10886<li>Arguments:
10887<ul>
10888
10889<li><tt>expr</tt> : an expression</li>
10890</ul>
10891</li>
10892<li>Return Value:
10893<ul>
10894
10895<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
10896<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
10897<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>
10898<li>if the argument is of numeric type then it is returned as the value of <tt>double</tt> type</li>
10899<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>
10900<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
10901<li>type error is raised for all other input types</li>
10902</ul>
10903</li>
10904<li>
10905
10906<p>Example:</p>
10907
10908<div>
10909<div>
10910<pre class="source">{
10911 &quot;v1&quot;: to_double(false),
10912 &quot;v2&quot;: to_double(true),
10913 &quot;v3&quot;: to_double(10),
10914 &quot;v4&quot;: to_double(11.5),
10915 &quot;v5&quot;: to_double(&quot;12.5&quot;)
10916};
10917</pre></div></div>
10918</li>
10919<li>
10920
10921<p>The expected result is:</p>
10922
10923<div>
10924<div>
10925<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 }
10926</pre></div></div>
10927</li>
10928</ul>
10929<p>The function has an alias <tt>todouble</tt>.</p></div>
10930<div class="section">
10931<h3><a name="to_number_.28to_num.29"></a>to_number (to_num)</h3>
10932<ul>
10933
10934<li>
10935
10936<p>Syntax:</p>
10937
10938<div>
10939<div>
10940<pre class="source">to_number(expr)
10941</pre></div></div>
10942</li>
10943<li>
10944
10945<p>Converts input value to a numeric value</p>
10946</li>
10947<li>Arguments:
10948<ul>
10949
10950<li><tt>expr</tt> : an expression</li>
10951</ul>
10952</li>
10953<li>Return Value:
10954<ul>
10955
10956<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
10957<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
10958<li>if the argument is of numeric type then it is returned as is</li>
10959<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>
10960<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>
10961<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
10962<li>type error is raised for all other input types</li>
10963</ul>
10964</li>
10965<li>
10966
10967<p>Example:</p>
10968
10969<div>
10970<div>
10971<pre class="source">{
10972 &quot;v1&quot;: to_number(false),
10973 &quot;v2&quot;: to_number(true),
10974 &quot;v3&quot;: to_number(10),
10975 &quot;v4&quot;: to_number(11.5),
10976 &quot;v5&quot;: to_number(&quot;12.5&quot;)
10977};
10978</pre></div></div>
10979</li>
10980<li>
10981
10982<p>The expected result is:</p>
10983
10984<div>
10985<div>
10986<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 }
10987</pre></div></div>
10988</li>
10989</ul>
10990<p>The function has three aliases: <tt>tonumber</tt>, <tt>to_num</tt>, and <tt>tonum</tt>.</p></div>
10991<div class="section">
10992<h3><a name="to_object_.28to_obj.29"></a>to_object (to_obj)</h3>
10993<ul>
10994
10995<li>
10996
10997<p>Syntax:</p>
10998
10999<div>
11000<div>
11001<pre class="source">to_object(expr)
11002</pre></div></div>
11003</li>
11004<li>
11005
11006<p>Converts input value to an <tt>object</tt> value</p>
11007</li>
11008<li>Arguments:
11009<ul>
11010
11011<li><tt>expr</tt> : an expression</li>
11012</ul>
11013</li>
11014<li>Return Value:
11015<ul>
11016
11017<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
11018<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
11019<li>if the argument is of <tt>object</tt> type then it is returned as is</li>
11020<li>otherwise an empty <tt>object</tt> is returned</li>
11021</ul>
11022</li>
11023<li>
11024
11025<p>Example:</p>
11026
11027<div>
11028<div>
11029<pre class="source">{
11030 &quot;v1&quot;: to_object({&quot;value&quot;: &quot;asterix&quot;}),
11031 &quot;v2&quot;: to_object(&quot;asterix&quot;)
11032};
11033</pre></div></div>
11034</li>
11035<li>
11036
11037<p>The expected result is:</p>
11038
11039<div>
11040<div>
11041<pre class="source">{ &quot;v1&quot;: {&quot;value&quot;: &quot;asterix&quot;}, &quot;v2&quot;: {} }
11042</pre></div></div>
11043</li>
11044</ul>
11045<p>The function has three aliases: <tt>toobject</tt>, <tt>to_obj</tt>, and <tt>toobj</tt>.</p></div>
11046<div class="section">
11047<h3><a name="to_string_.28to_str.29"></a>to_string (to_str)</h3>
11048<ul>
11049
11050<li>
11051
11052<p>Syntax:</p>
11053
11054<div>
11055<div>
11056<pre class="source">to_string(expr)
11057</pre></div></div>
11058</li>
11059<li>
11060
11061<p>Converts input value to a string value</p>
11062</li>
11063<li>Arguments:
11064<ul>
11065
11066<li><tt>expr</tt> : an expression</li>
11067</ul>
11068</li>
11069<li>Return Value:
11070<ul>
11071
11072<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
11073<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
11074<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>
11075<li>if the argument is of numeric type then its string representation is returned</li>
11076<li>if the argument is of <tt>string</tt> type then it is returned as is</li>
11077<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
11078<li>type error is raised for all other input types</li>
11079</ul>
11080</li>
11081<li>
11082
11083<p>Example:</p>
11084
11085<div>
11086<div>
11087<pre class="source">{
11088 &quot;v1&quot;: to_string(false),
11089 &quot;v2&quot;: to_string(true),
11090 &quot;v3&quot;: to_string(10),
11091 &quot;v4&quot;: to_string(11.5),
11092 &quot;v5&quot;: to_string(&quot;asterix&quot;)
11093};
11094</pre></div></div>
11095</li>
11096<li>
11097
11098<p>The expected result is:</p>
11099
11100<div>
11101<div>
11102<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; }
11103</pre></div></div>
11104</li>
11105</ul>
11106<p>The function has three aliases: <tt>tostring</tt>, <tt>to_str</tt>, and <tt>tostr</tt>.</p><!--
11107 ! Licensed to the Apache Software Foundation (ASF) under one
11108 ! or more contributor license agreements. See the NOTICE file
11109 ! distributed with this work for additional information
11110 ! regarding copyright ownership. The ASF licenses this file
11111 ! to you under the Apache License, Version 2.0 (the
11112 ! "License"); you may not use this file except in compliance
11113 ! with the License. You may obtain a copy of the License at
11114 !
11115 ! http://www.apache.org/licenses/LICENSE-2.0
11116 !
11117 ! Unless required by applicable law or agreed to in writing,
11118 ! software distributed under the License is distributed on an
11119 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11120 ! KIND, either express or implied. See the License for the
11121 ! specific language governing permissions and limitations
11122 ! under the License.
11123 !-->
11124</div></div>
11125<div class="section">
11126<h2><a name="Conditional_Functions"></a><a name="ConditionalFunctions" id="ConditionalFunctions">Conditional Functions</a></h2>
11127<div class="section">
11128<h3><a name="if_null_.28ifnull.29"></a>if_null (ifnull)</h3>
11129<ul>
11130
11131<li>
11132
11133<p>Syntax:</p>
11134
11135<div>
11136<div>
11137<pre class="source">if_null(expression1, expression2, ... expressionN)
11138</pre></div></div>
11139</li>
11140<li>
11141
11142<p>Finds first argument which value is not <tt>null</tt> and returns that value</p>
11143</li>
11144<li>Arguments:
11145<ul>
11146
11147<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11148</ul>
11149</li>
11150<li>Return Value:
11151<ul>
11152
11153<li>a <tt>null</tt> if all arguments evaluate to <tt>null</tt> or no arguments specified</li>
11154<li>a value of the first non-<tt>null</tt> argument otherwise</li>
11155</ul>
11156</li>
11157<li>
11158
11159<p>Example:</p>
11160
11161<div>
11162<div>
11163<pre class="source">{
11164 &quot;a&quot;: if_null(),
11165 &quot;b&quot;: if_null(null),
11166 &quot;c&quot;: if_null(null, &quot;asterixdb&quot;),
11167 &quot;d&quot;: is_missing(if_null(missing))
11168};
11169</pre></div></div>
11170</li>
11171<li>
11172
11173<p>The expected result is:</p>
11174
11175<div>
11176<div>
11177<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot;, &quot;d&quot;: true }
11178</pre></div></div>
11179</li>
11180</ul>
11181<p>The function has an alias <tt>ifnull</tt>.</p></div>
11182<div class="section">
11183<h3><a name="if_missing_.28ifmissing.29"></a>if_missing (ifmissing)</h3>
11184<ul>
11185
11186<li>
11187
11188<p>Syntax:</p>
11189
11190<div>
11191<div>
11192<pre class="source">if_missing(expression1, expression2, ... expressionN)
11193</pre></div></div>
11194</li>
11195<li>
11196
11197<p>Finds first argument which value is not <tt>missing</tt> and returns that value</p>
11198</li>
11199<li>Arguments:
11200<ul>
11201
11202<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11203</ul>
11204</li>
11205<li>Return Value:
11206<ul>
11207
11208<li>a <tt>null</tt> if all arguments evaluate to <tt>missing</tt> or no arguments specified</li>
11209<li>a value of the first non-<tt>missing</tt> argument otherwise</li>
11210</ul>
11211</li>
11212<li>
11213
11214<p>Example:</p>
11215
11216<div>
11217<div>
11218<pre class="source">{
11219 &quot;a&quot;: if_missing(),
11220 &quot;b&quot;: if_missing(missing),
11221 &quot;c&quot;: if_missing(missing, &quot;asterixdb&quot;),
11222 &quot;d&quot;: if_missing(null, &quot;asterixdb&quot;)
11223};
11224</pre></div></div>
11225</li>
11226<li>
11227
11228<p>The expected result is:</p>
11229
11230<div>
11231<div>
11232<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot;, &quot;d&quot;: null }
11233</pre></div></div>
11234</li>
11235</ul>
11236<p>The function has an alias <tt>ifmissing</tt>.</p></div>
11237<div class="section">
11238<h3><a name="if_missing_or_null_.28ifmissingornull.2C_coalesce.29"></a>if_missing_or_null (ifmissingornull, coalesce)</h3>
11239<ul>
11240
11241<li>
11242
11243<p>Syntax:</p>
11244
11245<div>
11246<div>
11247<pre class="source">if_missing_or_null(expression1, expression2, ... expressionN)
11248</pre></div></div>
11249</li>
11250<li>
11251
11252<p>Finds first argument which value is not <tt>null</tt> or <tt>missing</tt> and returns that value</p>
11253</li>
11254<li>Arguments:
11255<ul>
11256
11257<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11258</ul>
11259</li>
11260<li>Return Value:
11261<ul>
11262
11263<li>a <tt>null</tt> if all arguments evaluate to either <tt>null</tt> or <tt>missing</tt>, or no arguments specified</li>
11264<li>a value of the first non-<tt>null</tt>, non-<tt>missing</tt> argument otherwise</li>
11265</ul>
11266</li>
11267<li>
11268
11269<p>Example:</p>
11270
11271<div>
11272<div>
11273<pre class="source">{
11274 &quot;a&quot;: if_missing_or_null(),
11275 &quot;b&quot;: if_missing_or_null(null, missing),
11276 &quot;c&quot;: if_missing_or_null(null, missing, &quot;asterixdb&quot;)
11277};
11278</pre></div></div>
11279</li>
11280<li>
11281
11282<p>The expected result is:</p>
11283
11284<div>
11285<div>
11286<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot; }
11287</pre></div></div>
11288</li>
11289</ul>
11290<p>The function has two aliases: <tt>ifmissingornull</tt> and <tt>coalesce</tt>.</p></div>
11291<div class="section">
11292<h3><a name="if_inf_.28ifinf.29"></a>if_inf (ifinf)</h3>
11293<ul>
11294
11295<li>
11296
11297<p>Syntax:</p>
11298
11299<div>
11300<div>
11301<pre class="source">if_inf(expression1, expression2, ... expressionN)
11302</pre></div></div>
11303</li>
11304<li>
11305
11306<p>Finds first argument which is a non-infinite (<tt>INF</tt> or<tt>-INF</tt>) number</p>
11307</li>
11308<li>Arguments:
11309<ul>
11310
11311<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11312</ul>
11313</li>
11314<li>Return Value:
11315<ul>
11316
11317<li>a <tt>missing</tt> if <tt>missing</tt> argument was encountered before the first non-infinite number argument</li>
11318<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>
11319<li>the first non-infinite number argument otherwise</li>
11320</ul>
11321</li>
11322<li>
11323
11324<p>Example:</p>
11325
11326<div>
11327<div>
11328<pre class="source">{
11329 &quot;a&quot;: is_null(if_inf(null)),
11330 &quot;b&quot;: is_missing(if_inf(missing)),
11331 &quot;c&quot;: is_null(if_inf(double(&quot;INF&quot;))),
11332 &quot;d&quot;: if_inf(1, null, missing) ],
11333 &quot;e&quot;: is_null(if_inf(null, missing, 1)) ],
11334 &quot;f&quot;: is_missing(if_inf(missing, null, 1)) ],
11335 &quot;g&quot;: if_inf(float(&quot;INF&quot;), 1) ],
11336 &quot;h&quot;: to_string(if_inf(float(&quot;INF&quot;), double(&quot;NaN&quot;), 1)) ]
11337};
11338</pre></div></div>
11339</li>
11340<li>
11341
11342<p>The expected result is:</p>
11343
11344<div>
11345<div>
11346<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; }
11347</pre></div></div>
11348</li>
11349</ul>
11350<p>The function has an alias <tt>ifinf</tt>.</p></div>
11351<div class="section">
11352<h3><a name="if_nan_.28ifnan.29"></a>if_nan (ifnan)</h3>
11353<ul>
11354
11355<li>
11356
11357<p>Syntax:</p>
11358
11359<div>
11360<div>
11361<pre class="source">if_nan(expression1, expression2, ... expressionN)
11362</pre></div></div>
11363</li>
11364<li>
11365
11366<p>Finds first argument which is a non-<tt>NaN</tt> number</p>
11367</li>
11368<li>Arguments:
11369<ul>
11370
11371<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11372</ul>
11373</li>
11374<li>Return Value:
11375<ul>
11376
11377<li>a <tt>missing</tt> if <tt>missing</tt> argument was encountered before the first non-<tt>NaN</tt> number argument</li>
11378<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>
11379<li>the first non-<tt>NaN</tt> number argument otherwise</li>
11380</ul>
11381</li>
11382<li>
11383
11384<p>Example:</p>
11385
11386<div>
11387<div>
11388<pre class="source">{
11389 &quot;a&quot;: is_null(if_nan(null)),
11390 &quot;b&quot;: is_missing(if_nan(missing)),
11391 &quot;c&quot;: is_null(if_nan(double(&quot;NaN&quot;))),
11392 &quot;d&quot;: if_nan(1, null, missing) ],
11393 &quot;e&quot;: is_null(if_nan(null, missing, 1)) ],
11394 &quot;f&quot;: is_missing(if_nan(missing, null, 1)) ],
11395 &quot;g&quot;: if_nan(float(&quot;NaN&quot;), 1) ],
11396 &quot;h&quot;: to_string(if_nan(float(&quot;NaN&quot;), double(&quot;INF&quot;), 1)) ]
11397};
11398</pre></div></div>
11399</li>
11400<li>
11401
11402<p>The expected result is:</p>
11403
11404<div>
11405<div>
11406<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; }
11407</pre></div></div>
11408</li>
11409</ul>
11410<p>The function has an alias <tt>ifnan</tt>.</p></div>
11411<div class="section">
11412<h3><a name="if_nan_or_inf_.28ifnanorinf.29"></a>if_nan_or_inf (ifnanorinf)</h3>
11413<ul>
11414
11415<li>
11416
11417<p>Syntax:</p>
11418
11419<div>
11420<div>
11421<pre class="source">if_nan_or_inf(expression1, expression2, ... expressionN)
11422</pre></div></div>
11423</li>
11424<li>
11425
11426<p>Finds first argument which is a non-infinite (<tt>INF</tt> or<tt>-INF</tt>) and non-<tt>NaN</tt> number</p>
11427</li>
11428<li>Arguments:
11429<ul>
11430
11431<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11432</ul>
11433</li>
11434<li>Return Value:
11435<ul>
11436
11437<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>
11438<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>
11439<li>the first non-infinite and non-<tt>NaN</tt> number argument otherwise</li>
11440</ul>
11441</li>
11442<li>
11443
11444<p>Example:</p>
11445
11446<div>
11447<div>
11448<pre class="source">{
11449 &quot;a&quot;: is_null(if_nan_or_inf(null)),
11450 &quot;b&quot;: is_missing(if_nan_or_inf(missing)),
11451 &quot;c&quot;: is_null(if_nan_or_inf(double(&quot;NaN&quot;), double(&quot;INF&quot;))),
11452 &quot;d&quot;: if_nan_or_inf(1, null, missing) ],
11453 &quot;e&quot;: is_null(if_nan_or_inf(null, missing, 1)) ],
11454 &quot;f&quot;: is_missing(if_nan_or_inf(missing, null, 1)) ],
11455 &quot;g&quot;: if_nan_or_inf(float(&quot;NaN&quot;), float(&quot;INF&quot;), 1) ],
11456};
11457</pre></div></div>
11458</li>
11459<li>
11460
11461<p>The expected result is:</p>
11462
11463<div>
11464<div>
11465<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 }
11466</pre></div></div>
11467</li>
11468</ul>
11469<p>The function has an alias <tt>ifnanorinf</tt>.</p></div>
11470<div class="section">
11471<h3><a name="null_if_.28nullif.29"></a>null_if (nullif)</h3>
11472<ul>
11473
11474<li>
11475
11476<p>Syntax:</p>
11477
11478<div>
11479<div>
11480<pre class="source">null_if(expression1, expression2)
11481</pre></div></div>
11482</li>
11483<li>
11484
11485<p>Compares two arguments and returns <tt>null</tt> if they are equal, otherwise returns the first argument.</p>
11486</li>
11487<li>Arguments:
11488<ul>
11489
11490<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11491</ul>
11492</li>
11493<li>Return Value:
11494<ul>
11495
11496<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
11497<li><tt>null</tt> if
11498<ul>
11499
11500<li>any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value, or</li>
11501<li><tt>argument1</tt> = <tt>argument2</tt></li>
11502</ul>
11503</li>
11504<li>a value of the first argument otherwise</li>
11505</ul>
11506</li>
11507<li>
11508
11509<p>Example:</p>
11510
11511<div>
11512<div>
11513<pre class="source">{
11514 &quot;a&quot;: null_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;),
11515 &quot;b&quot;: null_if(1, 2)
11516};
11517</pre></div></div>
11518</li>
11519<li>
11520
11521<p>The expected result is:</p>
11522
11523<div>
11524<div>
11525<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: 1 }
11526</pre></div></div>
11527</li>
11528</ul>
11529<p>The function has an alias <tt>nullif</tt>.</p></div>
11530<div class="section">
11531<h3><a name="missing_if_.28missingif.29"></a>missing_if (missingif)</h3>
11532<ul>
11533
11534<li>
11535
11536<p>Syntax:</p>
11537
11538<div>
11539<div>
11540<pre class="source">missing_if(expression1, expression2)
11541</pre></div></div>
11542</li>
11543<li>
11544
11545<p>Compares two arguments and returns <tt>missing</tt> if they are equal, otherwise returns the first argument.</p>
11546</li>
11547<li>Arguments:
11548<ul>
11549
11550<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11551</ul>
11552</li>
11553<li>Return Value:
11554<ul>
11555
11556<li><tt>missing</tt> if
11557<ul>
11558
11559<li>any argument is a <tt>missing</tt> value, or</li>
11560<li>no argument is a <tt>null</tt> value and <tt>argument1</tt> = <tt>argument2</tt></li>
11561</ul>
11562</li>
11563<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
11564<li>a value of the first argument otherwise</li>
11565</ul>
11566</li>
11567<li>
11568
11569<p>Example:</p>
11570
11571<div>
11572<div>
11573<pre class="source">{
11574 &quot;a&quot;: missing_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)
11575 &quot;b&quot;: missing_if(1, 2),
11576};
11577</pre></div></div>
11578</li>
11579<li>
11580
11581<p>The expected result is:</p>
11582
11583<div>
11584<div>
11585<pre class="source">{ &quot;b&quot;: 1 }
11586</pre></div></div>
11587</li>
11588</ul>
11589<p>The function has an alias <tt>missingif</tt>.</p></div>
11590<div class="section">
11591<h3><a name="nan_if_.28nanif.29"></a>nan_if (nanif)</h3>
11592<ul>
11593
11594<li>
11595
11596<p>Syntax:</p>
11597
11598<div>
11599<div>
11600<pre class="source">nan_if(expression1, expression2)
11601</pre></div></div>
11602</li>
11603<li>
11604
11605<p>Compares two arguments and returns <tt>NaN</tt> value if they are equal, otherwise returns the first argument.</p>
11606</li>
11607<li>Arguments:
11608<ul>
11609
11610<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11611</ul>
11612</li>
11613<li>Return Value:
11614<ul>
11615
11616<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
11617<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
11618<li><tt>NaN</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
11619<li>a value of the first argument otherwise</li>
11620</ul>
11621</li>
11622<li>
11623
11624<p>Example:</p>
11625
11626<div>
11627<div>
11628<pre class="source">{
11629 &quot;a&quot;: to_string(nan_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
11630 &quot;b&quot;: nan_if(1, 2)
11631};
11632</pre></div></div>
11633</li>
11634<li>
11635
11636<p>The expected result is:</p>
11637
11638<div>
11639<div>
11640<pre class="source">{ &quot;a&quot;: &quot;NaN&quot;, &quot;b&quot;: 1 }
11641</pre></div></div>
11642</li>
11643</ul>
11644<p>The function has an alias <tt>nanif</tt>.</p></div>
11645<div class="section">
11646<h3><a name="posinf_if_.28posinfif.29"></a>posinf_if (posinfif)</h3>
11647<ul>
11648
11649<li>
11650
11651<p>Syntax:</p>
11652
11653<div>
11654<div>
11655<pre class="source">posinf_if(expression1, expression2)
11656</pre></div></div>
11657</li>
11658<li>
11659
11660<p>Compares two arguments and returns <tt>+INF</tt> value if they are equal, otherwise returns the first argument.</p>
11661</li>
11662<li>Arguments:
11663<ul>
11664
11665<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11666</ul>
11667</li>
11668<li>Return Value:
11669<ul>
11670
11671<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
11672<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
11673<li><tt>+INF</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
11674<li>a value of the first argument otherwise</li>
11675</ul>
11676</li>
11677<li>
11678
11679<p>Example:</p>
11680
11681<div>
11682<div>
11683<pre class="source">{
11684 &quot;a&quot;: to_string(posinf_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
11685 &quot;b&quot;: posinf_if(1, 2)
11686};
11687</pre></div></div>
11688</li>
11689<li>
11690
11691<p>The expected result is:</p>
11692
11693<div>
11694<div>
11695<pre class="source">{ &quot;a&quot;: &quot;+INF&quot;, &quot;b&quot;: 1 }
11696</pre></div></div>
11697</li>
11698</ul>
11699<p>The function has an alias <tt>posinfif</tt>.</p></div>
11700<div class="section">
11701<h3><a name="neginf_if_.28neginfif.29"></a>neginf_if (neginfif)</h3>
11702<ul>
11703
11704<li>
11705
11706<p>Syntax:</p>
11707
11708<div>
11709<div>
11710<pre class="source">neginf_if(expression1, expression2)
11711</pre></div></div>
11712</li>
11713<li>
11714
11715<p>Compares two arguments and returns <tt>-INF</tt> value if they are equal, otherwise returns the first argument.</p>
11716</li>
11717<li>Arguments:
11718<ul>
11719
11720<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
11721</ul>
11722</li>
11723<li>Return Value:
11724<ul>
11725
11726<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
11727<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
11728<li><tt>-INF</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
11729<li>a value of the first argument otherwise</li>
11730</ul>
11731</li>
11732<li>
11733
11734<p>Example:</p>
11735
11736<div>
11737<div>
11738<pre class="source">{
11739 &quot;a&quot;: to_string(neginf_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
11740 &quot;b&quot;: neginf_if(1, 2)
11741};
11742</pre></div></div>
11743</li>
11744<li>
11745
11746<p>The expected result is:</p>
11747
11748<div>
11749<div>
11750<pre class="source">{ &quot;a&quot;: &quot;-INF&quot;, &quot;b&quot;: 1 }
11751</pre></div></div>
11752</li>
11753</ul>
11754<p>The function has an alias <tt>neginfif</tt>.</p><!--
11755 ! Licensed to the Apache Software Foundation (ASF) under one
11756 ! or more contributor license agreements. See the NOTICE file
11757 ! distributed with this work for additional information
11758 ! regarding copyright ownership. The ASF licenses this file
11759 ! to you under the Apache License, Version 2.0 (the
11760 ! "License"); you may not use this file except in compliance
11761 ! with the License. You may obtain a copy of the License at
11762 !
11763 ! http://www.apache.org/licenses/LICENSE-2.0
11764 !
11765 ! Unless required by applicable law or agreed to in writing,
11766 ! software distributed under the License is distributed on an
11767 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11768 ! KIND, either express or implied. See the License for the
11769 ! specific language governing permissions and limitations
11770 ! under the License.
11771 !-->
11772</div></div>
11773<div class="section">
11774<h2><a name="Miscellaneous_Functions"></a><a name="MiscFunctions" id="MiscFunctions">Miscellaneous Functions</a></h2>
11775<div class="section">
11776<h3><a name="uuid"></a>uuid</h3>
11777<ul>
11778
11779<li>
11780
11781<p>Syntax:</p>
11782
11783<div>
11784<div>
11785<pre class="source">uuid()
11786</pre></div></div>
11787</li>
11788<li>
11789
11790<p>Generates a <tt>uuid</tt>.</p>
11791</li>
11792<li>Arguments:
11793<ul>
11794
11795<li>none</li>
11796</ul>
11797</li>
11798<li>Return Value:
11799<ul>
11800
11801<li>a generated, random <tt>uuid</tt>.</li>
11802</ul>
11803</li>
11804</ul></div>
11805<div class="section">
11806<h3><a name="len"></a>len</h3>
11807<ul>
11808
11809<li>
11810
11811<p>Syntax:</p>
11812<p>len(array)</p>
11813</li>
11814<li>
11815
11816<p>Returns the length of the array array.</p>
11817</li>
11818<li>Arguments:
11819<ul>
11820
11821<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>
11822</ul>
11823</li>
11824<li>Return Value:
11825<ul>
11826
11827<li>an <tt>integer</tt> that represents the length of input array or the size of the input multiset,</li>
11828<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
11829<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
11830</ul>
11831</li>
11832<li>
11833
11834<p>Example:</p>
11835
11836<div>
11837<div>
11838<pre class="source">len([&quot;Hello&quot;, &quot;World&quot;])
11839</pre></div></div>
11840</li>
11841<li>
11842
11843<p>The expected result is:</p>
11844
11845<div>
11846<div>
11847<pre class="source">2
11848</pre></div></div>
11849</li>
11850</ul></div>
11851<div class="section">
11852<h3><a name="not"></a>not</h3>
11853<ul>
11854
11855<li>
11856
11857<p>Syntax:</p>
11858
11859<div>
11860<div>
11861<pre class="source">not(expr)
11862</pre></div></div>
11863</li>
11864<li>
11865
11866<p>Inverts a <tt>boolean</tt> value</p>
11867</li>
11868<li>Arguments:
11869<ul>
11870
11871<li><tt>expr</tt> : an expression</li>
11872</ul>
11873</li>
11874<li>Return Value:
11875<ul>
11876
11877<li>a <tt>boolean</tt>, the inverse of <tt>expr</tt>,</li>
11878<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
11879<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
11880<li>other non-boolean argument value will cause a type error.</li>
11881</ul>
11882</li>
11883<li>Example:
11884
11885<div>
11886<div>
11887<pre class="source">{ &quot;v1&quot;: `not`(true), &quot;v2&quot;: `not`(false), &quot;v3&quot;: `not`(null), &quot;v4&quot;: `not`(missing) };
11888</pre></div></div>
11889</li>
11890<li>
11891
11892<p>The expected result is:</p>
11893
11894<div>
11895<div>
11896<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: true, &quot;v3&quot;: null }
11897</pre></div></div>
11898</li>
11899</ul></div>
11900<div class="section">
11901<h3><a name="random"></a>random</h3>
11902<ul>
11903
11904<li>
11905
11906<p>Syntax:</p>
11907
11908<div>
11909<div>
11910<pre class="source">random( [seed_value] )
11911</pre></div></div>
11912</li>
11913<li>
11914
11915<p>Returns a random number, accepting an optional seed value</p>
11916</li>
11917<li>Arguments:
11918<ul>
11919
11920<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>
11921</ul>
11922</li>
11923<li>Return Value:
11924<ul>
11925
11926<li>A random number of type <tt>double</tt> between 0 and 1,</li>
11927<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
11928<li><tt>null</tt> if the argument is a <tt>null</tt> value or a non-numeric value.</li>
11929</ul>
11930</li>
11931<li>
11932
11933<p>Example:</p>
11934
11935<div>
11936<div>
11937<pre class="source">{
11938 &quot;v1&quot;: random(),
11939 &quot;v2&quot;: random(unix_time_from_datetime_in_ms(current_datetime()))
11940};
11941</pre></div></div>
11942</li>
11943</ul></div>
11944<div class="section">
11945<h3><a name="range"></a>range</h3>
11946<ul>
11947
11948<li>
11949
11950<p>Syntax:</p>
11951
11952<div>
11953<div>
11954<pre class="source">range(start_numeric_value, end_numeric_value)
11955</pre></div></div>
11956</li>
11957<li>
11958
11959<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>
11960</li>
11961<li>Arguments:</li>
11962<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>
11963<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>
11964<li>Return Value:
11965<ul>
11966
11967<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>
11968</ul>
11969</li>
11970<li>Example:
11971
11972<div>
11973<div>
11974<pre class="source">range(0, 3);
11975</pre></div></div>
11976</li>
11977<li>
11978
11979<p>The expected result is:</p>
11980
11981<div>
11982<div>
11983<pre class="source">[ 0, 1, 2, 3 ]
11984</pre></div></div>
11985</li>
11986</ul></div>
11987<div class="section">
11988<h3><a name="switch_case"></a>switch_case</h3>
11989<ul>
11990
11991<li>
11992
11993<p>Syntax:</p>
11994
11995<div>
11996<div>
11997<pre class="source">switch_case(
11998 condition,
11999 case1, case1_result,
12000 case2, case2_result,
12001 ...,
12002 default, default_result
12003)
12004</pre></div></div>
12005</li>
12006<li>
12007
12008<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>
12009</li>
12010<li>Arguments:
12011<ul>
12012
12013<li><tt>condition</tt>: a variable (any type is allowed).</li>
12014<li><tt>caseI/default</tt>: a variable (any type is allowed).</li>
12015<li><tt>caseI/default_result</tt>: a variable (any type is allowed).</li>
12016</ul>
12017</li>
12018<li>Return Value:
12019<ul>
12020
12021<li><tt>caseI_result</tt> if <tt>condition</tt> matches <tt>caseI</tt>, otherwise <tt>default_result</tt>.</li>
12022</ul>
12023</li>
12024<li>Example 1:
12025
12026<div>
12027<div>
12028<pre class="source">switch_case(
12029 &quot;a&quot;,
12030 &quot;a&quot;, 0,
12031 &quot;x&quot;, 1,
12032 &quot;y&quot;, 2,
12033 &quot;z&quot;, 3
12034);
12035</pre></div></div>
12036</li>
12037<li>
12038
12039<p>The expected result is:</p>
12040
12041<div>
12042<div>
12043<pre class="source">0
12044</pre></div></div>
12045</li>
12046<li>
12047
12048<p>Example 2:</p>
12049
12050<div>
12051<div>
12052<pre class="source">switch_case(
12053 &quot;a&quot;,
12054 &quot;x&quot;, 1,
12055 &quot;y&quot;, 2,
12056 &quot;z&quot;, 3
12057);
12058</pre></div></div>
12059</li>
12060<li>
12061
12062<p>The expected result is:</p>
12063
12064<div>
12065<div>
12066<pre class="source">3
12067</pre></div></div>
12068</li>
12069</ul></div>
12070<div class="section">
12071<h3><a name="deep_equal"></a>deep_equal</h3>
12072<ul>
12073
12074<li>
12075
12076<p>Syntax:</p>
12077
12078<div>
12079<div>
12080<pre class="source">deep_equal(expr1, expr2)
12081</pre></div></div>
12082</li>
12083<li>
12084
12085<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>
12086</li>
12087<li>Arguments:
12088<ul>
12089
12090<li><tt>expr1</tt> : an expression,</li>
12091<li><tt>expr2</tt> : an expression.</li>
12092</ul>
12093</li>
12094<li>Return Value:
12095<ul>
12096
12097<li><tt>true</tt> or <tt>false</tt> depending on the data equality,</li>
12098<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
12099<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
12100</ul>
12101</li>
12102<li>
12103
12104<p>Example:</p>
12105
12106<div>
12107<div>
12108<pre class="source">deep_equal(
12109 {
12110 &quot;id&quot;:1,
12111 &quot;project&quot;:&quot;AsterixDB&quot;,
12112 &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
12113 &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
12114 },
12115 {
12116 &quot;id&quot;:1,
12117 &quot;project&quot;:&quot;AsterixDB&quot;,
12118 &quot;address&quot;:{&quot;city&quot;:&quot;San Diego&quot;, &quot;state&quot;:&quot;CA&quot;},
12119 &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
12120 }
12121);
12122</pre></div></div>
12123</li>
12124<li>
12125
12126<p>The expected result is:</p>
12127
12128<div>
12129<div>
12130<pre class="source">false
12131</pre></div></div>
12132</li>
12133</ul></div></div>
12134 </div>
12135 </div>
12136 </div>
12137 <hr/>
12138 <footer>
12139 <div class="container-fluid">
12140 <div class="row-fluid">
12141<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
12142 feather logo, and the Apache AsterixDB project logo are either
12143 registered trademarks or trademarks of The Apache Software
12144 Foundation in the United States and other countries.
12145 All other marks mentioned may be trademarks or registered
12146 trademarks of their respective owners.
12147 </div>
12148 </div>
12149 </div>
12150 </footer>
12151 </body>
12152</html>