Fix 0.9.9 docs to include generated pages

Change-Id:If17ec8dbd1de435c9a0caedf4daa7ee1ebe3e5b7
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/incubator-asterixdb-site/+/18222
Reviewed-by: Ian Maxon <imaxon@uci.edu>
diff --git a/content/docs/0.9.9/ansible.html b/content/docs/0.9.9/ansible.html
new file mode 100644
index 0000000..c1894a7
--- /dev/null
+++ b/content/docs/0.9.9/ansible.html
@@ -0,0 +1,299 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/ansible.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Installation using Ansible</title>
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="./css/site.css" />
+    <link rel="stylesheet" href="./css/print.css" media="print" />
+    <script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href="./" id="bannerLeft"><img src="images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li class="active"><a href="#"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href="./" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>Installation using Ansible</h1>
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="atoc" id="#toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#Introduction">Introduction</a></li>
+<li><a href="#Prerequisites">Prerequisites</a></li>
+<li><a href="#config">Cluster Configuration</a></li>
+<li><a href="#lifecycle">Cluster Lifecycle Management</a></li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Introduction" id="Introduction">Introduction</a></h2>
+<p>This installation option provides several wrapped <a class="externalLink" href="https://www.ansible.com/">Ansible</a>-based scripts to deploy, start, stop, and erase an AsterixDB instance on a multi-node cluster without requiring users to interact with each individual node in the cluster.</p></div>
+<div class="section">
+<h2><a name="Prerequisites" id="Prerequisites">Prerequisites</a></h2>
+<ul>
+
+<li>
+
+<p>Supported operating systems: <b>Linux</b> and <b>MacOS</b></p>
+</li>
+<li>
+
+<p>Install pip on your client machine:</p>
+<p>CentOS</p>
+
+<div>
+<div>
+<pre class="source"> $ sudo yum install python-pip
+</pre></div></div>
+
+<p>Ubuntu</p>
+
+<div>
+<div>
+<pre class="source"> $ sudo apt-get install python-pip
+</pre></div></div>
+
+<p>macOS</p>
+
+<div>
+<div>
+<pre class="source"> $ brew install pip
+</pre></div></div>
+</li>
+<li>
+
+<p>Install Ansible, boto, and boto3 on your client machine:</p>
+
+<div>
+<div>
+<pre class="source"> $ pip install ansible
+ $ pip install boto
+ $ pip install boto3
+</pre></div></div>
+
+<p>Note that you might need <tt>sudo</tt> depending on your system configuration.</p>
+<p><b>Make sure that the version of Ansible is no less than 2.2.1.0</b>:</p>
+
+<div>
+<div>
+<pre class="source"> $ ansible --version
+ ansible 2.2.1.0
+</pre></div></div>
+</li>
+<li>
+
+<p>Download the AsterixDB distribution package, unzip it, and navigate to <tt>opt/ansible/</tt></p>
+
+<div>
+<div>
+<pre class="source"> $ cd opt/ansible
+</pre></div></div>
+
+<p>The following files and directories are in the directory <tt>opt/ansible</tt>:</p>
+
+<div>
+<div>
+<pre class="source"> README  bin  conf  yaml
+</pre></div></div>
+
+<p><tt>bin</tt> contains scripts that deploy, start, stop and erase a multi-node AsterixDB cluster, according to the configuration specified in files under <tt>conf</tt>, and <tt>yaml</tt> contains internal Ansible scripts that the shell scripts in <tt>bin</tt> use.</p>
+</li>
+</ul></div>
+<div class="section">
+<h2><a name="Cluster_Configuration"></a><a name="config" id="config">Cluster Configuration</a></h2>
+<ul>
+
+<li>
+
+<p><b>Nodes and account</b>. Edit the inventory file <tt>conf/inventory</tt> when necessary. You mostly only need to specify the node DNS names (or IPs) for the cluster controller, i.e., the master node, in the <b>[cc]</b> section, and node controllers, i.e., slave nodes, in the <b>[ncs]</b> section. The following example configures a cluster with two slave nodes (172.0.1.11 and 172.0.1.12) and one master node (172.0.1.10).</p>
+
+<div>
+<div>
+<pre class="source"> [cc]
+ 172.0.1.10
+
+ [ncs]
+ 172.0.1.11
+ 172.0.1.12
+</pre></div></div>
+
+<p><b>Configure passwordless ssh from your current client that runs the scripts to all nodes listed in <tt>conf/inventory</tt> as well as <tt>localhost</tt>.</b> If the ssh user account for target machines is different from your current username, please uncomment and edit the following two lines:</p>
+
+<div>
+<div>
+<pre class="source"> ;[all:vars]
+ ;ansible_ssh_user=&lt;fill with your ssh account username&gt;
+</pre></div></div>
+
+<p>If you want to specify advanced Ansible builtin variables, please refer to the <a class="externalLink" href="http://docs.ansible.com/ansible/intro_inventory.html">Ansible documentation</a>.</p>
+</li>
+<li>
+
+<p><b>Remote working directories</b>. Edit <tt>conf/instance_settings.yml</tt> to change the remote binary directory (the variable &#x201c;binarydir&#x201d;) when necessary. By default, the binary directory will be under the home directory (as the value of Ansible builtin variable ansible_env.HOME) of the ssh user account on each node.</p>
+</li>
+</ul></div>
+<div class="section">
+<h2><a name="Cluster_Lifecycle_Management"></a><a name="lifecycle" id="lifecycle">Cluster Lifecycle Management</a></h2>
+<ul>
+
+<li>
+
+<p>Deploy the binary to all nodes:</p>
+
+<div>
+<div>
+<pre class="source"> $ bin/deploy.sh
+</pre></div></div>
+</li>
+<li>
+
+<p>Every time before starting the AsterixDB cluster, you can edit the instance configuration file <tt>conf/instance/cc.conf</tt>, except that IP addresses/DNS names are generated and cannot be changed. All available parameters and their usage can be found <a href="ncservice.html#Parameters">here</a>.</p>
+</li>
+<li>
+
+<p>Launch your AsterixDB cluster:</p>
+
+<div>
+<div>
+<pre class="source"> $ bin/start.sh
+</pre></div></div>
+
+<p>Now you can use the multi-node AsterixDB cluster by opening the master node listed in <tt>conf/inventory</tt> at port <tt>19001</tt> (which can be customized in <tt>conf/instance/cc.conf</tt>) in your browser.</p>
+</li>
+<li>
+
+<p>If you want to stop the the multi-node AsterixDB cluster, run the following script:</p>
+
+<div>
+<div>
+<pre class="source"> $ bin/stop.sh
+</pre></div></div>
+</li>
+<li>
+
+<p>If you want to remove the binary on all nodes, run the following script:</p>
+
+<div>
+<div>
+<pre class="source"> $ bin/erase.sh
+</pre></div></div>
+</li>
+</ul></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/content/docs/0.9.9/aql/builtins.html b/content/docs/0.9.9/aql/builtins.html
new file mode 100644
index 0000000..1dd3e91
--- /dev/null
+++ b/content/docs/0.9.9/aql/builtins.html
@@ -0,0 +1,12409 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/aql/builtins.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Builtin Functions</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+    <script type="text/javascript" src="../js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href=".././" id="bannerLeft"><img src="../images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="../index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="../ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="../ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="../aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="../sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="../datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="../sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="../SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="../sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="../api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="../csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="../aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="../feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="../udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="../sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="../sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="../sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="../geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="../geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="../interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="../spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="../sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="../aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li class="active"><a href="#"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href=".././" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="../images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>Builtin Functions</h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="toc" id="toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#NumericFunctions">Numeric Functions</a></li>
+<li><a href="#StringFunctions">String Functions</a></li>
+<li><a href="#BinaryFunctions">Binary Functions</a></li>
+<li><a href="#SpatialFunctions">Spatial Functions</a></li>
+<li><a href="#SimilarityFunctions">Similarity Functions</a></li>
+<li><a href="#TokenizingFunctions">Tokenizing Functions</a></li>
+<li><a href="#TemporalFunctions">Temporal Functions</a></li>
+<li><a href="#ObjectFunctions">Object Functions</a></li>
+<li><a href="#AggregateFunctions">Aggregate Functions (Array Functions)</a></li>
+<li><a href="#ComparisonFunctions">Comparison Functions</a></li>
+<li><a href="#TypeFunctions">Type Functions</a></li>
+<li><a href="#ConditionalFunctions">Conditional Functions</a></li>
+<li><a href="#MiscFunctions">Miscellaneous Functions</a></li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<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><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Numeric_Functions"></a><a name="NumericFunctions" id="NumericFunctions">Numeric Functions</a></h2>
+<div class="section">
+<h3><a name="abs"></a>abs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">abs(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the absolute value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The absolute value of the argument with the same type as the input argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="acos"></a>acos</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">acos(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc cosine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error,</li>
+<li>&#x201c;NaN&#x201d; for other legitimate numeric values.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="asin"></a>asin</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">asin(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc sine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error,</li>
+<li>&#x201c;NaN&#x201d; for other legitimate numeric values.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="atan"></a>atan</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">atan(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc tangent value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> arc tangent in radians for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="atan2"></a>atan2</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">atan2(numeric_value1, numeric_value2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc tangent value of numeric_value2/numeric_value1.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> arc tangent in radians for <tt>numeric_value1</tt> and <tt>numeric_value2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 0.4636476090008061, &quot;v2&quot;: 0.0, &quot;v3&quot;: 2.356194490192345 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ceil"></a>ceil</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ceil(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The ceiling value for the given number in the same type as the input argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: ceil(2013),
+  &quot;v2&quot;: ceil(-4036),
+  &quot;v3&quot;: ceil(0.3),
+  &quot;v4&quot;: ceil(float(&quot;-2013.2&quot;)),
+  &quot;v5&quot;: ceil(double(&quot;-2013.893823748327284&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="cos"></a>cos</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">cos(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the cosine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> cosine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="cosh"></a>cosh</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">cosh(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the hyperbolic cosine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> hyperbolic cosine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="degrees"></a>degrees</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">degrees(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts radians to degrees</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The degrees value for the given radians value. The returned value has type <tt>double</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: degrees(pi()) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 180.0 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="e"></a>e</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">e()
+</pre></div></div>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>e (base of the natural logarithm)</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: e() };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 2.718281828459045 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="exp"></a>exp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">exp(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes e<sup>numeric_value</sup>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>e<sup>numeric_value</sup>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="floor"></a>floor</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">floor(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The floor value for the given number in the same type as the input argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: floor(2013),
+  &quot;v2&quot;: floor(-4036),
+  &quot;v3&quot;: floor(0.8),
+  &quot;v4&quot;: floor(float(&quot;-2013.2&quot;)),
+  &quot;v5&quot;: floor(double(&quot;-2013.893823748327284&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ln"></a>ln</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ln(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes log<sub>e</sub>numeric_value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>log<sub>e</sub>numeric_value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="log"></a>log</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">log(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes log<sub>10</sub>numeric_value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>log<sub>10</sub>numeric_value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="pi"></a>pi</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">pi()
+</pre></div></div>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>Pi</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: pi() };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 3.141592653589793 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="power"></a>power</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">power(numeric_value1, numeric_value2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes numeric_value1<sup>numeric_value2</sup>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>numeric_value1<sup>numeric_value2</sup>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 1, &quot;v3&quot;: 0, &quot;v4&quot;: 1.4142135623730951 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="radians"></a>radians</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">radians(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts degrees to radians</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The radians value for the given degrees value. The returned value has type <tt>double</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: radians(180) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 3.141592653589793 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="round"></a>round</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">round(numeric_value[, round_digit])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The rounded value for the given number. The returned value has the following type:
+<ul>
+
+<li><tt>bigint</tt> if the input value has type <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt> or <tt>bigint</tt>,</li>
+<li><tt>float</tt> if the input value has type <tt>float</tt>,</li>
+<li><tt>double</tt> if the input value has type <tt>double</tt>;</li>
+</ul>
+</li>
+<li><tt>missing</tt> if the input value is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the input value is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will return a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: round(2013),
+  &quot;v2&quot;: round(-4036),
+  &quot;v3&quot;: round(0.8),
+  &quot;v4&quot;: round(float(&quot;-2013.256&quot;)),
+  &quot;v5&quot;: round(double(&quot;-2013.893823748327284&quot;))
+  &quot;v6&quot;: round(123456, -1),
+  &quot;v7&quot;: round(456.456, 2),
+  &quot;v8&quot;: round(456.456, -1),
+  &quot;v9&quot;: round(-456.456, -2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sign"></a>sign</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sign(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the sign of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the sign (a <tt>tinyint</tt>) of the argument, -1 for negative values, 0 for 0, and 1 for positive values,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 1, &quot;v2&quot;: 1, &quot;v3&quot;: 0, &quot;v4&quot;: 1, &quot;v5&quot;: -1 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sin"></a>sin</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sin(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the sine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> sine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sinh"></a>sinh</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sinh(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the hyperbolic sine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> hyperbolic sine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sqrt"></a>sqrt</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sqrt(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the square root of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> square root value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="tan"></a>tan</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">tan(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the tangent value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> tangent value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="tanh"></a>tanh</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">tanh(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the hyperbolic tangent value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> hyperbolic tangent value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="trunc"></a>trunc</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">trunc(numeric_value, number_digits)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<li><tt>number_digits</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> tangent value for the argument,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is <tt>missing</tt>,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-numeric value,</li>
+<li>the second argument is any other non-tinyint, non-smallint, non-integer, and non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="round_half_to_even"></a>round_half_to_even</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">round_half_to_even(numeric_value, [precision])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The rounded value for the given number in the same type as the input argument,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-numeric value,</li>
+<li>or, the second argument is any other non-tinyint, non-smallint, non-integer, or non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: round_half_to_even(2013),
+  &quot;v2&quot;: round_half_to_even(-4036),
+  &quot;v3&quot;: round_half_to_even(0.8),
+  &quot;v4&quot;: round_half_to_even(float(&quot;-2013.256&quot;)),
+  &quot;v5&quot;: round_half_to_even(double(&quot;-2013.893823748327284&quot;)),
+  &quot;v6&quot;: round_half_to_even(double(&quot;-2013.893823748327284&quot;), 2),
+  &quot;v7&quot;: round_half_to_even(2013, 4),
+  &quot;v8&quot;: round_half_to_even(float(&quot;-2013.256&quot;), 5)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="String_Functions"></a><a name="StringFunctions" id="StringFunctions">String Functions</a></h2>
+<div class="section">
+<h3><a name="concat"></a>concat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">concat(string1, string2, ...)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a concatenated string from arguments.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string1</tt>: a string value,</li>
+<li><tt>string2</tt>: a string value,</li>
+<li>&#x2026;.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a concatenated string from arguments,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">concat(&quot;test &quot;, &quot;driven &quot;, &quot;development&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;test driven development&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="contains"></a>contains</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">contains(string, substring_to_contain)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> contains the string <tt>substring_to_contain</tt></p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the given substring,</li>
+<li><tt>substring_to_contain</tt> : a target <tt>string</tt> that might be contained.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value, <tt>true</tt> if <tt>string</tt> contains <tt>substring_to_contain</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error,</li>
+<li><tt>false</tt> otherwise.</li>
+</ul>
+</li>
+<li>
+
+<p>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</p>
+</li>
+<li>Example:
+
+<div>
+<div>
+<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;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ends_with"></a>ends_with</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ends_with(string, substring_to_end_with)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> ends with the string <tt>substring_to_end_with</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might end with the given string,</li>
+<li><tt>substring_to_end_with</tt> : a <tt>string</tt> that might be contained as the ending substring.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value, <tt>true</tt> if <tt>string</tt> contains <tt>substring_to_contain</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error,</li>
+<li><tt>false</tt> otherwise.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: ends_with(&quot; love product-b its shortcut_menu is awesome:)&quot;, &quot;:)&quot;),
+  &quot;v2&quot;: ends_with(&quot; awsome:)&quot;, &quot;:-)&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="initcap_.28or_title.29"></a>initcap (or title)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">initcap(string)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> as the title form of the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: initcap(&quot;ASTERIXDB is here!&quot;), &quot;v2&quot;: title(&quot;ASTERIXDB is here!&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;Asterixdb Is Here!&quot;, &quot;v2&quot;: &quot;Asterixdb Is Here!&quot; }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="length"></a>length</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">length(string)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> or <tt>null</tt> that represents the string to be checked.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> that represents the length of <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">length(&quot;test string&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">11
+</pre></div></div>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">length(&quot;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (the emoji character &#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466; has 7 code points):</p>
+
+<div>
+<div>
+<pre class="source">7
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="lower"></a>lower</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">lower(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts a given string <tt>string</tt> to its lowercase form.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> as the lowercase form of the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">lower(&quot;ASTERIXDB&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;asterixdb&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ltrim"></a>ltrim</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ltrim(string[, chars]);
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
+<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a trimmed, new <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Related functions: see <tt>trim()</tt>, <tt>rtrim()</tt></li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">ltrim(&quot;me like x-phone&quot;, &quot;eml&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot; like x-phone&quot;
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
+
+<div>
+<div>
+<pre class="source">ltrim(&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;, &quot;&#x1f468;&#x200d;&#x1f466;&quot;)
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (only woman, girl and boy are left in the family):</p>
+
+<div>
+<div>
+<pre class="source">&quot;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="position"></a>position</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">position(string, string_pattern)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<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>
+<ul>
+
+<li>0-based: <tt>position</tt>, <tt>pos</tt>, <tt>position0</tt>, <tt>pos0</tt>.</li>
+<li>1-based: <tt>position1</tt>, <tt>pos1</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: position(&quot;ppphonepp&quot;, &quot;phone&quot;),
+  &quot;v2&quot;: position(&quot;hone&quot;, &quot;phone&quot;),
+  &quot;v3&quot;: position1(&quot;ppphonepp&quot;, &quot;phone&quot;),
+  &quot;v4&quot;: position1(&quot;hone&quot;, &quot;phone&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 2, &quot;v2&quot;: -1, v3&quot;: 3, &quot;v4&quot;: -1 }
+</pre></div></div>
+</li>
+<li>
+
+<p>Example of multi-code-point character:</p>
+
+<div>
+<div>
+<pre class="source">position(&quot;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x1f3c0;&quot;, &quot;&#x1f3c0;&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (the emoji family character has 7 code points):</p>
+
+<div>
+<div>
+<pre class="source">7
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_contains"></a>regexp_contains</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_contains(string, string_pattern[, string_flags])
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the strings <tt>string</tt> contains the regular expression pattern <tt>string_pattern</tt> (a Java regular expression pattern).</p>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li><tt>regexp_contains</tt>, <tt>regex_contains</tt>, <tt>contains_regexp</tt>, <tt>contains_regex</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: regexp_contains(&quot;pphonepp&quot;, &quot;p*hone&quot;),
+  &quot;v2&quot;: regexp_contains(&quot;hone&quot;, &quot;p+hone&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_like"></a>regexp_like</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_like(string, string_pattern[, string_flags])
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> exactly matches the regular expression pattern <tt>string_pattern</tt> (a Java regular expression pattern).</p>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li><tt>regexp_like</tt>, <tt>regex_like</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> that might be contained.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: regexp_like(&quot; can't stand acast the network is horrible:(&quot;, &quot;.*acast.*&quot;),
+  &quot;v2&quot;: regexp_like(&quot;acast&quot;, &quot;.*acst.*&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_position"></a>regexp_position</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_position(string, string_pattern[, string_flags])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<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>
+<li>1-Based: <tt>regexp_position1</tt>, <tt>regexp_pos1</tt>, <tt>regex_position1</tt> <tt>regex_pos1</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: regexp_position(&quot;pphonepp&quot;, &quot;p*hone&quot;),
+  &quot;v2&quot;: regexp_position(&quot;hone&quot;, &quot;p+hone&quot;),
+  &quot;v3&quot;: regexp_position1(&quot;pphonepp&quot;, &quot;p*hone&quot;),
+  &quot;v4&quot;: regexp_position1(&quot;hone&quot;, &quot;p+hone&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 0, &quot;v2&quot;: -1, &quot;v3&quot;: 1, &quot;v4&quot;: -1 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_replace"></a>regexp_replace</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_replace(string, string_pattern, string_replacement[, string_flags])
+regexp_replace(string, string_pattern, string_replacement[, replacement_limit])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li><tt>regexp_replace</tt>, <tt>regex_replace</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+<li><tt>string_replacement</tt> : a pattern <tt>string</tt> to be used as the replacement.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during replace.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>Returns a <tt>string</tt> that is obtained after the replacements.</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;like product-a the voicemail_service is awesome&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="repeat"></a>repeat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">repeat(string, n)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a string formed by repeating the input <tt>string</tt> <tt>n</tt> times.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be repeated,</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a string that repeats the input <tt>string</tt> <tt>n</tt> times,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-string value,</li>
+<li>or, the second argument is not a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt>.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">repeat(&quot;test&quot;, 3);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;testtesttest&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="replace"></a>replace</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">replace(string, search_string, replacement_string[, limit])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : an input <tt>string</tt>,</li>
+<li><tt>search_string</tt> : a <tt>string</tt>  substring to be searched for,</li>
+<li><tt>replacement_string</tt> : a <tt>string</tt> to be used as the replacement,</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>Returns a <tt>string</tt> that is obtained after the replacements,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value or non-integer <tt>limit</tt> will cause a type error,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: replace(&quot; like x-phone the voicemail_service is awesome&quot;, &quot; like x-phone&quot;, &quot;like product-a&quot;),
+  &quot;v2&quot;: replace(&quot;x-phone and x-phone&quot;, &quot;x-phone&quot;, &quot;product-a&quot;, 1)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: &quot;like product-a the voicemail_service is awesome&quot;,
+  &quot;v2&quot;: &quot;product-a and x-phone&quot;
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="reverse"></a>reverse</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">reverse(string)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be reversed</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a string containing characters from the the input <tt>string</tt> in the reverse order,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-string value</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">reverse(&quot;hello&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;olleh&quot;
+</pre></div></div>
+</li>
+<li>
+
+<p>Example of multi-code-point character (Korean):</p>
+
+<div>
+<div>
+<pre class="source">reverse(&quot;&#x1112;&#x1161;&#x11ab;&#x1100;&#x1173;&#x11af;&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (the Korean characters are splitted into code points and then the code points are reversed):</p>
+
+<div>
+<div>
+<pre class="source">&quot;&#x11af;&#x1173;&#x1100;&#x11ab;&#x1161;&#x1112;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="rtrim"></a>rtrim</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">rtrim(string[, chars]);
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
+<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a trimmed, new <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Related functions: see <tt>trim()</tt>, <tt>ltrim()</tt></li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: rtrim(&quot;i like x-phone&quot;, &quot;x-phone&quot;),
+  &quot;v2&quot;: rtrim(&quot;i like x-phone&quot;, &quot;onexph&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;i like &quot;, &quot;v2&quot;: &quot;i like x-&quot; }
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
+
+<div>
+<div>
+<pre class="source">rtrim(&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;, &quot;&#x1f468;&#x200d;&#x1f466;&quot;)
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (only man, woman and girl are left in the family):</p>
+
+<div>
+<div>
+<pre class="source">&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="split"></a>split</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">split(string, sep)
+</pre></div></div>
+</li>
+<li>
+
+<p>Splits the input <tt>string</tt> into an array of substrings separated by the string <tt>sep</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be split.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an array of substrings by splitting the input <tt>string</tt> by <tt>sep</tt>,</li>
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">split(&quot;test driven development&quot;, &quot; &quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;test&quot;, &quot;driven&quot;, &quot;development&quot; ]
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with two consecutive <tt>sep</tt>s in the <tt>string</tt>:</p>
+
+<div>
+<div>
+<pre class="source">split(&quot;123//456&quot;, &quot;/&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;123&quot;, &quot;&quot;, &quot;456&quot; ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="starts_with"></a>starts_with</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">starts_with(string, substring_to_start_with)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> starts with the string <tt>substring_to_start_with</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might start with the given string.</li>
+<li><tt>substring_to_start_with</tt> : a <tt>string</tt> that might be contained as the starting substring.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt>, returns <tt>true</tt> if <tt>string</tt> starts with the string <tt>substring_to_start_with</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error,</li>
+<li><tt>false</tt> otherwise.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot; : starts_with(&quot; like the plan, amazing&quot;, &quot; like&quot;),
+  &quot;v2&quot; : starts_with(&quot;I like the plan, amazing&quot;, &quot; like&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="substr"></a>substr</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">substr(string, offset[, length])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li>0-Based: <tt>substring</tt>, <tt>substr</tt>, <tt>substring0</tt>, <tt>substr0</tt>.</li>
+<li>1-Based: <tt>substring1</tt>, <tt>substr1</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the substring,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<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>
+<li>a <tt>null</tt> will be returned if:
+<ul>
+
+<li>the first argument is any other non-string value.</li>
+<li>the second argument is not a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt>.</li>
+<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>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: substr(&quot;test string&quot;, 6, 3), &quot;v2&quot;: substr1(&quot;test string&quot;, 6, 3) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;tri&quot;, &quot;v2&quot;: &quot;str&quot; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>substring</tt>.</p></div>
+<div class="section">
+<h3><a name="trim"></a>trim</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">trim(string[, chars]);
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
+<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a trimmed, new <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Related functions: see <tt>ltrim()</tt>, <tt>rtrim()</tt></li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">trim(&quot;i like x-phone&quot;, &quot;xphoen&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot; like &quot;
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
+<p>trim(&#x201c;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x201d;, &#x201c;&#x1f468;&#x200d;&#x1f466;&#x201d;)</p>
+</li>
+<li>
+
+<p>The expected result is (only woman and girl are left in the family):</p>
+
+<div>
+<div>
+<pre class="source"> &quot;&#x1f469;&#x200d;&#x1f467;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="upper"></a>upper</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">upper(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts a given string <tt>string</tt> to its uppercase form.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> as the uppercase form of the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">upper(&quot;hello&quot;)
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;HELLO&quot;
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="string_concat"></a>string_concat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">string_concat(array)
+</pre></div></div>
+</li>
+<li>
+
+<p>Concatenates an array of strings <tt>array</tt> into a single string.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the concatenated <tt>string</tt> value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-integer element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">string_concat([&quot;ASTERIX&quot;, &quot; &quot;, &quot;ROCKS!&quot;]);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;ASTERIX ROCKS!&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="string_join"></a>string_join</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">string_join(array, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Joins an array or multiset of strings <tt>array</tt> with the given separator <tt>string</tt> into a single string.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array</tt> : an <tt>array</tt> or <tt>multiset</tt> of strings (could be <tt>null</tt>) to be joined.</li>
+<li><tt>string</tt> : a <tt>string</tt> to serve as the separator.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the joined <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if the first argument array contains a <tt>missing</tt>,</li>
+<li><tt>null</tt> if the first argument array contains a <tt>null</tt> but does not contain a <tt>missing</tt>,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-array value, or contains any other non-string value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">string_join([&quot;ASTERIX&quot;, &quot;ROCKS~&quot;], &quot;!! &quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;ASTERIX!! ROCKS~&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="string_to_codepoint"></a>string_to_codepoint</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">string_to_codepoint(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts the string <tt>string</tt> to its code_based representation.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that will be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> of the code points for the string <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">string_to_codepoint(&quot;Hello ASTERIX!&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ 72, 101, 108, 108, 111, 32, 65, 83, 84, 69, 82, 73, 88, 33 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="codepoint_to_string"></a>codepoint_to_string</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">codepoint_to_string(array)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts the ordered code_based representation <tt>array</tt> to the corresponding string.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array</tt> : an <tt>array</tt> of integer code_points.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> representation of <tt>array</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-integer element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">codepoint_to_string([72, 101, 108, 108, 111, 32, 65, 83, 84, 69, 82, 73, 88, 33]);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;Hello ASTERIX!&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="substring_before"></a>substring_before</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">substring_before(string, string_pattern)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the substring from the given string <tt>string</tt> before the given pattern <tt>string_pattern</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
+<li><tt>string_pattern</tt> : a <tt>string</tt> pattern to be searched.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the substring,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">substring_before(&quot; like x-phone&quot;, &quot;x-phone&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot; like &quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="substring_after"></a>substring_after</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>substring_after(string, string_pattern);</p>
+</li>
+<li>
+
+<p>Returns the substring from the given string <tt>string</tt> after the given pattern <tt>string_pattern</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
+<li><tt>string_pattern</tt> : a <tt>string</tt> pattern to be searched.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the substring,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">substring_after(&quot; like x-phone&quot;, &quot;xph&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;one&quot;
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Binary_Functions"></a><a name="BinaryFunctions" id="BinaryFunctions">Binary Functions</a></h2>
+<div class="section">
+<h3><a name="parse_binary"></a>parse_binary</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>parse_binary(string, encoding)</p>
+</li>
+<li>
+
+<p>Creates a <tt>binary</tt> from an string encoded in <tt>encoding</tt> format.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : an encoded <tt>string</tt>,</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>binary</tt> that is decoded from the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<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>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>[ hex(&#x201c;ABCDEF0123456789&#x201d;), hex(&#x201c;ABCDEF0123456789&#x201d;), hex(&#x201c;4173746572697801&#x201d;) ]</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="print_binary"></a>print_binary</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>print_binary(binary, encoding)</p>
+</li>
+<li>
+
+<p>Prints a <tt>binary</tt> to the required encoding <tt>string</tt> format.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>binary</tt> : a <tt>binary</tt> data need to be printed.</li>
+<li><tt>encoding</tt> : a string notation specifies the expected encoding type. Currently we support <tt>hex</tt> and <tt>base64</tt> format.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the encoded format of a <tt>binary</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">[ print_binary(hex(&quot;ABCDEF0123456789&quot;), &quot;base64&quot;), print_binary(base64(&quot;q83vASNFZ4k=&quot;), &quot;hex&quot;) ]
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result are:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;q83vASNFZ4k=&quot;, &quot;ABCDEF0123456789&quot; ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="binary_length"></a>binary_length</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>binary_length(binary)</p>
+</li>
+<li>
+
+<p>Returns the number of bytes storing the binary data.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>binary</tt> : a <tt>binary</tt> value to be checked.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> that represents the number of bytes,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-binary input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">binary_length(hex(&quot;00AA&quot;))
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>2</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sub_binary"></a>sub_binary</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>sub_binary(binary, offset[, length])</p>
+</li>
+<li>
+
+<p>Returns the sub binary from the given <tt>binary</tt> based on the given start offset with the optional <tt>length</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>binary</tt> : a <tt>binary</tt> to be extracted,</li>
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>binary</tt> that represents the sub binary,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-binary value,</li>
+<li>or, the second argument is any other non-integer value,</li>
+<li>or, the third argument is any other non-integer value, if it is present.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">sub_binary(hex(&quot;AABBCCDD&quot;), 4);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is</p>
+
+<div>
+<div>
+<pre class="source">hex(&quot;DD&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="binary_concat"></a>binary_concat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>binary_concat(array)</p>
+</li>
+<li>
+
+<p>Concatenates a binary <tt>array</tt> or <tt>multiset</tt> into a single binary.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value  :
+<ul>
+
+<li>the concatenated <tt>binary</tt> value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-binary element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>binary_concat([hex(&#x201c;42&#x201d;), hex(&quot;&quot;), hex(&#x2018;42&#x2019;)]);</p>
+</li>
+<li>
+
+<p>The expected result is</p>
+<p>hex(&#x201c;4242&#x201d;)</p>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Spatial_Functions"></a><a name="SpatialFunctions" id="SpatialFunctions">Spatial Functions</a></h2>
+<div class="section">
+<h3><a name="create_point"></a>create_point</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_point(x, y)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>point</tt> using an <tt>x</tt> and <tt>y</tt> value.</p>
+</li>
+<li>Arguments:</li>
+<li><tt>x</tt> : a <tt>double</tt> that represents the x-coordinate,</li>
+<li><tt>y</tt> : a <tt>double</tt> that represents the y-coordinate.</li>
+<li>Return Value:</li>
+<li>a <tt>point</tt> representing the ordered pair (<tt>x</tt>, <tt>y</tt>),</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-double input value will cause a type error.</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;point&quot;: create_point(30.0,70.0) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;point&quot;: point(&quot;30.0,70.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_line"></a>create_line</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_line(point1, point2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>line</tt> using <tt>point1</tt> and <tt>point2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt> that represents the start point of the line.</li>
+<li><tt>point2</tt> : a <tt>point</tt> that represents the end point of the line.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a spatial <tt>line</tt> created using the points provided in <tt>point1</tt> and <tt>point2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;line&quot;: create_line(create_point(30.0,70.0), create_point(50.0,90.0)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;line&quot;: line(&quot;30.0,70.0 50.0,90.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_rectangle"></a>create_rectangle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_rectangle(point1, point2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>rectangle</tt> using <tt>point1</tt> and <tt>point2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt> that represents the lower_left point of the rectangle.</li>
+<li><tt>point2</tt> : a <tt>point</tt> that represents the upper_right point of the rectangle.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a spatial <tt>rectangle</tt> created using the points provided in <tt>point1</tt> and <tt>point2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;rectangle&quot;: create_rectangle(create_point(30.0,70.0), create_point(50.0,90.0)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;rectangle&quot;: rectangle(&quot;30.0,70.0 50.0,90.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_circle"></a>create_circle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_circle(point, radius)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>circle</tt> using <tt>point</tt> and <tt>radius</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point</tt> : a <tt>point</tt> that represents the center of the circle.</li>
+<li><tt>radius</tt> : a <tt>double</tt> that represents the radius of the circle.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a spatial <tt>circle</tt> created using the center point and the radius provided in <tt>point</tt> and <tt>radius</tt>.</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-point value,</li>
+<li>or, the second argument is any other non-double value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;circle&quot;: create_circle(create_point(30.0,70.0), 5.0) }
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;circle&quot;: circle(&quot;30.0,70.0 5.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_polygon"></a>create_polygon</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_polygon(array)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array</tt> : an array of doubles representing the points of the polygon.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>polygon</tt>, represents a spatial simple polygon created using the points provided in <tt>array</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-double element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;polygon&quot;: create_polygon([1.0,1.0,2.0,2.0,3.0,3.0,4.0,4.0]) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_x.2Fget_y"></a>get_x/get_y</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_x(point) or get_y(point)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the x or y coordinates of a point <tt>point</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point</tt> : a <tt>point</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> representing the x or y coordinates of the point <tt>point</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;x_coordinate&quot;: 2.3, &quot;y_coordinate&quot;: 5.0 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_points"></a>get_points</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_points(spatial_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an ordered array of the points forming the spatial object <tt>spatial_object</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>spatial_object</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> of the points forming the spatial object <tt>spatial_object</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-spatial-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_points(create_polygon([1.0,1.0,2.0,2.0,3.0,3.0,4.0,4.0]))
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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;) ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_center.2Fget_radius"></a>get_center/get_radius</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_center(circle_expression) or get_radius(circle_expression)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the center and the radius of a circle <tt>circle_expression</tt>, respectively.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>circle_expression</tt> : a <tt>circle</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>point</tt> or <tt>double</tt>, represent the center or radius of the circle <tt>circle_expression</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-circle input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;circle_radius&quot;: get_radius(create_circle(create_point(6.0,3.0), 1.0)),
+  &quot;circle_center&quot;: get_center(create_circle(create_point(6.0,3.0), 1.0))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;circle_radius&quot;: 1.0, &quot;circle_center&quot;: point(&quot;6.0,3.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_distance"></a>spatial_distance</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_distance(point1, point2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the Euclidean distance between <tt>point1</tt> and <tt>point2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt>.</li>
+<li><tt>point2</tt> : a <tt>point</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> as the Euclidean distance between <tt>point1</tt> and <tt>point2</tt>.</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">spatial_distance(point(&quot;47.44,80.65&quot;), create_point(30.0,70.0));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">20.434678857275934
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_area"></a>spatial_area</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_area(spatial_2d_expression)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the spatial area of <tt>spatial_2d_expression</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>spatial_2d_expression</tt> : a <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> representing the area of <tt>spatial_2d_expression</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-2d-spatial-object will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">spatial_area(create_circle(create_point(0.0,0.0), 5.0));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">78.53981625
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_intersect"></a>spatial_intersect</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_intersect(spatial_object1, spatial_object2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether <tt>@arg1</tt> and <tt>@arg2</tt> spatially intersect each other.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>spatial_object1</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+<li><tt>spatial_object2</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> representing whether <tt>spatial_object1</tt> and <tt>spatial_object2</tt> spatially overlap with each other,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-spatial-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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)));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">true
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_cell"></a>spatial_cell</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_cell(point1, point2, x_increment, y_increment)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the grid cell that <tt>point1</tt> belongs to.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt> representing the point of interest that its grid cell will be returned.</li>
+<li><tt>point2</tt> : a <tt>point</tt> representing the origin of the grid.</li>
+<li><tt>x_increment</tt> : a <tt>double</tt>, represents X increments.</li>
+<li><tt>y_increment</tt> : a <tt>double</tt>, represents Y increments.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>rectangle</tt> representing the grid cell that <tt>point1</tt> belongs to,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-point value,</li>
+<li>or, the second or third argument is any other non-double value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">spatial_cell(point(&quot;39.28,70.48&quot;), create_point(20.0,50.0), 5.5, 6.0);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">rectangle(&quot;36.5,68.0 42.0,74.0&quot;);
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Similarity_Functions"></a><a name="SimilarityFunctions" id="SimilarityFunctions">Similarity Functions</a></h2>
+<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>
+<div class="section">
+<h3><a name="edit_distance"></a>edit_distance</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">edit_distance(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the edit distance of <tt>expression1</tt> and <tt>expression2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
+<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> that represents the edit distance between <tt>expression1</tt> and <tt>expression2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">edit_distance(&quot;SuzannaTillson&quot;, &quot;Suzanna Tilson&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">2
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="edit_distance_check"></a>edit_distance_check</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">edit_distance_check(expression1, expression2, threshold)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the edit distance of <tt>expression1</tt> and <tt>expression2</tt> is within a given threshold.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
+<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
+<li><tt>threshold</tt> : a <tt>bigint</tt> that represents the distance threshold.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> with two items:
+<ul>
+
+<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>
+<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>
+<li>If the first item is false, then the second item is set to 2147483647.</li>
+</ul>
+</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-string value,</li>
+<li>or, the third argument is any other non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">edit_distance_check(&quot;happy&quot;,&quot;hapr&quot;,2);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ true, 2 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="edit_distance_contains"></a>edit_distance_contains</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">edit_distance_contains(expression1, expression2, threshold)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
+<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
+<li><tt>threshold</tt> : a <tt>bigint</tt> that represents the distance threshold.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> with two items:
+<ul>
+
+<li>The first item contains a <tt>boolean</tt> value representing whether <tt>expression1</tt> can contain <tt>expression2</tt>.</li>
+<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>
+</ul>
+</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-string value,</li>
+<li>or, the third argument is any other non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">edit_distance_contains(&quot;happy&quot;,&quot;hapr&quot;,2);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ true, 1 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="similarity_jaccard"></a>similarity_jaccard</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">similarity_jaccard(array1, array2)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array1</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+<li><tt>array2</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>float</tt> that represents the Jaccard similarity of <tt>array1</tt> and <tt>array2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if any element in any input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-integer element in any input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Note: a <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">keyword index</a> can be utilized for this function.</p>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">similarity_jaccard([1,5,8,9], [1,5,9,10]);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0.6
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="similarity_jaccard_check"></a>similarity_jaccard_check</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">similarity_jaccard_check(array1, array2, threshold)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>array1</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+<li><tt>array2</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+<li><tt>threshold</tt> : a <tt>double</tt> that represents the similarity threshold.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> with two items:
+<ul>
+
+<li>The first item contains a <tt>boolean</tt> value representing whether <tt>array1</tt> and <tt>array2</tt> are similar.</li>
+<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>
+</ul>
+</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if any element in any input array is <tt>missing</tt>,</li>
+<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>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-array value,
+<ul>
+
+<li>or, the third argument is any other non-double value.</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Note: a <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">keyword index</a> can be utilized for this function.</p>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">similarity_jaccard_check([1,5,8,9], [1,5,9,10], 0.6);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ false, 0.0 ]
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Tokenizing_Functions"></a><a name="TokenizingFunctions" id="TokenizingFunctions">Tokenizing Functions</a></h2>
+<div class="section">
+<h3><a name="word_tokens"></a>word_tokens</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">word_tokens(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an array of word tokens of <tt>string</tt> using non_alphanumeric characters as delimiters.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that will be tokenized.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> of <tt>string</tt> word tokens,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">word_tokens(&quot;I like the phone, awesome!&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;i&quot;, &quot;like&quot;, &quot;the&quot;, &quot;phone&quot;, &quot;awesome&quot; ]
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Temporal_Functions"></a><a name="TemporalFunctions" id="TemporalFunctions">Temporal Functions</a></h2>
+<div class="section">
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_year/get_month/get_day/get_hour/get_minute/get_second/get_millisecond(temporal_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Accessors for accessing fields in a temporal value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> value representing the field to be extracted,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;year&quot;: get_year(date(&quot;2010-10-30&quot;)),
+  &quot;month&quot;: get_month(datetime(&quot;1987-11-19T23:49:23.938&quot;)),
+  &quot;day&quot;: get_day(date(&quot;2010-10-30&quot;)),
+  &quot;hour&quot;: get_hour(time(&quot;12:23:34.930&quot;)),
+  &quot;min&quot;: get_minute(duration(&quot;P3Y73M632DT49H743M3948.94S&quot;)),
+  &quot;second&quot;: get_second(datetime(&quot;1987-11-19T23:49:23.938&quot;)),
+  &quot;ms&quot;: get_millisecond(duration(&quot;P3Y73M632DT49H743M3948.94S&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;year&quot;: 2010, &quot;month&quot;: 11, &quot;day&quot;: 30, &quot;hour&quot;: 12, &quot;min&quot;: 28, &quot;second&quot;: 23, &quot;ms&quot;: 94 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="adjust_datetime_for_timezone"></a>adjust_datetime_for_timezone</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">adjust_datetime_for_timezone(datetime, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Adjusts the given datetime <tt>datetime</tt> by applying the timezone information <tt>string</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt> : a <tt>datetime</tt> value to be adjusted.</li>
+<li><tt>string</tt> : a <tt>string</tt> representing the timezone information.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> value representing the new datetime after being adjusted by the timezone information,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-datetime value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">adjust_datetime_for_timezone(datetime(&quot;2008-04-26T10:10:00&quot;), &quot;+08:00&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;2008-04-26T18:10:00.000+08:00&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="adjust_time_for_timezone"></a>adjust_time_for_timezone</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">adjust_time_for_timezone(time, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Adjusts the given time <tt>time</tt> by applying the timezone information <tt>string</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>time</tt> : a <tt>time</tt> value to be adjusted.</li>
+<li><tt>string</tt> : a <tt>string</tt> representing the timezone information.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> value representing the new time after being adjusted by the timezone information,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-time value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">adjust_time_for_timezone(get_time_from_datetime(datetime(&quot;2008-04-26T10:10:00&quot;)), &quot;+08:00&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;18:10:00.000+08:00&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="calendar_duration_from_datetime"></a>calendar_duration_from_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">calendar_duration_from_datetime(datetime, duration_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a user_friendly representation of the duration <tt>duration_value</tt> based on the given datetime <tt>datetime</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt> : a <tt>datetime</tt> value to be used as the reference time point.</li>
+<li><tt>duration_value</tt> : a <tt>duration</tt> value to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>duration</tt> value with the duration as <tt>duration_value</tt> but with a user_friendly representation,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-datetime value,</li>
+<li>or, the second argument is any other non-duration input value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">calendar_duration_from_datetime(
+      datetime(&quot;2016-03-26T10:10:00&quot;),
+      datetime(&quot;2016-03-26T10:10:00&quot;) - datetime(&quot;2011-01-01T00:00:00&quot;)
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">duration(&quot;P5Y2M24DT10H10M&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_year_month_duration.2Fget_day_time_duration"></a>get_year_month_duration/get_day_time_duration</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_year_month_duration/get_day_time_duration(duration_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Extracts the correct <tt>duration</tt> subtype from <tt>duration_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>duration_value</tt> : a <tt>duration</tt> value to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>year_month_duration</tt> value or a <tt>day_time_duration</tt> value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_year_month_duration(duration(&quot;P12M50DT10H&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">year_month_duration(&quot;P1Y&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">months_from_year_month_duration/ms_from_day_time_duration(duration_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Extracts the number of months or the number of milliseconds from the <tt>duration</tt> subtype.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>duration_value</tt> : a <tt>duration</tt> of the correct subtype.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> representing the number of months/milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;months&quot;: months_from_year_month_duration(get_year_month_duration(duration(&quot;P5Y7MT50M&quot;))),
+    &quot;milliseconds&quot;: ms_from_day_time_duration(get_day_time_duration(duration(&quot;P5Y7MT50M&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{&quot;months&quot;: 67, &quot;milliseconds&quot;: 3000000}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="duration_from_months.2Fduration_from_ms"></a>duration_from_months/duration_from_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">duration_from_months/duration_from_ms(number_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates a <tt>duration</tt> from <tt>number_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>number_value</tt> : a <tt>bigint</tt> representing the number of months/milliseconds</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>duration</tt> containing <tt>number_value</tt> value for months/milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">duration_from_months(8);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">duration(&quot;P8M&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="duration_from_interval"></a>duration_from_interval</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">duration_from_interval(interval_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates a <tt>duration</tt> from <tt>interval_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval_value</tt> : an <tt>interval</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>duration</tt> representing the time in the <tt>interval_value</tt></li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;dr1&quot; : duration_from_interval(interval(date(&quot;2010-10-30&quot;), date(&quot;2010-12-21&quot;))),
+  &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;))),
+  &quot;dr3&quot; : duration_from_interval(interval(time(&quot;12:32:38&quot;), time(&quot;20:29:20&quot;))),
+  &quot;dr4&quot; : duration_from_interval(null)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;dr1&quot;: day_time_duration(&quot;P52D&quot;),
+  &quot;dr2&quot;: day_time_duration(&quot;P31DT1H1M1.111S&quot;),
+  &quot;dr3&quot;: day_time_duration(&quot;PT7H56M42S&quot;),
+  &quot;dr4&quot;: null
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="current_date"></a>current_date</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">current_date()
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the current date.</p>
+</li>
+<li>Arguments: None</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date</tt> value of the date when the function is called.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="current_time"></a>current_time</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">current_time()
+</pre></div></div>
+</li>
+<li>
+
+<p>Get the current time</p>
+</li>
+<li>Arguments: None</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt> value of the time when the function is called.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="current_datetime"></a>current_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">current_datetime()
+</pre></div></div>
+</li>
+<li>
+
+<p>Get the current datetime</p>
+</li>
+<li>Arguments: None</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value of the datetime when the function is called.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_date_from_datetime"></a>get_date_from_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_date_from_datetime(datetime)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the date value from the given datetime value <tt>datetime</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt>: a <tt>datetime</tt> value to be extracted from.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date</tt> value from the datetime,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>get_date_from_datetime(datetime(&#x201c;2016-03-26T10:10:00&#x201d;));</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>date(&#x201c;2016-03-26&#x201d;)</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_time_from_datetime"></a>get_time_from_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_time_from_datetime(datetime)
+</pre></div></div>
+</li>
+<li>
+
+<p>Get the time value from the given datetime value <tt>datetime</tt></p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt>: a <tt>datetime</tt> value to be extracted from.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt> value from the datetime.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_time_from_datetime(datetime(&quot;2016-03-26T10:10:00&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time(&quot;10:10:00.000&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="day_of_week"></a>day_of_week</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">day_of_week(date[, week_start_day])
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the day of the week for a given date (1_7)</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+<li><tt>week_start_day</tt>: (Optional) an integer or a string value (case-insensitive) specifying the day of the week to start counting from: 1=Sun[day], 2=Mon[day], &#x2026;, 7=Sat[urday]. If omitted, the default is 1 (Sunday).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the day of the week (1_7),</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;day_1&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;)),
+  &quot;day_2&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), 2),
+  &quot;day_3&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), &quot;Monday&quot;),
+  &quot;day_4&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), &quot;MON&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;day_1&quot;: 1, &quot;day_2&quot;: 7, &quot;day_3&quot;: 7, &quot;day_4&quot;: 7 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="day_of_year"></a>day_of_year</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">day_of_year(date)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the day of the year for a given date</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the day of the year,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">day_of_year(date(&quot;2011-12-31&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">365
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="week_of_year"></a>week_of_year</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">week_of_year(date[, week_start_day])
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the week of the year for a given date</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+<li><tt>week_start_day</tt>: (Optional) an integer or a string value (case-insensitive) specifying the day of the week to start counting from: 1=Sun[day], 2=Mon[day], &#x2026;, 7=Sat[urday]. If omitted, the default is 1 (Sunday).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the week of the year,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;week_1&quot;: week_of_year(date(&quot;2012-12-01&quot;)),
+  &quot;week_2&quot;: week_of_year(date(&quot;2012-12-01&quot;), 2),
+  &quot;week_3&quot;: week_of_year(date(&quot;2012-12-01&quot;), &quot;Monday&quot;),
+  &quot;week_4&quot;: week_of_year(date(&quot;2012-12-01&quot;), &quot;MON&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;week_1&quot;: 48, &quot;week_2&quot;: 49, &quot;week_3&quot;: 49, &quot;week_4&quot;: 49 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="quarter_of_year"></a>quarter_of_year</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">quarter_of_year(date)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the quarter of the year for a given date</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the quarter of the year (1_4),</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">quarter_of_year(date(&quot;2011-12-31&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">4
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="datetime_from_date_time"></a>datetime_from_date_time</h3>
+<ul>
+
+<li>Syntax:</li>
+</ul>
+<p>datetime_from_date_time(date,time)</p>
+<ul>
+
+<li>Gets a datetime representing the combination of <tt>date</tt> and <tt>time</tt>
+<ul>
+
+<li>Arguments:</li>
+<li><tt>date</tt>: a <tt>date</tt> value</li>
+<li><tt>time</tt> a <tt>time</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value by combining <tt>date</tt> and <tt>time</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if
+<ul>
+
+<li>the first argument is any other non-date value,</li>
+<li>or, the second argument is any other non-time value.</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="date_from_unix_time_in_days"></a>date_from_unix_time_in_days</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">date_from_unix_time_in_days(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a date representing the time after <tt>numeric_value</tt> days since 1970-01-01.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date</tt> value as the time after <tt>numeric_value</tt> days since 1970-01-01,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">date_from_unix_time_in_days(15800);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>date(&#x201c;2013-04-05&#x201d;)</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="datetime_from_unix_time_in_ms"></a>datetime_from_unix_time_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">datetime_from_unix_time_in_ms(numeric_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a datetime representing the time after <tt>numeric_value</tt> milliseconds since 1970-01-01T00:00:00Z.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<li><tt>string</tt> : (Optional) a string representing the target timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value as the time in the target time zone after <tt>numeric_value</tt> milliseconds since 1970-01-01T00:00:00Z,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+   &quot;datetime_1&quot;: datetime_from_unix_time_in_ms(1365139700000),
+   &quot;datetime_2&quot;: datetime_from_unix_time_in_ms(1365139700000, &quot;America/Los_Angeles&quot;)
+ };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;datetime_1&#x201d;: datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;), &#x201c;datetime_2&#x201d;: datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;) }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="datetime_from_unix_time_in_secs"></a>datetime_from_unix_time_in_secs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">datetime_from_unix_time_in_secs(numeric_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a datetime representing the time after <tt>numeric_value</tt> seconds since 1970-01-01T00:00:00Z.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<li><tt>string</tt> : (Optional) a string representing the target timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value as the time in the target time zone after <tt>numeric_value</tt> seconds since 1970-01-01T00:00:00Z,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;datetime_1&quot;: datetime_from_unix_time_in_secs(1365139700),
+  &quot;datetime_2&quot;: datetime_from_unix_time_in_secs(1365139700, &quot;America/Los_Angeles&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;datetime_1&#x201d;: datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;), &#x201c;datetime_2&#x201d;: datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;) }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="time_from_unix_time_in_ms"></a>time_from_unix_time_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">time_from_unix_time_in_ms(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a time representing the time after <tt>numeric_value</tt> milliseconds since 00:00:00.000.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt> value as the time after <tt>numeric_value</tt> milliseconds since 00:00:00.000,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">time_from_unix_time_in_ms(3748);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time(&quot;00:00:03.748&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_date_in_days"></a>unix_time_from_date_in_days</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_date_in_days(date_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the number of days since 1970-01-01 for <tt>date_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date_value</tt>: a <tt>date</tt> value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of days,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>unix_time_from_date_in_days(date(&#x201c;2013-04-05&#x201d;));</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>15800</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_datetime_in_ms"></a>unix_time_from_datetime_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_datetime_in_ms(datetime_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the time in milliseconds since 1970-01-01T00:00:00Z for <tt>datetime_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime_value</tt> : a <tt>datetime</tt> value.</li>
+<li><tt>string</tt> : (Optional) a string representing the source timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: unix_time_from_datetime_in_ms(datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;)), &#x201c;unix_time_2&#x201d;: unix_time_from_datetime_in_ms(datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;), &#x201c;America/Los_Angeles&#x201d;) };</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: 1365139700000, &#x201c;unix_time_2&#x201d;: 1365139700000 }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_datetime_in_secs"></a>unix_time_from_datetime_in_secs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_datetime_in_secs(datetime_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the time in seconds since 1970-01-01T00:00:00Z for <tt>datetime_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime_value</tt> : a <tt>datetime</tt> value.</li>
+</ul>
+</li>
+<li><tt>string</tt> : (Optional) a string representing the source timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of seconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: unix_time_from_datetime_in_secs(datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;)), &#x201c;unix_time_2&#x201d;: unix_time_from_datetime_in_secs(datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;), &#x201c;America/Los_Angeles&#x201d;) };</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: 1365139700, &#x201c;unix_time_2&#x201d;: 1365139700 }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_time_in_ms"></a>unix_time_from_time_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_time_in_ms(time_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the time the milliseconds since 00:00:00.000 for <tt>time_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>time_value</tt> : a <tt>time</tt> value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_time_in_ms(time(&quot;00:00:03.748&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3748
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="parse_date.2Fparse_time.2Fparse_datetime"></a>parse_date/parse_time/parse_datetime</h3>
+<ul>
+
+<li>Syntax:</li>
+</ul>
+<p>parse_date/parse_time/parse_datetime(date,formatting_expression)</p>
+<ul>
+
+<li>Creates a <tt>date/time/date_time</tt> value by treating <tt>date</tt> with formatting <tt>formatting_expression</tt></li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>string</tt> value representing the <tt>date/time/datetime</tt>.</li>
+<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>
+<li><tt>h</tt> hours</li>
+<li><tt>m</tt> minutes</li>
+<li><tt>s</tt> seconds</li>
+<li><tt>n</tt> (or <tt>S</tt>) milliseconds</li>
+<li><tt>a</tt> am/pm</li>
+<li><tt>z</tt> timezone (parsed and ignored)</li>
+<li><tt>Y</tt> year</li>
+<li><tt>Q</tt> quarter of year (1-4)</li>
+<li><tt>QQ</tt> quarter of year (01-04)</li>
+<li><tt>M</tt> month</li>
+<li><tt>D</tt> day</li>
+<li><tt>EEE</tt> weekday (abbreviated name, parsed and ignored)</li>
+<li><tt>EEEE</tt> weekday (full name, parsed and ignored)</li>
+<li><tt>_</tt>, <tt>'</tt>, <tt>/</tt>, <tt>.</tt>, <tt>,</tt>, <tt>T</tt> seperators for both time and date</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date/time/date_time</tt> value corresponding to <tt>date</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:</li>
+<li>the first argument is any other non-date value,</li>
+<li>the second argument is any other non-string value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">parse_time(&quot;30:30&quot;,&quot;m:s&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time(&quot;00:30:30.000&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="print_date.2Fprint_time.2Fprint_datetime"></a>print_date/print_time/print_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">print_date/print_time/print_datetime(date,formatting_expression)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date/time/datetime</tt> value.</li>
+<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>
+<li><tt>h</tt> hours</li>
+<li><tt>m</tt> minutes</li>
+<li><tt>s</tt> seconds</li>
+<li><tt>n</tt> (or <tt>S</tt>) milliseconds</li>
+<li><tt>a</tt> am/pm</li>
+<li><tt>Y</tt> year</li>
+<li><tt>Q</tt> quarter of year (1-4)</li>
+<li><tt>QQ</tt> quarter of year (01-04)</li>
+<li><tt>M</tt> month</li>
+<li><tt>MMM</tt> month (abbreviated name)</li>
+<li><tt>MMMM</tt> month (full name)</li>
+<li><tt>D</tt> day</li>
+<li><tt>DDD</tt> day of year</li>
+<li><tt>EEE</tt> weekday (abbreviated name)</li>
+<li><tt>EEEE</tt> weekday (full name)</li>
+<li><tt>_</tt>, <tt>'</tt>, <tt>/</tt>, <tt>.</tt>, <tt>,</tt>, <tt>T</tt> seperators for both time and date</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> value corresponding to <tt>date</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-date value,</li>
+<li>the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">print_time(time(&quot;00:30:30.000&quot;),&quot;m:s&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;30:30&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_interval_start.2C_get_interval_end"></a>get_interval_start, get_interval_end</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_interval_start/get_interval_end(interval)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the start/end of the given interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval</tt>: the interval to be accessed.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-interval value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;start&quot;: get_interval_start(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
+  &quot;end&quot;: get_interval_end(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;start&quot;: date(&quot;1984-01-01&quot;), &quot;end&quot;: date(&quot;1985-01-01&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<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)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the start/end of the given interval for the specific date/datetime/time type.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval</tt>: the interval to be accessed.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt>, <tt>date</tt>, or <tt>datetime</tt> (depending on the function) representing the starting or ending time,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-interval value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;start1&quot;: get_interval_start_date(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
+  &quot;end1&quot;: get_interval_end_date(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
+  &quot;start2&quot;: get_interval_start_datetime(interval_start_from_datetime(&quot;1984-01-01T08:30:00.000&quot;, &quot;P1Y1H&quot;)),
+  &quot;end2&quot;: get_interval_end_datetime(interval_start_from_datetime(&quot;1984-01-01T08:30:00.000&quot;, &quot;P1Y1H&quot;)),
+  &quot;start3&quot;: get_interval_start_time(interval_start_from_time(&quot;08:30:00.000&quot;, &quot;P1H&quot;)),
+  &quot;end3&quot;: get_interval_end_time(interval_start_from_time(&quot;08:30:00.000&quot;, &quot;P1H&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;start1&quot;: date(&quot;1984-01-01&quot;),
+  &quot;end1&quot;: date(&quot;1985-01-01&quot;),
+  &quot;start2&quot;: datetime(&quot;1984-01-01T08:30:00.000&quot;),
+  &quot;end2&quot;: datetime(&quot;1985-01-01T09:30:00.000&quot;),
+  &quot;start3&quot;: time(&quot;08:30:00.000&quot;),
+  &quot;end3&quot;: time(&quot;09:30:00.000&quot;)
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_overlapping_interval"></a>get_overlapping_interval</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_overlapping_interval(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the start/end of the given interval for the specific date/datetime/time type.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>: an <tt>interval</tt> value</li>
+<li><tt>interval2</tt>: an <tt>interval</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;))),
+  &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;))),
+  &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;))),
+  &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;))),
+  &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;))),
+  &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;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;overlap1&quot;: interval(time(&quot;12:23:39.000&quot;), time(&quot;18:27:19.000&quot;)),
+  &quot;overlap2&quot;: null,
+  &quot;overlap3&quot;: null,
+  &quot;overlap4&quot;: interval(date(&quot;2013-01-01&quot;), date(&quot;2014-01-01&quot;)),
+  &quot;overlap5&quot;: interval(datetime(&quot;1989-03-04T12:23:39.000&quot;), datetime(&quot;2000-10-30T18:27:19.000&quot;)),
+  &quot;overlap6&quot;: null
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_bin"></a>interval_bin</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_bin(time_to_bin, time_bin_anchor, duration_bin_size)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the <tt>interval</tt> value representing the bin containing the <tt>time_to_bin</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>time_to_bin</tt>: a date/time/datetime value representing the time to be binned.</li>
+<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>
+<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:
+<ul>
+
+<li>datetime +|_ year_month_duration</li>
+<li>datetime +|_ day_time_duration</li>
+<li>date +|_ year_month_duration</li>
+<li>date +|_ day_time_duration</li>
+<li>time +|_ day_time_duration</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:</li>
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument or the second argument is any other non-date/non-time/non-datetime value,</li>
+<li>or, the second argument is any other non-year_month_duration/non-day_time_duration value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>{ &#x201c;bin1&#x201d;: interval_bin(date(&#x201c;2010-10-30&#x201d;), date(&#x201c;1990-01-01&#x201d;), year_month_duration(&#x201c;P1Y&#x201d;)), &#x201c;bin2&#x201d;: interval_bin(datetime(&#x201c;1987-11-19T23:49:23.938&#x201d;), datetime(&#x201c;1990-01-01T00:00:00.000&#x201d;), year_month_duration(&#x201c;P6M&#x201d;)), &#x201c;bin3&#x201d;: interval_bin(time(&#x201c;12:23:34.930+07:00&#x201d;), time(&#x201c;00:00:00&#x201d;), day_time_duration(&#x201c;PT1M&#x201d;)), &#x201c;bin4&#x201d;: interval_bin(datetime(&#x201c;1987-11-19T23:49:23.938&#x201d;), datetime(&#x201c;2013-01-01T00:00:00.000&#x201d;), day_time_duration(&#x201c;PT24H&#x201d;)) };</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;bin1&#x201d;: interval(date(&#x201c;2010-01-01&#x201d;), date(&#x201c;2011-01-01&#x201d;)), &#x201c;bin2&#x201d;: interval(datetime(&#x201c;1987-07-01T00:00:00.000&#x201d;), datetime(&#x201c;1988-01-01T00:00:00.000&#x201d;)), &#x201c;bin3&#x201d;: interval(time(&#x201c;12:23:00.000&#x201d;), time(&#x201c;12:24:00.000&#x201d;)), &#x201c;bin4&#x201d;: interval(datetime(&#x201c;1987-11-19T00:00:00.000&#x201d;), datetime(&#x201c;1987-11-20T00:00:00.000&#x201d;)) }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_start_from_date.2Ftime.2Fdatetime"></a>interval_start_from_date/time/datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_start_from_date/time/datetime(date/time/datetime, duration)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>interval</tt> value representing the interval starting from the given time point with the length of duration,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument or the second argument is any other non-date/non-time/non-datetime value,</li>
+<li>or, the second argument is any other non-duration value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval1&quot;: interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;),
+  &quot;interval2&quot;: interval_start_from_time(time(&quot;02:23:28.394&quot;), &quot;PT3H24M&quot;),
+  &quot;interval3&quot;: interval_start_from_datetime(&quot;1999-09-09T09:09:09.999&quot;, duration(&quot;P2M30D&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval1&quot;: interval(date(&quot;1984-01-01&quot;), date(&quot;1985-01-01&quot;)),
+  &quot;interval2&quot;: interval(time(&quot;02:23:28.394&quot;), time(&quot;05:47:28.394&quot;)),
+  &quot;interval3&quot;: interval(datetime(&quot;1999-09-09T09:09:09.999&quot;), datetime(&quot;1999-12-09T09:09:09.999&quot;))
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="overlap_bins"></a>overlap_bins</h3>
+<ul>
+
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<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>
+</ul>
+</li>
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source"> overlap_bins(interval, time_bin_anchor, duration_bin_size)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an ordered list of <tt>interval</tt> values representing each bin that is overlapping the <tt>interval</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval</tt>: an <tt>interval</tt> value</li>
+<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>
+<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:
+<ul>
+
+<li>datetime +|_ year_month_duration</li>
+<li>datetime +|_ day_time_duration</li>
+<li>date +|_ year_month_duration</li>
+<li>date +|_ day_time_duration</li>
+<li>time +|_ day_time_duration</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first arugment is any other non-interval value,</li>
+<li>or, the second argument is any other non-date/non-time/non-datetime value,</li>
+<li>or, the second argument is any other non-year_month_duration/non-day_time_duration value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &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;)),
+  &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;)),
+  &quot;datetimebins&quot;: overlap_bins(interval(datetime(&quot;1800-01-01T23:59:48.938&quot;), datetime(&quot;2015-07-26T13:28:30.218&quot;)),
+                              datetime(&quot;1900-01-01T00:00:00.000&quot;), year_month_duration(&quot;P100Y&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;timebins&#x201d;: [ interval(time(&#x201c;17:00:00.000&#x201d;), time(&#x201c;17:30:00.000&#x201d;)), interval(time(&#x201c;17:30:00.000&#x201d;), time(&#x201c;18:00:00.000&#x201d;)), interval(time(&#x201c;18:00:00.000&#x201d;), time(&#x201c;18:30:00.000&#x201d;)), interval(time(&#x201c;18:30:00.000&#x201d;), time(&#x201c;19:00:00.000&#x201d;))                      ], &#x201c;datebins&#x201d;: [ interval(date(&#x201c;1980-01-01&#x201d;), date(&#x201c;1990-01-01&#x201d;)), interval(date(&#x201c;1990-01-01&#x201d;), date(&#x201c;2000-01-01&#x201d;)), interval(date(&#x201c;2000-01-01&#x201d;), date(&#x201c;2010-01-01&#x201d;)), interval(date(&#x201c;2010-01-01&#x201d;), date(&#x201c;2020-01-01&#x201d;))                      ], &#x201c;datetimebins&#x201d;: [ interval(datetime(&#x201c;1800-01-01T00:00:00.000&#x201d;), datetime(&#x201c;1900-01-01T00:00:00.000&#x201d;)), interval(datetime(&#x201c;1900-01-01T00:00:00.000&#x201d;), datetime(&#x201c;2000-01-01T00:00:00.000&#x201d;)), interval(datetime(&#x201c;2000-01-01T00:00:00.000&#x201d;), datetime(&#x201c;2100-01-01T00:00:00.000&#x201d;))                      ] };</p>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="interval_before.2C_interval_after"></a>interval_before, interval_after</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_before(interval1, interval2)
+interval_after(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether an interval happens before/after another interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_before&quot;: interval_before(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                     interval(date(&quot;2005-05-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;interval_after&quot;: interval_after(interval(date(&quot;2005-05-01&quot;), date(&quot;2012-09-09&quot;)),
+                                   interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_before&quot;: true, &quot;interval_after&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_covers.2C_interval_covered_by"></a>interval_covers, interval_covered_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_covers(interval1, interval2)
+interval_covered_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether one interval covers the other interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>
+
+<p>a <tt>boolean</tt> value. Specifically, <tt>interval_covers(interval1, interval2)</tt> is true if and only if</p>
+<p>interval1.start &lt;= interval2.start AND interval1.end &gt;= interval2.end</p>
+<p><tt>interval_covered_by(interval1, interval2)</tt> is true if and only if</p>
+<p>interval2.start &lt;= interval1.start AND interval2.end &gt;= interval1.end</p>
+</li>
+<li>
+
+<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_covers&quot;: interval_covers(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                     interval(date(&quot;2000-03-01&quot;), date(&quot;2004-09-09&quot;))),
+  &quot;interval_covered_by&quot;: interval_covered_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                             interval(date(&quot;2004-09-10&quot;), date(&quot;2012-08-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_covers&quot;: true, &quot;interval_covered_by&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_overlaps.2C_interval_overlapped_by"></a>interval_overlaps, interval_overlapped_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_overlaps(interval1, interval2)
+interval_overlapped_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These functions check whether two intervals overlap with each other.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value. Specifically, <tt>interval_overlaps(interval1, interval2)</tt> is true if and only if
+<p>interval1.start &lt; interval2.start AND interval2.end &gt; interval1.end AND interval1.end &gt; interval2.start</p></li>
+</ul>
+<p><tt>interval_overlapped_by(interval1, interval2)</tt> is true if and only if</p>
+
+<div>
+<div>
+<pre class="source">interval2.start &lt; interval1.start
+AND interval1.end &gt; interval2.end
+AND interval2.end &gt; interval1.start
+</pre></div></div>
+
+<ul>
+
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+<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>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;overlaps&quot;: interval_overlaps(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;overlapped_by&quot;: interval_overlapped_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                          interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;overlaps&quot;: true, &quot;overlapped_by&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_overlapping"></a>interval_overlapping</h3>
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_overlapping(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>This functions check whether two intervals share any points with each other.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>
+
+<p>a <tt>boolean</tt> value. Specifically, <tt>interval_overlapping(interval1, interval2)</tt> is true if</p>
+<p>interval1.start &lt; interval2.end AND interval1.end &gt; interval2.start</p>
+</li>
+<li>
+
+<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;overlapping1&quot;: interval_overlapping(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                       interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;overlapping2&quot;: interval_overlapping(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                       interval(date(&quot;2004-09-10&quot;), date(&quot;2006-12-31&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;overlapping1&quot;: true, &quot;overlapping2&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_meets.2C_interval_met_by"></a>interval_meets, interval_met_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_meets(interval1, interval2)
+interval_met_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether an interval meets with another interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;meets&quot;: interval_meets(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                          interval(date(&quot;2005-01-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;metby&quot;: interval_met_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                           interval(date(&quot;2004-09-10&quot;), date(&quot;2006-08-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;meets&quot;: true, &quot;metby&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_starts.2C_interval_started_by"></a>interval_starts, interval_started_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_starts(interval1, interval2)
+interval_started_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether one interval starts with the other interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value. Specifically, <tt>interval_starts(interval1, interval2)</tt> returns true if and only if
+<p>interval1.start = interval2.start AND interval1.end &lt;= interval2.end</p></li>
+</ul>
+<p><tt>interval_started_by(interval1, interval2)</tt> returns true if and only if</p>
+
+<div>
+<div>
+<pre class="source">interval1.start = interval2.start
+AND interval2.end &lt;= interval1.end
+</pre></div></div>
+
+<ul>
+
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_starts&quot;: interval_starts(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                     interval(date(&quot;2000-01-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;interval_started_by&quot;: interval_started_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                             interval(date(&quot;2006-08-01&quot;), date(&quot;2006-08-02&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_starts&quot;: true, &quot;interval_started_by&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_ends.2C_interval_ended_by"></a>interval_ends, interval_ended_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_ends(interval1, interval2)
+interval_ended_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether one interval ends with the other interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>
+
+<p>a <tt>boolean</tt> value. Specifically, <tt>interval_ends(interval1, interval2)</tt> returns true if and only if</p>
+<p>interval1.end = interval2.end AND interval1.start &gt;= interval2.start</p>
+<p><tt>interval_ended_by(interval1, interval2)</tt> returns true if and only if</p>
+<p>interval2.end = interval1.end AND interval2.start &gt;= interval1.start</p>
+</li>
+<li>
+
+<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_ends&quot;: interval_ends(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                 interval(date(&quot;1998-01-01&quot;), date(&quot;2005-01-01&quot;))),
+  &quot;interval_ended_by&quot;: interval_ended_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                         interval(date(&quot;2006-09-10&quot;), date(&quot;2007-03-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_ends&quot;: true, &quot;interval_ended_by&quot;: true }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Object_Functions"></a><a name="ObjectFunctions" id="ObjectFunctions">Object Functions</a></h2>
+<div class="section">
+<h3><a name="get_object_fields"></a>get_object_fields</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_object_fields(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Access the object field names, type and open status for a given object.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : a object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_object_fields(
+                  {
+                    &quot;id&quot;: 1,
+                    &quot;project&quot;: &quot;AsterixDB&quot;,
+                    &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+                    &quot;related&quot;: [&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                  }
+                 );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  { &quot;field-name&quot;: &quot;id&quot;, &quot;field-type&quot;: &quot;INT64&quot;, &quot;is-open&quot;: false },
+  { &quot;field-name&quot;: &quot;project&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false },
+  { &quot;field-name&quot;: &quot;address&quot;, &quot;field-type&quot;: &quot;RECORD&quot;, &quot;is-open&quot;: false,
+    &quot;nested&quot;: [
+                { &quot;field-name&quot;: &quot;city&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false },
+                { &quot;field-name&quot;: &quot;state&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false }
+              ]
+  },
+  { &quot;field-name&quot;:
+        &quot;related&quot;,
+        &quot;field-type&quot;: &quot;ORDEREDLIST&quot;,
+        &quot;is-open&quot;: false,
+        &quot;list&quot;: [
+                  { &quot;field-type&quot;: &quot;STRING&quot; },
+                  { &quot;field-type&quot;: &quot;STRING&quot; },
+                  { &quot;field-type&quot;: &quot;STRING&quot; }
+                ]
+  }
+]
+</pre></div></div>
+</li>
+</ul>
+<p>]</p></div>
+<div class="section">
+<h3><a name="get_object_field_value"></a>get_object_field_value</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_object_field_value(input_object, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Access the field name given in the <tt>string_expression</tt> from the <tt>object_expression</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : a <tt>object</tt> value.</li>
+<li><tt>string</tt> : a <tt>string</tt> representing the top level field name.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>any</tt> value saved in the designated field of the object,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-object value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_object_field_value({
+                         &quot;id&quot;: 1,
+                         &quot;project&quot;: &quot;AsterixDB&quot;,
+                         &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+                         &quot;related&quot;: [&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                        },
+                        &quot;project&quot;
+                       );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;AsterixDB&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_remove_fields"></a>object_remove_fields</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_remove_fields(input_object, field_names)
+</pre></div></div>
+</li>
+<li>
+
+<p>Remove indicated fields from a object given a list of field names.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt>:  a object value.</li>
+<li><tt>field_names</tt>: an array of strings and/or array of array of strings.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>a new object value without the fields listed in the second argument,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-object value,</li>
+<li>or, the second argument is any other non-array value or recursively contains non-string items.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_remove_fields(
+                       {
+                         &quot;id&quot;:1,
+                         &quot;project&quot;:&quot;AsterixDB&quot;,
+                         &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+                         &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                       },
+                       [[&quot;address&quot;, &quot;city&quot;], &quot;related&quot;]
+                     );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;:1,
+  &quot;project&quot;:&quot;AsterixDB&quot;,
+  &quot;address&quot;:{ &quot;state&quot;: &quot;CA&quot; }
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_add_fields"></a>object_add_fields</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_add_fields(input_object, fields)
+</pre></div></div>
+</li>
+<li>
+
+<p>Add fields to a object given a list of field names.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : a object value.</li>
+<li><tt>fields</tt>: an array of field descriptor objects where each object has field_name and  field_value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a new object value with the new fields included,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-object value,</li>
+<li>the second argument is any other non-array value, or contains non-object items.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_add_fields(
+                   {
+                     &quot;id&quot;:1,
+                     &quot;project&quot;:&quot;AsterixDB&quot;,
+                     &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+                     &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                    },
+                    [{&quot;field-name&quot;:&quot;employment_location&quot;, &quot;field-value&quot;:create_point(30.0,70.0)}]
+                  );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+   &quot;id&quot;:1,
+   &quot;project&quot;:&quot;AsterixDB&quot;,
+   &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+   &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+   &quot;employment_location&quot;: point(&quot;30.0,70.0&quot;)
+ }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_merge"></a>object_merge</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_merge(object1, object2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Merge two different objects into a new object.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>object1</tt> : a object value.</li>
+<li><tt>object2</tt> : a object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_merge(
+              {
+                &quot;id&quot;:1,
+                &quot;project&quot;:&quot;AsterixDB&quot;,
+                &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+                &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+              },
+              {
+                &quot;user_id&quot;: 22,
+                &quot;employer&quot;: &quot;UC Irvine&quot;,
+                &quot;employment_type&quot;: &quot;visitor&quot;
+              }
+            );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;employment_type&quot;: &quot;visitor&quot;,
+  &quot;address&quot;: {
+    &quot;city&quot;: &quot;Irvine&quot;,
+    &quot;state&quot;: &quot;CA&quot;
+  },
+  &quot;related&quot;: [
+    &quot;Hivestrix&quot;,
+    &quot;Preglix&quot;,
+    &quot;Apache VXQuery&quot;
+  ],
+  &quot;user_id&quot;: 22,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+  &quot;employer&quot;: &quot;UC Irvine&quot;,
+  &quot;id&quot;: 1
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_length"></a>object_length</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_length(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns number of top-level fields in the given object</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an integer that represents the number of top-level fields in the given object,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value or any other non-object value</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_length(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+               }
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_names"></a>object_names</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_names(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns names of top-level fields in the given object</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an array with top-level field names of the given object,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value or any other non-object value</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_names(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+               }
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;id&quot;, &quot;project&quot;, &quot;address&quot; ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_remove"></a>object_remove</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_remove(input_object, field_name)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a new object that has the same fields as the input object except the field to be removed</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>field_name</tt> : a string field name.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>A new object that has the same fields as <tt>input_object</tt> except the field <tt>field_name</tt>,</li>
+<li><tt>missing</tt> if the argument <tt>input_object</tt> or <tt>field_name</tt> is missing,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_remove(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;address&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_rename"></a>object_rename</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_rename(input_object, old_field, new_field)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>old_field</tt> : a string representing the old (original) field name inside the object <tt>input_object</tt>.</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_rename(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;address&quot;
+               , &quot;location&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_unwrap"></a>object_unwrap</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_unwrap(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the value of the single name-value pair that appears in <tt>input_object</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value that consists of exactly one name-value pair.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The value of the single name-value pair that appears in <tt>input_object</tt>,</li>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_unwrap(
+             {
+               &quot;id&quot;: 1
+             }
+           );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  1
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_replace"></a>object_replace</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_replace(input_object, old_value, new_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>old_value</tt> : a primitive type value to be replaced by <tt>new_value</tt>.</li>
+<li><tt>new_value</tt> : a value to replace <tt>old_value</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if <tt>input_object</tt>  or <tt>old_value</tt> is null,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li><tt>old_value</tt> is not a primitive type value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_replace(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;AsterixDB&quot;
+               , &quot;Apache AsterixDB&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;Apache AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_add"></a>object_add</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_add(input_object, field_name, field_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>field_name</tt> : a string representing a field name to be added.</li>
+<li><tt>field_value</tt> : a value to be assigned to the new field <tt>field_name</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>missing</tt>,</li>
+<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>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_add(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;company&quot;
+               , &quot;Apache&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+  &quot;company&quot;: &quot;Apache&quot;
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_put"></a>object_put</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_put(input_object, field_name, field_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Adds, modifies, or removes a field of an object.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>field_name</tt> : a string representing a field name to be added.</li>
+<li><tt>field_value</tt> : a value to be assigned to the new field <tt>field_name</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>missing</tt>,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_put(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;project&quot;
+               , &quot;Apache AsterixDB&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;Apache AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_values"></a>object_values</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_values(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an array of the values of the fields in <tt>input_object</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>An array of the values of the fields in <tt>input_object</tt>,</li>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<li><tt>null</tt> if <tt>input_object</tt> is null or any non-object value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_values(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  1,
+  &quot;AsterixDB&quot;,
+  {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_pairs"></a>object_pairs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_pairs(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>An array of the <tt>name</tt>/<tt>value</tt> pairs of the fields in <tt>input_object</tt>,</li>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<li><tt>null</tt> if <tt>input_object</tt> is null or any non-object value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_pairs(
+              {
+                &quot;id&quot;: 1,
+                &quot;project&quot;: &quot;AsterixDB&quot;,
+                &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+              }
+            );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  { &quot;name&quot;: &quot;id&quot;, &quot;value&quot;: 1 },
+  { &quot;name&quot;: &quot;project&quot;, &quot;value&quot;: &quot;AsterixDB&quot; },
+  { &quot;name&quot;: &quot;address&quot;, &quot;value&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;} }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="pairs"></a>pairs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">pairs(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>input_object</tt> : an object value (or an array or a multiset)</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<li><tt>null</tt> if <tt>input_object</tt> is null or a value of a primitive data type.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">pairs(
+       {
+         &quot;id&quot;: 1,
+         &quot;project&quot;: &quot;AsterixDB&quot;,
+         &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+       }
+     );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  [ &quot;id&quot;, 1 ],
+  [ &quot;project&quot;, &quot;AsterixDB&quot; ],
+  [ &quot;address&quot;, { &quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot; } ],
+  [ &quot;city&quot;, &quot;Irvine&quot; ],
+  [ &quot;state&quot;, &quot;CA&quot; ]
+]
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Aggregate_Functions_.28Array_Functions.29"></a><a name="AggregateFunctions" id="AggregateFunctions">Aggregate Functions (Array Functions) </a></h2>
+<p>This section contains detailed descriptions of the built-in aggregate functions in the query language.</p>
+<p>The query language also supports standard SQL aggregate functions (e.g., <tt>MIN</tt>, <tt>MAX</tt>, <tt>SUM</tt>, <tt>COUNT</tt>, and <tt>AVG</tt>). Note that these are not real functions in the query language, but just syntactic sugars over corresponding builtin aggregate functions (e.g., <tt>ARRAY_MIN</tt>, <tt>ARRAY_MAX</tt>, <tt>ARRAY_SUM</tt>, <tt>ARRAY_COUNT</tt>, and <tt>ARRAY_AVG</tt>). Refer to <a href="manual.html#Aggregation_PseudoFunctions">Aggregation Pseudo-Functions</a> for details.</p>
+<p>The <tt>DISTINCT</tt> keyword may be used with built-in aggregate functions and standard SQL aggregate functions. It may also be used with aggregate functions used as window functions. It determines whether the function aggregates all values in the group, or distinct values only. Refer to <a href="manual.html#Function_call_expressions">Function Calls</a> for details.</p>
+<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>
+<div class="section">
+<h3><a name="array_count"></a>array_count</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_count(collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the number of non-null and non-missing items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> to be counted,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of non-null and non-missing items in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li>any other non-array and non-multiset input value will cause an error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_count( ['hello', 'world', 1, 2, 3, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">5
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_avg"></a>array_avg</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_avg(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the average value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the average of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_avg( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.725
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_sum"></a>array_sum</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_sum(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sum of non-null and non-missing items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_sum( [1.2, 2.3, 3.4, 0, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">6.9
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_min"></a>array_min</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_min(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the min value of non-null and non-missing comparable items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_min( [1.2, 2.3, 3.4, 0, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_max"></a>array_max</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_max(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the max value of the non-null and non-missing comparable items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_max( [1.2, 2.3, 3.4, 0, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3.4
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_stddev_samp"></a>array_stddev_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample standard deviation value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample standard deviation of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_samp( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.4591664287073858
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_stddev_pop"></a>array_stddev_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population standard deviation value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population standard deviation of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_pop( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.2636751956100112
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_var_samp"></a>array_var_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_var_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample variance value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample variance of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_var_samp( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">2.1291666666666664
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_var_pop"></a>array_var_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_var_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population variance value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population variance of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_var_pop( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.5968749999999998
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_skewness"></a>array_skewness</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_skewness(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the skewness value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the skewness of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_skewness( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">-0.04808451539164242
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_kurtosis"></a>array_kurtosis</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_kurtosis(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the kurtosis value from the normal distribution of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_kurtosis( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">-1.342049701096427
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_count"></a>strict_count</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_count(collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the number of items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing the items to be counted,</li>
+<li>or a <tt>null</tt> value,</li>
+<li>or a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of items in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_count( [1, 2, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">4
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_avg"></a>strict_avg</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_avg(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the average value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the average of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_avg( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">200.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_sum"></a>strict_sum</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_sum(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sum of the items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_sum( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">600
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_min"></a>strict_min</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_min(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the min value of comparable items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_min( [10.2, 100, 5] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">5.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_max"></a>strict_max</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_max(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the max value of numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_max( [10.2, 100, 5] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">100.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_stddev_samp"></a>strict_stddev_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample standard deviation value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample standard deviation of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_samp( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">100.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_stddev_pop"></a>strict_stddev_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population standard deviation value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population standard deviation of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_pop( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">81.64965809277261
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_var_samp"></a>strict_var_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample variance value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample variance of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_samp( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">10000.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_var_pop"></a>strict_var_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population variance value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population variance of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_pop( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">6666.666666666667
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_skewness"></a>strict_skewness</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_skewness(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the skewness value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the skewness of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_skewness( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_kurtosis"></a>strict_kurtosis</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_kurtosis(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the kurtosis value from the normal distribution of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the kurtosis from a normal distribution of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_kurtosis( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">-1.5
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Comparison_Functions"></a><a name="ComparisonFunctions" id="ComparisonFunctions">Comparison Functions</a></h2>
+<div class="section">
+<h3><a name="greatest"></a>greatest</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">greatest(numeric_value1, numeric_value2, ...)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the greatest value among arguments.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+<li>&#x2026;.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> if any argument is a <tt>missing</tt> value or <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 3, &quot;v2&quot;: 5000.0 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="least"></a>least</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">least(numeric_value1, numeric_value2, ...)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the least value among arguments.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+<li>&#x2026;.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> if any argument is a <tt>missing</tt> value or <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 1, &quot;v2&quot;: -0.5 }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Type_Functions"></a><a name="TypeFunctions" id="TypeFunctions">Type Functions</a></h2>
+<div class="section">
+<h3><a name="is_array"></a>is_array</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_array(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be an <tt>array</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is an <tt>array</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_array(true),
+  &quot;b&quot;: is_array(false),
+  &quot;c&quot;: isarray(null),
+  &quot;d&quot;: isarray(missing),
+  &quot;e&quot;: isarray(&quot;d&quot;),
+  &quot;f&quot;: isarray(4.0),
+  &quot;g&quot;: isarray(5),
+  &quot;h&quot;: isarray([&quot;1&quot;, 2]),
+  &quot;i&quot;: isarray({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isarray</tt>.</p></div>
+<div class="section">
+<h3><a name="is_multiset"></a>is_multiset</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_multiset(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be an <tt>multiset</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is an <tt>multiset</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_multiset(true),
+  &quot;b&quot;: is_multiset(false),
+  &quot;c&quot;: is_multiset(null),
+  &quot;d&quot;: is_multiset(missing),
+  &quot;e&quot;: is_multiset(&quot;d&quot;),
+  &quot;f&quot;: ismultiset(4.0),
+  &quot;g&quot;: ismultiset([&quot;1&quot;, 2]),
+  &quot;h&quot;: ismultiset({&quot;a&quot;:1}),
+  &quot;i&quot;: ismultiset({{&quot;hello&quot;, 9328, &quot;world&quot;, [1, 2, null]}})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ismultiset</tt>.</p></div>
+<div class="section">
+<h3><a name="is_atomic_.28is_atom.29"></a>is_atomic (is_atom)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_atomic(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a value of a <a href="../datamodel.html#PrimitiveTypes">primitive</a> type.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a primitive type or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_atomic(true),
+  &quot;b&quot;: is_atomic(false),
+  &quot;c&quot;: isatomic(null),
+  &quot;d&quot;: isatomic(missing),
+  &quot;e&quot;: isatomic(&quot;d&quot;),
+  &quot;f&quot;: isatom(4.0),
+  &quot;g&quot;: isatom(5),
+  &quot;h&quot;: isatom([&quot;1&quot;, 2]),
+  &quot;i&quot;: isatom({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isatomic</tt>, <tt>is_atom</tt>, and <tt>isatom</tt>.</p></div>
+<div class="section">
+<h3><a name="is_boolean_.28is_bool.29"></a>is_boolean (is_bool)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_boolean(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>boolean</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>boolean</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: isboolean(true),
+  &quot;b&quot;: isboolean(false),
+  &quot;c&quot;: is_boolean(null),
+  &quot;d&quot;: is_boolean(missing),
+  &quot;e&quot;: isbool(&quot;d&quot;),
+  &quot;f&quot;: isbool(4.0),
+  &quot;g&quot;: isbool(5),
+  &quot;h&quot;: isbool([&quot;1&quot;, 2]),
+  &quot;i&quot;: isbool({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isboolean</tt>, <tt>is_bool</tt>, and <tt>isbool</tt>.</p></div>
+<div class="section">
+<h3><a name="is_number_.28is_num.29"></a>is_number (is_num)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_number(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a numeric value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_number(true),
+  &quot;b&quot;: is_number(false),
+  &quot;c&quot;: isnumber(null),
+  &quot;d&quot;: isnumber(missing),
+  &quot;e&quot;: isnumber(&quot;d&quot;),
+  &quot;f&quot;: isnum(4.0),
+  &quot;g&quot;: isnum(5),
+  &quot;h&quot;: isnum([&quot;1&quot;, 2]),
+  &quot;i&quot;: isnum({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isnumber</tt>, <tt>is_num</tt>, and <tt>isnum</tt>.</p></div>
+<div class="section">
+<h3><a name="is_object_.28is_obj.29"></a>is_object (is_obj)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_object(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>object</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>object</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_object(true),
+  &quot;b&quot;: is_object(false),
+  &quot;c&quot;: isobject(null),
+  &quot;d&quot;: isobject(missing),
+  &quot;e&quot;: isobj(&quot;d&quot;),
+  &quot;f&quot;: isobj(4.0),
+  &quot;g&quot;: isobj(5),
+  &quot;h&quot;: isobj([&quot;1&quot;, 2]),
+  &quot;i&quot;: isobj({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<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>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isobject</tt>, <tt>is_obj</tt>, and <tt>isobj</tt>.</p></div>
+<div class="section">
+<h3><a name="is_string_.28is_str.29"></a>is_string (is_str)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_string(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>string</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>string</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_string(true),
+  &quot;b&quot;: isstring(false),
+  &quot;c&quot;: isstring(null),
+  &quot;d&quot;: isstr(missing),
+  &quot;e&quot;: isstr(&quot;d&quot;),
+  &quot;f&quot;: isstr(4.0),
+  &quot;g&quot;: isstr(5),
+  &quot;h&quot;: isstr([&quot;1&quot;, 2]),
+  &quot;i&quot;: isstr({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isstring</tt>, <tt>is_str</tt>, and <tt>isstr</tt>.</p></div>
+<div class="section">
+<h3><a name="is_null"></a>is_null</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_null(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>null</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the variable is a <tt>null</tt> or not,</li>
+<li>a <tt>missing</tt> if the input is <tt>missing</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: is_null(null), &quot;v2&quot;: is_null(1), &quot;v3&quot;: is_null(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isnull</tt>.</p></div>
+<div class="section">
+<h3><a name="is_missing"></a>is_missing</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_missing(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>missing</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the variable is a <tt>missing</tt> or not.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: is_missing(null), &quot;v2&quot;: is_missing(1), &quot;v3&quot;: is_missing(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: false, &quot;v3&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ismissing</tt>.</p></div>
+<div class="section">
+<h3><a name="is_unknown"></a>is_unknown</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_unknown(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given variable is a <tt>null</tt> value or a <tt>missing</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: is_unknown(null), &quot;v2&quot;: is_unknown(1), &quot;v3&quot;: is_unknown(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false, &quot;v3&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isunknown</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="is_binary_.28is_bin.29"></a>is_binary (is_bin)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_binary(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>binary</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>binary</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_binary(true),
+  &quot;b&quot;: is_binary(false),
+  &quot;c&quot;: isbinary(null),
+  &quot;d&quot;: isbinary(missing),
+  &quot;e&quot;: isbin(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isbin(hex(&quot;ABCDEF0123456789&quot;)),
+  &quot;g&quot;: is_bin(sub_binary(hex(&quot;AABBCCDD&quot;), 4)),
+  &quot;h&quot;: is_bin(2),
+  &quot;i&quot;: is_bin({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isbinary</tt>, <tt>is_bin</tt>, and <tt>isbin</tt>.</p></div>
+<div class="section">
+<h3><a name="is_uuid"></a>is_uuid</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_uuid(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>uuid</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>uuid</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_uuid(true),
+  &quot;b&quot;: is_uuid(false),
+  &quot;c&quot;: is_uuid(null),
+  &quot;d&quot;: is_uuid(missing),
+  &quot;e&quot;: isuuid(4.0),
+  &quot;f&quot;: isuuid(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isuuid(uuid(&quot;5c848e5c-6b6a-498f-8452-8847a2957421&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isuuid</tt>.</p></div>
+<div class="section">
+<h3><a name="is_point"></a>is_point</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_point(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>point</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>point</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_point(true),
+  &quot;b&quot;: is_point(false),
+  &quot;c&quot;: is_point(null),
+  &quot;d&quot;: is_point(missing),
+  &quot;e&quot;: is_point(point(&quot;1,2&quot;)),
+  &quot;f&quot;: ispoint(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: ispoint(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: ispoint(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: ispoint(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: ispoint(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ispoint</tt>.</p></div>
+<div class="section">
+<h3><a name="is_line"></a>is_line</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_line(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>line</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>line</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_line(true),
+  &quot;b&quot;: is_line(false),
+  &quot;c&quot;: is_line(null),
+  &quot;d&quot;: is_line(missing),
+  &quot;e&quot;: is_line(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isline(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: isline(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: isline(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: isline(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: isline(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isline</tt>.</p></div>
+<div class="section">
+<h3><a name="is_rectangle"></a>is_rectangle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_rectangle(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>rectangle</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>rectangle</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_rectangle(true),
+  &quot;b&quot;: is_rectangle(false),
+  &quot;c&quot;: is_rectangle(null),
+  &quot;d&quot;: is_rectangle(missing),
+  &quot;e&quot;: is_rectangle(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isrectangle(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: isrectangle(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: isrectangle(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: isrectangle(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: isrectangle(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isrectangle</tt>.</p></div>
+<div class="section">
+<h3><a name="is_circle"></a>is_circle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_circle(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>circle</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>circle</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_circle(true),
+  &quot;b&quot;: is_circle(false),
+  &quot;c&quot;: is_circle(null),
+  &quot;d&quot;: is_circle(missing),
+  &quot;e&quot;: is_circle(point(&quot;1,2&quot;)),
+  &quot;f&quot;: iscircle(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: iscircle(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: iscircle(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: iscircle(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: iscircle(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>iscircle</tt>.</p></div>
+<div class="section">
+<h3><a name="is_polygon"></a>is_polygon</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_polygon(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>polygon</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>polygon</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_polygon(true),
+  &quot;b&quot;: is_polygon(false),
+  &quot;c&quot;: is_polygon(null),
+  &quot;d&quot;: is_polygon(missing),
+  &quot;e&quot;: is_polygon(point(&quot;1,2&quot;)),
+  &quot;f&quot;: ispolygon(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: ispolygon(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: ispolygon(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: ispolygon(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: ispolygon(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ispolygon</tt>.</p></div>
+<div class="section">
+<h3><a name="is_spatial"></a>is_spatial</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_spatial(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a spatial value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_spatial(true),
+  &quot;b&quot;: is_spatial(false),
+  &quot;c&quot;: is_spatial(null),
+  &quot;d&quot;: is_spatial(missing),
+  &quot;e&quot;: is_spatial(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isspatial(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: isspatial(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: isspatial(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: isspatial(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: isspatial(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isspatial</tt>.</p></div>
+<div class="section">
+<h3><a name="is_date"></a>is_date</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_date(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>date</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>date</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_date(true),
+  &quot;b&quot;: is_date(false),
+  &quot;c&quot;: is_date(null),
+  &quot;d&quot;: is_date(missing),
+  &quot;e&quot;: is_date(date(&quot;-19700101&quot;)),
+  &quot;f&quot;: isdate(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isdate(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: isdate(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: isdate(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: isdate(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: isdate(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isdate</tt>.</p></div>
+<div class="section">
+<h3><a name="is_datetime_.28is_timestamp.29"></a>is_datetime (is_timestamp)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_datetime(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>datetime</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>datetime</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_datetime(true),
+  &quot;b&quot;: is_datetime(false),
+  &quot;c&quot;: is_datetime(null),
+  &quot;d&quot;: is_datetime(missing),
+  &quot;e&quot;: is_datetime(datetime(&quot;2016-02-02T12:09:22.023Z&quot;)),
+  &quot;f&quot;: isdatetime(datetime(&quot;2011-03-03T12:10:42.011Z&quot;)),
+  &quot;g&quot;: isdatetime(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: is_timestamp(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: is_timestamp(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: istimestamp(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: istimestamp(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isdatetime</tt>, <tt>is_timestamp</tt>, and <tt>istimestamp</tt>.</p></div>
+<div class="section">
+<h3><a name="is_time"></a>is_time</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_time(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>time</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>time</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_time(true),
+  &quot;b&quot;: is_time(false),
+  &quot;c&quot;: is_time(null),
+  &quot;d&quot;: is_time(missing),
+  &quot;e&quot;: is_time(time(&quot;08:00:00.000Z&quot;)),
+  &quot;f&quot;: istime(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: istime(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: istime(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: istime(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: istime(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: istime(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>istime</tt>.</p></div>
+<div class="section">
+<h3><a name="is_duration"></a>is_duration</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_duration(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a duration value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>duration/year_month_duration/day_time_duration</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_duration(true),
+  &quot;b&quot;: is_duration(false),
+  &quot;c&quot;: is_duration(null),
+  &quot;d&quot;: is_duration(missing),
+  &quot;e&quot;: is_duration(duration(&quot;-PT20.943S&quot;)),
+  &quot;f&quot;: isduration(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isduration(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: isduration(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: isduration(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: isduration(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: isduration(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isduration</tt>.</p></div>
+<div class="section">
+<h3><a name="is_interval"></a>is_interval</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_interval(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>interval</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>interval</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_interval(true),
+  &quot;b&quot;: is_interval(false),
+  &quot;c&quot;: is_interval(null),
+  &quot;d&quot;: is_interval(missing),
+  &quot;e&quot;: is_interval(interval(datetime(&quot;2013-01-01T00:01:01.000Z&quot;), datetime(&quot;2013-05-05T13:39:01.049Z&quot;))),
+  &quot;f&quot;: isinterval(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isinterval(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: isinterval(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: isinterval(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: isinterval(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: isinterval(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isinterval</tt>.</p></div>
+<div class="section">
+<h3><a name="is_temporal"></a>is_temporal</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_temporal(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a temporal value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_temporal(true),
+  &quot;b&quot;: is_temporal(false),
+  &quot;c&quot;: is_temporal(null),
+  &quot;d&quot;: is_temporal(missing),
+  &quot;e&quot;: is_temporal(duration(&quot;-PT20.943S&quot;)),
+  &quot;f&quot;: istemporal(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: istemporal(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: istemporal(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: istemporal(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: istemporal(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: istemporal(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>istemporal</tt>.</p></div>
+<div class="section">
+<h3><a name="get_type"></a>get_type</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_type(expr)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: get_type(true),
+  &quot;b&quot;: get_type(false),
+  &quot;c&quot;: get_type(null),
+  &quot;d&quot;: get_type(missing),
+  &quot;e&quot;: get_type(&quot;d&quot;),
+  &quot;f&quot;: gettype(4.0),
+  &quot;g&quot;: gettype(5),
+  &quot;h&quot;: gettype([&quot;1&quot;, 2]),
+  &quot;i&quot;: gettype({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>gettype</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="to_array"></a>to_array</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_array(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to an <tt>array</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of <tt>array</tt> type then it is returned as is</li>
+<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>
+<li>otherwise an <tt>array</tt> containing the input expression as its single item is returned</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_array(&quot;asterix&quot;),
+  &quot;v2&quot;: to_array([&quot;asterix&quot;]),
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: [&quot;asterix&quot;], &quot;v2&quot;: [&quot;asterix&quot;] }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>toarray</tt>.</p></div>
+<div class="section">
+<h3><a name="to_atomic_.28to_atom.29"></a>to_atomic (to_atom)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_atomic(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a <a href="../datamodel.html#PrimitiveTypes">primitive</a> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of primitive type then it is returned as is</li>
+<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>
+<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>
+<li>otherwise <tt>null</tt> is returned</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_atomic(&quot;asterix&quot;),
+  &quot;v2&quot;: to_atomic([&quot;asterix&quot;]),
+  &quot;v3&quot;: to_atomic([0, 1]),
+  &quot;v4&quot;: to_atomic({&quot;value&quot;: &quot;asterix&quot;}),
+  &quot;v5&quot;: to_number({&quot;x&quot;: 1, &quot;y&quot;: 2})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>toatomic</tt>, <tt>to_atom</tt>, and <tt>toatom</tt>.</p></div>
+<div class="section">
+<h3><a name="to_boolean_.28to_bool.29"></a>to_boolean (to_bool)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_boolean(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a <tt>boolean</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of <tt>boolean</tt> type then it is returned as is</li>
+<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>
+<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>
+<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>
+<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>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_boolean(0),
+  &quot;v2&quot;: to_boolean(1),
+  &quot;v3&quot;: to_boolean(&quot;&quot;),
+  &quot;v4&quot;: to_boolean(&quot;asterix&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: true, &quot;v3&quot;: false, &quot;v4&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>toboolean</tt>, <tt>to_bool</tt>, and <tt>tobool</tt>.</p></div>
+<div class="section">
+<h3><a name="to_bigint"></a>to_bigint</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_bigint(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to an integer value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<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>
+<li>if the argument is of numeric integer type then it is returned as the same value of <tt>bigint</tt> type</li>
+<li>if the argument is of numeric <tt>float</tt>/<tt>double</tt> type then it is converted to <tt>bigint</tt> type</li>
+<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>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_bigint(false),
+  &quot;v2&quot;: to_bigint(true),
+  &quot;v3&quot;: to_bigint(10),
+  &quot;v4&quot;: to_bigint(float(&quot;1e100&quot;)),
+  &quot;v5&quot;: to_bigint(double(&quot;1e1000&quot;)),
+  &quot;v6&quot;: to_bigint(&quot;20&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>tobigint</tt>.</p></div>
+<div class="section">
+<h3><a name="to_double"></a>to_double</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_double(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a <tt>double</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<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>
+<li>if the argument is of numeric type then it is returned as the value of <tt>double</tt> type</li>
+<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>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_double(false),
+  &quot;v2&quot;: to_double(true),
+  &quot;v3&quot;: to_double(10),
+  &quot;v4&quot;: to_double(11.5),
+  &quot;v5&quot;: to_double(&quot;12.5&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>todouble</tt>.</p></div>
+<div class="section">
+<h3><a name="to_number_.28to_num.29"></a>to_number (to_num)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_number(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a numeric value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of numeric type then it is returned as is</li>
+<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>
+<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>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_number(false),
+  &quot;v2&quot;: to_number(true),
+  &quot;v3&quot;: to_number(10),
+  &quot;v4&quot;: to_number(11.5),
+  &quot;v5&quot;: to_number(&quot;12.5&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>tonumber</tt>, <tt>to_num</tt>, and <tt>tonum</tt>.</p></div>
+<div class="section">
+<h3><a name="to_object_.28to_obj.29"></a>to_object (to_obj)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_object(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to an <tt>object</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of <tt>object</tt> type then it is returned as is</li>
+<li>otherwise an empty <tt>object</tt> is returned</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_object({&quot;value&quot;: &quot;asterix&quot;}),
+  &quot;v2&quot;: to_object(&quot;asterix&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: {&quot;value&quot;: &quot;asterix&quot;}, &quot;v2&quot;: {} }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>toobject</tt>, <tt>to_obj</tt>, and <tt>toobj</tt>.</p></div>
+<div class="section">
+<h3><a name="to_string_.28to_str.29"></a>to_string (to_str)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_string(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a string value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<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>
+<li>if the argument is of numeric type then its string representation is returned</li>
+<li>if the argument is of <tt>string</tt> type then it is returned as is</li>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_string(false),
+  &quot;v2&quot;: to_string(true),
+  &quot;v3&quot;: to_string(10),
+  &quot;v4&quot;: to_string(11.5),
+  &quot;v5&quot;: to_string(&quot;asterix&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>tostring</tt>, <tt>to_str</tt>, and <tt>tostr</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Conditional_Functions"></a><a name="ConditionalFunctions" id="ConditionalFunctions">Conditional Functions</a></h2>
+<div class="section">
+<h3><a name="if_null_.28ifnull.29"></a>if_null (ifnull)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_null(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which value is not <tt>null</tt> and returns that value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>null</tt> if all arguments evaluate to <tt>null</tt> or no arguments specified</li>
+<li>a value of the first non-<tt>null</tt> argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: if_null(),
+    &quot;b&quot;: if_null(null),
+    &quot;c&quot;: if_null(null, &quot;asterixdb&quot;),
+    &quot;d&quot;: is_missing(if_null(missing))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot;, &quot;d&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifnull</tt>.</p></div>
+<div class="section">
+<h3><a name="if_missing_.28ifmissing.29"></a>if_missing (ifmissing)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_missing(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which value is not <tt>missing</tt> and returns that value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>null</tt> if all arguments evaluate to <tt>missing</tt> or no arguments specified</li>
+<li>a value of the first non-<tt>missing</tt> argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: if_missing(),
+    &quot;b&quot;: if_missing(missing),
+    &quot;c&quot;: if_missing(missing, &quot;asterixdb&quot;),
+    &quot;d&quot;: if_missing(null, &quot;asterixdb&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot;, &quot;d&quot;: null }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifmissing</tt>.</p></div>
+<div class="section">
+<h3><a name="if_missing_or_null_.28ifmissingornull.2C_coalesce.29"></a>if_missing_or_null (ifmissingornull, coalesce)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_missing_or_null(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which value is not <tt>null</tt> or <tt>missing</tt> and returns that value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>null</tt> if all arguments evaluate to either <tt>null</tt> or <tt>missing</tt>, or no arguments specified</li>
+<li>a value of the first non-<tt>null</tt>, non-<tt>missing</tt> argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: if_missing_or_null(),
+    &quot;b&quot;: if_missing_or_null(null, missing),
+    &quot;c&quot;: if_missing_or_null(null, missing, &quot;asterixdb&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has two aliases: <tt>ifmissingornull</tt> and <tt>coalesce</tt>.</p></div>
+<div class="section">
+<h3><a name="if_inf_.28ifinf.29"></a>if_inf (ifinf)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_inf(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which is a non-infinite (<tt>INF</tt> or<tt>-INF</tt>) number</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>missing</tt> if <tt>missing</tt> argument was encountered before the first non-infinite number argument</li>
+<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>
+<li>the first non-infinite number argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: is_null(if_inf(null)),
+    &quot;b&quot;: is_missing(if_inf(missing)),
+    &quot;c&quot;: is_null(if_inf(double(&quot;INF&quot;))),
+    &quot;d&quot;: if_inf(1, null, missing) ],
+    &quot;e&quot;: is_null(if_inf(null, missing, 1)) ],
+    &quot;f&quot;: is_missing(if_inf(missing, null, 1)) ],
+    &quot;g&quot;: if_inf(float(&quot;INF&quot;), 1) ],
+    &quot;h&quot;: to_string(if_inf(float(&quot;INF&quot;), double(&quot;NaN&quot;), 1)) ]
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifinf</tt>.</p></div>
+<div class="section">
+<h3><a name="if_nan_.28ifnan.29"></a>if_nan (ifnan)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_nan(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which is a non-<tt>NaN</tt> number</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>missing</tt> if <tt>missing</tt> argument was encountered before the first non-<tt>NaN</tt> number argument</li>
+<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>
+<li>the first non-<tt>NaN</tt> number argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: is_null(if_nan(null)),
+    &quot;b&quot;: is_missing(if_nan(missing)),
+    &quot;c&quot;: is_null(if_nan(double(&quot;NaN&quot;))),
+    &quot;d&quot;: if_nan(1, null, missing) ],
+    &quot;e&quot;: is_null(if_nan(null, missing, 1)) ],
+    &quot;f&quot;: is_missing(if_nan(missing, null, 1)) ],
+    &quot;g&quot;: if_nan(float(&quot;NaN&quot;), 1) ],
+    &quot;h&quot;: to_string(if_nan(float(&quot;NaN&quot;), double(&quot;INF&quot;), 1)) ]
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifnan</tt>.</p></div>
+<div class="section">
+<h3><a name="if_nan_or_inf_.28ifnanorinf.29"></a>if_nan_or_inf (ifnanorinf)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_nan_or_inf(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which is a non-infinite (<tt>INF</tt> or<tt>-INF</tt>) and non-<tt>NaN</tt> number</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<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>
+<li>the first non-infinite and non-<tt>NaN</tt> number argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: is_null(if_nan_or_inf(null)),
+    &quot;b&quot;: is_missing(if_nan_or_inf(missing)),
+    &quot;c&quot;: is_null(if_nan_or_inf(double(&quot;NaN&quot;), double(&quot;INF&quot;))),
+    &quot;d&quot;: if_nan_or_inf(1, null, missing) ],
+    &quot;e&quot;: is_null(if_nan_or_inf(null, missing, 1)) ],
+    &quot;f&quot;: is_missing(if_nan_or_inf(missing, null, 1)) ],
+    &quot;g&quot;: if_nan_or_inf(float(&quot;NaN&quot;), float(&quot;INF&quot;), 1) ],
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifnanorinf</tt>.</p></div>
+<div class="section">
+<h3><a name="null_if_.28nullif.29"></a>null_if (nullif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">null_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>null</tt> if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if
+<ul>
+
+<li>any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value, or</li>
+<li><tt>argument1</tt> = <tt>argument2</tt></li>
+</ul>
+</li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: null_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;),
+    &quot;b&quot;: null_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>nullif</tt>.</p></div>
+<div class="section">
+<h3><a name="missing_if_.28missingif.29"></a>missing_if (missingif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">missing_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>missing</tt> if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if
+<ul>
+
+<li>any argument is a <tt>missing</tt> value, or</li>
+<li>no argument is a <tt>null</tt> value and <tt>argument1</tt> = <tt>argument2</tt></li>
+</ul>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: missing_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)
+    &quot;b&quot;: missing_if(1, 2),
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>missingif</tt>.</p></div>
+<div class="section">
+<h3><a name="nan_if_.28nanif.29"></a>nan_if (nanif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">nan_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>NaN</tt> value if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li><tt>NaN</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: to_string(nan_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
+    &quot;b&quot;: nan_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: &quot;NaN&quot;, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>nanif</tt>.</p></div>
+<div class="section">
+<h3><a name="posinf_if_.28posinfif.29"></a>posinf_if (posinfif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">posinf_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>+INF</tt> value if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li><tt>+INF</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: to_string(posinf_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
+    &quot;b&quot;: posinf_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: &quot;+INF&quot;, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>posinfif</tt>.</p></div>
+<div class="section">
+<h3><a name="neginf_if_.28neginfif.29"></a>neginf_if (neginfif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">neginf_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>-INF</tt> value if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li><tt>-INF</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: to_string(neginf_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
+    &quot;b&quot;: neginf_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: &quot;-INF&quot;, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>neginfif</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Miscellaneous_Functions"></a><a name="MiscFunctions" id="MiscFunctions">Miscellaneous Functions</a></h2>
+<div class="section">
+<h3><a name="uuid"></a>uuid</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">uuid()
+</pre></div></div>
+</li>
+<li>
+
+<p>Generates a <tt>uuid</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li>none</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a generated, random <tt>uuid</tt>.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="len"></a>len</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>len(array)</p>
+</li>
+<li>
+
+<p>Returns the length of the array array.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>integer</tt> that represents the length of input array or the size of the input multiset,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">len([&quot;Hello&quot;, &quot;World&quot;])
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">2
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="not"></a>not</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">not(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Inverts a <tt>boolean</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt>, the inverse of <tt>expr</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>other non-boolean argument value will cause a type error.</li>
+</ul>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: `not`(true), &quot;v2&quot;: `not`(false), &quot;v3&quot;: `not`(null), &quot;v4&quot;: `not`(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: true, &quot;v3&quot;: null }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="random"></a>random</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">random( [seed_value] )
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a random number, accepting an optional seed value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>A random number of type <tt>double</tt> between 0 and 1,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value or a non-numeric value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: random(),
+  &quot;v2&quot;: random(unix_time_from_datetime_in_ms(current_datetime()))
+};
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="range"></a>range</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">range(start_numeric_value, end_numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:</li>
+<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>
+<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>
+<li>Return Value:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">range(0, 3);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ 0, 1, 2, 3 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="switch_case"></a>switch_case</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">switch_case(
+    condition,
+    case1, case1_result,
+    case2, case2_result,
+    ...,
+    default, default_result
+)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>condition</tt>: a variable (any type is allowed).</li>
+<li><tt>caseI/default</tt>: a variable (any type is allowed).</li>
+<li><tt>caseI/default_result</tt>: a variable (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>caseI_result</tt> if <tt>condition</tt> matches <tt>caseI</tt>, otherwise <tt>default_result</tt>.</li>
+</ul>
+</li>
+<li>Example 1:
+
+<div>
+<div>
+<pre class="source">switch_case(
+    &quot;a&quot;,
+    &quot;a&quot;, 0,
+    &quot;x&quot;, 1,
+    &quot;y&quot;, 2,
+    &quot;z&quot;, 3
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0
+</pre></div></div>
+</li>
+<li>
+
+<p>Example 2:</p>
+
+<div>
+<div>
+<pre class="source">switch_case(
+    &quot;a&quot;,
+    &quot;x&quot;, 1,
+    &quot;y&quot;, 2,
+    &quot;z&quot;, 3
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="deep_equal"></a>deep_equal</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">deep_equal(expr1, expr2)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr1</tt> : an expression,</li>
+<li><tt>expr2</tt> : an expression.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>true</tt> or <tt>false</tt> depending on the data equality,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">deep_equal(
+           {
+             &quot;id&quot;:1,
+             &quot;project&quot;:&quot;AsterixDB&quot;,
+             &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+             &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+           },
+           {
+             &quot;id&quot;:1,
+             &quot;project&quot;:&quot;AsterixDB&quot;,
+             &quot;address&quot;:{&quot;city&quot;:&quot;San Diego&quot;, &quot;state&quot;:&quot;CA&quot;},
+             &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+           }
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">false
+</pre></div></div>
+</li>
+</ul></div></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/content/docs/0.9.9/aws.html b/content/docs/0.9.9/aws.html
new file mode 100644
index 0000000..375eb07
--- /dev/null
+++ b/content/docs/0.9.9/aws.html
@@ -0,0 +1,390 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/aws.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Installation using Amazon Web Services</title>
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="./css/site.css" />
+    <link rel="stylesheet" href="./css/print.css" media="print" />
+    <script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href="./" id="bannerLeft"><img src="images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li class="active"><a href="#"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href="./" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>Installation using Amazon Web Services</h1>
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="atoc" id="#toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#Introduction">Introduction</a></li>
+<li><a href="#Prerequisites">Prerequisites</a></li>
+<li><a href="#config">Cluster Configuration</a></li>
+<li><a href="#lifecycle">Cluster Lifecycle Management</a></li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Introduction" id="Introduction">Introduction</a></h2>
+<p>Note that you can always manually launch a number of Amazon Web Services EC2 instances and then run the Ansible cluster installation scripts as described <a href="ansible.html">here</a> separately to manage the lifecycle of an AsterixDB cluster on those EC2 instances.</p>
+<p>However, via this installation option, we provide a combo solution for automating both AWS EC2 and AsterixDB, where you can run only one script to deploy, start, stop, and terminate an AsterixDB cluster on AWS.</p></div>
+<div class="section">
+<h2><a name="Prerequisites" id="Prerequisites">Prerequisites</a></h2>
+<ul>
+
+<li>
+
+<p>Supported operating systems for the client: <b>Linux</b> and <b>MacOS</b></p>
+</li>
+<li>
+
+<p>Supported operating systems for Amazon Web Services instances: <b>Linux</b></p>
+</li>
+<li>
+
+<p>Install pip on your client machine:</p>
+<p>CentOS</p>
+
+<div>
+<div>
+<pre class="source"> $ sudo yum install python-pip
+</pre></div></div>
+
+<p>Ubuntu</p>
+
+<div>
+<div>
+<pre class="source"> $ sudo apt-get install python-pip
+</pre></div></div>
+
+<p>macOS</p>
+
+<div>
+<div>
+<pre class="source"> $ brew install pip
+</pre></div></div>
+</li>
+<li>
+
+<p>Install Ansible, boto, and boto3 on your client machine:</p>
+
+<div>
+<div>
+<pre class="source"> $ pip install ansible
+ $ pip install boto
+ $ pip install boto3
+</pre></div></div>
+
+<p>Note that you might need <tt>sudo</tt> depending on your system configuration.</p>
+<p><b>Make sure that the version of Ansible is no less than 2.2.1.0</b>:</p>
+
+<div>
+<div>
+<pre class="source"> $ ansible --version
+ ansible 2.2.1.0
+</pre></div></div>
+
+<p><b>For users with macOS 10.11+</b>, please create a user-level Ansible configuration file at:</p>
+
+<div>
+<div>
+<pre class="source"> ~/.ansible.cfg
+</pre></div></div>
+
+<p>and add the following configuration:</p>
+
+<div>
+<div>
+<pre class="source"> [ssh_connection]
+ control_path = %(directory)s/%%C
+</pre></div></div>
+</li>
+<li>
+
+<p>Download the AsterixDB distribution package, unzip it, navigate to <tt>opt/aws/</tt></p>
+
+<div>
+<div>
+<pre class="source"> $ cd opt/aws
+</pre></div></div>
+
+<p>The following files and directories are in the directory <tt>opt/aws</tt>:</p>
+
+<div>
+<div>
+<pre class="source"> README  bin  conf  yaml
+</pre></div></div>
+
+<p><tt>bin</tt> contains scripts that start and terminate an AWS-based cluster instance, according to the configuration specified in files under <tt>conf</tt>, and <tt>yaml</tt> contains internal Ansible scripts that the shell scripts in <tt>bin</tt> use.</p>
+</li>
+<li>
+
+<p>Create an AWS account and an IAM user.</p>
+<p>Set up a security group that you&#x2019;d like to use for your AWS cluster. <b>The security group should at least allow all TCP connections from anywhere.</b> Provide the name of the security group as the value for the <tt>group</tt> field in <tt>conf/aws_settings.yml</tt>.</p>
+</li>
+<li>
+
+<p>Retrieve your AWS EC2 key pair name and use that as the <tt>keypair</tt> in <tt>conf/aws_settings.yml</tt>;</p>
+<p>retrieve your AWS IAM <tt>access key ID</tt> and use that as the <tt>access_key_id</tt> in <tt>conf/aws_settings.yml</tt>;</p>
+<p>retrieve your AWS IAM <tt>secret access key</tt> and use that as the <tt>secret_access_key</tt> in <tt>conf/aws_settings.yml</tt>.</p>
+<p>Note that you can only read or download <tt>access key ID</tt> and <tt>secret access key</tt> once from your AWS console. If you forget them, you have to create new keys and delete the old ones.</p>
+</li>
+<li>
+
+<p>Configure your ssh setting by editing <tt>~/.ssh/config</tt> and adding the following entry:</p>
+
+<div>
+<div>
+<pre class="source"> Host *.amazonaws.com
+      IdentityFile &lt;path_of_private_key&gt;
+</pre></div></div>
+
+<p>Note that &lt;path_of_private_key&gt; should be replaced by the path to the file that stores the private key for the key pair that you uploaded to AWS and used in <tt>conf/aws_settings</tt>. For example:</p>
+
+<div>
+<div>
+<pre class="source"> Host *.amazonaws.com
+      IdentityFile ~/.ssh/id_rsa
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h2><a name="Cluster_Configuration"></a><a name="config" id="config">Cluster Configuration</a></h2>
+<ul>
+
+<li>
+
+<p><b>AWS settings</b>.  Edit <tt>conf/instance_settings.yml</tt>. The meaning of each parameter is listed as follows:</p>
+
+<div>
+<div>
+<pre class="source"> # The OS image id for ec2 instances.
+ image: ami-76fa4116
+
+ # The data center region for ec2 instances.
+ region: us-west-2
+
+ # The tag for each ec2 machine. Use different tags for isolation.
+ tag: scale_test
+
+ # The name of a security group that appears in your AWS console.
+ group: default
+
+ # The name of a key pair that appears in your AWS console.
+ keypair: &lt;to be filled&gt;
+
+ # The AWS access key id for your IAM user.
+ access_key_id: &lt;to be filled&gt;
+
+ # The AWS secret key for your IAM user.
+ secret_access_key: &lt;to be filled&gt;
+
+ # The AWS instance type. A full list of available types are listed at:
+ # https://aws.amazon.com/ec2/instance-types/
+ instance_type: t2.micro
+
+ # The number of ec2 instances that construct a cluster.
+ count: 3
+
+ # The user name.
+ user: ec2-user
+
+ # Whether to reuse one slave machine to host the master process.
+ cc_on_nc: false
+</pre></div></div>
+
+<p><b>As described in <a href="#Prerequisites">prerequisites</a>, the following parameters must be customized:</b></p>
+
+<div>
+<div>
+<pre class="source"> # The tag for each ec2 machine. Use different tags for isolation.
+ tag: scale_test
+
+ # The name of a security group that appears in your AWS console.
+ group: default
+
+ # The name of a key pair that appears in your AWS console.
+ keypair: &lt;to be filled&gt;
+
+ # The AWS access key id for your IAM user.
+ access_key_id: &lt;to be filled&gt;
+
+ # The AWS secrety key for your IAM user.
+ secret_access_key: &lt;to be filled&gt;
+</pre></div></div>
+</li>
+<li>
+
+<p><b>Remote working directories</b>. Edit <tt>conf/instance_settings.yml</tt> to change the remote binary directory (the variable &#x201c;binarydir&#x201d;) when necessary. By default, the binary directory will be under the home directory (as the value of Ansible builtin variable ansible_env.HOME) of the ssh user account on each node.</p>
+</li>
+</ul></div>
+<div class="section">
+<h2><a name="Cluster_Lifecycle_Management"></a><a name="lifecycle" id="lifecycle">Cluster Lifecycle Management</a></h2>
+<ul>
+
+<li>
+
+<p>Allocate AWS EC2 nodes (the number of nodes is specified in <tt>conf/instance_settings.yml</tt>) and deploy the binary to all allocated EC2 nodes:</p>
+
+<div>
+<div>
+<pre class="source"> bin/deploy.sh
+</pre></div></div>
+</li>
+<li>
+
+<p>Before starting the AsterixDB cluster, you the instance configuration file <tt>conf/instance/cc.conf</tt> can be modified with the exception of the IP addresses/DNS names which are are generated and cannot be changed. All available parameters and their usage can be found <a href="ncservice.html#Parameters">here</a>.</p>
+</li>
+<li>
+
+<p>Launch your AsterixDB cluster on EC2:</p>
+
+<div>
+<div>
+<pre class="source"> bin/start.sh
+</pre></div></div>
+
+<p>Now you can use the multi-node AsterixDB cluster on EC2 by by opening the master node listed in <tt>conf/instance/inventory</tt> at port <tt>19001</tt> (which can be customized in <tt>conf/instance/cc.conf</tt>) in your browser.</p>
+</li>
+<li>
+
+<p>If you want to stop the AWS-based AsterixDB cluster, run the following script:</p>
+
+<div>
+<div>
+<pre class="source"> bin/stop.sh
+</pre></div></div>
+
+<p>Note that this only stops AsterixDB but does not stop the EC2 nodes.</p>
+</li>
+<li>
+
+<p>If you want to terminate the EC2 nodes that run the AsterixDB cluster, run the following script:</p>
+
+<div>
+<div>
+<pre class="source"> bin/terminate.sh
+</pre></div></div>
+
+<p><b>Note that it will destroy everything in the AsterixDB cluster you installed and terminate all EC2 nodes for the cluster.</b></p>
+</li>
+</ul></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/content/docs/0.9.9/datamodel.html b/content/docs/0.9.9/datamodel.html
new file mode 100644
index 0000000..07e2af4
--- /dev/null
+++ b/content/docs/0.9.9/datamodel.html
@@ -0,0 +1,784 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/datamodel.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; The Asterix Data Model (ADM)</title>
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="./css/site.css" />
+    <link rel="stylesheet" href="./css/print.css" media="print" />
+    <script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href="./" id="bannerLeft"><img src="images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li class="active"><a href="#"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href="./" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>The Asterix Data Model (ADM)</h1>
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="toc" id="toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#PrimitiveTypes">Primitive Types</a>
+<ul>
+
+<li><a href="#PrimitiveTypesBoolean">Boolean</a></li>
+<li><a href="#PrimitiveTypesString">String</a></li>
+<li><a href="#PrimitiveTypesInt">Tinyint / Smallint / Integer (Int) / Bigint</a></li>
+<li><a href="#PrimitiveTypesFloat">Float</a></li>
+<li><a href="#PrimitiveTypesDouble">Double (Double Precision)</a></li>
+<li><a href="#PrimitiveTypesBinary">Binary</a></li>
+<li><a href="#PrimitiveTypesPoint">Point</a></li>
+<li><a href="#PrimitiveTypesLine">Line</a></li>
+<li><a href="#PrimitiveTypesRectangle">Rectangle</a></li>
+<li><a href="#PrimitiveTypesCircle">Circle</a></li>
+<li><a href="#PrimitiveTypesPolygon">Polygon</a></li>
+<li><a href="#PrimitiveTypesDate">Date</a></li>
+<li><a href="#PrimitiveTypesTime">Time</a></li>
+<li><a href="#PrimitiveTypesDateTime">Datetime (Timestamp)</a></li>
+<li><a href="#PrimitiveTypesDuration">Duration/Year_month_duration/Day_time_duration</a></li>
+<li><a href="#PrimitiveTypesInterval">Interval</a></li>
+<li><a href="#PrimitiveTypesUUID">UUID</a></li>
+</ul>
+</li>
+<li><a href="#IncompleteInformationTypes">Incomplete Information Types</a>
+<ul>
+
+<li><a href="#IncompleteInformationTypesNull">Null</a></li>
+<li><a href="#IncompleteInformationTypesMissing">Missing</a></li>
+</ul>
+</li>
+<li><a href="#DerivedTypes">Derived Types</a>
+<ul>
+
+<li><a href="#DerivedTypesObject">Object</a></li>
+<li><a href="#DerivedTypesArray">Array</a></li>
+<li><a href="#DerivedTypesMultiset">Multiset</a></li>
+</ul>
+</li>
+</ul>
+<p>An instance of Asterix data model (ADM) can be a <i><i>primitive type</i></i> (<tt>boolean</tt>, <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, <tt>bigint</tt>, <tt>string</tt>, <tt>float</tt>, <tt>double</tt>, <tt>date</tt>, <tt>time</tt>, <tt>datetime</tt>, etc.), a <i><i>special type</i></i> (<tt>null</tt> or <tt>missing</tt>), or a <i><i>derived type</i></i>.</p>
+<p>The type names are case-insensitive, e.g., both <tt>BIGINT</tt> and <tt>bigint</tt> are acceptable.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Primitive_Types"></a><a name="PrimitiveTypes" id="PrimitiveTypes">Primitive Types</a></h2>
+<div class="section">
+<h3><a name="Boolean"></a><a name="PrimitiveTypesBoolean" id="PrimitiveTypesBoolean">Boolean</a></h3>
+<p><tt>boolean</tt> data type can have one of the two values: <i>true</i> or <i>false</i>.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;true&quot;: true, &quot;false&quot;: false };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;true&quot;: true, &quot;false&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="String"></a><a name="PrimitiveTypesString" id="PrimitiveTypesString">String</a></h3>
+<p><tt>string</tt> represents a sequence of characters. The total length of the sequence can be up to 2,147,483,648.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: string(&quot;This is a string.&quot;), &quot;v2&quot;: string(&quot;\&quot;This is a quoted string\&quot;&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;This is a string.&quot;, &quot;v2&quot;: &quot;\&quot;This is a quoted string\&quot;&quot; }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="Tinyint_.2F_Smallint_.2F_Integer_.28Int.29_.2F_Bigint"></a><a name="PrimitiveTypesInt" id="PrimitiveTypesInt">Tinyint / Smallint / Integer (Int) / Bigint</a></h3>
+<p>Integer types using 8, 16, 32, or 64 bits. The ranges of these types are:</p>
+<ul>
+
+<li><tt>tinyint</tt>: -128 to 127</li>
+<li><tt>smallint</tt>: -32768 to 32767</li>
+<li><tt>integer</tt>: -2147483648 to 2147483647</li>
+<li><tt>bigint</tt>: -9223372036854775808 to 9223372036854775807</li>
+</ul>
+<p><tt>int</tt> is an abbreviated alias for integer.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;tinyint&quot;: tiny(&quot;125&quot;), &quot;smallint&quot;: smallint(&quot;32765&quot;), &quot;integer&quot;: 294967295, &quot;bigint&quot;: bigint(&quot;1700000000000000000&quot;)};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;tinyint&quot;: 125, &quot;smallint&quot;: 32765, &quot;integer&quot;: 294967295, &quot;bigint&quot;: 1700000000000000000 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Float"></a><a name="PrimitiveTypesFloat" id="PrimitiveTypesFloat">Float</a></h3>
+<p><tt>float</tt> represents approximate numeric data values using 4 bytes. The range of a float value can be from 2^(-149) to (2-2^(-23)&#xb7;2^(127) for both positive and negative. Beyond these ranges will get <tt>INF</tt> or <tt>-INF</tt>.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: float(&quot;NaN&quot;), &quot;v2&quot;: float(&quot;INF&quot;), &quot;v3&quot;: float(&quot;-INF&quot;), &quot;v4&quot;: float(&quot;-2013.5&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;NaN&quot;, &quot;v2&quot;: &quot;INF&quot;, &quot;v3&quot;: &quot;-INF&quot;, &quot;v4&quot;: -2013.5 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Double_.28double_precision.29"></a><a name="PrimitiveTypesDouble" id="PrimitiveTypesDouble">Double (double precision)</a></h3>
+<p><tt>double</tt> represents approximate numeric data values using 8 bytes. The range of a double value can be from (2^(-1022)) to (2-2^(-52))&#xb7;2^(1023) for both positive and negative. Beyond these ranges will get <tt>INF</tt> or <tt>-INF</tt>.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: double(&quot;NaN&quot;), &quot;v2&quot;: double(&quot;INF&quot;), &quot;v3&quot;: double(&quot;-INF&quot;), &quot;v4&quot;: &quot;-2013.593823748327284&quot; };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;NaN&quot;, &quot;v2&quot;: &quot;INF&quot;, &quot;v3&quot;: &quot;-INF&quot;, &quot;v4&quot;: -2013.5938237483274 }
+</pre></div></div>
+</li>
+</ul>
+<p><tt>Double precision</tt> is an alias of <tt>double</tt>.</p></div>
+<div class="section">
+<h3><a name="Binary"></a><a name="PrimitiveTypesBinary" id="PrimitiveTypesBinary">Binary</a></h3>
+<p><tt>binary</tt> represents a sequence of bytes. It can be constructed from a <tt>hex</tt> or a <tt>base64</tt> string sequence. The total length of the byte sequence can be up to 2,147,483,648.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;hex1&quot; : hex(&quot;ABCDEF0123456789&quot;),
+  &quot;hex2&quot;: hex(&quot;abcdef0123456789&quot;),
+  &quot;base64_1&quot; : base64(&quot;0123456789qwertyui+/&quot;),
+  &quot;base64_2&quot; : base64('QXN0ZXJpeA==')
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The default output format is in <tt>hex</tt> format. Thus, the expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;hex1&quot;: hex(&quot;ABCDEF0123456789&quot;),
+  &quot;hex2&quot;: hex(&quot;ABCDEF0123456789&quot;),
+  &quot;base64_1&quot;: hex(&quot;D35DB7E39EBBF3DAB07ABB72BA2FBF&quot;),
+  &quot;base64_2&quot;: hex(&quot;41737465726978&quot;)
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Point"></a><a name="PrimitiveTypesPoint" id="PrimitiveTypesPoint">Point</a></h3>
+<p><tt>point</tt> is the fundamental two-dimensional building block for spatial types. It consists of two <tt>double</tt> coordinates x and y.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: point(&quot;80.10d, -10E5&quot;), &quot;v2&quot;: point(&quot;5.10E-10d, -10E5&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: point(&quot;80.1,-1000000.0&quot;), &quot;v2&quot;: point(&quot;5.1E-10,-1000000.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Line"></a><a name="PrimitiveTypesLine" id="PrimitiveTypesLine">Line</a></h3>
+<p><tt>line</tt> consists of two points that represent the start and the end points of a line segment.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: line(&quot;10.1234,11.1e-1 +10.2E-2,-11.22&quot;), &quot;v2&quot;: line(&quot;0.1234,-1.00e-10 +10.5E-2,-01.02&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: line(&quot;10.1234,1.11 0.102,-11.22&quot;), &quot;v2&quot;: line(&quot;0.1234,-1.0E-10 0.105,-1.02&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Rectangle"></a><a name="PrimitiveTypesRectangle" id="PrimitiveTypesRectangle">Rectangle</a></h3>
+<p><tt>rectangle</tt> consists of two points that represent the <i><i>bottom left</i></i> and <i><i>upper right</i></i> corners of a rectangle.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: rectangle(&quot;5.1,11.8 87.6,15.6548&quot;), &quot;v2&quot;: rectangle(&quot;0.1234,-1.00e-10 5.5487,0.48765&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: rectangle(&quot;5.1,11.8 87.6,15.6548&quot;), &quot;v2&quot;: rectangle(&quot;0.1234,-1.0E-10 5.5487,0.48765&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Circle"></a><a name="PrimitiveTypesCircle" id="PrimitiveTypesCircle">Circle</a></h3>
+<p><tt>circle</tt> consists of one point that represents the center of the circle and a radius of type <tt>double</tt>.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: circle(&quot;10.1234,11.1e-1 +10.2E-2&quot;), &quot;v2&quot;: circle(&quot;0.1234,-1.00e-10 +10.5E-2&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: circle(&quot;10.1234,1.11 0.102&quot;), &quot;v2&quot;: circle(&quot;0.1234,-1.0E-10 0.105&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Polygon"></a><a name="PrimitiveTypesPolygon" id="PrimitiveTypesPolygon">Polygon</a></h3>
+<p><tt>polygon</tt> consists of <i><i>n</i></i> points that represent the vertices of a <i><i>simple closed</i></i> polygon.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: polygon(&quot;-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81&quot;),
+  &quot;v2&quot;: polygon(&quot;-1.0,+10.5e2 -02.15E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: polygon(&quot;-1.2,130.0 -214000.0,2.15 -350.0,3.6 -0.0046,4.81&quot;),
+  &quot;v2&quot;: polygon(&quot;-1.0,1050.0 -2.15E50,2.5 -1.0,3300.0 -250000.0,20.15 350.0,3.6 -0.0046,4.75 -2.0,100.0 -200000.0,20.1 30.5,3.25 -0.00433,4.75&quot;) }
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Date"></a><a name="PrimitiveTypesDate" id="PrimitiveTypesDate">Date</a></h3>
+<p><tt>date</tt> represents a time point along the Gregorian calendar system specified by the year, month and day. ASTERIX supports the date from <tt>-9999-01-01</tt> to <tt>9999-12-31</tt>.</p>
+<p>A date value can be represented in two formats, extended format and basic format.</p>
+<ul>
+
+<li>Extended format is represented as <tt>[-]yyyy-mm-dd</tt> for <tt>year-month-day</tt>. Each field should be padded if there are less digits than the format specified.</li>
+<li>Basic format is in the format of <tt>[-]yyyymmdd</tt>.</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: date(&quot;2013-01-01&quot;), &quot;v2&quot;: date(&quot;-19700101&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: date(&quot;2013-01-01&quot;), &quot;v2&quot;: date(&quot;-1970-01-01&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Time"></a><a name="PrimitiveTypesTime" id="PrimitiveTypesTime">Time</a></h3>
+<p><tt>time</tt> type describes the time within the range of a day. It is represented by three fields: hour, minute and second. Millisecond field is optional as the fraction of the second field. Its extended format is as <tt>hh:mm:ss[.mmm]</tt> and the basic format is <tt>hhmmss[mmm]</tt>. The value domain is from <tt>00:00:00.000</tt> to <tt>23:59:59.999</tt>.</p>
+<p>Timezone field is optional for a time value. Timezone is represented as <tt>[+|-]hh:mm</tt> for extended format or <tt>[+|-]hhmm</tt> for basic format. Note that the sign designators cannot be omitted. <tt>Z</tt> can also be used to represent the UTC local time. If no timezone information is given, it is UTC by default.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: time(&quot;12:12:12.039Z&quot;), &quot;v2&quot;: time(&quot;000000000-0800&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: time(&quot;12:12:12.039Z&quot;), &quot;v2&quot;: time(&quot;08:00:00.000Z&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Datetime_.28Timestamp.29"></a><a name="PrimitiveTypesDateTime" id="PrimitiveTypesDateTime">Datetime (Timestamp)</a></h3>
+<p>A <tt>datetime</tt> value is a combination of an <tt>date</tt> and <tt>time</tt>, representing a fixed time point along the Gregorian calendar system. The value is among <tt>-9999-01-01 00:00:00.000</tt> and <tt>9999-12-31 23:59:59.999</tt>.</p>
+<p>A <tt>datetime</tt> value is represented as a combination of the representation of its <tt>date</tt> part and <tt>time</tt> part, separated by a separator <tt>T</tt>. Either extended or basic format can be used, and the two parts should be the same format.</p>
+<p>Millisecond field and timezone field are optional, as specified in the <tt>time</tt> type.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: datetime(&quot;2013-01-01T12:12:12.039Z&quot;), &quot;v2&quot;: datetime(&quot;-19700101T000000000-0800&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: datetime(&quot;2013-01-01T12:12:12.039Z&quot;), &quot;v2&quot;: datetime(&quot;-1970-01-01T08:00:00.000Z&quot;) }
+</pre></div></div>
+</li>
+</ul>
+<p><tt>timestamp</tt> is an alias of <tt>datetime</tt>.</p></div>
+<div class="section">
+<h3><a name="Duration.2FYear_month_duration.2FDay_time_duration"></a><a name="PrimitiveTypesDuration" id="PrimitiveTypesDuration">Duration/Year_month_duration/Day_time_duration</a></h3>
+<p><tt>duration</tt> represents a duration of time. A duration value is specified by integers on at least one of the following fields: year, month, day, hour, minute, second, and millisecond.</p>
+<p>A duration value is in the format of <tt>[-]PnYnMnDTnHnMn.mmmS</tt>. The millisecond part (as the fraction of the second field) is optional, and when no millisecond field is used, the decimal point should also be absent.</p>
+<p>Negative durations are also supported for the arithmetic operations between time instance types (<tt>date</tt>, <tt>time</tt> and <tt>datetime</tt>), and is used to roll the time back for the given duration. For example <tt>date(&quot;2012-01-01&quot;) + duration(&quot;-P3D&quot;)</tt> will return <tt>date(&quot;2011-12-29&quot;)</tt>.</p>
+<p>There are also two sub-duration types, namely <tt>year_month_duration</tt> and <tt>day_time_duration</tt>. <tt>year_month_duration</tt> represents only the years and months of a duration, while <tt>day_time_duration</tt> represents only the day to millisecond fields. Different from the <tt>duration</tt> type, both these two subtypes are totally ordered, so they can be used for comparison and index construction.</p>
+<p>Note that a canonical representation of the duration is always returned, regardless whether the duration is in the canonical representation or not from the user&#x2019;s input. More information about canonical representation can be found from <a class="externalLink" href="http://www.w3.org/TR/xpath-functions/#canonical-dayTimeDuration">XPath dayTimeDuration Canonical Representation</a> and <a class="externalLink" href="http://www.w3.org/TR/xpath-functions/#canonical-yearMonthDuration">yearMonthDuration Canonical Representation</a>.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: duration(&quot;P100Y12MT12M&quot;), &quot;v2&quot;: duration(&quot;-PT20.943S&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: duration(&quot;P101YT12M&quot;), &quot;v2&quot;: duration(&quot;-PT20.943S&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Interval"></a><a name="PrimitiveTypesInterval" id="PrimitiveTypesInterval">Interval</a></h3>
+<p><tt>interval</tt> represents inclusive-exclusive ranges of time. It is defined by two time point values with the same temporal type(<tt>date</tt>, <tt>time</tt> or <tt>datetime</tt>).</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;)),
+  &quot;v2&quot;: interval(time(&quot;00:01:01&quot;), time(&quot;213901049+0800&quot;)),
+  &quot;v3&quot;: interval(datetime(&quot;2013-01-01T00:01:01&quot;), datetime(&quot;20130505T213901049+0800&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: interval(date(&quot;2013-01-01&quot;), date(&quot;2013-05-05&quot;)),
+  &quot;v2&quot;: interval(time(&quot;00:01:01.000Z&quot;), time(&quot;13:39:01.049Z&quot;)),
+  &quot;v3&quot;: interval(datetime(&quot;2013-01-01T00:01:01.000Z&quot;), datetime(&quot;2013-05-05T13:39:01.049Z&quot;))
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="UUID"></a><a name="PrimitiveTypesUUID" id="PrimitiveTypesUUID">UUID</a></h3>
+<p><tt>uuid</tt> represents a UUID value, which stands for Universally unique identifier. It is defined by a canonical format using hexadecimal text with inserted hyphen characters. (E.g.: 5a28ce1e-6a74-4201-9e8f-683256e5706f). This type is generally used to store auto-generated primary key values.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">return { &quot;v1&quot;:uuid(&quot;5c848e5c-6b6a-498f-8452-8847a2957421&quot;) }
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: uuid(&quot;5c848e5c-6b6a-498f-8452-8847a2957421&quot;) }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Incomplete_Information_Types"></a><a name="IncompleteInformationTypes" id="IncompleteInformationTypes">Incomplete Information Types</a></h2>
+<div class="section">
+<h3><a name="Null"></a><a name="IncompleteInformationTypesNull" id="IncompleteInformationTypesNull">Null</a></h3>
+<p><tt>null</tt> is a special value that is often used to represent an unknown value. For example, a user might not be able to know the value of a field and let it be <tt>null</tt>.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;field&quot;: null };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;field&quot;: null }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Missing"></a><a name="IncompleteInformationTypesMissing" id="IncompleteInformationTypesMissing">Missing</a></h3>
+<p><tt>missing</tt> indicates that a name-value pair is missing from an object. If a missing name-value pair is accessed, an empty result value is returned by the query.</p>
+<p>As neither the data model nor the system enforces homogeneity for datasets or collections, items in a dataset or collection can be of heterogeneous types and so a field can be present in one object and <tt>missing</tt> in another.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;field&quot;: missing };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{  }
+</pre></div></div>
+</li>
+</ul>
+<p>Since a field with value <tt>missing</tt> means the field is absent, we get an empty object.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Derived_Types"></a><a name="DerivedTypes" id="DerivedTypes">Derived Types</a></h2>
+<div class="section">
+<h3><a name="Object"></a><a name="DerivedTypesObject" id="DerivedTypesObject">Object</a></h3>
+<p>An <tt>object</tt> contains a set of &#xfb01;elds, where each &#xfb01;eld is described by its name and type. An object type may be defined as either open or closed. Open objects (instances of open object types) are permitted to contain &#xfb01;elds that are not part of the type de&#xfb01;nition, while closed objects do not permit their instances to carry extra fields. An example type definition for an object is:</p>
+
+<div>
+<div>
+<pre class="source">    create type SoldierType as open {
+        name: string?,
+        rank: string,
+        serialno: int
+    };
+</pre></div></div>
+
+<p>Syntactically, object constructors are surrounded by curly braces &#x201c;{&#x2026;}&#x201d;. Some examples of legitimate instances of the above type include:</p>
+
+<div>
+<div>
+<pre class="source">    { &quot;name&quot;: &quot;Joe Blow&quot;, &quot;rank&quot;: &quot;Sergeant&quot;, &quot;serialno&quot;: 1234567 }
+    { &quot;rank&quot;: &quot;Private&quot;, &quot;serialno&quot;: 9876543 }
+    { &quot;name&quot;: &quot;Sally Forth&quot;, &quot;rank&quot;: &quot;Major&quot;, &quot;serialno&quot;: 2345678, &quot;gender&quot;: &quot;F&quot; }
+</pre></div></div>
+
+<p>The first instance has all of the type&#x2019;s prescribed content. The second instance is missing the name field, which is fine because it is optional (due to the ?). The third instance has an extra field; that is fine because the type definition specifies that it is open (which is also true by default, if open is not specified). To more tightly control object content, specifying closed instead of open in the type definition for SoldierType would have made the third example instance an invalid instance of the type.</p></div>
+<div class="section">
+<h3><a name="Array"></a><a name="DerivedTypesArray" id="DerivedTypesArray">Array</a></h3>
+<p>An <tt>array</tt> is a container that holds a fixed number of values. Array constructors are denoted by brackets: &#x201c;[&#x2026;]&#x201d;.</p>
+<p>An example would be</p>
+
+<div>
+<div>
+<pre class="source">    [&quot;alice&quot;, 123, &quot;bob&quot;, null]
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Multiset"></a><a name="DerivedTypesMultiset" id="DerivedTypesMultiset">Multiset</a></h3>
+<p>A <tt>multiset</tt> is a generalization of the concept of a set that, unlike a set, allows multiple instances of the multiset&#x2019;s elements. Multiset constructors are denoted by two opening curly braces followed by data and two closing curly braces, like &#x201c;{{&#x2026;}}&#x201d;.</p>
+<p>An example would be</p>
+
+<div>
+<div>
+<pre class="source">    {{&quot;hello&quot;, 9328, &quot;world&quot;, [1, 2, null]}}
+</pre></div></div></div></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/content/docs/0.9.9/feeds.html b/content/docs/0.9.9/feeds.html
new file mode 100644
index 0000000..1210a3f
--- /dev/null
+++ b/content/docs/0.9.9/feeds.html
@@ -0,0 +1,422 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/feeds.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Data Ingestion with Feeds</title>
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="./css/site.css" />
+    <link rel="stylesheet" href="./css/print.css" media="print" />
+    <script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href="./" id="bannerLeft"><img src="images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li class="active"><a href="#"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href="./" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>Data Ingestion with Feeds</h1>
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="atoc" id="#toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#Introduction">Introduction</a></li>
+<li><a href="#FeedAdapters">Feed Adapters</a></li>
+<li><a href="#FeedPolicies">Feed Policies</a><!--
+! Licensed to the Apache Software Foundation (ASF) under one
+! or more contributor license agreements.  See the NOTICE file
+! distributed with this work for additional information
+! regarding copyright ownership.  The ASF licenses this file
+! to you under the Apache License, Version 2.0 (the
+! "License"); you may not use this file except in compliance
+! with the License.  You may obtain a copy of the License at
+!
+!   http://www.apache.org/licenses/LICENSE-2.0
+!
+! Unless required by applicable law or agreed to in writing,
+! software distributed under the License is distributed on an
+! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+! KIND, either express or implied.  See the License for the
+! specific language governing permissions and limitations
+! under the License.
+!--></li>
+</ul></div>
+<div class="section">
+<h2><a name="Introduction">Introduction</a></h2>
+<p>In this document, we describe the support for data ingestion in AsterixDB. Data feeds are a new mechanism for having continuous data arrive into a BDMS from external sources and incrementally populate a persisted dataset and associated indexes. We add a new BDMS architectural component, called a data feed, that makes a Big Data system the caretaker for functionality that used to live outside, and we show how it improves users&#x2019; lives and system performance.</p></div>
+<div class="section">
+<h2><a name="Feed_Adapters"></a><a name="FeedAdapters">Feed Adapters</a></h2>
+<p>The functionality of establishing a connection with a data source and receiving, parsing and translating its data into ADM objects (for storage inside AsterixDB) is contained in a feed adapter. A feed adapter is an implementation of an interface and its details are specific to a given data source. An adapter may optionally be given parameters to configure its runtime behavior. Depending upon the data transfer protocol/APIs offered by the data source, a feed adapter may operate in a push or a pull mode. Push mode involves just one initial request by the adapter to the data source for setting up the connection. Once a connection is authorized, the data source &#x201c;pushes&#x201d; data to the adapter without any subsequent requests by the adapter. In contrast, when operating in a pull mode, the adapter makes a separate request each time to receive data. AsterixDB currently provides built-in adapters for several popular data sources such as Twitter and RSS feeds. AsterixDB additionally provides a generic socket-based adapter that can be used to ingest data that is directed at a prescribed socket.</p>
+<p>In this tutorial, we shall describe building two example data ingestion pipelines that cover the popular scenarios of ingesting data from (a) Twitter (b) RSS  (c) Socket Feed source.</p>
+<div class="section">
+<div class="section">
+<h4><a name="Ingesting_Twitter_Stream"></a>Ingesting Twitter Stream</h4>
+<p>We shall use the built-in push-based Twitter adapter. As a pre-requisite, we must define a Tweet using the AsterixDB Data Model (ADM) and the query language SQL++. Given below are the type definitions in SQL++ that create a Tweet datatype which is representative of a real tweet as obtained from Twitter.</p>
+
+<div>
+<div>
+<pre class="source">    drop dataverse feeds if exists;
+
+    create dataverse feeds;
+    use feeds;
+
+    create type TwitterUser as closed {
+        screen_name: string,
+        lang: string,
+        friends_count: int32,
+        statuses_count: int32
+    };
+
+    create type Tweet as open {
+        id: int64,
+        user: TwitterUser
+    };
+
+    create dataset Tweets (Tweet) primary key id;
+</pre></div></div>
+
+<p>We also create a dataset that we shall use to persist the tweets in AsterixDB. Next we make use of the <tt>create feed</tt> SQL++ statement to define our example data feed.</p>
+<div class="section">
+<h5><a name="Using_the_.E2.80.9Cpush_twitter.E2.80.9D_feed_adapter"></a>Using the &#x201c;push_twitter&#x201d; feed adapter</h5>
+<p>The &#x201c;push_twitter&#x201d; adapter requires setting up an application account with Twitter. To retrieve tweets, Twitter requires registering an application. Registration involves providing a name and a brief description for the application. Each application has associated OAuth authentication credentials that include OAuth keys and tokens. Accessing the Twitter API requires providing the following.</p>
+<ol style="list-style-type: decimal">
+
+<li>Consumer Key (API Key)</li>
+<li>Consumer Secret (API Secret)</li>
+<li>Access Token</li>
+<li>Access Token Secret</li>
+</ol>
+<p>The &#x201c;push_twitter&#x201d; adapter takes as configuration the above mentioned parameters. End users are required to obtain the above authentication credentials prior to using the &#x201c;push_twitter&#x201d; adapter. For further information on obtaining OAuth keys and tokens and registering an application with Twitter, please visit <a class="externalLink" href="http://apps.twitter.com">http://apps.twitter.com</a>.</p>
+<p>Note that AsterixDB uses the Twitter4J API for getting data from Twitter. Due to a license conflict, Apache AsterixDB cannot ship the Twitter4J library. To use the Twitter adapter in AsterixDB, please download the necessary dependencies (<tt>twitter4j-core-4.0.x.jar</tt> and <tt>twitter4j-stream-4.0.x.jar</tt>) and drop them into the <tt>repo/</tt> directory before AsterixDB starts.</p>
+<p>Given below is an example SQL++ statement that creates a feed called &#x201c;TwitterFeed&#x201d; by using the &#x201c;push_twitter&#x201d; adapter.</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    create feed TwitterFeed with {
+      &quot;adapter-name&quot;: &quot;push_twitter&quot;,
+      &quot;type-name&quot;: &quot;Tweet&quot;,
+      &quot;format&quot;: &quot;twitter-status&quot;,
+      &quot;consumer.key&quot;: &quot;************&quot;,
+      &quot;consumer.secret&quot;: &quot;************&quot;,
+      &quot;access.token&quot;: &quot;**********&quot;,
+      &quot;access.token.secret&quot;: &quot;*************&quot;
+    };
+</pre></div></div>
+
+<p>It is required that the above authentication parameters are provided valid. Note that the <tt>create feed</tt> statement does not initiate the flow of data from Twitter into the AsterixDB instance. Instead, the <tt>create feed</tt> statement only results in registering the feed with the instance. The flow of data along a feed is initiated when it is connected to a target dataset using the connect feed statement and activated using the start feed statement.</p>
+<p>The Twitter adapter also supports several Twitter streaming APIs as follow:</p>
+<ol style="list-style-type: decimal">
+
+<li>Track filter <tt>&quot;keywords&quot;: &quot;AsterixDB, Apache&quot;</tt></li>
+<li>Locations filter <tt>&quot;locations&quot;: &quot;-29.7, 79.2, 36.7, 72.0; -124.848974,-66.885444, 24.396308, 49.384358&quot;</tt></li>
+<li>Language filter <tt>&quot;language&quot;: &quot;en&quot;</tt></li>
+<li>Filter level <tt>&quot;filter-level&quot;: &quot;low&quot;</tt></li>
+</ol>
+<p>An example of Twitter adapter tracking tweets with keyword &#x201c;news&#x201d; can be described using following ddl:</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    create feed TwitterFeed with {
+      &quot;adapter-name&quot;: &quot;push_twitter&quot;,
+      &quot;type-name&quot;: &quot;Tweet&quot;,
+      &quot;format&quot;: &quot;twitter-status&quot;,
+      &quot;consumer.key&quot;: &quot;************&quot;,
+      &quot;consumer.secret&quot;: &quot;************&quot;,
+      &quot;access.token&quot;: &quot;**********&quot;,
+      &quot;access.token.secret&quot;: &quot;*************&quot;,
+      &quot;keywords&quot;: &quot;news&quot;
+    };
+</pre></div></div>
+
+<p>For more details about these APIs, please visit <a class="externalLink" href="https://dev.twitter.com/streaming/overview/request-parameters">https://dev.twitter.com/streaming/overview/request-parameters</a></p></div></div>
+<div class="section">
+<h4><a name="Lifecycle_of_a_Feed"></a>Lifecycle of a Feed</h4>
+<p>A feed is a logical artifact that is brought to life (i.e., its data flow is initiated) only when it is activated using the <tt>start feed</tt> statement. Before we active a feed, we need to designate the dataset where the data to be persisted using <tt>connect feed</tt> statement. Subsequent to a <tt>connect feed</tt> statement, the feed is said to be in the connected state. After that, <tt>start feed</tt> statement will activate the feed, and start the dataflow from feed to its connected dataset. Multiple feeds can simultaneously be connected to a dataset such that the contents of the dataset represent the union of the connected feeds. Also one feed can be simultaneously connected to multiple target datasets.</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    connect feed TwitterFeed to dataset Tweets;
+
+    start feed TwitterFeed;
+</pre></div></div>
+
+<p>The <tt>connect feed</tt> statement above directs AsterixDB to persist the data from <tt>TwitterFeed</tt> feed into the <tt>Tweets</tt> dataset. The <tt>start feed</tt> statement will activate the feed and start the dataflow. If it is required (by the high-level application) to also retain the raw tweets obtained from Twitter, the end user may additionally choose to connect TwitterFeed to a different dataset.</p>
+<p>Let the feed run for a minute, then run the following query to see the latest tweets that are stored into the data set.</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    select * from Tweets limit 10;
+</pre></div></div>
+
+<p>The dataflow of data from a feed can be terminated explicitly by <tt>stop feed</tt> statement.</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    stop feed TwitterFeed;
+</pre></div></div>
+
+<p>The <tt>disconnnect statement</tt> can be used to disconnect the feed from certain dataset.</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    disconnect feed TwitterFeed from dataset Tweets;
+</pre></div></div>
+</div></div>
+<div class="section">
+<h3><a name="Ingesting_with_Other_Adapters"></a>Ingesting with Other Adapters</h3>
+<p>AsterixDB has several builtin feed adapters for data ingestion. User can also implement their own adapters and plug them into AsterixDB. Here we introduce <tt>socket_adapter</tt> and <tt>localfs</tt> feed adapter that cover most of the common application scenarios.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Using_the_.E2.80.9Csocket_adapter.E2.80.9D_feed_adapter"></a>Using the &#x201c;socket_adapter&#x201d; feed adapter</h5>
+<p><tt>socket_adapter</tt> feed opens a web socket on the given node which allows user to push data into AsterixDB directly. Here is an example:</p>
+
+<div>
+<div>
+<pre class="source">    drop dataverse feeds if exists;
+    create dataverse feeds;
+    use feeds;
+
+    create type TestDataType as open {
+       screenName: string
+    };
+
+    create dataset TestDataset(TestDataType) primary key screenName;
+
+    create feed TestSocketFeed with {
+      &quot;adapter-name&quot;: &quot;socket_adapter&quot;,
+      &quot;sockets&quot;: &quot;127.0.0.1:10001&quot;,
+      &quot;address-type&quot;: &quot;IP&quot;,
+      &quot;type-name&quot;: &quot;TestDataType&quot;,
+      &quot;format&quot;: &quot;adm&quot;
+    };
+
+    connect feed TestSocketFeed to dataset TestDataset;
+
+    use feeds;
+    start feed TestSocketFeed;
+</pre></div></div>
+
+<p>The above statements create a socket feed which is listening to &#x201c;10001&#x201d; port of the host machine. This feed accepts data records in &#x201c;adm&#x201d; format. As an example, you can download the sample dataset <a href="../data/chu.adm">Chirp Users</a> and push them line by line into the socket feed using any socket client you like. Following is a socket client example in Python:</p>
+
+<div>
+<div>
+<pre class="source">    from socket import socket
+
+    ip = '127.0.0.1'
+    port1 = 10001
+    filePath = 'chu.adm'
+
+    sock1 = socket()
+    sock1.connect((ip, port1))
+
+    with open(filePath) as inputData:
+        for line in inputData:
+            sock1.sendall(line)
+        sock1.close()
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Using_the_.E2.80.9Clocalfs.E2.80.9D_feed_adapter"></a>Using the &#x201c;localfs&#x201d; feed adapter</h4>
+<p><tt>localfs</tt> adapter enables data ingestion from local file system. It allows user to feed data records on local disk into a dataset. A DDL example for creating a <tt>localfs</tt> feed is given as follow:</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    create type TestDataType as open {
+       screenName: string
+    };
+
+    create dataset TestDataset(TestDataType) primary key screenName;
+
+    create feed TestFileFeed with {
+      &quot;adapter-name&quot;: &quot;localfs&quot;,
+      &quot;type-name&quot;: &quot;TestDataType&quot;,
+      &quot;path&quot;: &quot;HOSTNAME://LOCAL_FILE_PATH&quot;,
+      &quot;format&quot;: &quot;adm&quot;
+    };
+
+    connect feed TestFileFeed to dataset TestDataset;
+
+    start feed TestFileFeed;
+</pre></div></div>
+
+<p>Similar to previous examples, we need to define the datatype and dataset this feed uses. The &#x201c;path&#x201d; parameter refers to the local data file that we want to ingest data from. <tt>HOSTNAME</tt> can either be the IP address or node name of the machine which holds the file. <tt>LOCAL_FILE_PATH</tt> indicates the absolute path to the file on that machine. Similarly to <tt>socket_adapter</tt>, this feed takes <tt>adm</tt> formatted data records.</p></div></div>
+<div class="section">
+<h3><a name="Datatype_for_feed_and_target_dataset"></a>Datatype for feed and target dataset</h3>
+<p>The &#x201c;type-name&#x201d; parameter in create feed statement defines the <tt>datatype</tt> of the datasource. In most use cases, feed will have the same <tt>datatype</tt> as the target dataset. However, if we want to perform certain preprocess before the data records gets into the target dataset (append autogenerated key, apply user defined functions, etc.), we will need to define the datatypes for feed and dataset separately.</p>
+<div class="section">
+<h4><a name="Ingestion_with_autogenerated_key"></a>Ingestion with autogenerated key</h4>
+<p>AsterixDB supports using autogenerated uuid as the primary key for dataset. When we use this feature, we will need to define a datatype with the primary key field, and specify that field to be autogenerated when creating the dataset. Use that same datatype in feed definition will cause a type discrepancy since there is no such field in the datasource. Thus, we will need to define two separate datatypes for feed and dataset:</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    create type DBLPFeedType as closed {
+      dblpid: string,
+      title: string,
+      authors: string,
+      misc: string
+    }
+
+    create type DBLPDataSetType as open {
+      id: uuid,
+      dblpid: string,
+      title: string,
+      authors: string,
+      misc: string
+    }
+    create dataset DBLPDataset(DBLPDataSetType) primary key id autogenerated;
+
+    create feed DBLPFeed with {
+      &quot;adapter-name&quot;: &quot;socket_adapter&quot;,
+      &quot;sockets&quot;: &quot;127.0.0.1:10001&quot;,
+      &quot;address-type&quot;: &quot;IP&quot;,
+      &quot;type-name&quot;: &quot;DBLPFeedType&quot;,
+      &quot;format&quot;: &quot;adm&quot;
+    };
+
+    connect feed DBLPFeed to dataset DBLPDataset;
+
+    start feed DBLPFeed;
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h2><a name="Policies_for_Feed_Ingestion"></a><a name="FeedPolicies">Policies for Feed Ingestion</a></h2>
+<p>Multiple feeds may be concurrently operational on an AsterixDB cluster, each competing for resources (CPU cycles, network bandwidth, disk IO) to maintain pace with their respective data sources. As a data management system, AsterixDB is able to manage a set of concurrent feeds and make dynamic decisions related to the allocation of resources, resolving resource bottlenecks and the handling of failures. Each feed has its own set of constraints, influenced largely by the nature of its data source and the applications that intend to consume and process the ingested data. Consider an application that intends to discover the trending topics on Twitter by analyzing tweets that are being processed. Losing a few tweets may be acceptable. In contrast, when ingesting from a data source that provides a click-stream of ad clicks, losing data would translate to a loss of revenue for an application that tracks revenue by charging advertisers per click.</p>
+<p>AsterixDB allows a data feed to have an associated ingestion policy that is expressed as a collection of parameters and associated values. An ingestion policy dictates the runtime behavior of the feed in response to resource bottlenecks and failures. AsterixDB provides a set of policies that help customize the system&#x2019;s runtime behavior when handling excess objects.</p>
+<div class="section">
+<div class="section">
+<h4><a name="Policies"></a>Policies</h4>
+<ul>
+
+<li>
+
+<p><i>Spill</i>: Objects that cannot be processed by an operator for lack of resources (referred to as excess objects hereafter) should be persisted to the local disk for deferred processing.</p>
+</li>
+<li>
+
+<p><i>Discard</i>: Excess objects should be discarded.</p>
+</li>
+</ul>
+<p>Note that the end user may choose to form a custom policy.  For example, it is possible in AsterixDB to create a custom policy that spills excess objects to disk and subsequently resorts to throttling if the spillage crosses a configured threshold. In all cases, the desired ingestion policy is specified as part of the <tt>connect feed</tt> statement or else the &#x201c;Basic&#x201d; policy will be chosen as the default.</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    connect feed TwitterFeed to dataset Tweets using policy Basic;
+</pre></div></div></div></div></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/content/docs/0.9.9/interval_join.html b/content/docs/0.9.9/interval_join.html
new file mode 100644
index 0000000..61c2141
--- /dev/null
+++ b/content/docs/0.9.9/interval_join.html
@@ -0,0 +1,216 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/interval_join.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Interval Joins</title>
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="./css/site.css" />
+    <link rel="stylesheet" href="./css/print.css" media="print" />
+    <script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href="./" id="bannerLeft"><img src="images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li class="active"><a href="#"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href="./" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>Interval Joins</h1>
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="atoc" id="#toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#Interval_joins">Introduction</a></li>
+<li><a href="#Range_hint">Range Hints</a></li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Interval_Joins"></a><a name="Interval_joins" id="Interval_joins">Interval Joins</a></h2>
+<p>This system allows for the 13 types of Allen&#x2019;s interval-join relations. The default, when using these joins, is either Nested Loop, or Hybrid Hash Join. The optimal algorithm will be automatically selected based on the query. Hybrid Hash Join will be selected in cases where the relation includes an equality; these cases are: <tt>interval_starts()</tt>, <tt>interval_started_by()</tt>, <tt>interval_ends()</tt>, <tt>interval_ended_by()</tt>, <tt>interval_meets()</tt>, and <tt>interval_met_by()</tt>. Otherwise, the system will default to nested loop join. To use interval merge join you must include a range hint. Adding a range hint allows for the system to pick interval merge join.</p>
+<p>The 13 interval functions are <tt>interval_after()</tt>, <tt>interval_before()</tt>, <tt>interval_covers()</tt>, <tt>interval_covered_by()</tt>, <tt>interval_ends()</tt>, <tt>interval_ended_by()</tt>, <tt>interval_meets()</tt>, <tt>interval_met_by()</tt>, <tt>interval_overlaps()</tt>, <tt>interval_overlapping()</tt>, <tt>interval_overlapped_by()</tt>, <tt>interval_starts()</tt>, and <tt>interval_started_by()</tt>.</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="How_to_use_an_interval_join"></a>How to use an interval join</h5>
+
+<div>
+<div>
+<pre class="source">select f.name as staff, d.name as student
+from Staff as f, Students as d
+where interval_after(f.employment, d.attendance)
+</pre></div></div>
+
+<p>In this scenario, <tt>interval_after()</tt> can be replaced with any of the 13 join functions. Here is what each of the functions represent if A represents the first interval parameter, and B represents the second set interval parameter:</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Function </th>
+<th> Condition </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> Before(A, B) and After(B, A) </td>
+<td> A.end &lt; B.start </td></tr>
+<tr class="a">
+<td> Covers(A, B) and Covered_by(B, A) </td>
+<td> A.start &lt;= B.start and A.end &gt;= B.end </td></tr>
+<tr class="b">
+<td> Ends(A, B) and Ended_by(B, A) </td>
+<td> A.end = B.end and A.start &gt;= B.start </td></tr>
+<tr class="a">
+<td> Meets(A, B) and Met_by(B, A) </td>
+<td> A.end = B.start </td></tr>
+<tr class="b">
+<td> Overlaps(A, B) and Overlapped_by(B, A) </td>
+<td> A.start &lt; B.start and B.start &gt; A.end and A.end &gt; B.start </td></tr>
+<tr class="a">
+<td> Overlapping(A, B)</td>
+<td> (A.start &gt;= B.start and B.start &lt; A.end) or (B.end &lt;= A.end and B.end &lt; A.start)</td></tr>
+<tr class="b">
+<td> Starts(A, B) and Started_by(B, A) </td>
+<td> A.start = B.start and A.end &lt;= B.end </td></tr>
+</tbody>
+</table></div></div></div>
+<div class="section">
+<h3><a name="Using_a_Range_Hint"></a><a name="Range_hint" id="Range_hint"> Using a Range Hint </a></h3>
+<p>To use an efficient interval join the data must be partitioned with the details in a range hint. Interval joins with a range hint currently work for intervals types of date, datetime, or time; the range hint type must match the interval type. Adding a range hint directly before the interval join function will cause the system to pick interval merge join for these interval functions: <tt>interval_after()</tt>, <tt>interval_before()</tt>, <tt>interval_covers()</tt>, <tt>interval_covered_by()</tt>, <tt>interval_overlaps()</tt>, <tt>interval_overlapping()</tt>, <tt>interval_overlapped_by()</tt>. The other relations will ignore the range hint and pick Hybrid Hash Join as described earlier.</p>
+<p>Here is an example of how interval joins work with a range hint for all the supported data types. Suppose that we have two sets of data, a data set of staff members with an interval for length of employment and an id. The other dataset represents students, which may include an interval for attendance and an id. Each partition receives data based on the split points; The split points in the range hint must be strategically set by the user so that the data divides evenly among partitions. For example, if your query contains 1 split point, and the system is using two partitions, the data before the split point will be sent to the first partition, and the data after the split point will be sent to the second partition. This continues to work respectively based on the number of split points and number of partitions. Ideally, the number of split points should equal the number of partitions - 1.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Range_Hint_Example"></a>Range Hint Example</h5>
+
+<div>
+<div>
+<pre class="source">/*+ range [&lt;Expression&gt;, ..., ] */
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Range_Hint_Example_with_Date"></a>Range Hint Example with Date</h5>
+
+<div>
+<div>
+<pre class="source">select f.name as staff, d.name as student
+from Staff as f, Students as d
+where
+/*+ range [date(&quot;2003-06-30&quot;), date(&quot;2005-12-31&quot;), date(&quot;2008-06-30&quot;)] */
+interval_after(f.employment, d.attendance)
+order by f.name, d.name;
+</pre></div></div></div></div></div></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/content/docs/0.9.9/sqlpp/builtins.html b/content/docs/0.9.9/sqlpp/builtins.html
new file mode 100644
index 0000000..c869680
--- /dev/null
+++ b/content/docs/0.9.9/sqlpp/builtins.html
@@ -0,0 +1,15389 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/sqlpp/builtins.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Builtin Functions</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+    <script type="text/javascript" src="../js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href=".././" id="bannerLeft"><img src="../images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="../index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="../ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="../ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="../aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="../sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="../datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="../sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="../SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li class="active"><a href="#"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="../api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="../csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="../aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="../feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="../udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="../sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="../sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="../sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="../geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="../geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="../interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="../spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="../sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="../aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="../aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href=".././" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="../images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>Builtin Functions</h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="toc" id="toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#NumericFunctions">Numeric Functions</a></li>
+<li><a href="#StringFunctions">String Functions</a></li>
+<li><a href="#BinaryFunctions">Binary Functions</a></li>
+<li><a href="#SpatialFunctions">Spatial Functions</a></li>
+<li><a href="#SimilarityFunctions">Similarity Functions</a></li>
+<li><a href="#TokenizingFunctions">Tokenizing Functions</a></li>
+<li><a href="#TemporalFunctions">Temporal Functions</a></li>
+<li><a href="#ObjectFunctions">Object Functions</a></li>
+<li><a href="#AggregateFunctions">Aggregate Functions (Array Functions)</a></li>
+<li><a href="#ComparisonFunctions">Comparison Functions</a></li>
+<li><a href="#TypeFunctions">Type Functions</a></li>
+<li><a href="#ConditionalFunctions">Conditional Functions</a></li>
+<li><a href="#MiscFunctions">Miscellaneous Functions</a></li>
+<li><a href="#BitwiseFunctions">Bitwise Functions</a></li>
+<li><a href="#WindowFunctions">Window Functions</a></li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<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><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Numeric_Functions"></a><a name="NumericFunctions" id="NumericFunctions">Numeric Functions</a></h2>
+<div class="section">
+<h3><a name="abs"></a>abs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">abs(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the absolute value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The absolute value of the argument with the same type as the input argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="acos"></a>acos</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">acos(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc cosine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error,</li>
+<li>&#x201c;NaN&#x201d; for other legitimate numeric values.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="asin"></a>asin</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">asin(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc sine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error,</li>
+<li>&#x201c;NaN&#x201d; for other legitimate numeric values.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="atan"></a>atan</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">atan(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc tangent value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> arc tangent in radians for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="atan2"></a>atan2</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">atan2(numeric_value1, numeric_value2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc tangent value of numeric_value2/numeric_value1.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> arc tangent in radians for <tt>numeric_value1</tt> and <tt>numeric_value2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 0.4636476090008061, &quot;v2&quot;: 0.0, &quot;v3&quot;: 2.356194490192345 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ceil"></a>ceil</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ceil(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The ceiling value for the given number in the same type as the input argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: ceil(2013),
+  &quot;v2&quot;: ceil(-4036),
+  &quot;v3&quot;: ceil(0.3),
+  &quot;v4&quot;: ceil(float(&quot;-2013.2&quot;)),
+  &quot;v5&quot;: ceil(double(&quot;-2013.893823748327284&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="cos"></a>cos</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">cos(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the cosine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> cosine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="cosh"></a>cosh</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">cosh(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the hyperbolic cosine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> hyperbolic cosine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="degrees"></a>degrees</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">degrees(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts radians to degrees</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The degrees value for the given radians value. The returned value has type <tt>double</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: degrees(pi()) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 180.0 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="e"></a>e</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">e()
+</pre></div></div>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>e (base of the natural logarithm)</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: e() };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 2.718281828459045 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="exp"></a>exp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">exp(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes e<sup>numeric_value</sup>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>e<sup>numeric_value</sup>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="floor"></a>floor</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">floor(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The floor value for the given number in the same type as the input argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: floor(2013),
+  &quot;v2&quot;: floor(-4036),
+  &quot;v3&quot;: floor(0.8),
+  &quot;v4&quot;: floor(float(&quot;-2013.2&quot;)),
+  &quot;v5&quot;: floor(double(&quot;-2013.893823748327284&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ln"></a>ln</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ln(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes log<sub>e</sub>numeric_value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>log<sub>e</sub>numeric_value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="log"></a>log</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">log(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes log<sub>10</sub>numeric_value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>log<sub>10</sub>numeric_value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="pi"></a>pi</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">pi()
+</pre></div></div>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>Pi</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: pi() };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 3.141592653589793 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="power"></a>power</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">power(numeric_value1, numeric_value2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes numeric_value1<sup>numeric_value2</sup>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>numeric_value1<sup>numeric_value2</sup>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 1, &quot;v3&quot;: 0, &quot;v4&quot;: 1.4142135623730951 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="radians"></a>radians</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">radians(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts degrees to radians</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The radians value for the given degrees value. The returned value has type <tt>double</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: radians(180) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 3.141592653589793 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="round"></a>round</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">round(numeric_value[, round_digit])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The rounded value for the given number. The returned value has the following type:
+<ul>
+
+<li><tt>bigint</tt> if the input value has type <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt> or <tt>bigint</tt>,</li>
+<li><tt>float</tt> if the input value has type <tt>float</tt>,</li>
+<li><tt>double</tt> if the input value has type <tt>double</tt>;</li>
+</ul>
+</li>
+<li><tt>missing</tt> if the input value is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the input value is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will return a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: round(2013),
+  &quot;v2&quot;: round(-4036),
+  &quot;v3&quot;: round(0.8),
+  &quot;v4&quot;: round(float(&quot;-2013.256&quot;)),
+  &quot;v5&quot;: round(double(&quot;-2013.893823748327284&quot;))
+  &quot;v6&quot;: round(123456, -1),
+  &quot;v7&quot;: round(456.456, 2),
+  &quot;v8&quot;: round(456.456, -1),
+  &quot;v9&quot;: round(-456.456, -2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sign"></a>sign</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sign(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the sign of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the sign (a <tt>tinyint</tt>) of the argument, -1 for negative values, 0 for 0, and 1 for positive values,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 1, &quot;v2&quot;: 1, &quot;v3&quot;: 0, &quot;v4&quot;: 1, &quot;v5&quot;: -1 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sin"></a>sin</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sin(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the sine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> sine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sinh"></a>sinh</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sinh(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the hyperbolic sine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> hyperbolic sine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sqrt"></a>sqrt</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sqrt(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the square root of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> square root value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="tan"></a>tan</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">tan(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the tangent value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> tangent value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="tanh"></a>tanh</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">tanh(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the hyperbolic tangent value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> hyperbolic tangent value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="trunc"></a>trunc</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">trunc(numeric_value, number_digits)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<li><tt>number_digits</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> tangent value for the argument,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is <tt>missing</tt>,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-numeric value,</li>
+<li>the second argument is any other non-tinyint, non-smallint, non-integer, and non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="round_half_to_even"></a>round_half_to_even</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">round_half_to_even(numeric_value, [precision])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The rounded value for the given number in the same type as the input argument,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-numeric value,</li>
+<li>or, the second argument is any other non-tinyint, non-smallint, non-integer, or non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: round_half_to_even(2013),
+  &quot;v2&quot;: round_half_to_even(-4036),
+  &quot;v3&quot;: round_half_to_even(0.8),
+  &quot;v4&quot;: round_half_to_even(float(&quot;-2013.256&quot;)),
+  &quot;v5&quot;: round_half_to_even(double(&quot;-2013.893823748327284&quot;)),
+  &quot;v6&quot;: round_half_to_even(double(&quot;-2013.893823748327284&quot;), 2),
+  &quot;v7&quot;: round_half_to_even(2013, 4),
+  &quot;v8&quot;: round_half_to_even(float(&quot;-2013.256&quot;), 5)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="String_Functions"></a><a name="StringFunctions" id="StringFunctions">String Functions</a></h2>
+<div class="section">
+<h3><a name="concat"></a>concat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">concat(string1, string2, ...)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a concatenated string from arguments.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string1</tt>: a string value,</li>
+<li><tt>string2</tt>: a string value,</li>
+<li>&#x2026;.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a concatenated string from arguments,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">concat(&quot;test &quot;, &quot;driven &quot;, &quot;development&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;test driven development&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="contains"></a>contains</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">contains(string, substring_to_contain)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> contains the string <tt>substring_to_contain</tt></p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the given substring,</li>
+<li><tt>substring_to_contain</tt> : a target <tt>string</tt> that might be contained.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value, <tt>true</tt> if <tt>string</tt> contains <tt>substring_to_contain</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error,</li>
+<li><tt>false</tt> otherwise.</li>
+</ul>
+</li>
+<li>
+
+<p>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</p>
+</li>
+<li>Example:
+
+<div>
+<div>
+<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;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ends_with"></a>ends_with</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ends_with(string, substring_to_end_with)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> ends with the string <tt>substring_to_end_with</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might end with the given string,</li>
+<li><tt>substring_to_end_with</tt> : a <tt>string</tt> that might be contained as the ending substring.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value, <tt>true</tt> if <tt>string</tt> contains <tt>substring_to_contain</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error,</li>
+<li><tt>false</tt> otherwise.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: ends_with(&quot; love product-b its shortcut_menu is awesome:)&quot;, &quot;:)&quot;),
+  &quot;v2&quot;: ends_with(&quot; awsome:)&quot;, &quot;:-)&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="initcap_.28or_title.29"></a>initcap (or title)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">initcap(string)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> as the title form of the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: initcap(&quot;ASTERIXDB is here!&quot;), &quot;v2&quot;: title(&quot;ASTERIXDB is here!&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;Asterixdb Is Here!&quot;, &quot;v2&quot;: &quot;Asterixdb Is Here!&quot; }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="length"></a>length</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">length(string)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> or <tt>null</tt> that represents the string to be checked.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> that represents the length of <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">length(&quot;test string&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">11
+</pre></div></div>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">length(&quot;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (the emoji character &#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466; has 7 code points):</p>
+
+<div>
+<div>
+<pre class="source">7
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="lower"></a>lower</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">lower(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts a given string <tt>string</tt> to its lowercase form.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> as the lowercase form of the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">lower(&quot;ASTERIXDB&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;asterixdb&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ltrim"></a>ltrim</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ltrim(string[, chars]);
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
+<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a trimmed, new <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Related functions: see <tt>trim()</tt>, <tt>rtrim()</tt></li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">ltrim(&quot;me like x-phone&quot;, &quot;eml&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot; like x-phone&quot;
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
+
+<div>
+<div>
+<pre class="source">ltrim(&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;, &quot;&#x1f468;&#x200d;&#x1f466;&quot;)
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (only woman, girl and boy are left in the family):</p>
+
+<div>
+<div>
+<pre class="source">&quot;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="position"></a>position</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">position(string, string_pattern)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<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>
+<ul>
+
+<li>0-based: <tt>position</tt>, <tt>pos</tt>, <tt>position0</tt>, <tt>pos0</tt>.</li>
+<li>1-based: <tt>position1</tt>, <tt>pos1</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: position(&quot;ppphonepp&quot;, &quot;phone&quot;),
+  &quot;v2&quot;: position(&quot;hone&quot;, &quot;phone&quot;),
+  &quot;v3&quot;: position1(&quot;ppphonepp&quot;, &quot;phone&quot;),
+  &quot;v4&quot;: position1(&quot;hone&quot;, &quot;phone&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 2, &quot;v2&quot;: -1, v3&quot;: 3, &quot;v4&quot;: -1 }
+</pre></div></div>
+</li>
+<li>
+
+<p>Example of multi-code-point character:</p>
+
+<div>
+<div>
+<pre class="source">position(&quot;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x1f3c0;&quot;, &quot;&#x1f3c0;&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (the emoji family character has 7 code points):</p>
+
+<div>
+<div>
+<pre class="source">7
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_contains"></a>regexp_contains</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_contains(string, string_pattern[, string_flags])
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the strings <tt>string</tt> contains the regular expression pattern <tt>string_pattern</tt> (a Java regular expression pattern).</p>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li><tt>regexp_contains</tt>, <tt>regex_contains</tt>, <tt>contains_regexp</tt>, <tt>contains_regex</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: regexp_contains(&quot;pphonepp&quot;, &quot;p*hone&quot;),
+  &quot;v2&quot;: regexp_contains(&quot;hone&quot;, &quot;p+hone&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_like"></a>regexp_like</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_like(string, string_pattern[, string_flags])
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> exactly matches the regular expression pattern <tt>string_pattern</tt> (a Java regular expression pattern).</p>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li><tt>regexp_like</tt>, <tt>regex_like</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> that might be contained.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: regexp_like(&quot; can't stand acast the network is horrible:(&quot;, &quot;.*acast.*&quot;),
+  &quot;v2&quot;: regexp_like(&quot;acast&quot;, &quot;.*acst.*&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_position"></a>regexp_position</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_position(string, string_pattern[, string_flags])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<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>
+<li>1-Based: <tt>regexp_position1</tt>, <tt>regexp_pos1</tt>, <tt>regex_position1</tt> <tt>regex_pos1</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: regexp_position(&quot;pphonepp&quot;, &quot;p*hone&quot;),
+  &quot;v2&quot;: regexp_position(&quot;hone&quot;, &quot;p+hone&quot;),
+  &quot;v3&quot;: regexp_position1(&quot;pphonepp&quot;, &quot;p*hone&quot;),
+  &quot;v4&quot;: regexp_position1(&quot;hone&quot;, &quot;p+hone&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 0, &quot;v2&quot;: -1, &quot;v3&quot;: 1, &quot;v4&quot;: -1 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_replace"></a>regexp_replace</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_replace(string, string_pattern, string_replacement[, string_flags])
+regexp_replace(string, string_pattern, string_replacement[, replacement_limit])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li><tt>regexp_replace</tt>, <tt>regex_replace</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+<li><tt>string_replacement</tt> : a pattern <tt>string</tt> to be used as the replacement.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during replace.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>Returns a <tt>string</tt> that is obtained after the replacements.</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;like product-a the voicemail_service is awesome&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="repeat"></a>repeat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">repeat(string, n)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a string formed by repeating the input <tt>string</tt> <tt>n</tt> times.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be repeated,</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a string that repeats the input <tt>string</tt> <tt>n</tt> times,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-string value,</li>
+<li>or, the second argument is not a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt>.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">repeat(&quot;test&quot;, 3);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;testtesttest&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="replace"></a>replace</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">replace(string, search_string, replacement_string[, limit])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : an input <tt>string</tt>,</li>
+<li><tt>search_string</tt> : a <tt>string</tt>  substring to be searched for,</li>
+<li><tt>replacement_string</tt> : a <tt>string</tt> to be used as the replacement,</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>Returns a <tt>string</tt> that is obtained after the replacements,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value or non-integer <tt>limit</tt> will cause a type error,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: replace(&quot; like x-phone the voicemail_service is awesome&quot;, &quot; like x-phone&quot;, &quot;like product-a&quot;),
+  &quot;v2&quot;: replace(&quot;x-phone and x-phone&quot;, &quot;x-phone&quot;, &quot;product-a&quot;, 1)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: &quot;like product-a the voicemail_service is awesome&quot;,
+  &quot;v2&quot;: &quot;product-a and x-phone&quot;
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="reverse"></a>reverse</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">reverse(string)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be reversed</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a string containing characters from the the input <tt>string</tt> in the reverse order,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-string value</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">reverse(&quot;hello&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;olleh&quot;
+</pre></div></div>
+</li>
+<li>
+
+<p>Example of multi-code-point character (Korean):</p>
+
+<div>
+<div>
+<pre class="source">reverse(&quot;&#x1112;&#x1161;&#x11ab;&#x1100;&#x1173;&#x11af;&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (the Korean characters are splitted into code points and then the code points are reversed):</p>
+
+<div>
+<div>
+<pre class="source">&quot;&#x11af;&#x1173;&#x1100;&#x11ab;&#x1161;&#x1112;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="rtrim"></a>rtrim</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">rtrim(string[, chars]);
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
+<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a trimmed, new <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Related functions: see <tt>trim()</tt>, <tt>ltrim()</tt></li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: rtrim(&quot;i like x-phone&quot;, &quot;x-phone&quot;),
+  &quot;v2&quot;: rtrim(&quot;i like x-phone&quot;, &quot;onexph&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;i like &quot;, &quot;v2&quot;: &quot;i like x-&quot; }
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
+
+<div>
+<div>
+<pre class="source">rtrim(&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;, &quot;&#x1f468;&#x200d;&#x1f466;&quot;)
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (only man, woman and girl are left in the family):</p>
+
+<div>
+<div>
+<pre class="source">&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="split"></a>split</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">split(string, sep)
+</pre></div></div>
+</li>
+<li>
+
+<p>Splits the input <tt>string</tt> into an array of substrings separated by the string <tt>sep</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be split.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an array of substrings by splitting the input <tt>string</tt> by <tt>sep</tt>,</li>
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">split(&quot;test driven development&quot;, &quot; &quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;test&quot;, &quot;driven&quot;, &quot;development&quot; ]
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with two consecutive <tt>sep</tt>s in the <tt>string</tt>:</p>
+
+<div>
+<div>
+<pre class="source">split(&quot;123//456&quot;, &quot;/&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;123&quot;, &quot;&quot;, &quot;456&quot; ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="starts_with"></a>starts_with</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">starts_with(string, substring_to_start_with)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> starts with the string <tt>substring_to_start_with</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might start with the given string.</li>
+<li><tt>substring_to_start_with</tt> : a <tt>string</tt> that might be contained as the starting substring.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt>, returns <tt>true</tt> if <tt>string</tt> starts with the string <tt>substring_to_start_with</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error,</li>
+<li><tt>false</tt> otherwise.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot; : starts_with(&quot; like the plan, amazing&quot;, &quot; like&quot;),
+  &quot;v2&quot; : starts_with(&quot;I like the plan, amazing&quot;, &quot; like&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="substr"></a>substr</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">substr(string, offset[, length])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li>0-Based: <tt>substring</tt>, <tt>substr</tt>, <tt>substring0</tt>, <tt>substr0</tt>.</li>
+<li>1-Based: <tt>substring1</tt>, <tt>substr1</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the substring,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<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>
+<li>a <tt>null</tt> will be returned if:
+<ul>
+
+<li>the first argument is any other non-string value.</li>
+<li>the second argument is not a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt>.</li>
+<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>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: substr(&quot;test string&quot;, 6, 3), &quot;v2&quot;: substr1(&quot;test string&quot;, 6, 3) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;tri&quot;, &quot;v2&quot;: &quot;str&quot; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>substring</tt>.</p></div>
+<div class="section">
+<h3><a name="trim"></a>trim</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">trim(string[, chars]);
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
+<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a trimmed, new <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Related functions: see <tt>ltrim()</tt>, <tt>rtrim()</tt></li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">trim(&quot;i like x-phone&quot;, &quot;xphoen&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot; like &quot;
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
+<p>trim(&#x201c;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x201d;, &#x201c;&#x1f468;&#x200d;&#x1f466;&#x201d;)</p>
+</li>
+<li>
+
+<p>The expected result is (only woman and girl are left in the family):</p>
+
+<div>
+<div>
+<pre class="source"> &quot;&#x1f469;&#x200d;&#x1f467;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="upper"></a>upper</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">upper(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts a given string <tt>string</tt> to its uppercase form.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> as the uppercase form of the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">upper(&quot;hello&quot;)
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;HELLO&quot;
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="string_concat"></a>string_concat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">string_concat(array)
+</pre></div></div>
+</li>
+<li>
+
+<p>Concatenates an array of strings <tt>array</tt> into a single string.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the concatenated <tt>string</tt> value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-integer element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">string_concat([&quot;ASTERIX&quot;, &quot; &quot;, &quot;ROCKS!&quot;]);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;ASTERIX ROCKS!&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="string_join"></a>string_join</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">string_join(array, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Joins an array or multiset of strings <tt>array</tt> with the given separator <tt>string</tt> into a single string.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array</tt> : an <tt>array</tt> or <tt>multiset</tt> of strings (could be <tt>null</tt>) to be joined.</li>
+<li><tt>string</tt> : a <tt>string</tt> to serve as the separator.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the joined <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if the first argument array contains a <tt>missing</tt>,</li>
+<li><tt>null</tt> if the first argument array contains a <tt>null</tt> but does not contain a <tt>missing</tt>,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-array value, or contains any other non-string value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">string_join([&quot;ASTERIX&quot;, &quot;ROCKS~&quot;], &quot;!! &quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;ASTERIX!! ROCKS~&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="string_to_codepoint"></a>string_to_codepoint</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">string_to_codepoint(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts the string <tt>string</tt> to its code_based representation.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that will be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> of the code points for the string <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">string_to_codepoint(&quot;Hello ASTERIX!&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ 72, 101, 108, 108, 111, 32, 65, 83, 84, 69, 82, 73, 88, 33 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="codepoint_to_string"></a>codepoint_to_string</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">codepoint_to_string(array)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts the ordered code_based representation <tt>array</tt> to the corresponding string.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array</tt> : an <tt>array</tt> of integer code_points.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> representation of <tt>array</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-integer element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">codepoint_to_string([72, 101, 108, 108, 111, 32, 65, 83, 84, 69, 82, 73, 88, 33]);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;Hello ASTERIX!&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="substring_before"></a>substring_before</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">substring_before(string, string_pattern)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the substring from the given string <tt>string</tt> before the given pattern <tt>string_pattern</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
+<li><tt>string_pattern</tt> : a <tt>string</tt> pattern to be searched.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the substring,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">substring_before(&quot; like x-phone&quot;, &quot;x-phone&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot; like &quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="substring_after"></a>substring_after</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>substring_after(string, string_pattern);</p>
+</li>
+<li>
+
+<p>Returns the substring from the given string <tt>string</tt> after the given pattern <tt>string_pattern</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
+<li><tt>string_pattern</tt> : a <tt>string</tt> pattern to be searched.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the substring,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">substring_after(&quot; like x-phone&quot;, &quot;xph&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;one&quot;
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Binary_Functions"></a><a name="BinaryFunctions" id="BinaryFunctions">Binary Functions</a></h2>
+<div class="section">
+<h3><a name="parse_binary"></a>parse_binary</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>parse_binary(string, encoding)</p>
+</li>
+<li>
+
+<p>Creates a <tt>binary</tt> from an string encoded in <tt>encoding</tt> format.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : an encoded <tt>string</tt>,</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>binary</tt> that is decoded from the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<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>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>[ hex(&#x201c;ABCDEF0123456789&#x201d;), hex(&#x201c;ABCDEF0123456789&#x201d;), hex(&#x201c;4173746572697801&#x201d;) ]</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="print_binary"></a>print_binary</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>print_binary(binary, encoding)</p>
+</li>
+<li>
+
+<p>Prints a <tt>binary</tt> to the required encoding <tt>string</tt> format.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>binary</tt> : a <tt>binary</tt> data need to be printed.</li>
+<li><tt>encoding</tt> : a string notation specifies the expected encoding type. Currently we support <tt>hex</tt> and <tt>base64</tt> format.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the encoded format of a <tt>binary</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">[ print_binary(hex(&quot;ABCDEF0123456789&quot;), &quot;base64&quot;), print_binary(base64(&quot;q83vASNFZ4k=&quot;), &quot;hex&quot;) ]
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result are:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;q83vASNFZ4k=&quot;, &quot;ABCDEF0123456789&quot; ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="binary_length"></a>binary_length</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>binary_length(binary)</p>
+</li>
+<li>
+
+<p>Returns the number of bytes storing the binary data.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>binary</tt> : a <tt>binary</tt> value to be checked.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> that represents the number of bytes,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-binary input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">binary_length(hex(&quot;00AA&quot;))
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>2</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sub_binary"></a>sub_binary</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>sub_binary(binary, offset[, length])</p>
+</li>
+<li>
+
+<p>Returns the sub binary from the given <tt>binary</tt> based on the given start offset with the optional <tt>length</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>binary</tt> : a <tt>binary</tt> to be extracted,</li>
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>binary</tt> that represents the sub binary,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-binary value,</li>
+<li>or, the second argument is any other non-integer value,</li>
+<li>or, the third argument is any other non-integer value, if it is present.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">sub_binary(hex(&quot;AABBCCDD&quot;), 4);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is</p>
+
+<div>
+<div>
+<pre class="source">hex(&quot;DD&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="binary_concat"></a>binary_concat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>binary_concat(array)</p>
+</li>
+<li>
+
+<p>Concatenates a binary <tt>array</tt> or <tt>multiset</tt> into a single binary.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value  :
+<ul>
+
+<li>the concatenated <tt>binary</tt> value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-binary element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>binary_concat([hex(&#x201c;42&#x201d;), hex(&quot;&quot;), hex(&#x2018;42&#x2019;)]);</p>
+</li>
+<li>
+
+<p>The expected result is</p>
+<p>hex(&#x201c;4242&#x201d;)</p>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Spatial_Functions"></a><a name="SpatialFunctions" id="SpatialFunctions">Spatial Functions</a></h2>
+<div class="section">
+<h3><a name="create_point"></a>create_point</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_point(x, y)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>point</tt> using an <tt>x</tt> and <tt>y</tt> value.</p>
+</li>
+<li>Arguments:</li>
+<li><tt>x</tt> : a <tt>double</tt> that represents the x-coordinate,</li>
+<li><tt>y</tt> : a <tt>double</tt> that represents the y-coordinate.</li>
+<li>Return Value:</li>
+<li>a <tt>point</tt> representing the ordered pair (<tt>x</tt>, <tt>y</tt>),</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-double input value will cause a type error.</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;point&quot;: create_point(30.0,70.0) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;point&quot;: point(&quot;30.0,70.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_line"></a>create_line</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_line(point1, point2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>line</tt> using <tt>point1</tt> and <tt>point2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt> that represents the start point of the line.</li>
+<li><tt>point2</tt> : a <tt>point</tt> that represents the end point of the line.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a spatial <tt>line</tt> created using the points provided in <tt>point1</tt> and <tt>point2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;line&quot;: create_line(create_point(30.0,70.0), create_point(50.0,90.0)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;line&quot;: line(&quot;30.0,70.0 50.0,90.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_rectangle"></a>create_rectangle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_rectangle(point1, point2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>rectangle</tt> using <tt>point1</tt> and <tt>point2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt> that represents the lower_left point of the rectangle.</li>
+<li><tt>point2</tt> : a <tt>point</tt> that represents the upper_right point of the rectangle.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a spatial <tt>rectangle</tt> created using the points provided in <tt>point1</tt> and <tt>point2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;rectangle&quot;: create_rectangle(create_point(30.0,70.0), create_point(50.0,90.0)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;rectangle&quot;: rectangle(&quot;30.0,70.0 50.0,90.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_circle"></a>create_circle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_circle(point, radius)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>circle</tt> using <tt>point</tt> and <tt>radius</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point</tt> : a <tt>point</tt> that represents the center of the circle.</li>
+<li><tt>radius</tt> : a <tt>double</tt> that represents the radius of the circle.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a spatial <tt>circle</tt> created using the center point and the radius provided in <tt>point</tt> and <tt>radius</tt>.</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-point value,</li>
+<li>or, the second argument is any other non-double value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;circle&quot;: create_circle(create_point(30.0,70.0), 5.0) }
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;circle&quot;: circle(&quot;30.0,70.0 5.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_polygon"></a>create_polygon</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_polygon(array)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array</tt> : an array of doubles representing the points of the polygon.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>polygon</tt>, represents a spatial simple polygon created using the points provided in <tt>array</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-double element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;polygon&quot;: create_polygon([1.0,1.0,2.0,2.0,3.0,3.0,4.0,4.0]) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_x.2Fget_y"></a>get_x/get_y</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_x(point) or get_y(point)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the x or y coordinates of a point <tt>point</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point</tt> : a <tt>point</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> representing the x or y coordinates of the point <tt>point</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;x_coordinate&quot;: 2.3, &quot;y_coordinate&quot;: 5.0 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_points"></a>get_points</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_points(spatial_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an ordered array of the points forming the spatial object <tt>spatial_object</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>spatial_object</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> of the points forming the spatial object <tt>spatial_object</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-spatial-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_points(create_polygon([1.0,1.0,2.0,2.0,3.0,3.0,4.0,4.0]))
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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;) ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_center.2Fget_radius"></a>get_center/get_radius</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_center(circle_expression) or get_radius(circle_expression)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the center and the radius of a circle <tt>circle_expression</tt>, respectively.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>circle_expression</tt> : a <tt>circle</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>point</tt> or <tt>double</tt>, represent the center or radius of the circle <tt>circle_expression</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-circle input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;circle_radius&quot;: get_radius(create_circle(create_point(6.0,3.0), 1.0)),
+  &quot;circle_center&quot;: get_center(create_circle(create_point(6.0,3.0), 1.0))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;circle_radius&quot;: 1.0, &quot;circle_center&quot;: point(&quot;6.0,3.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_distance"></a>spatial_distance</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_distance(point1, point2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the Euclidean distance between <tt>point1</tt> and <tt>point2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt>.</li>
+<li><tt>point2</tt> : a <tt>point</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> as the Euclidean distance between <tt>point1</tt> and <tt>point2</tt>.</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">spatial_distance(point(&quot;47.44,80.65&quot;), create_point(30.0,70.0));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">20.434678857275934
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_area"></a>spatial_area</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_area(spatial_2d_expression)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the spatial area of <tt>spatial_2d_expression</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>spatial_2d_expression</tt> : a <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> representing the area of <tt>spatial_2d_expression</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-2d-spatial-object will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">spatial_area(create_circle(create_point(0.0,0.0), 5.0));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">78.53981625
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_intersect"></a>spatial_intersect</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_intersect(spatial_object1, spatial_object2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether <tt>@arg1</tt> and <tt>@arg2</tt> spatially intersect each other.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>spatial_object1</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+<li><tt>spatial_object2</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> representing whether <tt>spatial_object1</tt> and <tt>spatial_object2</tt> spatially overlap with each other,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-spatial-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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)));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">true
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_cell"></a>spatial_cell</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_cell(point1, point2, x_increment, y_increment)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the grid cell that <tt>point1</tt> belongs to.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt> representing the point of interest that its grid cell will be returned.</li>
+<li><tt>point2</tt> : a <tt>point</tt> representing the origin of the grid.</li>
+<li><tt>x_increment</tt> : a <tt>double</tt>, represents X increments.</li>
+<li><tt>y_increment</tt> : a <tt>double</tt>, represents Y increments.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>rectangle</tt> representing the grid cell that <tt>point1</tt> belongs to,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-point value,</li>
+<li>or, the second or third argument is any other non-double value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">spatial_cell(point(&quot;39.28,70.48&quot;), create_point(20.0,50.0), 5.5, 6.0);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">rectangle(&quot;36.5,68.0 42.0,74.0&quot;);
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Similarity_Functions"></a><a name="SimilarityFunctions" id="SimilarityFunctions">Similarity Functions</a></h2>
+<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>
+<div class="section">
+<h3><a name="edit_distance"></a>edit_distance</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">edit_distance(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the edit distance of <tt>expression1</tt> and <tt>expression2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
+<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> that represents the edit distance between <tt>expression1</tt> and <tt>expression2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">edit_distance(&quot;SuzannaTillson&quot;, &quot;Suzanna Tilson&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">2
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="edit_distance_check"></a>edit_distance_check</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">edit_distance_check(expression1, expression2, threshold)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the edit distance of <tt>expression1</tt> and <tt>expression2</tt> is within a given threshold.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
+<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
+<li><tt>threshold</tt> : a <tt>bigint</tt> that represents the distance threshold.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> with two items:
+<ul>
+
+<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>
+<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>
+<li>If the first item is false, then the second item is set to 2147483647.</li>
+</ul>
+</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-string value,</li>
+<li>or, the third argument is any other non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">edit_distance_check(&quot;happy&quot;,&quot;hapr&quot;,2);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ true, 2 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="edit_distance_contains"></a>edit_distance_contains</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">edit_distance_contains(expression1, expression2, threshold)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
+<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
+<li><tt>threshold</tt> : a <tt>bigint</tt> that represents the distance threshold.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> with two items:
+<ul>
+
+<li>The first item contains a <tt>boolean</tt> value representing whether <tt>expression1</tt> can contain <tt>expression2</tt>.</li>
+<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>
+</ul>
+</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-string value,</li>
+<li>or, the third argument is any other non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">edit_distance_contains(&quot;happy&quot;,&quot;hapr&quot;,2);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ true, 1 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="similarity_jaccard"></a>similarity_jaccard</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">similarity_jaccard(array1, array2)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array1</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+<li><tt>array2</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>float</tt> that represents the Jaccard similarity of <tt>array1</tt> and <tt>array2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if any element in any input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-integer element in any input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Note: a <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">keyword index</a> can be utilized for this function.</p>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">similarity_jaccard([1,5,8,9], [1,5,9,10]);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0.6
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="similarity_jaccard_check"></a>similarity_jaccard_check</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">similarity_jaccard_check(array1, array2, threshold)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>array1</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+<li><tt>array2</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+<li><tt>threshold</tt> : a <tt>double</tt> that represents the similarity threshold.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> with two items:
+<ul>
+
+<li>The first item contains a <tt>boolean</tt> value representing whether <tt>array1</tt> and <tt>array2</tt> are similar.</li>
+<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>
+</ul>
+</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if any element in any input array is <tt>missing</tt>,</li>
+<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>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-array value,
+<ul>
+
+<li>or, the third argument is any other non-double value.</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Note: a <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">keyword index</a> can be utilized for this function.</p>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">similarity_jaccard_check([1,5,8,9], [1,5,9,10], 0.6);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ false, 0.0 ]
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Tokenizing_Functions"></a><a name="TokenizingFunctions" id="TokenizingFunctions">Tokenizing Functions</a></h2>
+<div class="section">
+<h3><a name="word_tokens"></a>word_tokens</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">word_tokens(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an array of word tokens of <tt>string</tt> using non_alphanumeric characters as delimiters.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that will be tokenized.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> of <tt>string</tt> word tokens,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">word_tokens(&quot;I like the phone, awesome!&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;i&quot;, &quot;like&quot;, &quot;the&quot;, &quot;phone&quot;, &quot;awesome&quot; ]
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Temporal_Functions"></a><a name="TemporalFunctions" id="TemporalFunctions">Temporal Functions</a></h2>
+<div class="section">
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_year/get_month/get_day/get_hour/get_minute/get_second/get_millisecond(temporal_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Accessors for accessing fields in a temporal value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> value representing the field to be extracted,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;year&quot;: get_year(date(&quot;2010-10-30&quot;)),
+  &quot;month&quot;: get_month(datetime(&quot;1987-11-19T23:49:23.938&quot;)),
+  &quot;day&quot;: get_day(date(&quot;2010-10-30&quot;)),
+  &quot;hour&quot;: get_hour(time(&quot;12:23:34.930&quot;)),
+  &quot;min&quot;: get_minute(duration(&quot;P3Y73M632DT49H743M3948.94S&quot;)),
+  &quot;second&quot;: get_second(datetime(&quot;1987-11-19T23:49:23.938&quot;)),
+  &quot;ms&quot;: get_millisecond(duration(&quot;P3Y73M632DT49H743M3948.94S&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;year&quot;: 2010, &quot;month&quot;: 11, &quot;day&quot;: 30, &quot;hour&quot;: 12, &quot;min&quot;: 28, &quot;second&quot;: 23, &quot;ms&quot;: 94 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="adjust_datetime_for_timezone"></a>adjust_datetime_for_timezone</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">adjust_datetime_for_timezone(datetime, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Adjusts the given datetime <tt>datetime</tt> by applying the timezone information <tt>string</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt> : a <tt>datetime</tt> value to be adjusted.</li>
+<li><tt>string</tt> : a <tt>string</tt> representing the timezone information.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> value representing the new datetime after being adjusted by the timezone information,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-datetime value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">adjust_datetime_for_timezone(datetime(&quot;2008-04-26T10:10:00&quot;), &quot;+08:00&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;2008-04-26T18:10:00.000+08:00&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="adjust_time_for_timezone"></a>adjust_time_for_timezone</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">adjust_time_for_timezone(time, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Adjusts the given time <tt>time</tt> by applying the timezone information <tt>string</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>time</tt> : a <tt>time</tt> value to be adjusted.</li>
+<li><tt>string</tt> : a <tt>string</tt> representing the timezone information.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> value representing the new time after being adjusted by the timezone information,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-time value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">adjust_time_for_timezone(get_time_from_datetime(datetime(&quot;2008-04-26T10:10:00&quot;)), &quot;+08:00&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;18:10:00.000+08:00&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="calendar_duration_from_datetime"></a>calendar_duration_from_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">calendar_duration_from_datetime(datetime, duration_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a user_friendly representation of the duration <tt>duration_value</tt> based on the given datetime <tt>datetime</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt> : a <tt>datetime</tt> value to be used as the reference time point.</li>
+<li><tt>duration_value</tt> : a <tt>duration</tt> value to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>duration</tt> value with the duration as <tt>duration_value</tt> but with a user_friendly representation,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-datetime value,</li>
+<li>or, the second argument is any other non-duration input value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">calendar_duration_from_datetime(
+      datetime(&quot;2016-03-26T10:10:00&quot;),
+      datetime(&quot;2016-03-26T10:10:00&quot;) - datetime(&quot;2011-01-01T00:00:00&quot;)
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">duration(&quot;P5Y2M24DT10H10M&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_year_month_duration.2Fget_day_time_duration"></a>get_year_month_duration/get_day_time_duration</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_year_month_duration/get_day_time_duration(duration_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Extracts the correct <tt>duration</tt> subtype from <tt>duration_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>duration_value</tt> : a <tt>duration</tt> value to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>year_month_duration</tt> value or a <tt>day_time_duration</tt> value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_year_month_duration(duration(&quot;P12M50DT10H&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">year_month_duration(&quot;P1Y&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">months_from_year_month_duration/ms_from_day_time_duration(duration_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Extracts the number of months or the number of milliseconds from the <tt>duration</tt> subtype.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>duration_value</tt> : a <tt>duration</tt> of the correct subtype.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> representing the number of months/milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;months&quot;: months_from_year_month_duration(get_year_month_duration(duration(&quot;P5Y7MT50M&quot;))),
+    &quot;milliseconds&quot;: ms_from_day_time_duration(get_day_time_duration(duration(&quot;P5Y7MT50M&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{&quot;months&quot;: 67, &quot;milliseconds&quot;: 3000000}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="duration_from_months.2Fduration_from_ms"></a>duration_from_months/duration_from_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">duration_from_months/duration_from_ms(number_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates a <tt>duration</tt> from <tt>number_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>number_value</tt> : a <tt>bigint</tt> representing the number of months/milliseconds</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>duration</tt> containing <tt>number_value</tt> value for months/milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">duration_from_months(8);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">duration(&quot;P8M&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="duration_from_interval"></a>duration_from_interval</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">duration_from_interval(interval_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates a <tt>duration</tt> from <tt>interval_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval_value</tt> : an <tt>interval</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>duration</tt> representing the time in the <tt>interval_value</tt></li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;dr1&quot; : duration_from_interval(interval(date(&quot;2010-10-30&quot;), date(&quot;2010-12-21&quot;))),
+  &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;))),
+  &quot;dr3&quot; : duration_from_interval(interval(time(&quot;12:32:38&quot;), time(&quot;20:29:20&quot;))),
+  &quot;dr4&quot; : duration_from_interval(null)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;dr1&quot;: day_time_duration(&quot;P52D&quot;),
+  &quot;dr2&quot;: day_time_duration(&quot;P31DT1H1M1.111S&quot;),
+  &quot;dr3&quot;: day_time_duration(&quot;PT7H56M42S&quot;),
+  &quot;dr4&quot;: null
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="current_date"></a>current_date</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">current_date()
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the current date.</p>
+</li>
+<li>Arguments: None</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date</tt> value of the date when the function is called.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="current_time"></a>current_time</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">current_time()
+</pre></div></div>
+</li>
+<li>
+
+<p>Get the current time</p>
+</li>
+<li>Arguments: None</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt> value of the time when the function is called.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="current_datetime"></a>current_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">current_datetime()
+</pre></div></div>
+</li>
+<li>
+
+<p>Get the current datetime</p>
+</li>
+<li>Arguments: None</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value of the datetime when the function is called.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_date_from_datetime"></a>get_date_from_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_date_from_datetime(datetime)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the date value from the given datetime value <tt>datetime</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt>: a <tt>datetime</tt> value to be extracted from.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date</tt> value from the datetime,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>get_date_from_datetime(datetime(&#x201c;2016-03-26T10:10:00&#x201d;));</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>date(&#x201c;2016-03-26&#x201d;)</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_time_from_datetime"></a>get_time_from_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_time_from_datetime(datetime)
+</pre></div></div>
+</li>
+<li>
+
+<p>Get the time value from the given datetime value <tt>datetime</tt></p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt>: a <tt>datetime</tt> value to be extracted from.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt> value from the datetime.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_time_from_datetime(datetime(&quot;2016-03-26T10:10:00&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time(&quot;10:10:00.000&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="day_of_week"></a>day_of_week</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">day_of_week(date[, week_start_day])
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the day of the week for a given date (1_7)</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+<li><tt>week_start_day</tt>: (Optional) an integer or a string value (case-insensitive) specifying the day of the week to start counting from: 1=Sun[day], 2=Mon[day], &#x2026;, 7=Sat[urday]. If omitted, the default is 1 (Sunday).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the day of the week (1_7),</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;day_1&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;)),
+  &quot;day_2&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), 2),
+  &quot;day_3&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), &quot;Monday&quot;),
+  &quot;day_4&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), &quot;MON&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;day_1&quot;: 1, &quot;day_2&quot;: 7, &quot;day_3&quot;: 7, &quot;day_4&quot;: 7 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="day_of_year"></a>day_of_year</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">day_of_year(date)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the day of the year for a given date</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the day of the year,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">day_of_year(date(&quot;2011-12-31&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">365
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="week_of_year"></a>week_of_year</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">week_of_year(date[, week_start_day])
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the week of the year for a given date</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+<li><tt>week_start_day</tt>: (Optional) an integer or a string value (case-insensitive) specifying the day of the week to start counting from: 1=Sun[day], 2=Mon[day], &#x2026;, 7=Sat[urday]. If omitted, the default is 1 (Sunday).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the week of the year,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;week_1&quot;: week_of_year(date(&quot;2012-12-01&quot;)),
+  &quot;week_2&quot;: week_of_year(date(&quot;2012-12-01&quot;), 2),
+  &quot;week_3&quot;: week_of_year(date(&quot;2012-12-01&quot;), &quot;Monday&quot;),
+  &quot;week_4&quot;: week_of_year(date(&quot;2012-12-01&quot;), &quot;MON&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;week_1&quot;: 48, &quot;week_2&quot;: 49, &quot;week_3&quot;: 49, &quot;week_4&quot;: 49 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="quarter_of_year"></a>quarter_of_year</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">quarter_of_year(date)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the quarter of the year for a given date</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the quarter of the year (1_4),</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">quarter_of_year(date(&quot;2011-12-31&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">4
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="datetime_from_date_time"></a>datetime_from_date_time</h3>
+<ul>
+
+<li>Syntax:</li>
+</ul>
+<p>datetime_from_date_time(date,time)</p>
+<ul>
+
+<li>Gets a datetime representing the combination of <tt>date</tt> and <tt>time</tt>
+<ul>
+
+<li>Arguments:</li>
+<li><tt>date</tt>: a <tt>date</tt> value</li>
+<li><tt>time</tt> a <tt>time</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value by combining <tt>date</tt> and <tt>time</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if
+<ul>
+
+<li>the first argument is any other non-date value,</li>
+<li>or, the second argument is any other non-time value.</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="date_from_unix_time_in_days"></a>date_from_unix_time_in_days</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">date_from_unix_time_in_days(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a date representing the time after <tt>numeric_value</tt> days since 1970-01-01.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date</tt> value as the time after <tt>numeric_value</tt> days since 1970-01-01,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">date_from_unix_time_in_days(15800);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>date(&#x201c;2013-04-05&#x201d;)</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="datetime_from_unix_time_in_ms"></a>datetime_from_unix_time_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">datetime_from_unix_time_in_ms(numeric_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a datetime representing the time after <tt>numeric_value</tt> milliseconds since 1970-01-01T00:00:00Z.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<li><tt>string</tt> : (Optional) a string representing the target timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value as the time in the target time zone after <tt>numeric_value</tt> milliseconds since 1970-01-01T00:00:00Z,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+   &quot;datetime_1&quot;: datetime_from_unix_time_in_ms(1365139700000),
+   &quot;datetime_2&quot;: datetime_from_unix_time_in_ms(1365139700000, &quot;America/Los_Angeles&quot;)
+ };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;datetime_1&#x201d;: datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;), &#x201c;datetime_2&#x201d;: datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;) }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="datetime_from_unix_time_in_secs"></a>datetime_from_unix_time_in_secs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">datetime_from_unix_time_in_secs(numeric_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a datetime representing the time after <tt>numeric_value</tt> seconds since 1970-01-01T00:00:00Z.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<li><tt>string</tt> : (Optional) a string representing the target timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value as the time in the target time zone after <tt>numeric_value</tt> seconds since 1970-01-01T00:00:00Z,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;datetime_1&quot;: datetime_from_unix_time_in_secs(1365139700),
+  &quot;datetime_2&quot;: datetime_from_unix_time_in_secs(1365139700, &quot;America/Los_Angeles&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;datetime_1&#x201d;: datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;), &#x201c;datetime_2&#x201d;: datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;) }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="time_from_unix_time_in_ms"></a>time_from_unix_time_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">time_from_unix_time_in_ms(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a time representing the time after <tt>numeric_value</tt> milliseconds since 00:00:00.000.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt> value as the time after <tt>numeric_value</tt> milliseconds since 00:00:00.000,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">time_from_unix_time_in_ms(3748);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time(&quot;00:00:03.748&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_date_in_days"></a>unix_time_from_date_in_days</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_date_in_days(date_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the number of days since 1970-01-01 for <tt>date_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date_value</tt>: a <tt>date</tt> value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of days,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>unix_time_from_date_in_days(date(&#x201c;2013-04-05&#x201d;));</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>15800</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_datetime_in_ms"></a>unix_time_from_datetime_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_datetime_in_ms(datetime_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the time in milliseconds since 1970-01-01T00:00:00Z for <tt>datetime_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime_value</tt> : a <tt>datetime</tt> value.</li>
+<li><tt>string</tt> : (Optional) a string representing the source timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: unix_time_from_datetime_in_ms(datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;)), &#x201c;unix_time_2&#x201d;: unix_time_from_datetime_in_ms(datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;), &#x201c;America/Los_Angeles&#x201d;) };</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: 1365139700000, &#x201c;unix_time_2&#x201d;: 1365139700000 }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_datetime_in_secs"></a>unix_time_from_datetime_in_secs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_datetime_in_secs(datetime_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the time in seconds since 1970-01-01T00:00:00Z for <tt>datetime_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime_value</tt> : a <tt>datetime</tt> value.</li>
+</ul>
+</li>
+<li><tt>string</tt> : (Optional) a string representing the source timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of seconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: unix_time_from_datetime_in_secs(datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;)), &#x201c;unix_time_2&#x201d;: unix_time_from_datetime_in_secs(datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;), &#x201c;America/Los_Angeles&#x201d;) };</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: 1365139700, &#x201c;unix_time_2&#x201d;: 1365139700 }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_time_in_ms"></a>unix_time_from_time_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_time_in_ms(time_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the time the milliseconds since 00:00:00.000 for <tt>time_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>time_value</tt> : a <tt>time</tt> value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_time_in_ms(time(&quot;00:00:03.748&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3748
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="parse_date.2Fparse_time.2Fparse_datetime"></a>parse_date/parse_time/parse_datetime</h3>
+<ul>
+
+<li>Syntax:</li>
+</ul>
+<p>parse_date/parse_time/parse_datetime(date,formatting_expression)</p>
+<ul>
+
+<li>Creates a <tt>date/time/date_time</tt> value by treating <tt>date</tt> with formatting <tt>formatting_expression</tt></li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>string</tt> value representing the <tt>date/time/datetime</tt>.</li>
+<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>
+<li><tt>h</tt> hours</li>
+<li><tt>m</tt> minutes</li>
+<li><tt>s</tt> seconds</li>
+<li><tt>n</tt> (or <tt>S</tt>) milliseconds</li>
+<li><tt>a</tt> am/pm</li>
+<li><tt>z</tt> timezone (parsed and ignored)</li>
+<li><tt>Y</tt> year</li>
+<li><tt>Q</tt> quarter of year (1-4)</li>
+<li><tt>QQ</tt> quarter of year (01-04)</li>
+<li><tt>M</tt> month</li>
+<li><tt>D</tt> day</li>
+<li><tt>EEE</tt> weekday (abbreviated name, parsed and ignored)</li>
+<li><tt>EEEE</tt> weekday (full name, parsed and ignored)</li>
+<li><tt>_</tt>, <tt>'</tt>, <tt>/</tt>, <tt>.</tt>, <tt>,</tt>, <tt>T</tt> seperators for both time and date</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date/time/date_time</tt> value corresponding to <tt>date</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:</li>
+<li>the first argument is any other non-date value,</li>
+<li>the second argument is any other non-string value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">parse_time(&quot;30:30&quot;,&quot;m:s&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time(&quot;00:30:30.000&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="print_date.2Fprint_time.2Fprint_datetime"></a>print_date/print_time/print_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">print_date/print_time/print_datetime(date,formatting_expression)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date/time/datetime</tt> value.</li>
+<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>
+<li><tt>h</tt> hours</li>
+<li><tt>m</tt> minutes</li>
+<li><tt>s</tt> seconds</li>
+<li><tt>n</tt> (or <tt>S</tt>) milliseconds</li>
+<li><tt>a</tt> am/pm</li>
+<li><tt>Y</tt> year</li>
+<li><tt>Q</tt> quarter of year (1-4)</li>
+<li><tt>QQ</tt> quarter of year (01-04)</li>
+<li><tt>M</tt> month</li>
+<li><tt>MMM</tt> month (abbreviated name)</li>
+<li><tt>MMMM</tt> month (full name)</li>
+<li><tt>D</tt> day</li>
+<li><tt>DDD</tt> day of year</li>
+<li><tt>EEE</tt> weekday (abbreviated name)</li>
+<li><tt>EEEE</tt> weekday (full name)</li>
+<li><tt>_</tt>, <tt>'</tt>, <tt>/</tt>, <tt>.</tt>, <tt>,</tt>, <tt>T</tt> seperators for both time and date</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> value corresponding to <tt>date</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-date value,</li>
+<li>the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">print_time(time(&quot;00:30:30.000&quot;),&quot;m:s&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;30:30&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_interval_start.2C_get_interval_end"></a>get_interval_start, get_interval_end</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_interval_start/get_interval_end(interval)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the start/end of the given interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval</tt>: the interval to be accessed.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-interval value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;start&quot;: get_interval_start(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
+  &quot;end&quot;: get_interval_end(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;start&quot;: date(&quot;1984-01-01&quot;), &quot;end&quot;: date(&quot;1985-01-01&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<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)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the start/end of the given interval for the specific date/datetime/time type.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval</tt>: the interval to be accessed.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt>, <tt>date</tt>, or <tt>datetime</tt> (depending on the function) representing the starting or ending time,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-interval value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;start1&quot;: get_interval_start_date(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
+  &quot;end1&quot;: get_interval_end_date(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
+  &quot;start2&quot;: get_interval_start_datetime(interval_start_from_datetime(&quot;1984-01-01T08:30:00.000&quot;, &quot;P1Y1H&quot;)),
+  &quot;end2&quot;: get_interval_end_datetime(interval_start_from_datetime(&quot;1984-01-01T08:30:00.000&quot;, &quot;P1Y1H&quot;)),
+  &quot;start3&quot;: get_interval_start_time(interval_start_from_time(&quot;08:30:00.000&quot;, &quot;P1H&quot;)),
+  &quot;end3&quot;: get_interval_end_time(interval_start_from_time(&quot;08:30:00.000&quot;, &quot;P1H&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;start1&quot;: date(&quot;1984-01-01&quot;),
+  &quot;end1&quot;: date(&quot;1985-01-01&quot;),
+  &quot;start2&quot;: datetime(&quot;1984-01-01T08:30:00.000&quot;),
+  &quot;end2&quot;: datetime(&quot;1985-01-01T09:30:00.000&quot;),
+  &quot;start3&quot;: time(&quot;08:30:00.000&quot;),
+  &quot;end3&quot;: time(&quot;09:30:00.000&quot;)
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_overlapping_interval"></a>get_overlapping_interval</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_overlapping_interval(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the start/end of the given interval for the specific date/datetime/time type.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>: an <tt>interval</tt> value</li>
+<li><tt>interval2</tt>: an <tt>interval</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;))),
+  &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;))),
+  &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;))),
+  &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;))),
+  &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;))),
+  &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;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;overlap1&quot;: interval(time(&quot;12:23:39.000&quot;), time(&quot;18:27:19.000&quot;)),
+  &quot;overlap2&quot;: null,
+  &quot;overlap3&quot;: null,
+  &quot;overlap4&quot;: interval(date(&quot;2013-01-01&quot;), date(&quot;2014-01-01&quot;)),
+  &quot;overlap5&quot;: interval(datetime(&quot;1989-03-04T12:23:39.000&quot;), datetime(&quot;2000-10-30T18:27:19.000&quot;)),
+  &quot;overlap6&quot;: null
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_bin"></a>interval_bin</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_bin(time_to_bin, time_bin_anchor, duration_bin_size)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the <tt>interval</tt> value representing the bin containing the <tt>time_to_bin</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>time_to_bin</tt>: a date/time/datetime value representing the time to be binned.</li>
+<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>
+<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:
+<ul>
+
+<li>datetime +|_ year_month_duration</li>
+<li>datetime +|_ day_time_duration</li>
+<li>date +|_ year_month_duration</li>
+<li>date +|_ day_time_duration</li>
+<li>time +|_ day_time_duration</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:</li>
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument or the second argument is any other non-date/non-time/non-datetime value,</li>
+<li>or, the second argument is any other non-year_month_duration/non-day_time_duration value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>{ &#x201c;bin1&#x201d;: interval_bin(date(&#x201c;2010-10-30&#x201d;), date(&#x201c;1990-01-01&#x201d;), year_month_duration(&#x201c;P1Y&#x201d;)), &#x201c;bin2&#x201d;: interval_bin(datetime(&#x201c;1987-11-19T23:49:23.938&#x201d;), datetime(&#x201c;1990-01-01T00:00:00.000&#x201d;), year_month_duration(&#x201c;P6M&#x201d;)), &#x201c;bin3&#x201d;: interval_bin(time(&#x201c;12:23:34.930+07:00&#x201d;), time(&#x201c;00:00:00&#x201d;), day_time_duration(&#x201c;PT1M&#x201d;)), &#x201c;bin4&#x201d;: interval_bin(datetime(&#x201c;1987-11-19T23:49:23.938&#x201d;), datetime(&#x201c;2013-01-01T00:00:00.000&#x201d;), day_time_duration(&#x201c;PT24H&#x201d;)) };</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;bin1&#x201d;: interval(date(&#x201c;2010-01-01&#x201d;), date(&#x201c;2011-01-01&#x201d;)), &#x201c;bin2&#x201d;: interval(datetime(&#x201c;1987-07-01T00:00:00.000&#x201d;), datetime(&#x201c;1988-01-01T00:00:00.000&#x201d;)), &#x201c;bin3&#x201d;: interval(time(&#x201c;12:23:00.000&#x201d;), time(&#x201c;12:24:00.000&#x201d;)), &#x201c;bin4&#x201d;: interval(datetime(&#x201c;1987-11-19T00:00:00.000&#x201d;), datetime(&#x201c;1987-11-20T00:00:00.000&#x201d;)) }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_start_from_date.2Ftime.2Fdatetime"></a>interval_start_from_date/time/datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_start_from_date/time/datetime(date/time/datetime, duration)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>interval</tt> value representing the interval starting from the given time point with the length of duration,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument or the second argument is any other non-date/non-time/non-datetime value,</li>
+<li>or, the second argument is any other non-duration value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval1&quot;: interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;),
+  &quot;interval2&quot;: interval_start_from_time(time(&quot;02:23:28.394&quot;), &quot;PT3H24M&quot;),
+  &quot;interval3&quot;: interval_start_from_datetime(&quot;1999-09-09T09:09:09.999&quot;, duration(&quot;P2M30D&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval1&quot;: interval(date(&quot;1984-01-01&quot;), date(&quot;1985-01-01&quot;)),
+  &quot;interval2&quot;: interval(time(&quot;02:23:28.394&quot;), time(&quot;05:47:28.394&quot;)),
+  &quot;interval3&quot;: interval(datetime(&quot;1999-09-09T09:09:09.999&quot;), datetime(&quot;1999-12-09T09:09:09.999&quot;))
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="overlap_bins"></a>overlap_bins</h3>
+<ul>
+
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<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>
+</ul>
+</li>
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source"> overlap_bins(interval, time_bin_anchor, duration_bin_size)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an ordered list of <tt>interval</tt> values representing each bin that is overlapping the <tt>interval</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval</tt>: an <tt>interval</tt> value</li>
+<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>
+<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:
+<ul>
+
+<li>datetime +|_ year_month_duration</li>
+<li>datetime +|_ day_time_duration</li>
+<li>date +|_ year_month_duration</li>
+<li>date +|_ day_time_duration</li>
+<li>time +|_ day_time_duration</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first arugment is any other non-interval value,</li>
+<li>or, the second argument is any other non-date/non-time/non-datetime value,</li>
+<li>or, the second argument is any other non-year_month_duration/non-day_time_duration value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &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;)),
+  &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;)),
+  &quot;datetimebins&quot;: overlap_bins(interval(datetime(&quot;1800-01-01T23:59:48.938&quot;), datetime(&quot;2015-07-26T13:28:30.218&quot;)),
+                              datetime(&quot;1900-01-01T00:00:00.000&quot;), year_month_duration(&quot;P100Y&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;timebins&#x201d;: [ interval(time(&#x201c;17:00:00.000&#x201d;), time(&#x201c;17:30:00.000&#x201d;)), interval(time(&#x201c;17:30:00.000&#x201d;), time(&#x201c;18:00:00.000&#x201d;)), interval(time(&#x201c;18:00:00.000&#x201d;), time(&#x201c;18:30:00.000&#x201d;)), interval(time(&#x201c;18:30:00.000&#x201d;), time(&#x201c;19:00:00.000&#x201d;))                      ], &#x201c;datebins&#x201d;: [ interval(date(&#x201c;1980-01-01&#x201d;), date(&#x201c;1990-01-01&#x201d;)), interval(date(&#x201c;1990-01-01&#x201d;), date(&#x201c;2000-01-01&#x201d;)), interval(date(&#x201c;2000-01-01&#x201d;), date(&#x201c;2010-01-01&#x201d;)), interval(date(&#x201c;2010-01-01&#x201d;), date(&#x201c;2020-01-01&#x201d;))                      ], &#x201c;datetimebins&#x201d;: [ interval(datetime(&#x201c;1800-01-01T00:00:00.000&#x201d;), datetime(&#x201c;1900-01-01T00:00:00.000&#x201d;)), interval(datetime(&#x201c;1900-01-01T00:00:00.000&#x201d;), datetime(&#x201c;2000-01-01T00:00:00.000&#x201d;)), interval(datetime(&#x201c;2000-01-01T00:00:00.000&#x201d;), datetime(&#x201c;2100-01-01T00:00:00.000&#x201d;))                      ] };</p>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="interval_before.2C_interval_after"></a>interval_before, interval_after</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_before(interval1, interval2)
+interval_after(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether an interval happens before/after another interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_before&quot;: interval_before(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                     interval(date(&quot;2005-05-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;interval_after&quot;: interval_after(interval(date(&quot;2005-05-01&quot;), date(&quot;2012-09-09&quot;)),
+                                   interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_before&quot;: true, &quot;interval_after&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_covers.2C_interval_covered_by"></a>interval_covers, interval_covered_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_covers(interval1, interval2)
+interval_covered_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether one interval covers the other interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>
+
+<p>a <tt>boolean</tt> value. Specifically, <tt>interval_covers(interval1, interval2)</tt> is true if and only if</p>
+<p>interval1.start &lt;= interval2.start AND interval1.end &gt;= interval2.end</p>
+<p><tt>interval_covered_by(interval1, interval2)</tt> is true if and only if</p>
+<p>interval2.start &lt;= interval1.start AND interval2.end &gt;= interval1.end</p>
+</li>
+<li>
+
+<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_covers&quot;: interval_covers(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                     interval(date(&quot;2000-03-01&quot;), date(&quot;2004-09-09&quot;))),
+  &quot;interval_covered_by&quot;: interval_covered_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                             interval(date(&quot;2004-09-10&quot;), date(&quot;2012-08-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_covers&quot;: true, &quot;interval_covered_by&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_overlaps.2C_interval_overlapped_by"></a>interval_overlaps, interval_overlapped_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_overlaps(interval1, interval2)
+interval_overlapped_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These functions check whether two intervals overlap with each other.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value. Specifically, <tt>interval_overlaps(interval1, interval2)</tt> is true if and only if
+<p>interval1.start &lt; interval2.start AND interval2.end &gt; interval1.end AND interval1.end &gt; interval2.start</p></li>
+</ul>
+<p><tt>interval_overlapped_by(interval1, interval2)</tt> is true if and only if</p>
+
+<div>
+<div>
+<pre class="source">interval2.start &lt; interval1.start
+AND interval1.end &gt; interval2.end
+AND interval2.end &gt; interval1.start
+</pre></div></div>
+
+<ul>
+
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+<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>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;overlaps&quot;: interval_overlaps(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;overlapped_by&quot;: interval_overlapped_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                          interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;overlaps&quot;: true, &quot;overlapped_by&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_overlapping"></a>interval_overlapping</h3>
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_overlapping(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>This functions check whether two intervals share any points with each other.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>
+
+<p>a <tt>boolean</tt> value. Specifically, <tt>interval_overlapping(interval1, interval2)</tt> is true if</p>
+<p>interval1.start &lt; interval2.end AND interval1.end &gt; interval2.start</p>
+</li>
+<li>
+
+<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;overlapping1&quot;: interval_overlapping(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                       interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;overlapping2&quot;: interval_overlapping(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                       interval(date(&quot;2004-09-10&quot;), date(&quot;2006-12-31&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;overlapping1&quot;: true, &quot;overlapping2&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_meets.2C_interval_met_by"></a>interval_meets, interval_met_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_meets(interval1, interval2)
+interval_met_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether an interval meets with another interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;meets&quot;: interval_meets(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                          interval(date(&quot;2005-01-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;metby&quot;: interval_met_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                           interval(date(&quot;2004-09-10&quot;), date(&quot;2006-08-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;meets&quot;: true, &quot;metby&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_starts.2C_interval_started_by"></a>interval_starts, interval_started_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_starts(interval1, interval2)
+interval_started_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether one interval starts with the other interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value. Specifically, <tt>interval_starts(interval1, interval2)</tt> returns true if and only if
+<p>interval1.start = interval2.start AND interval1.end &lt;= interval2.end</p></li>
+</ul>
+<p><tt>interval_started_by(interval1, interval2)</tt> returns true if and only if</p>
+
+<div>
+<div>
+<pre class="source">interval1.start = interval2.start
+AND interval2.end &lt;= interval1.end
+</pre></div></div>
+
+<ul>
+
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_starts&quot;: interval_starts(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                     interval(date(&quot;2000-01-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;interval_started_by&quot;: interval_started_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                             interval(date(&quot;2006-08-01&quot;), date(&quot;2006-08-02&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_starts&quot;: true, &quot;interval_started_by&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_ends.2C_interval_ended_by"></a>interval_ends, interval_ended_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_ends(interval1, interval2)
+interval_ended_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether one interval ends with the other interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>
+
+<p>a <tt>boolean</tt> value. Specifically, <tt>interval_ends(interval1, interval2)</tt> returns true if and only if</p>
+<p>interval1.end = interval2.end AND interval1.start &gt;= interval2.start</p>
+<p><tt>interval_ended_by(interval1, interval2)</tt> returns true if and only if</p>
+<p>interval2.end = interval1.end AND interval2.start &gt;= interval1.start</p>
+</li>
+<li>
+
+<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_ends&quot;: interval_ends(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                 interval(date(&quot;1998-01-01&quot;), date(&quot;2005-01-01&quot;))),
+  &quot;interval_ended_by&quot;: interval_ended_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                         interval(date(&quot;2006-09-10&quot;), date(&quot;2007-03-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_ends&quot;: true, &quot;interval_ended_by&quot;: true }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Object_Functions"></a><a name="ObjectFunctions" id="ObjectFunctions">Object Functions</a></h2>
+<div class="section">
+<h3><a name="get_object_fields"></a>get_object_fields</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_object_fields(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Access the object field names, type and open status for a given object.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : a object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_object_fields(
+                  {
+                    &quot;id&quot;: 1,
+                    &quot;project&quot;: &quot;AsterixDB&quot;,
+                    &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+                    &quot;related&quot;: [&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                  }
+                 );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  { &quot;field-name&quot;: &quot;id&quot;, &quot;field-type&quot;: &quot;INT64&quot;, &quot;is-open&quot;: false },
+  { &quot;field-name&quot;: &quot;project&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false },
+  { &quot;field-name&quot;: &quot;address&quot;, &quot;field-type&quot;: &quot;RECORD&quot;, &quot;is-open&quot;: false,
+    &quot;nested&quot;: [
+                { &quot;field-name&quot;: &quot;city&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false },
+                { &quot;field-name&quot;: &quot;state&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false }
+              ]
+  },
+  { &quot;field-name&quot;:
+        &quot;related&quot;,
+        &quot;field-type&quot;: &quot;ORDEREDLIST&quot;,
+        &quot;is-open&quot;: false,
+        &quot;list&quot;: [
+                  { &quot;field-type&quot;: &quot;STRING&quot; },
+                  { &quot;field-type&quot;: &quot;STRING&quot; },
+                  { &quot;field-type&quot;: &quot;STRING&quot; }
+                ]
+  }
+]
+</pre></div></div>
+</li>
+</ul>
+<p>]</p></div>
+<div class="section">
+<h3><a name="get_object_field_value"></a>get_object_field_value</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_object_field_value(input_object, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Access the field name given in the <tt>string_expression</tt> from the <tt>object_expression</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : a <tt>object</tt> value.</li>
+<li><tt>string</tt> : a <tt>string</tt> representing the top level field name.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>any</tt> value saved in the designated field of the object,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-object value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_object_field_value({
+                         &quot;id&quot;: 1,
+                         &quot;project&quot;: &quot;AsterixDB&quot;,
+                         &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+                         &quot;related&quot;: [&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                        },
+                        &quot;project&quot;
+                       );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;AsterixDB&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_remove_fields"></a>object_remove_fields</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_remove_fields(input_object, field_names)
+</pre></div></div>
+</li>
+<li>
+
+<p>Remove indicated fields from a object given a list of field names.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt>:  a object value.</li>
+<li><tt>field_names</tt>: an array of strings and/or array of array of strings.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>a new object value without the fields listed in the second argument,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-object value,</li>
+<li>or, the second argument is any other non-array value or recursively contains non-string items.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_remove_fields(
+                       {
+                         &quot;id&quot;:1,
+                         &quot;project&quot;:&quot;AsterixDB&quot;,
+                         &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+                         &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                       },
+                       [[&quot;address&quot;, &quot;city&quot;], &quot;related&quot;]
+                     );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;:1,
+  &quot;project&quot;:&quot;AsterixDB&quot;,
+  &quot;address&quot;:{ &quot;state&quot;: &quot;CA&quot; }
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_add_fields"></a>object_add_fields</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_add_fields(input_object, fields)
+</pre></div></div>
+</li>
+<li>
+
+<p>Add fields to a object given a list of field names.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : a object value.</li>
+<li><tt>fields</tt>: an array of field descriptor objects where each object has field_name and  field_value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a new object value with the new fields included,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-object value,</li>
+<li>the second argument is any other non-array value, or contains non-object items.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_add_fields(
+                   {
+                     &quot;id&quot;:1,
+                     &quot;project&quot;:&quot;AsterixDB&quot;,
+                     &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+                     &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                    },
+                    [{&quot;field-name&quot;:&quot;employment_location&quot;, &quot;field-value&quot;:create_point(30.0,70.0)}]
+                  );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+   &quot;id&quot;:1,
+   &quot;project&quot;:&quot;AsterixDB&quot;,
+   &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+   &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+   &quot;employment_location&quot;: point(&quot;30.0,70.0&quot;)
+ }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_merge"></a>object_merge</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_merge(object1, object2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Merge two different objects into a new object.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>object1</tt> : a object value.</li>
+<li><tt>object2</tt> : a object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_merge(
+              {
+                &quot;id&quot;:1,
+                &quot;project&quot;:&quot;AsterixDB&quot;,
+                &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+                &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+              },
+              {
+                &quot;user_id&quot;: 22,
+                &quot;employer&quot;: &quot;UC Irvine&quot;,
+                &quot;employment_type&quot;: &quot;visitor&quot;
+              }
+            );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;employment_type&quot;: &quot;visitor&quot;,
+  &quot;address&quot;: {
+    &quot;city&quot;: &quot;Irvine&quot;,
+    &quot;state&quot;: &quot;CA&quot;
+  },
+  &quot;related&quot;: [
+    &quot;Hivestrix&quot;,
+    &quot;Preglix&quot;,
+    &quot;Apache VXQuery&quot;
+  ],
+  &quot;user_id&quot;: 22,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+  &quot;employer&quot;: &quot;UC Irvine&quot;,
+  &quot;id&quot;: 1
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_length"></a>object_length</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_length(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns number of top-level fields in the given object</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an integer that represents the number of top-level fields in the given object,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value or any other non-object value</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_length(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+               }
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_names"></a>object_names</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_names(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns names of top-level fields in the given object</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an array with top-level field names of the given object,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value or any other non-object value</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_names(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+               }
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;id&quot;, &quot;project&quot;, &quot;address&quot; ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_remove"></a>object_remove</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_remove(input_object, field_name)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a new object that has the same fields as the input object except the field to be removed</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>field_name</tt> : a string field name.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>A new object that has the same fields as <tt>input_object</tt> except the field <tt>field_name</tt>,</li>
+<li><tt>missing</tt> if the argument <tt>input_object</tt> or <tt>field_name</tt> is missing,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_remove(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;address&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_rename"></a>object_rename</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_rename(input_object, old_field, new_field)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>old_field</tt> : a string representing the old (original) field name inside the object <tt>input_object</tt>.</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_rename(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;address&quot;
+               , &quot;location&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_unwrap"></a>object_unwrap</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_unwrap(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the value of the single name-value pair that appears in <tt>input_object</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value that consists of exactly one name-value pair.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The value of the single name-value pair that appears in <tt>input_object</tt>,</li>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_unwrap(
+             {
+               &quot;id&quot;: 1
+             }
+           );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  1
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_replace"></a>object_replace</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_replace(input_object, old_value, new_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>old_value</tt> : a primitive type value to be replaced by <tt>new_value</tt>.</li>
+<li><tt>new_value</tt> : a value to replace <tt>old_value</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if <tt>input_object</tt>  or <tt>old_value</tt> is null,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li><tt>old_value</tt> is not a primitive type value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_replace(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;AsterixDB&quot;
+               , &quot;Apache AsterixDB&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;Apache AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_add"></a>object_add</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_add(input_object, field_name, field_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>field_name</tt> : a string representing a field name to be added.</li>
+<li><tt>field_value</tt> : a value to be assigned to the new field <tt>field_name</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>missing</tt>,</li>
+<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>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_add(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;company&quot;
+               , &quot;Apache&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+  &quot;company&quot;: &quot;Apache&quot;
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_put"></a>object_put</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_put(input_object, field_name, field_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Adds, modifies, or removes a field of an object.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>field_name</tt> : a string representing a field name to be added.</li>
+<li><tt>field_value</tt> : a value to be assigned to the new field <tt>field_name</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>missing</tt>,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_put(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;project&quot;
+               , &quot;Apache AsterixDB&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;Apache AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_values"></a>object_values</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_values(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an array of the values of the fields in <tt>input_object</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>An array of the values of the fields in <tt>input_object</tt>,</li>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<li><tt>null</tt> if <tt>input_object</tt> is null or any non-object value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_values(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  1,
+  &quot;AsterixDB&quot;,
+  {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_pairs"></a>object_pairs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_pairs(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>An array of the <tt>name</tt>/<tt>value</tt> pairs of the fields in <tt>input_object</tt>,</li>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<li><tt>null</tt> if <tt>input_object</tt> is null or any non-object value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_pairs(
+              {
+                &quot;id&quot;: 1,
+                &quot;project&quot;: &quot;AsterixDB&quot;,
+                &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+              }
+            );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  { &quot;name&quot;: &quot;id&quot;, &quot;value&quot;: 1 },
+  { &quot;name&quot;: &quot;project&quot;, &quot;value&quot;: &quot;AsterixDB&quot; },
+  { &quot;name&quot;: &quot;address&quot;, &quot;value&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;} }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="pairs"></a>pairs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">pairs(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>input_object</tt> : an object value (or an array or a multiset)</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<li><tt>null</tt> if <tt>input_object</tt> is null or a value of a primitive data type.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">pairs(
+       {
+         &quot;id&quot;: 1,
+         &quot;project&quot;: &quot;AsterixDB&quot;,
+         &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+       }
+     );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  [ &quot;id&quot;, 1 ],
+  [ &quot;project&quot;, &quot;AsterixDB&quot; ],
+  [ &quot;address&quot;, { &quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot; } ],
+  [ &quot;city&quot;, &quot;Irvine&quot; ],
+  [ &quot;state&quot;, &quot;CA&quot; ]
+]
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Aggregate_Functions_.28Array_Functions.29"></a><a name="AggregateFunctions" id="AggregateFunctions">Aggregate Functions (Array Functions) </a></h2>
+<p>This section contains detailed descriptions of the built-in aggregate functions in the query language.</p>
+<p>The query language also supports standard SQL aggregate functions (e.g., <tt>MIN</tt>, <tt>MAX</tt>, <tt>SUM</tt>, <tt>COUNT</tt>, and <tt>AVG</tt>). Note that these are not real functions in the query language, but just syntactic sugars over corresponding builtin aggregate functions (e.g., <tt>ARRAY_MIN</tt>, <tt>ARRAY_MAX</tt>, <tt>ARRAY_SUM</tt>, <tt>ARRAY_COUNT</tt>, and <tt>ARRAY_AVG</tt>). Refer to <a href="manual.html#Aggregation_PseudoFunctions">Aggregation Pseudo-Functions</a> for details.</p>
+<p>The <tt>DISTINCT</tt> keyword may be used with built-in aggregate functions and standard SQL aggregate functions. It may also be used with aggregate functions used as window functions. It determines whether the function aggregates all values in the group, or distinct values only. Refer to <a href="manual.html#Function_call_expressions">Function Calls</a> for details.</p>
+<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>
+<div class="section">
+<h3><a name="array_count"></a>array_count</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_count(collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the number of non-null and non-missing items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> to be counted,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of non-null and non-missing items in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li>any other non-array and non-multiset input value will cause an error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_count( ['hello', 'world', 1, 2, 3, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">5
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_avg"></a>array_avg</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_avg(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the average value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the average of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_avg( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.725
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_sum"></a>array_sum</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_sum(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sum of non-null and non-missing items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_sum( [1.2, 2.3, 3.4, 0, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">6.9
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_min"></a>array_min</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_min(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the min value of non-null and non-missing comparable items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_min( [1.2, 2.3, 3.4, 0, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_max"></a>array_max</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_max(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the max value of the non-null and non-missing comparable items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_max( [1.2, 2.3, 3.4, 0, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3.4
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_stddev_samp"></a>array_stddev_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample standard deviation value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample standard deviation of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_samp( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.4591664287073858
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_stddev_pop"></a>array_stddev_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population standard deviation value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population standard deviation of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_pop( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.2636751956100112
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_var_samp"></a>array_var_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_var_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample variance value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample variance of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_var_samp( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">2.1291666666666664
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_var_pop"></a>array_var_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_var_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population variance value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population variance of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_var_pop( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.5968749999999998
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_skewness"></a>array_skewness</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_skewness(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the skewness value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the skewness of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_skewness( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">-0.04808451539164242
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_kurtosis"></a>array_kurtosis</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_kurtosis(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the kurtosis value from the normal distribution of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_kurtosis( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">-1.342049701096427
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_count"></a>strict_count</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_count(collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the number of items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing the items to be counted,</li>
+<li>or a <tt>null</tt> value,</li>
+<li>or a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of items in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_count( [1, 2, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">4
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_avg"></a>strict_avg</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_avg(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the average value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the average of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_avg( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">200.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_sum"></a>strict_sum</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_sum(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sum of the items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_sum( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">600
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_min"></a>strict_min</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_min(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the min value of comparable items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_min( [10.2, 100, 5] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">5.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_max"></a>strict_max</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_max(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the max value of numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_max( [10.2, 100, 5] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">100.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_stddev_samp"></a>strict_stddev_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample standard deviation value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample standard deviation of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_samp( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">100.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_stddev_pop"></a>strict_stddev_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population standard deviation value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population standard deviation of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_pop( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">81.64965809277261
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_var_samp"></a>strict_var_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample variance value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample variance of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_samp( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">10000.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_var_pop"></a>strict_var_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population variance value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population variance of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_pop( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">6666.666666666667
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_skewness"></a>strict_skewness</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_skewness(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the skewness value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the skewness of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_skewness( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_kurtosis"></a>strict_kurtosis</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_kurtosis(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the kurtosis value from the normal distribution of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the kurtosis from a normal distribution of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_kurtosis( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">-1.5
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Comparison_Functions"></a><a name="ComparisonFunctions" id="ComparisonFunctions">Comparison Functions</a></h2>
+<div class="section">
+<h3><a name="greatest"></a>greatest</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">greatest(numeric_value1, numeric_value2, ...)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the greatest value among arguments.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+<li>&#x2026;.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> if any argument is a <tt>missing</tt> value or <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 3, &quot;v2&quot;: 5000.0 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="least"></a>least</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">least(numeric_value1, numeric_value2, ...)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the least value among arguments.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+<li>&#x2026;.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> if any argument is a <tt>missing</tt> value or <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 1, &quot;v2&quot;: -0.5 }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Type_Functions"></a><a name="TypeFunctions" id="TypeFunctions">Type Functions</a></h2>
+<div class="section">
+<h3><a name="is_array"></a>is_array</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_array(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be an <tt>array</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is an <tt>array</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_array(true),
+  &quot;b&quot;: is_array(false),
+  &quot;c&quot;: isarray(null),
+  &quot;d&quot;: isarray(missing),
+  &quot;e&quot;: isarray(&quot;d&quot;),
+  &quot;f&quot;: isarray(4.0),
+  &quot;g&quot;: isarray(5),
+  &quot;h&quot;: isarray([&quot;1&quot;, 2]),
+  &quot;i&quot;: isarray({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isarray</tt>.</p></div>
+<div class="section">
+<h3><a name="is_multiset"></a>is_multiset</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_multiset(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be an <tt>multiset</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is an <tt>multiset</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_multiset(true),
+  &quot;b&quot;: is_multiset(false),
+  &quot;c&quot;: is_multiset(null),
+  &quot;d&quot;: is_multiset(missing),
+  &quot;e&quot;: is_multiset(&quot;d&quot;),
+  &quot;f&quot;: ismultiset(4.0),
+  &quot;g&quot;: ismultiset([&quot;1&quot;, 2]),
+  &quot;h&quot;: ismultiset({&quot;a&quot;:1}),
+  &quot;i&quot;: ismultiset({{&quot;hello&quot;, 9328, &quot;world&quot;, [1, 2, null]}})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ismultiset</tt>.</p></div>
+<div class="section">
+<h3><a name="is_atomic_.28is_atom.29"></a>is_atomic (is_atom)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_atomic(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a value of a <a href="../datamodel.html#PrimitiveTypes">primitive</a> type.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a primitive type or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_atomic(true),
+  &quot;b&quot;: is_atomic(false),
+  &quot;c&quot;: isatomic(null),
+  &quot;d&quot;: isatomic(missing),
+  &quot;e&quot;: isatomic(&quot;d&quot;),
+  &quot;f&quot;: isatom(4.0),
+  &quot;g&quot;: isatom(5),
+  &quot;h&quot;: isatom([&quot;1&quot;, 2]),
+  &quot;i&quot;: isatom({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isatomic</tt>, <tt>is_atom</tt>, and <tt>isatom</tt>.</p></div>
+<div class="section">
+<h3><a name="is_boolean_.28is_bool.29"></a>is_boolean (is_bool)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_boolean(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>boolean</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>boolean</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: isboolean(true),
+  &quot;b&quot;: isboolean(false),
+  &quot;c&quot;: is_boolean(null),
+  &quot;d&quot;: is_boolean(missing),
+  &quot;e&quot;: isbool(&quot;d&quot;),
+  &quot;f&quot;: isbool(4.0),
+  &quot;g&quot;: isbool(5),
+  &quot;h&quot;: isbool([&quot;1&quot;, 2]),
+  &quot;i&quot;: isbool({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isboolean</tt>, <tt>is_bool</tt>, and <tt>isbool</tt>.</p></div>
+<div class="section">
+<h3><a name="is_number_.28is_num.29"></a>is_number (is_num)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_number(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a numeric value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_number(true),
+  &quot;b&quot;: is_number(false),
+  &quot;c&quot;: isnumber(null),
+  &quot;d&quot;: isnumber(missing),
+  &quot;e&quot;: isnumber(&quot;d&quot;),
+  &quot;f&quot;: isnum(4.0),
+  &quot;g&quot;: isnum(5),
+  &quot;h&quot;: isnum([&quot;1&quot;, 2]),
+  &quot;i&quot;: isnum({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isnumber</tt>, <tt>is_num</tt>, and <tt>isnum</tt>.</p></div>
+<div class="section">
+<h3><a name="is_object_.28is_obj.29"></a>is_object (is_obj)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_object(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>object</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>object</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_object(true),
+  &quot;b&quot;: is_object(false),
+  &quot;c&quot;: isobject(null),
+  &quot;d&quot;: isobject(missing),
+  &quot;e&quot;: isobj(&quot;d&quot;),
+  &quot;f&quot;: isobj(4.0),
+  &quot;g&quot;: isobj(5),
+  &quot;h&quot;: isobj([&quot;1&quot;, 2]),
+  &quot;i&quot;: isobj({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<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>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isobject</tt>, <tt>is_obj</tt>, and <tt>isobj</tt>.</p></div>
+<div class="section">
+<h3><a name="is_string_.28is_str.29"></a>is_string (is_str)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_string(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>string</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>string</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_string(true),
+  &quot;b&quot;: isstring(false),
+  &quot;c&quot;: isstring(null),
+  &quot;d&quot;: isstr(missing),
+  &quot;e&quot;: isstr(&quot;d&quot;),
+  &quot;f&quot;: isstr(4.0),
+  &quot;g&quot;: isstr(5),
+  &quot;h&quot;: isstr([&quot;1&quot;, 2]),
+  &quot;i&quot;: isstr({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isstring</tt>, <tt>is_str</tt>, and <tt>isstr</tt>.</p></div>
+<div class="section">
+<h3><a name="is_null"></a>is_null</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_null(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>null</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the variable is a <tt>null</tt> or not,</li>
+<li>a <tt>missing</tt> if the input is <tt>missing</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: is_null(null), &quot;v2&quot;: is_null(1), &quot;v3&quot;: is_null(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isnull</tt>.</p></div>
+<div class="section">
+<h3><a name="is_missing"></a>is_missing</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_missing(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>missing</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the variable is a <tt>missing</tt> or not.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: is_missing(null), &quot;v2&quot;: is_missing(1), &quot;v3&quot;: is_missing(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: false, &quot;v3&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ismissing</tt>.</p></div>
+<div class="section">
+<h3><a name="is_unknown"></a>is_unknown</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_unknown(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given variable is a <tt>null</tt> value or a <tt>missing</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: is_unknown(null), &quot;v2&quot;: is_unknown(1), &quot;v3&quot;: is_unknown(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false, &quot;v3&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isunknown</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="is_binary_.28is_bin.29"></a>is_binary (is_bin)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_binary(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>binary</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>binary</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_binary(true),
+  &quot;b&quot;: is_binary(false),
+  &quot;c&quot;: isbinary(null),
+  &quot;d&quot;: isbinary(missing),
+  &quot;e&quot;: isbin(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isbin(hex(&quot;ABCDEF0123456789&quot;)),
+  &quot;g&quot;: is_bin(sub_binary(hex(&quot;AABBCCDD&quot;), 4)),
+  &quot;h&quot;: is_bin(2),
+  &quot;i&quot;: is_bin({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isbinary</tt>, <tt>is_bin</tt>, and <tt>isbin</tt>.</p></div>
+<div class="section">
+<h3><a name="is_uuid"></a>is_uuid</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_uuid(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>uuid</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>uuid</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_uuid(true),
+  &quot;b&quot;: is_uuid(false),
+  &quot;c&quot;: is_uuid(null),
+  &quot;d&quot;: is_uuid(missing),
+  &quot;e&quot;: isuuid(4.0),
+  &quot;f&quot;: isuuid(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isuuid(uuid(&quot;5c848e5c-6b6a-498f-8452-8847a2957421&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isuuid</tt>.</p></div>
+<div class="section">
+<h3><a name="is_point"></a>is_point</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_point(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>point</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>point</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_point(true),
+  &quot;b&quot;: is_point(false),
+  &quot;c&quot;: is_point(null),
+  &quot;d&quot;: is_point(missing),
+  &quot;e&quot;: is_point(point(&quot;1,2&quot;)),
+  &quot;f&quot;: ispoint(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: ispoint(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: ispoint(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: ispoint(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: ispoint(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ispoint</tt>.</p></div>
+<div class="section">
+<h3><a name="is_line"></a>is_line</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_line(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>line</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>line</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_line(true),
+  &quot;b&quot;: is_line(false),
+  &quot;c&quot;: is_line(null),
+  &quot;d&quot;: is_line(missing),
+  &quot;e&quot;: is_line(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isline(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: isline(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: isline(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: isline(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: isline(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isline</tt>.</p></div>
+<div class="section">
+<h3><a name="is_rectangle"></a>is_rectangle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_rectangle(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>rectangle</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>rectangle</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_rectangle(true),
+  &quot;b&quot;: is_rectangle(false),
+  &quot;c&quot;: is_rectangle(null),
+  &quot;d&quot;: is_rectangle(missing),
+  &quot;e&quot;: is_rectangle(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isrectangle(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: isrectangle(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: isrectangle(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: isrectangle(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: isrectangle(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isrectangle</tt>.</p></div>
+<div class="section">
+<h3><a name="is_circle"></a>is_circle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_circle(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>circle</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>circle</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_circle(true),
+  &quot;b&quot;: is_circle(false),
+  &quot;c&quot;: is_circle(null),
+  &quot;d&quot;: is_circle(missing),
+  &quot;e&quot;: is_circle(point(&quot;1,2&quot;)),
+  &quot;f&quot;: iscircle(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: iscircle(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: iscircle(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: iscircle(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: iscircle(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>iscircle</tt>.</p></div>
+<div class="section">
+<h3><a name="is_polygon"></a>is_polygon</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_polygon(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>polygon</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>polygon</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_polygon(true),
+  &quot;b&quot;: is_polygon(false),
+  &quot;c&quot;: is_polygon(null),
+  &quot;d&quot;: is_polygon(missing),
+  &quot;e&quot;: is_polygon(point(&quot;1,2&quot;)),
+  &quot;f&quot;: ispolygon(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: ispolygon(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: ispolygon(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: ispolygon(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: ispolygon(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ispolygon</tt>.</p></div>
+<div class="section">
+<h3><a name="is_spatial"></a>is_spatial</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_spatial(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a spatial value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_spatial(true),
+  &quot;b&quot;: is_spatial(false),
+  &quot;c&quot;: is_spatial(null),
+  &quot;d&quot;: is_spatial(missing),
+  &quot;e&quot;: is_spatial(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isspatial(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: isspatial(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: isspatial(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: isspatial(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: isspatial(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isspatial</tt>.</p></div>
+<div class="section">
+<h3><a name="is_date"></a>is_date</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_date(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>date</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>date</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_date(true),
+  &quot;b&quot;: is_date(false),
+  &quot;c&quot;: is_date(null),
+  &quot;d&quot;: is_date(missing),
+  &quot;e&quot;: is_date(date(&quot;-19700101&quot;)),
+  &quot;f&quot;: isdate(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isdate(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: isdate(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: isdate(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: isdate(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: isdate(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isdate</tt>.</p></div>
+<div class="section">
+<h3><a name="is_datetime_.28is_timestamp.29"></a>is_datetime (is_timestamp)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_datetime(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>datetime</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>datetime</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_datetime(true),
+  &quot;b&quot;: is_datetime(false),
+  &quot;c&quot;: is_datetime(null),
+  &quot;d&quot;: is_datetime(missing),
+  &quot;e&quot;: is_datetime(datetime(&quot;2016-02-02T12:09:22.023Z&quot;)),
+  &quot;f&quot;: isdatetime(datetime(&quot;2011-03-03T12:10:42.011Z&quot;)),
+  &quot;g&quot;: isdatetime(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: is_timestamp(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: is_timestamp(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: istimestamp(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: istimestamp(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isdatetime</tt>, <tt>is_timestamp</tt>, and <tt>istimestamp</tt>.</p></div>
+<div class="section">
+<h3><a name="is_time"></a>is_time</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_time(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>time</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>time</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_time(true),
+  &quot;b&quot;: is_time(false),
+  &quot;c&quot;: is_time(null),
+  &quot;d&quot;: is_time(missing),
+  &quot;e&quot;: is_time(time(&quot;08:00:00.000Z&quot;)),
+  &quot;f&quot;: istime(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: istime(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: istime(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: istime(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: istime(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: istime(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>istime</tt>.</p></div>
+<div class="section">
+<h3><a name="is_duration"></a>is_duration</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_duration(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a duration value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>duration/year_month_duration/day_time_duration</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_duration(true),
+  &quot;b&quot;: is_duration(false),
+  &quot;c&quot;: is_duration(null),
+  &quot;d&quot;: is_duration(missing),
+  &quot;e&quot;: is_duration(duration(&quot;-PT20.943S&quot;)),
+  &quot;f&quot;: isduration(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isduration(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: isduration(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: isduration(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: isduration(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: isduration(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isduration</tt>.</p></div>
+<div class="section">
+<h3><a name="is_interval"></a>is_interval</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_interval(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>interval</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>interval</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_interval(true),
+  &quot;b&quot;: is_interval(false),
+  &quot;c&quot;: is_interval(null),
+  &quot;d&quot;: is_interval(missing),
+  &quot;e&quot;: is_interval(interval(datetime(&quot;2013-01-01T00:01:01.000Z&quot;), datetime(&quot;2013-05-05T13:39:01.049Z&quot;))),
+  &quot;f&quot;: isinterval(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isinterval(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: isinterval(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: isinterval(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: isinterval(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: isinterval(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isinterval</tt>.</p></div>
+<div class="section">
+<h3><a name="is_temporal"></a>is_temporal</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_temporal(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a temporal value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_temporal(true),
+  &quot;b&quot;: is_temporal(false),
+  &quot;c&quot;: is_temporal(null),
+  &quot;d&quot;: is_temporal(missing),
+  &quot;e&quot;: is_temporal(duration(&quot;-PT20.943S&quot;)),
+  &quot;f&quot;: istemporal(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: istemporal(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: istemporal(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: istemporal(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: istemporal(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: istemporal(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>istemporal</tt>.</p></div>
+<div class="section">
+<h3><a name="get_type"></a>get_type</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_type(expr)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: get_type(true),
+  &quot;b&quot;: get_type(false),
+  &quot;c&quot;: get_type(null),
+  &quot;d&quot;: get_type(missing),
+  &quot;e&quot;: get_type(&quot;d&quot;),
+  &quot;f&quot;: gettype(4.0),
+  &quot;g&quot;: gettype(5),
+  &quot;h&quot;: gettype([&quot;1&quot;, 2]),
+  &quot;i&quot;: gettype({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>gettype</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="to_array"></a>to_array</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_array(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to an <tt>array</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of <tt>array</tt> type then it is returned as is</li>
+<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>
+<li>otherwise an <tt>array</tt> containing the input expression as its single item is returned</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_array(&quot;asterix&quot;),
+  &quot;v2&quot;: to_array([&quot;asterix&quot;]),
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: [&quot;asterix&quot;], &quot;v2&quot;: [&quot;asterix&quot;] }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>toarray</tt>.</p></div>
+<div class="section">
+<h3><a name="to_atomic_.28to_atom.29"></a>to_atomic (to_atom)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_atomic(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a <a href="../datamodel.html#PrimitiveTypes">primitive</a> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of primitive type then it is returned as is</li>
+<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>
+<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>
+<li>otherwise <tt>null</tt> is returned</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_atomic(&quot;asterix&quot;),
+  &quot;v2&quot;: to_atomic([&quot;asterix&quot;]),
+  &quot;v3&quot;: to_atomic([0, 1]),
+  &quot;v4&quot;: to_atomic({&quot;value&quot;: &quot;asterix&quot;}),
+  &quot;v5&quot;: to_number({&quot;x&quot;: 1, &quot;y&quot;: 2})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>toatomic</tt>, <tt>to_atom</tt>, and <tt>toatom</tt>.</p></div>
+<div class="section">
+<h3><a name="to_boolean_.28to_bool.29"></a>to_boolean (to_bool)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_boolean(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a <tt>boolean</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of <tt>boolean</tt> type then it is returned as is</li>
+<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>
+<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>
+<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>
+<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>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_boolean(0),
+  &quot;v2&quot;: to_boolean(1),
+  &quot;v3&quot;: to_boolean(&quot;&quot;),
+  &quot;v4&quot;: to_boolean(&quot;asterix&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: true, &quot;v3&quot;: false, &quot;v4&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>toboolean</tt>, <tt>to_bool</tt>, and <tt>tobool</tt>.</p></div>
+<div class="section">
+<h3><a name="to_bigint"></a>to_bigint</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_bigint(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to an integer value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<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>
+<li>if the argument is of numeric integer type then it is returned as the same value of <tt>bigint</tt> type</li>
+<li>if the argument is of numeric <tt>float</tt>/<tt>double</tt> type then it is converted to <tt>bigint</tt> type</li>
+<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>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_bigint(false),
+  &quot;v2&quot;: to_bigint(true),
+  &quot;v3&quot;: to_bigint(10),
+  &quot;v4&quot;: to_bigint(float(&quot;1e100&quot;)),
+  &quot;v5&quot;: to_bigint(double(&quot;1e1000&quot;)),
+  &quot;v6&quot;: to_bigint(&quot;20&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>tobigint</tt>.</p></div>
+<div class="section">
+<h3><a name="to_double"></a>to_double</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_double(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a <tt>double</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<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>
+<li>if the argument is of numeric type then it is returned as the value of <tt>double</tt> type</li>
+<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>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_double(false),
+  &quot;v2&quot;: to_double(true),
+  &quot;v3&quot;: to_double(10),
+  &quot;v4&quot;: to_double(11.5),
+  &quot;v5&quot;: to_double(&quot;12.5&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>todouble</tt>.</p></div>
+<div class="section">
+<h3><a name="to_number_.28to_num.29"></a>to_number (to_num)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_number(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a numeric value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of numeric type then it is returned as is</li>
+<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>
+<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>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_number(false),
+  &quot;v2&quot;: to_number(true),
+  &quot;v3&quot;: to_number(10),
+  &quot;v4&quot;: to_number(11.5),
+  &quot;v5&quot;: to_number(&quot;12.5&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>tonumber</tt>, <tt>to_num</tt>, and <tt>tonum</tt>.</p></div>
+<div class="section">
+<h3><a name="to_object_.28to_obj.29"></a>to_object (to_obj)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_object(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to an <tt>object</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of <tt>object</tt> type then it is returned as is</li>
+<li>otherwise an empty <tt>object</tt> is returned</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_object({&quot;value&quot;: &quot;asterix&quot;}),
+  &quot;v2&quot;: to_object(&quot;asterix&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: {&quot;value&quot;: &quot;asterix&quot;}, &quot;v2&quot;: {} }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>toobject</tt>, <tt>to_obj</tt>, and <tt>toobj</tt>.</p></div>
+<div class="section">
+<h3><a name="to_string_.28to_str.29"></a>to_string (to_str)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_string(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a string value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<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>
+<li>if the argument is of numeric type then its string representation is returned</li>
+<li>if the argument is of <tt>string</tt> type then it is returned as is</li>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_string(false),
+  &quot;v2&quot;: to_string(true),
+  &quot;v3&quot;: to_string(10),
+  &quot;v4&quot;: to_string(11.5),
+  &quot;v5&quot;: to_string(&quot;asterix&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>tostring</tt>, <tt>to_str</tt>, and <tt>tostr</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Conditional_Functions"></a><a name="ConditionalFunctions" id="ConditionalFunctions">Conditional Functions</a></h2>
+<div class="section">
+<h3><a name="if_null_.28ifnull.29"></a>if_null (ifnull)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_null(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which value is not <tt>null</tt> and returns that value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>null</tt> if all arguments evaluate to <tt>null</tt> or no arguments specified</li>
+<li>a value of the first non-<tt>null</tt> argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: if_null(),
+    &quot;b&quot;: if_null(null),
+    &quot;c&quot;: if_null(null, &quot;asterixdb&quot;),
+    &quot;d&quot;: is_missing(if_null(missing))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot;, &quot;d&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifnull</tt>.</p></div>
+<div class="section">
+<h3><a name="if_missing_.28ifmissing.29"></a>if_missing (ifmissing)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_missing(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which value is not <tt>missing</tt> and returns that value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>null</tt> if all arguments evaluate to <tt>missing</tt> or no arguments specified</li>
+<li>a value of the first non-<tt>missing</tt> argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: if_missing(),
+    &quot;b&quot;: if_missing(missing),
+    &quot;c&quot;: if_missing(missing, &quot;asterixdb&quot;),
+    &quot;d&quot;: if_missing(null, &quot;asterixdb&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot;, &quot;d&quot;: null }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifmissing</tt>.</p></div>
+<div class="section">
+<h3><a name="if_missing_or_null_.28ifmissingornull.2C_coalesce.29"></a>if_missing_or_null (ifmissingornull, coalesce)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_missing_or_null(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which value is not <tt>null</tt> or <tt>missing</tt> and returns that value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>null</tt> if all arguments evaluate to either <tt>null</tt> or <tt>missing</tt>, or no arguments specified</li>
+<li>a value of the first non-<tt>null</tt>, non-<tt>missing</tt> argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: if_missing_or_null(),
+    &quot;b&quot;: if_missing_or_null(null, missing),
+    &quot;c&quot;: if_missing_or_null(null, missing, &quot;asterixdb&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has two aliases: <tt>ifmissingornull</tt> and <tt>coalesce</tt>.</p></div>
+<div class="section">
+<h3><a name="if_inf_.28ifinf.29"></a>if_inf (ifinf)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_inf(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which is a non-infinite (<tt>INF</tt> or<tt>-INF</tt>) number</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>missing</tt> if <tt>missing</tt> argument was encountered before the first non-infinite number argument</li>
+<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>
+<li>the first non-infinite number argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: is_null(if_inf(null)),
+    &quot;b&quot;: is_missing(if_inf(missing)),
+    &quot;c&quot;: is_null(if_inf(double(&quot;INF&quot;))),
+    &quot;d&quot;: if_inf(1, null, missing) ],
+    &quot;e&quot;: is_null(if_inf(null, missing, 1)) ],
+    &quot;f&quot;: is_missing(if_inf(missing, null, 1)) ],
+    &quot;g&quot;: if_inf(float(&quot;INF&quot;), 1) ],
+    &quot;h&quot;: to_string(if_inf(float(&quot;INF&quot;), double(&quot;NaN&quot;), 1)) ]
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifinf</tt>.</p></div>
+<div class="section">
+<h3><a name="if_nan_.28ifnan.29"></a>if_nan (ifnan)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_nan(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which is a non-<tt>NaN</tt> number</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>missing</tt> if <tt>missing</tt> argument was encountered before the first non-<tt>NaN</tt> number argument</li>
+<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>
+<li>the first non-<tt>NaN</tt> number argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: is_null(if_nan(null)),
+    &quot;b&quot;: is_missing(if_nan(missing)),
+    &quot;c&quot;: is_null(if_nan(double(&quot;NaN&quot;))),
+    &quot;d&quot;: if_nan(1, null, missing) ],
+    &quot;e&quot;: is_null(if_nan(null, missing, 1)) ],
+    &quot;f&quot;: is_missing(if_nan(missing, null, 1)) ],
+    &quot;g&quot;: if_nan(float(&quot;NaN&quot;), 1) ],
+    &quot;h&quot;: to_string(if_nan(float(&quot;NaN&quot;), double(&quot;INF&quot;), 1)) ]
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifnan</tt>.</p></div>
+<div class="section">
+<h3><a name="if_nan_or_inf_.28ifnanorinf.29"></a>if_nan_or_inf (ifnanorinf)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_nan_or_inf(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which is a non-infinite (<tt>INF</tt> or<tt>-INF</tt>) and non-<tt>NaN</tt> number</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<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>
+<li>the first non-infinite and non-<tt>NaN</tt> number argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: is_null(if_nan_or_inf(null)),
+    &quot;b&quot;: is_missing(if_nan_or_inf(missing)),
+    &quot;c&quot;: is_null(if_nan_or_inf(double(&quot;NaN&quot;), double(&quot;INF&quot;))),
+    &quot;d&quot;: if_nan_or_inf(1, null, missing) ],
+    &quot;e&quot;: is_null(if_nan_or_inf(null, missing, 1)) ],
+    &quot;f&quot;: is_missing(if_nan_or_inf(missing, null, 1)) ],
+    &quot;g&quot;: if_nan_or_inf(float(&quot;NaN&quot;), float(&quot;INF&quot;), 1) ],
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifnanorinf</tt>.</p></div>
+<div class="section">
+<h3><a name="null_if_.28nullif.29"></a>null_if (nullif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">null_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>null</tt> if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if
+<ul>
+
+<li>any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value, or</li>
+<li><tt>argument1</tt> = <tt>argument2</tt></li>
+</ul>
+</li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: null_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;),
+    &quot;b&quot;: null_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>nullif</tt>.</p></div>
+<div class="section">
+<h3><a name="missing_if_.28missingif.29"></a>missing_if (missingif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">missing_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>missing</tt> if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if
+<ul>
+
+<li>any argument is a <tt>missing</tt> value, or</li>
+<li>no argument is a <tt>null</tt> value and <tt>argument1</tt> = <tt>argument2</tt></li>
+</ul>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: missing_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)
+    &quot;b&quot;: missing_if(1, 2),
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>missingif</tt>.</p></div>
+<div class="section">
+<h3><a name="nan_if_.28nanif.29"></a>nan_if (nanif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">nan_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>NaN</tt> value if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li><tt>NaN</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: to_string(nan_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
+    &quot;b&quot;: nan_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: &quot;NaN&quot;, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>nanif</tt>.</p></div>
+<div class="section">
+<h3><a name="posinf_if_.28posinfif.29"></a>posinf_if (posinfif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">posinf_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>+INF</tt> value if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li><tt>+INF</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: to_string(posinf_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
+    &quot;b&quot;: posinf_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: &quot;+INF&quot;, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>posinfif</tt>.</p></div>
+<div class="section">
+<h3><a name="neginf_if_.28neginfif.29"></a>neginf_if (neginfif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">neginf_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>-INF</tt> value if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li><tt>-INF</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: to_string(neginf_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
+    &quot;b&quot;: neginf_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: &quot;-INF&quot;, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>neginfif</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Miscellaneous_Functions"></a><a name="MiscFunctions" id="MiscFunctions">Miscellaneous Functions</a></h2>
+<div class="section">
+<h3><a name="uuid"></a>uuid</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">uuid()
+</pre></div></div>
+</li>
+<li>
+
+<p>Generates a <tt>uuid</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li>none</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a generated, random <tt>uuid</tt>.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="len"></a>len</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>len(array)</p>
+</li>
+<li>
+
+<p>Returns the length of the array array.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>integer</tt> that represents the length of input array or the size of the input multiset,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">len([&quot;Hello&quot;, &quot;World&quot;])
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">2
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="not"></a>not</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">not(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Inverts a <tt>boolean</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt>, the inverse of <tt>expr</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>other non-boolean argument value will cause a type error.</li>
+</ul>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: `not`(true), &quot;v2&quot;: `not`(false), &quot;v3&quot;: `not`(null), &quot;v4&quot;: `not`(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: true, &quot;v3&quot;: null }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="random"></a>random</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">random( [seed_value] )
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a random number, accepting an optional seed value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>A random number of type <tt>double</tt> between 0 and 1,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value or a non-numeric value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: random(),
+  &quot;v2&quot;: random(unix_time_from_datetime_in_ms(current_datetime()))
+};
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="range"></a>range</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">range(start_numeric_value, end_numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:</li>
+<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>
+<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>
+<li>Return Value:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">range(0, 3);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ 0, 1, 2, 3 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="switch_case"></a>switch_case</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">switch_case(
+    condition,
+    case1, case1_result,
+    case2, case2_result,
+    ...,
+    default, default_result
+)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>condition</tt>: a variable (any type is allowed).</li>
+<li><tt>caseI/default</tt>: a variable (any type is allowed).</li>
+<li><tt>caseI/default_result</tt>: a variable (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>caseI_result</tt> if <tt>condition</tt> matches <tt>caseI</tt>, otherwise <tt>default_result</tt>.</li>
+</ul>
+</li>
+<li>Example 1:
+
+<div>
+<div>
+<pre class="source">switch_case(
+    &quot;a&quot;,
+    &quot;a&quot;, 0,
+    &quot;x&quot;, 1,
+    &quot;y&quot;, 2,
+    &quot;z&quot;, 3
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0
+</pre></div></div>
+</li>
+<li>
+
+<p>Example 2:</p>
+
+<div>
+<div>
+<pre class="source">switch_case(
+    &quot;a&quot;,
+    &quot;x&quot;, 1,
+    &quot;y&quot;, 2,
+    &quot;z&quot;, 3
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="deep_equal"></a>deep_equal</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">deep_equal(expr1, expr2)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr1</tt> : an expression,</li>
+<li><tt>expr2</tt> : an expression.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>true</tt> or <tt>false</tt> depending on the data equality,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">deep_equal(
+           {
+             &quot;id&quot;:1,
+             &quot;project&quot;:&quot;AsterixDB&quot;,
+             &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+             &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+           },
+           {
+             &quot;id&quot;:1,
+             &quot;project&quot;:&quot;AsterixDB&quot;,
+             &quot;address&quot;:{&quot;city&quot;:&quot;San Diego&quot;, &quot;state&quot;:&quot;CA&quot;},
+             &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+           }
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">false
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Bitwise_Functions"></a><a name="BitwiseFunctions" id="BitwiseFunctions">Bitwise Functions</a></h2>
+<p>All Bit/Binary functions can only operate on 64-bit signed integers.</p>
+<p><b>Note:</b> All non-integer numbers and other data types result in null.</p>
+<p><b>Note:</b> The query language uses two&#x2019;s complement representation.</p>
+<p>When looking at the value in binary form, bit 1 is the Least Significant Bit (LSB) and bit 32 is the Most Significant Bit (MSB).</p>
+<p>(MSB) Bit 32 &#x2192; <tt>0000 0000 0000 0000 0000 0000 0000 0000</tt> &#x2190; Bit 1 (LSB)</p>
+<div class="section">
+<h3><a name="bitand"></a>bitand</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITAND(int_value1, int_value2, ... , int_valueN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the result of a bitwise AND operation performed on all input integer values.</p>
+<p>The bitwise AND operation compares each bit of <tt>int_value1</tt> to the corresponding bit of every other <tt>int_value</tt>. If all bits are 1, then the corresponding result bit is set to 1; otherwise it is set to 0 (zero).</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>int_valueI</tt>: Integers, or any valid expressions which evaluate to integers, that are used to compare.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the bitwise AND between all of the input integers.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Compare 3 (0011 in binary) and 6 (0110 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: BITAND(3,6) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: 2 }
+</pre></div></div>
+
+<p>This results in 2 (0010 in binary) because only bit 2 is set in both 3 (00<b>1</b>1) and 6 (01<b>1</b>0).</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>Compare 4.5 and 3 (0011 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: BITAND(4.5,3) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: null }
+</pre></div></div>
+
+<p>The result is null because 4.5 is not an integer.</p>
+</li>
+<li>
+
+<p>Example 3:</p>
+<p>Compare 4.0 (0100 in binary) and 3 (0011 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: BITAND(4.0,3) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: 0 }
+</pre></div></div>
+
+<p>This results in 0 (zero) because 4.0 (0100) and 3 (0011) do not share any bits that are both 1.</p>
+</li>
+<li>
+
+<p>Example 4:</p>
+<p>Compare 3 (0011 in binary) and 6 (0110 in binary) and 15 (1111 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: BITAND(3,6,15) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: 2 }
+</pre></div></div>
+
+<p>This results in 2 (0010 in binary) because only the 2nd bit from the right is 1 in all three numbers.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="bitclear"></a>bitclear</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITCLEAR(int_value, positions)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the result after clearing the specified bit, or array of bits in <tt>int_value</tt> using the given <tt>positions</tt>.</p>
+<p><b>Note:</b> Specifying a negative or zero bit position makes the function return a null.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>int_value</tt>: An integer, or any valid expression which evaluates to an integer, that contains the target bit or bits to clear.</p>
+</li>
+<li>
+
+<p><tt>positions</tt>: An integer or an array of integers specifying the position or positions to be cleared.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the result after clearing the bit or bits specified.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Clear bit 1 from 6 (0110 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitCLEAR&quot;: BITCLEAR(6,1) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitCLEAR&quot;: 6 }
+</pre></div></div>
+
+<p>This results in 6 (011<b>0</b> in binary) because bit 1 was already zero.</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>Clear bits 1 and 2 from 6 (01<b>10</b> in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitCLEAR&quot;: BITCLEAR(6,[1,2]) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitCLEAR&quot;: 4 }
+</pre></div></div>
+
+<p>This results in 4 (01<b>0</b>0 in binary) because bit 2 changed to zero.</p>
+</li>
+<li>
+
+<p>Example 3:</p>
+<p>Clear bits 1, 2, 4, and 5 from 31 (0<b>11</b>1<b>11</b> in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitCLEAR&quot;: BITCLEAR(31,[1,2,4,5]) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitCLEAR&quot;: 4 }
+</pre></div></div>
+
+<p>This results in 4 (0<b>00</b>1<b>00</b>) because bits 1, 2, 4, and 5 changed to zero.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="bitnot"></a>bitnot</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITNOT(int_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the results of a bitwise logical NOT operation performed on an integer value.</p>
+<p>The bitwise logical NOT operation reverses the bits in the value. For each value bit that is 1, the corresponding result bit will be set to 0 (zero); and for each value bit that is 0 (zero), the corresponding result bit will be set to 1.</p>
+<p><b>Note:</b> All bits of the integer will be altered by this operation.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>int_value</tt>: An integer, or any valid expression which evaluates to an integer, that contains the target bits to reverse.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the result after performing the logical NOT operation.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Perform the NOT operation on 3 (0000 0000 0000 0000 0000 0000 0000 0011 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitNOT&quot;: BITNOT(3) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitNOT&quot;: -4 }
+</pre></div></div>
+
+<p>This results in -4 (<b>1111 1111 1111 1111 1111 1111 1111 1100</b> in binary) because all bits changed.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="bitor"></a>bitor</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITOR(int_value1, int_value2, ... , int_valueN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the result of a bitwise inclusive OR operation performed on all input integer values.</p>
+<p>The bitwise inclusive OR operation compares each bit of <tt>int_value1</tt> to the corresponding bit of every other <tt>int_value</tt>. If any bit is 1, the corresponding result bit is set to 1; otherwise, it is set to 0 (zero).</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>int_valueI</tt>: Integers, or any valid expressions which evaluate to integers, that are used to compare.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the bitwise OR between all of the input integers.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Perform OR on 3 (0011 in binary) and 6 (0110 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitOR&quot;: BITOR(3,6) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitOR&quot;: 7 }
+</pre></div></div>
+
+<p>This results in 7 (0<b>111</b> in binary) because at least 1 bit of each (00<b>11</b> and 0<b>11</b>0) is 1 in bits 1, 2, and 3.</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>Perform OR on 3 (0011 in binary) and -4 (1000 0000 0000 &#x2026; 0000 1100 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitOR&quot;: BITOR(3,-4) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitOR&quot;: -1 }
+</pre></div></div>
+
+<p>This results in -1 (<b>1111 1111 1111 &#x2026; 1111 1111</b> in binary) because the two 1 bits in 3 fill in the two 0 bits in -4 to turn on all the bits.</p>
+</li>
+<li>
+
+<p>Example 3:</p>
+<p>Perform OR on 3 (0011 in binary) and 6 (0110 in binary) and 15 (1111 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitOR&quot;: BITOR(3,6,15) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitOR&quot;: 15 }
+</pre></div></div>
+
+<p>This results in 15 (1111 in binary) because there is at least one 1 in each of the four rightmost bits.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="bitset"></a>bitset</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITSET(int_value, positions)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the result after setting the specified bit <tt>position</tt>, or array of bit positions, to 1 in the given <tt>int_value</tt>.</p>
+<p><b>Note:</b> Specifying a negative or zero position makes the function return a null.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>int_value</tt>: An integer, or any valid expression which evaluates to an integer, that contains the target bit or bits to set.</p>
+</li>
+<li>
+
+<p><tt>positions</tt>: An integer or an array of integers specifying the position or positions to be set.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the result after setting the bit or bits specified. If the bit is already set, then it stays set.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Set bit 1 in the value 6 (011<b>0</b> in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSET&quot;: BITSET(6,1) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSET&quot;: 7 }
+</pre></div></div>
+
+<p>This results in 7 (011<b>1</b> in binary) because bit 1 changed to 1.</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>Set bits 1 and 2 in the value 6 (01<b>10</b> in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSET&quot;: BITSET(6,[1,2]) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSET&quot;: 7 }
+</pre></div></div>
+
+<p>This also results in 7 (01<b>11</b> in binary) because bit 1 changed while bit 2 remained the same.</p>
+</li>
+<li>
+
+<p>Example 3:</p>
+<p>Set bits 1 and 4 in the value 6 (<b>0</b>11<b>0</b> in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSET&quot;: BITSET(6,[1,4]) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSET&quot;: 15 }
+</pre></div></div>
+
+<p>This results in 15 (<b>1</b>11<b>1</b> in binary) because bit 1 and 4 changed to ones.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="bitshift"></a>bitshift</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITSHIFT(int_value, shift_amount[, rotate])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the result of a bit shift operation performed on the integer value <tt>int_value</tt>. The <tt>shift_amount</tt> supports left and right shifts. These are logical shifts. The third parameter <tt>rotate</tt> supports circular shift. This is similar to the BitROTATE function in Oracle.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>int_value</tt>: An integer, or any valid expression which evaluates to an integer, that contains the target bit or bits to shift.</p>
+</li>
+<li>
+
+<p><tt>shift_amount</tt>: An integer, or any valid expression which evaluates to an integer, that contains the number of bits to shift.</p>
+<ul>
+
+<li>
+
+<p>A positive (+) number means this is a LEFT shift.</p>
+</li>
+<li>
+
+<p>A negative (-) number means this is a RIGHT shift.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p><tt>rotate</tt>: (Optional) A boolean, or any valid expression which evaluates to a boolean, where:</p>
+<ul>
+
+<li>
+
+<p>FALSE means this is a LOGICAL shift, where bits shifted off the end of a value are considered lost.</p>
+</li>
+<li>
+
+<p>TRUE means this is a CIRCULAR shift (shift-and-rotate operation), where bits shifted off the end of a value are rotated back onto the value at the <i>other</i> end. In other words, the bits rotate in what might be thought of as a circular pattern; therefore, these bits are not lost.</p>
+</li>
+</ul>
+<p>If omitted, the default is FALSE.</p>
+</li>
+</ul>
+<p>For comparison, see the below table.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Input </th>
+<th> Shift </th>
+<th> Result of Logical Shift (Rotate FALSE) </th>
+<th> Result of Circular Shift (Rotate TRUE) </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> 6 (0000 0110)     </td>
+<td> 4     </td>
+<td> 96 (0110 0000)    </td>
+<td> 96 (0110 0000)                                 </td></tr>
+<tr class="a">
+<td> 6 (0000 0110)     </td>
+<td> 3     </td>
+<td> 48 (0011 0000)    </td>
+<td> 48 (0011 0000)                                 </td></tr>
+<tr class="b">
+<td> 6 (0000 0110)     </td>
+<td> 2     </td>
+<td> 24 (0001 1000)    </td>
+<td> 24 (0001 1000)                                 </td></tr>
+<tr class="a">
+<td> 6 (0000 0110)     </td>
+<td> 1     </td>
+<td> 12 (0000 1100)    </td>
+<td> 12 (0000 1100)                                 </td></tr>
+<tr class="b">
+<td> <b>6 (0000 0110)</b> </td>
+<td> <b>0</b> </td>
+<td> <b>6 (0000 0110)</b> </td>
+<td> <b>6 (0000 0110)</b>                              </td></tr>
+<tr class="a">
+<td> 6 (0000 0110)     </td>
+<td> -1    </td>
+<td> 3 (0000 0011)     </td>
+<td> 3 (0000 0011)                                  </td></tr>
+<tr class="b">
+<td> 6 (0000 0110)     </td>
+<td> -2    </td>
+<td> 1 (0000 0001)     </td>
+<td> -9223372036854775807 (1000 0000 &#x2026; 0000 0001) </td></tr>
+<tr class="a">
+<td> 6 (0000 0110)     </td>
+<td> -3    </td>
+<td> 0 (0000 0000)     </td>
+<td> -4611686018427387904 (1100 0000 &#x2026; 0000 0000) </td></tr>
+<tr class="b">
+<td> 6 (0000 0110)     </td>
+<td> -4    </td>
+<td> 0 (0000 0000)     </td>
+<td> 6917529027641081856 (0110 0000 &#x2026; 0000 0000)  </td></tr>
+</tbody>
+</table>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the result of either a logical or circular shift of the given integer.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Logical left shift of the number 6 (0110 in binary) by one bit.</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: BITSHIFT(6,1,FALSE) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: 12 }
+</pre></div></div>
+
+<p>This results in 12 (1100 in binary) because the 1-bits moved from positions 2 and 3 to positions 3 and 4.</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>Logical right shift of the number 6 (0110 in binary) by two bits.</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: BITSHIFT(6,-2) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: 1 }
+</pre></div></div>
+
+<p>This results in 1 (0001 in binary) because the 1-bit in position 3 moved to position 1 and the 1-bit in position 2 was dropped.</p>
+</li>
+<li>
+
+<p>Example 2b:</p>
+<p>Circular right shift of the number 6 (0110 in binary) by two bits.</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: BITSHIFT(6,-2,TRUE) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: -9223372036854775807 }
+</pre></div></div>
+
+<p>This results in -9223372036854775807 (1100 0000 0000 0000 0000 0000 0000 0000 in binary) because the two 1-bits wrapped right, around to the Most Significant Digit position and changed the integer&#x2019;s sign to negative.</p>
+</li>
+<li>
+
+<p>Example 3:</p>
+<p>Circular left shift of the number 524288 (1000 0000 0000 0000 0000 in binary) by 45 bits.</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: BITSHIFT(524288,45,TRUE) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: 1 }
+</pre></div></div>
+
+<p>This results in 1 because the 1-bit wrapped left, around to the Least Significant Digit position.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="bittest"></a>bittest</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITTEST(int_value, positions [, all_set])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns TRUE if the specified bit, or bits, is a 1; otherwise, returns FALSE if the specified bit, or bits, is a 0 (zero).</p>
+<p><b>Note:</b> Specifying a negative or zero bit position will result in null being returned.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>int_value</tt>: An integer, or any valid expression which evaluates to an integer, that contains the target bit or bits to test.</p>
+</li>
+<li>
+
+<p><tt>positions</tt>: An integer or an array of integers specifying the position or positions to be tested.</p>
+</li>
+<li>
+
+<p><tt>all_set</tt>: (Optional) A boolean, or any valid expression which evaluates to a boolean.</p>
+<ul>
+
+<li>
+
+<p>When <tt>all_set</tt> is FALSE, then it returns TRUE even if one bit in one of the positions is set.</p>
+</li>
+<li>
+
+<p>When <tt>all_set</tt> is TRUE, then it returns TRUE only if all input positions are set.</p>
+</li>
+</ul>
+<p>If omitted, the default is FALSE.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>A boolean, that follows the below table:
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> <tt>int_value</tt>                    </th>
+<th> <tt>all_set</tt> </th>
+<th> Return Value </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> <i>all</i> specified bits are TRUE  </td>
+<td> FALSE     </td>
+<td> TRUE         </td></tr>
+<tr class="a">
+<td> <i>all</i> specified bits are TRUE  </td>
+<td> TRUE      </td>
+<td> TRUE         </td></tr>
+<tr class="b">
+<td> <i>some</i> specified bits are TRUE </td>
+<td> FALSE     </td>
+<td> TRUE         </td></tr>
+<tr class="a">
+<td> <i>some</i> specified bits are TRUE </td>
+<td> TRUE      </td>
+<td> FALSE        </td></tr>
+</tbody>
+</table>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>In the number 6 (0110 in binary), is bit 1 set?</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;IsBitSET&quot;: ISBITSET(6,1) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;IsBitSET&quot;: false }
+</pre></div></div>
+
+<p>This returns FALSE because bit 1 of 6 (011<b>0</b> in binary) is not set to 1.</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>In the number 1, is either bit 1 or bit 2 set?</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitTEST&quot;: BITTEST(1,[1,2],FALSE) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitTEST&quot;: true }
+</pre></div></div>
+
+<p>This returns TRUE because bit 1 of the number 1 (000<b>1</b> in binary) is set to 1.</p>
+</li>
+<li>
+
+<p>Example 3:</p>
+<p>In the number 6 (0110 in binary), are both bits 2 and 3 set?</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;IsBitSET&quot;: ISBITSET(6,[2,3],TRUE) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;IsBitSET&quot;: true }
+</pre></div></div>
+
+<p>This returns TRUE because both bits 2 and 3 in the number 6 (0<b>11</b>0 in binary) are set to 1.</p>
+</li>
+<li>
+
+<p>Example 4:</p>
+<p>In the number 6 (0110 in binary), are all the bits in positions 1 through 3 set?</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitTEST&quot;: BITTEST(6,[1,3],TRUE) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitTEST&quot;: false }
+</pre></div></div>
+
+<p>This returns FALSE because bit 1 in the number 6 (011<b>0</b> in binary) is set to 0 (zero).</p>
+</li>
+</ul>
+<p>The function has an alias <tt>isbitset</tt>.</p></div>
+<div class="section">
+<h3><a name="bitxor"></a>bitxor</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITXOR(int_value1, int_value2, ... , int_valueN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the result of a bitwise Exclusive OR operation performed on two or more integer values.</p>
+<p>The bitwise Exclusive OR operation compares each bit of <tt>int_value1</tt> to the corresponding bit of <tt>int_value2</tt>.</p>
+<p>If there are more than two input values, the first two are compared; then their result is compared to the next input value; and so on.</p>
+<p>When the compared bits do not match, the result bit is 1; otherwise, the compared bits do match, and the result bit is 0 (zero), as summarized:</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Bit 1 </th>
+<th> Bit 2 </th>
+<th> XOR Result Bit </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> 0     </td>
+<td> 0     </td>
+<td> 0              </td></tr>
+<tr class="a">
+<td> 0     </td>
+<td> 1     </td>
+<td> 1              </td></tr>
+<tr class="b">
+<td> 1     </td>
+<td> 0     </td>
+<td> 1              </td></tr>
+<tr class="a">
+<td> 1     </td>
+<td> 1     </td>
+<td> 0              </td></tr>
+</tbody>
+</table>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>int_valueI</tt>: Integers, or any valid expressions which evaluate to integers, that are used to compare.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the bitwise XOR between the input integers.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Perform the XOR operation on 3 (0011 in binary) and 6 (0110 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitXOR&quot;: BITXOR(3,6) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitXOR&quot;: 5 }
+</pre></div></div>
+
+<p>This returns 5 (0101 in binary) because the 1st bit pair and 3rd bit pair are different (resulting in 1) while the 2nd bit pair and 4th bit pair are the same (resulting in 0):</p>
+
+<div>
+<div>
+<pre class="source">0011 (3)
+0110 (6)
+====
+0101 (5)
+</pre></div></div>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>Perform the XOR operation on 3 (0011 in binary) and 6 (0110 in binary) and 15 (1111 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitXOR&quot;: BITXOR(3,6,15) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitXOR&quot;: 10 }
+</pre></div></div>
+
+<p>This returns 10 (1010 in binary) because 3 XOR 6 equals 5 (0101 in binary), and then 5 XOR 15 equals 10 (1010 in binary).</p>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Window_Functions"></a><a name="WindowFunctions" id="WindowFunctions">Window Functions</a></h2>
+<p>Window functions are used to compute an aggregate or cumulative value, based on a portion of the tuples selected by a query. For each input tuple, a movable window of tuples is defined. The window determines the tuples to be used by the window function.</p>
+<p>The tuples are not grouped into a single output tuple &#x2014; each tuple remains separate in the query output.</p>
+<p>All window functions must be used with an OVER clause. Refer to <a href="manual.html#Over_clauses">Window Queries</a> for details.</p>
+<p>Window functions cannot appear in the FROM clause clause or LIMIT clause.</p>
+<div class="section">
+<h3><a name="cume_dist"></a>cume_dist</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">CUME_DIST() OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the percentile rank of the current tuple as part of the cumulative distribution &#x2013; that is, the number of tuples ranked lower than or equal to the current tuple, including the current tuple, divided by the total number of tuples in the window partition.</p>
+<p>The window order clause determines the sort order of the tuples. If the window order clause is omitted, the function returns the same result (1.0) for each tuple.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>None.</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>A number greater than 0 and less than or equal to 1. The higher the value, the higher the ranking.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each customer, find the cumulative distribution of all orders by order number.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+SELECT o.custid, o.orderno, CUME_DIST() OVER (
+  PARTITION BY o.custid
+  ORDER BY o.orderno
+) AS `rank`
+ORDER BY o.custid, o.orderno;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;rank&quot;: 0.25,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002
+  },
+  {
+    &quot;rank&quot;: 0.5,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007
+  },
+  {
+    &quot;rank&quot;: 0.75,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005
+  },
+  {
+    &quot;rank&quot;: 0.5,
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="dense_rank"></a>dense_rank</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">DENSE_RANK() OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the dense rank of the current tuple &#x2013; that is, the number of distinct tuples preceding this tuple in the current window partition, plus one.</p>
+<p>The tuples are ordered by the window order clause. If any tuples are tied, they will have the same rank. If the window order clause is omitted, the function returns the same result (1) for each tuple.</p>
+<p>For this function, when any tuples have the same rank, the rank of the next tuple will be consecutive, so there will not be a gap in the sequence of returned values. For example, if there are five tuples ranked 3, the next dense rank is 4.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>None.</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, greater than or equal to 1.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>Find the dense rank of all orders by number of items.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+SELECT o.orderno, LEN(o.items) AS items,
+DENSE_RANK() OVER (
+  ORDER BY LEN(o.items)
+) AS `rank`
+ORDER BY `rank`, o.orderno;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;items&quot;: 0,
+    &quot;rank&quot;: 1,
+    &quot;orderno&quot;: 1009
+  },
+  {
+    &quot;items&quot;: 1,
+    &quot;rank&quot;: 2,
+    &quot;orderno&quot;: 1008
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1001
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1002
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1003
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1004
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1007
+  },
+  {
+    &quot;items&quot;: 3,
+    &quot;rank&quot;: 4,
+    &quot;orderno&quot;: 1006
+  },
+  {
+    &quot;items&quot;: 4,
+    &quot;rank&quot;: 5,
+    &quot;orderno&quot;: 1005
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="first_value"></a>first_value</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">FIRST_VALUE(expr) [nulls-modifier] OVER (window-definition)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the requested value from the first tuple in the current window frame, where the window frame is specified by the window definition.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expr</tt>: The value that you want to return from the first tuple in the window frame. <sup>[</sup><a href="#fn_1"><sup>1</sup></a><sup>]</sup></li>
+</ul>
+</li>
+<li>
+
+<p>Modifiers:</p>
+<ul>
+
+<li><a href="manual.html#Window_function_options">NULLS Modifier</a>: (Optional) Determines how NULL or MISSING values are treated when finding the first value in the window frame.
+<ul>
+
+<li>
+
+<p><tt>IGNORE NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are ignored when finding the first tuple. In this case, the function returns the first non-NULL, non-MISSING value.</p>
+</li>
+<li>
+
+<p><tt>RESPECT NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are included when finding the first tuple.</p>
+</li>
+</ul>
+<p>If this modifier is omitted, the default is <tt>RESPECT NULLS</tt>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_frame_clause">Window Frame Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>
+
+<p>The specified value from the first tuple. The order of the tuples is determined by the window order clause.</p>
+</li>
+<li>
+
+<p>NULL, if the frame was empty or if all values were NULL or MISSING and the <tt>IGNORE NULLS</tt> modifier was specified.</p>
+</li>
+<li>
+
+<p>In the following cases, this function may return unpredictable results.</p>
+<ul>
+
+<li>
+
+<p>If the window order clause is omitted.</p>
+</li>
+<li>
+
+<p>If the window frame is defined by <tt>ROWS</tt>, and there are tied tuples in the window frame.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>To make the function return deterministic results, add a window order clause, or add further ordering terms to the window order clause so that no tuples are tied.</p>
+</li>
+<li>
+
+<p>If the window frame is defined by <tt>RANGE</tt> or <tt>GROUPS</tt>, and there are tied tuples in the window frame, the function returns the first value of the input expression.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each order, show the customer and the value, including the value of the smallest order from that customer.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno, revenue,
+FIRST_VALUE(revenue) OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+) AS smallest_order;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null,
+    &quot;smallest_order&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45,
+    &quot;smallest_order&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8,
+    &quot;smallest_order&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55,
+    &quot;smallest_order&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95,
+    &quot;smallest_order&quot;: 477.95
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94,
+    &quot;smallest_order&quot;: 199.94
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92,
+    &quot;smallest_order&quot;: 4639.92
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73,
+    &quot;smallest_order&quot;: 157.73
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58,
+    &quot;smallest_order&quot;: 157.73
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="lag"></a>lag</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">LAG(expr[, offset[, default]]) [nulls-modifier] OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the value from a tuple at a given offset prior to the current tuple position.</p>
+<p>The window order clause determines the sort order of the tuples. If the window order clause is omitted, the return values may be unpredictable.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>expr</tt>: The value that you want to return from the offset tuple. <sup>[</sup><a href="#fn_1"><sup>1</sup></a><sup>]</sup></p>
+</li>
+<li>
+
+<p><tt>offset</tt>: (Optional) A positive integer. If omitted, the default is 1.</p>
+</li>
+<li>
+
+<p><tt>default</tt>: (Optional) The value to return when the offset goes out of partition scope. If omitted, the default is NULL.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Modifiers:</p>
+<ul>
+
+<li><a href="manual.html#Window_function_options">NULLS Modifier</a>: (Optional) Determines how NULL or MISSING values are treated when finding the offset tuple in the window partition.
+<ul>
+
+<li>
+
+<p><tt>IGNORE NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are ignored when finding the offset tuple.</p>
+</li>
+<li>
+
+<p><tt>RESPECT NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are included when finding the offset tuple.</p>
+</li>
+</ul>
+<p>If this modifier is omitted, the default is <tt>RESPECT NULLS</tt>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>
+
+<p>The specified value from the offset tuple.</p>
+</li>
+<li>
+
+<p>If the offset tuple is out of partition scope, it returns the default value, or NULL if no default is specified.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each order, show the customer and the value, including the value of the next-smallest order from that customer.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno, revenue,
+LAG(revenue, 1, &quot;No smaller order&quot;) OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+) AS next_smallest_order;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null,
+    &quot;next_smallest_order&quot;: &quot;No smaller order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45,
+    &quot;next_smallest_order&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8,
+    &quot;next_smallest_order&quot;: 130.45
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55,
+    &quot;next_smallest_order&quot;: 1999.8
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95,
+    &quot;next_smallest_order&quot;: &quot;No smaller order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94,
+    &quot;next_smallest_order&quot;: &quot;No smaller order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92,
+    &quot;next_smallest_order&quot;: &quot;No smaller order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73,
+    &quot;next_smallest_order&quot;: &quot;No smaller order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58,
+    &quot;next_smallest_order&quot;: 157.73
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="last_value"></a>last_value</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">LAST_VALUE(expr) [nulls-modifier] OVER (window-definition)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the requested value from the last tuple in the current window frame, where the window frame is specified by the window definition.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expr</tt>: The value that you want to return from the last tuple in the window frame. <sup>[</sup><a href="#fn_1"><sup>1</sup></a><sup>]</sup></li>
+</ul>
+</li>
+<li>
+
+<p>Modifiers:</p>
+<ul>
+
+<li><a href="manual.html#Window_function_options">NULLS Modifier</a>: (Optional) Determines how NULL or MISSING values are treated when finding the last tuple in the window frame.
+<ul>
+
+<li>
+
+<p><tt>IGNORE NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are ignored when finding the last tuple. In this case, the function returns the last non-NULL, non-MISSING value.</p>
+</li>
+<li>
+
+<p><tt>RESPECT NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are included when finding the last tuple.</p>
+</li>
+</ul>
+<p>If this modifier is omitted, the default is <tt>RESPECT NULLS</tt>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_frame_clause">Window Frame Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>
+
+<p>The specified value from the last tuple. The order of the tuples is determined by the window order clause.</p>
+</li>
+<li>
+
+<p>NULL, if the frame was empty or if all values were NULL or MISSING and the <tt>IGNORE NULLS</tt> modifier was specified.</p>
+</li>
+<li>
+
+<p>In the following cases, this function may return unpredictable results.</p>
+<ul>
+
+<li>
+
+<p>If the window order clause is omitted.</p>
+</li>
+<li>
+
+<p>If the window frame clause is omitted.</p>
+</li>
+<li>
+
+<p>If the window frame is defined by <tt>ROWS</tt>, and there are tied tuples in the window frame.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>To make the function return deterministic results, add a window order clause, or add further ordering terms to the window order clause so that no tuples are tied.</p>
+</li>
+<li>
+
+<p>If the window frame is defined by <tt>RANGE</tt> or <tt>GROUPS</tt>, and there are tied tuples in the window frame, the function returns the last value of the input expression.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each order, show the customer and the value, including the value of the largest order from that customer.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno, revenue,
+LAST_VALUE(revenue) OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+  ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING -- &#x278a;
+) AS largest_order;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null,
+    &quot;largest_order&quot;: 10906.55
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45,
+    &quot;largest_order&quot;: 10906.55
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8,
+    &quot;largest_order&quot;: 10906.55
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55,
+    &quot;largest_order&quot;: 10906.55
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95,
+    &quot;largest_order&quot;: 477.95
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94,
+    &quot;largest_order&quot;: 199.94
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92,
+    &quot;largest_order&quot;: 4639.92
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73,
+    &quot;largest_order&quot;: 18847.58
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58,
+    &quot;largest_order&quot;: 18847.58
+  }
+]
+</pre></div></div>
+
+<p>&#x2780; This clause specifies that the window frame should extend to the end of the window partition. Without this clause, the end point of the window frame would always be the current tuple. This would mean that the largest order would always be the same as the current order.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="lead"></a>lead</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">LEAD(expr[, offset[, default]]) [nulls-modifier] OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the value from a tuple at a given offset ahead of the current tuple position.</p>
+<p>The window order clause determines the sort order of the tuples. If the window order clause is omitted, the return values may be unpredictable.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>expr</tt>: The value that you want to return from the offset tuple. <sup>[</sup><a href="#fn_1"><sup>1</sup></a><sup>]</sup></p>
+</li>
+<li>
+
+<p><tt>offset</tt>: (Optional) A positive integer. If omitted, the default is 1.</p>
+</li>
+<li>
+
+<p><tt>default</tt>: (Optional) The value to return when the offset goes out of window partition scope. If omitted, the default is NULL.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Modifiers:</p>
+<ul>
+
+<li><a href="manual.html#Window_function_options">NULLS Modifier</a>: (Optional) Determines how NULL or MISSING values are treated when finding the offset tuple in the window partition.
+<ul>
+
+<li>
+
+<p><tt>IGNORE NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are ignored when finding the offset tuple.</p>
+</li>
+<li>
+
+<p><tt>RESPECT NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are included when finding the offset tuple.</p>
+</li>
+</ul>
+<p>If this modifier is omitted, the default is <tt>RESPECT NULLS</tt>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>
+
+<p>The specified value from the offset tuple.</p>
+</li>
+<li>
+
+<p>If the offset tuple is out of partition scope, it returns the default value, or NULL if no default is specified.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each order, show the customer and the value, including the value of the next-largest order from that customer.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno, revenue,
+LEAD(revenue, 1, &quot;No larger order&quot;) OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+) AS next_largest_order;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null,
+    &quot;next_largest_order&quot;: 130.45
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45,
+    &quot;next_largest_order&quot;: 1999.8
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8,
+    &quot;next_largest_order&quot;: 10906.55
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55,
+    &quot;next_largest_order&quot;: &quot;No larger order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95,
+    &quot;next_largest_order&quot;: &quot;No larger order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94,
+    &quot;next_largest_order&quot;: &quot;No larger order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92,
+    &quot;next_largest_order&quot;: &quot;No larger order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73,
+    &quot;next_largest_order&quot;: 18847.58
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58,
+    &quot;next_largest_order&quot;: &quot;No larger order&quot;
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="nth_value"></a>nth_value</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">NTH_VALUE(expr, offset) [from-modifier] [nulls-modifier] OVER (window-definition)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the requested value from a tuple in the current window frame, where the window frame is specified by the window definition.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>expr</tt>: The value that you want to return from the offset tuple in the window frame. <sup>[</sup><a href="#fn_1"><sup>1</sup></a><sup>]</sup></p>
+</li>
+<li>
+
+<p><tt>offset</tt>: The number of the offset tuple within the window frame, counting from 1.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Modifiers:</p>
+<ul>
+
+<li>
+
+<p><a href="manual.html#Window_function_options">FROM Modifier</a>: (Optional) Determines where the function starts counting the offset.</p>
+<ul>
+
+<li>
+
+<p><tt>FROM FIRST</tt>: Counting starts at the first tuple in the window frame. In this case, an offset of 1 is the first tuple in the window frame, 2 is the second tuple, and so on.</p>
+</li>
+<li>
+
+<p><tt>FROM LAST</tt>: Counting starts at the last tuple in the window frame. In this case, an offset of 1 is the last tuple in the window frame, 2 is the second-to-last tuple, and so on.</p>
+</li>
+</ul>
+<p>The order of the tuples is determined by the window order clause. If this modifier is omitted, the default is <tt>FROM FIRST</tt>.</p>
+</li>
+<li>
+
+<p><a href="manual.html#Window_function_options">NULLS Modifier</a>: (Optional) Determines how NULL or MISSING values are treated when finding the offset tuple in the window frame.</p>
+<ul>
+
+<li>
+
+<p><tt>IGNORE NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are ignored when finding the offset tuple.</p>
+</li>
+<li>
+
+<p><tt>RESPECT NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are included when finding the offset tuple.</p>
+</li>
+</ul>
+<p>If this modifier is omitted, the default is <tt>RESPECT NULLS</tt>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_frame_clause">Window Frame Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>
+
+<p>The specified value from the offset tuple.</p>
+</li>
+<li>
+
+<p>In the following cases, this function may return unpredictable results.</p>
+<ul>
+
+<li>
+
+<p>If the window order clause is omitted.</p>
+</li>
+<li>
+
+<p>If the window frame is defined by <tt>ROWS</tt>, and there are tied tuples in the window frame.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>To make the function return deterministic results, add a window order clause, or add further ordering terms to the window order clause so that no tuples are tied.</p>
+</li>
+<li>
+
+<p>If the window frame is defined by <tt>RANGE</tt> or <tt>GROUPS</tt>, and there are tied tuples in the window frame, the function returns the first value of the input expression when counting <tt>FROM FIRST</tt>, or the last value of the input expression when counting <tt>FROM LAST</tt>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>For each order, show the customer and the value, including the value of the second smallest order from that customer.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno, revenue,
+NTH_VALUE(revenue, 2) FROM FIRST OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+  ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING -- &#x278a;
+) AS smallest_order_but_1;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null,
+    &quot;smallest_order_but_1&quot;: 130.45
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45, // &#x278b;
+    &quot;smallest_order_but_1&quot;: 130.45
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8,
+    &quot;smallest_order_but_1&quot;: 130.45
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55,
+    &quot;smallest_order_but_1&quot;: 130.45
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95,
+    &quot;smallest_order_but_1&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94,
+    &quot;smallest_order_but_1&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92,
+    &quot;smallest_order_but_1&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73,
+    &quot;smallest_order_but_1&quot;: 18847.58
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58, // &#x278b;
+    &quot;smallest_order_but_1&quot;: 18847.58
+  }
+]
+</pre></div></div>
+
+<p>&#x2780; This clause specifies that the window frame should extend to the end of the window partition. Without this clause, the end point of the window frame would always be the current tuple. This would mean that for the smallest order, the function would be unable to find the route with the second smallest order.</p>
+<p>&#x2781; The second smallest order from this customer.</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>For each order, show the customer and the value, including the value of the second largest order from that customer.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno, revenue,
+NTH_VALUE(revenue, 2) FROM LAST OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+  ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING -- &#x278a;
+) AS largest_order_but_1;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55,
+    &quot;largest_order_but_1&quot;: 1999.8
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8, // &#x278b;
+    &quot;largest_order_but_1&quot;: 1999.8
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45,
+    &quot;largest_order_but_1&quot;: 1999.8
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null,
+    &quot;largest_order_but_1&quot;: 1999.8
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95,
+    &quot;largest_order_but_1&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94,
+    &quot;largest_order_but_1&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92,
+    &quot;largest_order_but_1&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58,
+    &quot;largest_order_but_1&quot;: 157.73
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73, // &#x278b;
+    &quot;largest_order_but_1&quot;: 157.73
+  }
+]
+</pre></div></div>
+
+<p>&#x2780; This clause specifies that the window frame should extend to the end of the window partition. Without this clause, the end point of the window frame would always be the current tuple. This would mean the function would be unable to find the second largest order for smaller orders.</p>
+<p>&#x2781; The second largest order from this customer.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ntile"></a>ntile</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">NTILE(num_tiles) OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Divides the window partition into the specified number of tiles, and allocates each tuple in the window partition to a tile, so that as far as possible each tile has an equal number of tuples. When the set of tuples is not equally divisible by the number of tiles, the function puts more tuples into the lower-numbered tiles. For each tuple, the function returns the number of the tile into which that tuple was placed.</p>
+<p>The window order clause determines the sort order of the tuples. If the window order clause is omitted then the tuples are processed in an undefined order.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>num_tiles</tt>: The number of tiles into which you want to divide the window partition. This argument can be an expression and must evaluate to a number. If the number is not an integer, it will be truncated.</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An value greater than or equal to 1 and less than or equal to the number of tiles.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>Allocate each order to one of three tiles by value.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.orderno, revenue,
+NTILE(3) OVER (
+  ORDER BY revenue
+) AS `ntile`;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;ntile&quot;: 1,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null
+  },
+  {
+    &quot;ntile&quot;: 1,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45
+  },
+  {
+    &quot;ntile&quot;: 1,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73
+  },
+  {
+    &quot;ntile&quot;: 2,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94
+  },
+  {
+    &quot;ntile&quot;: 2,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95
+  },
+  {
+    &quot;ntile&quot;: 2,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8
+  },
+  {
+    &quot;ntile&quot;: 3,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92
+  },
+  {
+    &quot;ntile&quot;: 3,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55
+  },
+  {
+    &quot;ntile&quot;: 3,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="percent_rank"></a>percent_rank</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">PERCENT_RANK() OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the percentile rank of the current tuple &#x2013; that is, the rank of the tuples minus one, divided by the total number of tuples in the window partition minus one.</p>
+<p>The window order clause determines the sort order of the tuples. If the window order clause is omitted, the function returns the same result (0) for each tuple.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>None.</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>A number between 0 and 1. The higher the value, the higher the ranking.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each customer, find the percentile rank of all orders by order number.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+SELECT o.custid, o.orderno, PERCENT_RANK() OVER (
+  PARTITION BY o.custid
+  ORDER BY o.orderno
+) AS `rank`;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;rank&quot;: 0,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002
+  },
+  {
+    &quot;rank&quot;: 0.3333333333333333,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007
+  },
+  {
+    &quot;rank&quot;: 0.6666666666666666,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009
+  },
+  {
+    &quot;rank&quot;: 0,
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003
+  },
+  {
+    &quot;rank&quot;: 0,
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004
+  },
+  {
+    &quot;rank&quot;: 0,
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005
+  },
+  {
+    &quot;rank&quot;: 0,
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="rank"></a>rank</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">RANK() OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the rank of the current tuple &#x2013; that is, the number of distinct tuples preceding this tuple in the current window partition, plus one.</p>
+<p>The tuples are ordered by the window order clause. If any tuples are tied, they will have the same rank. If the window order clause is omitted, the function returns the same result (1) for each tuple.</p>
+<p>When any tuples have the same rank, the rank of the next tuple will include all preceding tuples, so there may be a gap in the sequence of returned values. For example, if there are five tuples ranked 3, the next rank is 8.</p>
+<p>To avoid gaps in the returned values, use the DENSE_RANK() function instead.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>None.</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, greater than or equal to 1.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>Find the rank of all orders by number of items.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+SELECT o.orderno, LEN(o.items) AS items,
+RANK() OVER (
+  ORDER BY LEN(o.items)
+) AS `rank`;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;items&quot;: 0,
+    &quot;rank&quot;: 1,
+    &quot;orderno&quot;: 1009
+  },
+  {
+    &quot;items&quot;: 1,
+    &quot;rank&quot;: 2,
+    &quot;orderno&quot;: 1008
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1004
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1007
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1002
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1001
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1003
+  },
+  {
+    &quot;items&quot;: 3,
+    &quot;rank&quot;: 8,
+    &quot;orderno&quot;: 1006
+  },
+  {
+    &quot;items&quot;: 4,
+    &quot;rank&quot;: 9,
+    &quot;orderno&quot;: 1005
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ratio_to_report"></a>ratio_to_report</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">RATIO_TO_REPORT(expr) OVER (window-definition)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the fractional ratio of the specified value for each tuple to the sum of values for all tuples in the window frame.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expr</tt>: The value for which you want to calculate the fractional ratio. <sup>[</sup><a href="#fn_1"><sup>1</sup></a><sup>]</sup></li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_frame_clause">Window Frame Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>
+
+<p>A number between 0 and 1, representing the fractional ratio of the value for the current tuple to the sum of values for all tuples in the current window frame. The sum of returned values for all tuples in the current window frame is 1.</p>
+</li>
+<li>
+
+<p>If the input expression does not evaluate to a number, or the sum of values for all tuples is zero, it returns NULL.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each customer, calculate the value of each order as a fraction of the total value of all orders.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno,
+RATIO_TO_REPORT(revenue) OVER (
+  PARTITION BY o.custid
+) AS fractional_ratio;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;fractional_ratio&quot;: 0.010006289887088855
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;fractional_ratio&quot;: 0.8365971710849288
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;fractional_ratio&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;fractional_ratio&quot;: 0.15339653902798234
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;fractional_ratio&quot;: 1
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;fractional_ratio&quot;: 1
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;fractional_ratio&quot;: 1
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;fractional_ratio&quot;: 0.9917007404772666
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;fractional_ratio&quot;: 0.008299259522733382
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="row_number"></a>row_number</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ROW_NUMBER() OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a unique row number for every tuple in every window partition. In each window partition, the row numbering starts at 1.</p>
+<p>The window order clause determines the sort order of the tuples. If the window order clause is omitted, the return values may be unpredictable.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>None.</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, greater than or equal to 1.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each customer, number all orders by value.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno,
+ROW_NUMBER() OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+) AS `row`;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;row&quot;: 1,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009
+  },
+  {
+    &quot;row&quot;: 2,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007
+  },
+  {
+    &quot;row&quot;: 3,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008
+  },
+  {
+    &quot;row&quot;: 4,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002
+  },
+  {
+    &quot;row&quot;: 1,
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003
+  },
+  {
+    &quot;row&quot;: 1,
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004
+  },
+  {
+    &quot;row&quot;: 1,
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005
+  },
+  {
+    &quot;row&quot;: 1,
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001
+  },
+  {
+    &quot;row&quot;: 2,
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006
+  }
+]
+</pre></div></div>
+</li>
+</ul><hr />
+<p><a name="fn_1" id="fn_1">1</a>. If the query contains the GROUP BY clause or any <a href="#AggregateFunctions">aggregate functions</a>, this expression must only depend on GROUP BY expressions or aggregate functions.</p></div></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/content/docs/0.9.9/sqlpp/manual.html b/content/docs/0.9.9/sqlpp/manual.html
new file mode 100644
index 0000000..e002139
--- /dev/null
+++ b/content/docs/0.9.9/sqlpp/manual.html
@@ -0,0 +1,5342 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/sqlpp/manual.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; The SQL++ Query Language</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+    <script type="text/javascript" src="../js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href=".././" id="bannerLeft"><img src="../images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="../index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="../ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="../ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="../aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="../sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="../datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li class="active"><a href="#"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="../SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="../sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="../api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="../csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="../aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="../feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="../udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="../sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="../sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="../sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="../geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="../geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="../interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="../spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="../sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="../aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="../aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href=".././" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="../images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>The SQL++ Query Language</h1>
+<ul>
+
+<li><a href="#Introduction">1. Introduction</a></li>
+<li><a href="#Expressions">2. Expressions</a>
+<ul>
+
+<li><a href="#Operator_expressions">Operator Expressions</a>
+<ul>
+
+<li><a href="#Arithmetic_operators">Arithmetic Operators</a></li>
+<li><a href="#Collection_operators">Collection Operators</a></li>
+<li><a href="#Comparison_operators">Comparison Operators</a></li>
+<li><a href="#Logical_operators">Logical Operators</a></li>
+</ul>
+</li>
+<li><a href="#Quantified_expressions">Quantified Expressions</a></li>
+<li><a href="#Path_expressions">Path Expressions</a></li>
+<li><a href="#Primary_expressions">Primary Expressions</a>
+<ul>
+
+<li><a href="#Literals">Literals</a></li>
+<li><a href="#Variable_references">Identifiers and Variable References</a></li>
+<li><a href="#Parameter_references">Parameter References</a></li>
+<li><a href="#Parenthesized_expressions">Parenthesized Expressions</a></li>
+<li><a href="#Function_call_expressions">Function Calls</a></li>
+<li><a href="#Case_expressions">Case Expressions</a></li>
+<li><a href="#Constructors">Constructors</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li><a href="#Queries">3. Queries</a>
+<ul>
+
+<li><a href="#Select_clauses">SELECT Clauses</a>
+<ul>
+
+<li><a href="#Select_element">Select Value</a></li>
+<li><a href="#SQL_select">SQL-style Select</a></li>
+<li><a href="#Select_star">Select *</a></li>
+<li><a href="#Select_distinct">Select Distinct</a></li>
+<li><a href="#Unnamed_projections">Unnamed Projections</a></li>
+<li><a href="#Abbreviated_field_access_expressions">Abbreviated Field Access Expressions</a></li>
+</ul>
+</li>
+<li><a href="#From_clauses">FROM clauses</a>
+<ul>
+
+<li><a href="#Joins">Joins</a></li>
+</ul>
+</li>
+<li><a href="#Let_clauses">LET Clauses</a></li>
+<li><a href="#WHERE_Clause">WHERE Clause</a></li>
+<li><a href="#Grouping">Grouping</a>
+<ul>
+
+<li><a href="#GROUP_BY_Clause">GROUP BY Clause</a></li>
+<li><a href="#HAVING_Clause">HAVING Clause</a></li>
+<li><a href="#Aggregation_PseudoFunctions">Aggregation Pseudo-functions</a></li>
+<li><a href="#GROUP_AS_Clause">GROUP AS Clause</a></li>
+</ul>
+</li>
+<li><a href="#Union_all">Selection and UNION ALL</a></li>
+<li><a href="#With_clauses">WITH Clauses</a></li>
+<li><a href="#Order_By_clauses">ORDER BY, LIMIT, and OFFSET Clauses</a></li>
+<li><a href="#Subqueries">Subqueries</a></li>
+</ul>
+</li>
+<li><a href="#Over_clauses">4. Window Functions</a>
+<ul>
+
+<li><a href="#Window_function_call">Window Function Call</a>
+<ul>
+
+<li><a href="#Window_function_arguments">Window Function Arguments</a></li>
+<li><a href="#Window_function_options">Window Function Options</a></li>
+<li><a href="#Window_frame_variable">Window Frame Variable</a></li>
+<li><a href="#Window_definition">Window Definition</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li><a href="#Errors">5. Errors</a>
+<ul>
+
+<li><a href="#Syntax_errors">Syntax Errors</a></li>
+<li><a href="#Identifier_resolution_errors">Identifier Resolution Errors</a></li>
+<li><a href="#Type_errors">Type Errors</a></li>
+<li><a href="#Resource_errors">Resource Errors</a></li>
+</ul>
+</li>
+<li><a href="#Vs_SQL-92">6.Differences from SQL-92</a></li>
+<li><a href="#DDL_and_DML_statements">7. DDL and DML Statements</a>
+<ul>
+
+<li><a href="#Lifecycle_management_statements">Lifecycle Management Statements</a>
+<ul>
+
+<li><a href="#Use">Use Statement</a></li>
+<li><a href="#Sets">Set Statement</a></li>
+<li><a href="#Functions">Function Declaration</a></li>
+<li><a href="#Create">Create Statement</a>
+<ul>
+
+<li><a href="#Dataverses">Create Dataverse</a></li>
+<li><a href="#Types">Create Type</a></li>
+<li><a href="#Datasets">Create Dataset</a></li>
+<li><a href="#Indices">Create Index</a></li>
+<li><a href="#Synonyms">Create Synonym</a></li>
+<li><a href="#Create_function">Create Function</a></li>
+<li><a href="#Create_view">Create View</a></li>
+</ul>
+</li>
+<li><a href="#Removal">Drop Statement</a></li>
+<li><a href="#Load_statement">Load Statement</a></li>
+</ul>
+</li>
+<li><a href="#Modification_statements">Modification Statements</a>
+<ul>
+
+<li><a href="#Inserts">Insert Statement</a></li>
+<li><a href="#Upserts">Upsert Statement</a></li>
+<li><a href="#Deletes">Delete Statement</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li><a href="#Reserved_keywords">Appendix 1. Reserved Keywords</a></li>
+<li><a href="#Performance_tuning">Appendix 2. Performance Tuning</a>
+<ul>
+
+<li><a href="#Parallelism_parameter">Parallelism Parameter</a></li>
+<li><a href="#Memory_parameters">Memory Parameters</a></li>
+<li><a href="#Query_hints">Query Hints</a></li>
+</ul>
+</li>
+<li><a href="#Variable_bindings_and_name_resolution">Appendix 3. Variable Bindings and Name Resolution</a></li>
+<li><a href="#Manual_data">Appendix 4. Example Data</a>
+<ul>
+
+<li><a href="#definition_statements">Data Definitions</a></li>
+<li><a href="#customers_data">Customers Dataset</a></li>
+<li><a href="#orders_data">Orders Dataset</a></li>
+</ul>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Introduction" id="Introduction">1. Introduction</a></h1>
+<p>This document is intended as a reference guide to the full syntax and semantics of AsterixDB&#x2019;s query language, a SQL-based language for working with semistructured data. The language is a derivative of SQL++, a declarative query language for JSON data which is largely backwards compatible with SQL. SQL++ originated from research in the FORWARD project at UC San Diego, and it has much in common with SQL; some differences exist due to the different data models that the two languages were designed to serve. SQL was designed for interacting with the flat, schema-ified world of relational databases, while SQL++ generalizes SQL to also handle nested data formats (like JSON) and the schema-optional (or even schema-less) data models of modern NoSQL and BigData systems.</p>
+<p>In the context of Apache AsterixDB, SQL++ is intended for working with the Asterix Data Model (<a href="../datamodel.html">ADM</a>), a data model based on a superset of JSON with an enriched and flexible type system. New AsterixDB users are encouraged to read and work through the (much friendlier) guide &#x201c;<a href="primer-sqlpp.html">AsterixDB 101: An ADM and SQL++ Primer</a>&#x201d; before attempting to make use of this document. In addition, readers are advised to read through the <a href="../datamodel.html">Asterix Data Model (ADM) reference guide</a> first as well, as an understanding of the data model is a prerequisite to understanding SQL++.</p>
+<p>In what follows, we detail the features of the SQL++ language in a grammar-guided manner. We list and briefly explain each of the productions in the query grammar, offering examples (and results) for clarity. In this manual, we will explain how to use the various features of SQL++ using two datasets named <tt>customers</tt> and <tt>orders</tt>. Each dataset is a collection of objects. The contents of the example datasets can be found at the end of this manual in <a href="#Manual_data">Appendix 4</a>.</p>
+<p>For additional reading on SQL++ and more examples, refer to <a class="externalLink" href="https://asterixdb.apache.org/files/SQL_Book.pdf">SQL++ for SQL Users: A Tutorial</a>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Expressions" id="Expressions">2. Expressions</a></h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>An expression is a language fragment that can be evaluated to return a value. For example, the expression 2 + 3 returns the value 5. Expressions are the building blocks from which queries are constructed. SQL++ supports nearly all of the kinds of expressions in SQL, and adds some new kinds as well.</p>
+<p>SQL++ is an orthogonal language, which means that expressions can serve as operands of higher level expressions. By nesting expressions inside other expressions, complex queries can be built up. Any expression can be enclosed in parentheses to establish operator precedence.</p>
+<p>In this section, we&#x2019;ll discuss the various kinds of SQL++ expressions.</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Expr"></a>Expr</h5>
+<p><img src="../images/diagrams/Expr.png" alt="" /></p></div></div></div></div>
+<div class="section">
+<h2><a name="Operator_Expressions"></a><a name="Operator_expressions" id="Operator_expressions">Operator Expressions</a></h2>
+<p>Operators perform a specific operation on the input values or expressions. The syntax of an operator expression is as follows:</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="OperatorExpr"></a>OperatorExpr</h5>
+<p><img src="../images/diagrams/OperatorExpr.png" alt="" /></p>
+<p>The language provides a full set of operators that you can use within its statements. Here are the categories of operators:</p>
+<ul>
+
+<li><a href="#Arithmetic_operators">Arithmetic Operators</a>, to perform basic mathematical operations;</li>
+<li><a href="#Collection_operators">Collection Operators</a>, to evaluate expressions on collections or objects;</li>
+<li><a href="#Comparison_operators">Comparison Operators</a>, to compare two expressions;</li>
+<li><a href="#Logical_operators">Logical Operators</a>, to combine operators using Boolean logic.</li>
+</ul>
+<p>The following table summarizes the precedence order (from higher to lower) of the major unary and binary operators:</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Operator                                                                    </th>
+<th> Operation </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> EXISTS, NOT EXISTS                                                          </td>
+<td>  Collection emptiness testing </td></tr>
+<tr class="a">
+<td> ^                                                                           </td>
+<td>  Exponentiation  </td></tr>
+<tr class="b">
+<td> *, /, DIV, MOD (%)                                                          </td>
+<td>  Multiplication, division, modulo </td></tr>
+<tr class="a">
+<td> +, -                                                                        </td>
+<td>  Addition, subtraction  </td></tr>
+<tr class="b">
+<td> ||                                                                </td>
+<td>  String concatenation </td></tr>
+<tr class="a">
+<td> IS NULL, IS NOT NULL, IS MISSING, IS NOT MISSING, <br />IS UNKNOWN, IS NOT UNKNOWN, IS VALUED, IS NOT VALUED </td>
+<td> Unknown value comparison </td></tr>
+<tr class="b">
+<td> BETWEEN, NOT BETWEEN                                                        </td>
+<td> Range comparison (inclusive on both sides) </td></tr>
+<tr class="a">
+<td> =, !=, &lt;&gt;, &lt;, &gt;, &lt;=, &gt;=, LIKE, NOT LIKE, IN, NOT IN, IS DISTINCT FROM, IS NOT DISTINCT FROM </td>
+<td> Comparison  </td></tr>
+<tr class="b">
+<td> NOT                                                                         </td>
+<td> Logical negation </td></tr>
+<tr class="a">
+<td> AND                                                                         </td>
+<td> Conjunction </td></tr>
+<tr class="b">
+<td> OR                                                                          </td>
+<td> Disjunction </td></tr>
+</tbody>
+</table>
+<p>In general, if any operand evaluates to a <tt>MISSING</tt> value, the enclosing operator will return <tt>MISSING</tt>; if none of the operands evaluates to a <tt>MISSING</tt> value but there is an operand which evaluates to a <tt>NULL</tt> value, the enclosing operator will return <tt>NULL</tt>. However, there are a few exceptions listed in <a href="#Comparison_operators">comparison operators</a> and <a href="#Logical_operators">logical operators</a>.</p></div></div></div>
+<div class="section">
+<h3><a name="Arithmetic_Operators"></a><a name="Arithmetic_operators" id="Arithmetic_operators">Arithmetic Operators</a></h3>
+<p>Arithmetic operators are used to exponentiate, add, subtract, multiply, and divide numeric values, or concatenate string values.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Operator     </th>
+<th>  Purpose                                                                </th>
+<th> Example    </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> +, -         </td>
+<td>  As unary operators, they denote a <br />positive or negative expression </td>
+<td> SELECT VALUE -1; </td></tr>
+<tr class="a">
+<td> +, -         </td>
+<td>  As binary operators, they add or subtract                              </td>
+<td> SELECT VALUE 1 + 2; </td></tr>
+<tr class="b">
+<td> *            </td>
+<td>  Multiply                                                               </td>
+<td> SELECT VALUE 4 * 2; </td></tr>
+<tr class="a">
+<td> /            </td>
+<td>  Divide (returns a value of type <tt>double</tt> if both operands are integers)</td>
+<td> SELECT VALUE 5 / 2; </td></tr>
+<tr class="b">
+<td> DIV          </td>
+<td>  Divide (returns an integer value if both operands are integers)        </td>
+<td> SELECT VALUE 5 DIV 2; </td></tr>
+<tr class="a">
+<td> MOD (%)      </td>
+<td>  Modulo                                                                 </td>
+<td> SELECT VALUE 5 % 2; </td></tr>
+<tr class="b">
+<td> ^            </td>
+<td>  Exponentiation                                                         </td>
+<td> SELECT VALUE 2^3;       </td></tr>
+<tr class="a">
+<td> || </td>
+<td>  String concatenation                                                   </td>
+<td> SELECT VALUE &#x201c;ab&#x201d;||&#x201c;c&#x201d;||&#x201c;d&#x201d;;       </td></tr>
+</tbody>
+</table></div>
+<div class="section">
+<h3><a name="Collection_Operators"></a><a name="Collection_operators" id="Collection_operators">Collection Operators</a></h3>
+<p>Collection operators are used for membership tests (IN, NOT IN) or empty collection tests (EXISTS, NOT EXISTS).</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Operator   </th>
+<th>  Purpose                                     </th>
+<th> Example    </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> IN         </td>
+<td>  Membership test                             </td>
+<td> FROM customers AS c <br />WHERE c.address.zipcode IN [&#x201c;02340&#x201d;, &#x201c;02115&#x201d;] <br /> SELECT *; </td></tr>
+<tr class="a">
+<td> NOT IN     </td>
+<td>  Non-membership test                         </td>
+<td> FROM customers AS c <br />WHERE c.address.zipcode NOT IN [&#x201c;02340&#x201d;, &#x201c;02115&#x201d;] <br /> SELECT *;</td></tr>
+<tr class="b">
+<td> EXISTS     </td>
+<td>  Check whether a collection is not empty     </td>
+<td> FROM orders AS o <br />WHERE EXISTS  o.items <br /> SELECT *;</td></tr>
+<tr class="a">
+<td> NOT EXISTS </td>
+<td>  Check whether a collection is empty         </td>
+<td> FROM orders AS o <br />WHERE NOT EXISTS  o.items <br /> SELECT *; </td></tr>
+</tbody>
+</table></div>
+<div class="section">
+<h3><a name="Comparison_Operators"></a><a name="Comparison_operators" id="Comparison_operators">Comparison Operators</a></h3>
+<p>Comparison operators are used to compare values.</p>
+<p>The comparison operators fall into one of two sub-categories: missing value comparisons and regular value comparisons. SQL++ (and JSON) has two ways of representing missing information in an object &#x2014; the presence of the field with a NULL for its value (as in SQL), and the absence of the field (which JSON permits). For example, the first of the following objects represents Jack, whose friend is Jill. In the other examples, Jake is friendless &#xe0; la SQL, with a friend field that is NULL, while Joe is friendless in a more natural (for JSON) way, i.e., by not having a friend field.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">{&quot;name&quot;: &quot;Jack&quot;, &quot;friend&quot;: &quot;Jill&quot;}
+
+{&quot;name&quot;: &quot;Jake&quot;, &quot;friend&quot;: NULL}
+
+{&quot;name&quot;: &quot;Joe&quot;}
+</pre></div></div>
+
+<p>The following table enumerates all of the comparison operators available in SQL++.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Operator       </th>
+<th>  Purpose                                       </th>
+<th> Example    </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> IS NULL        </td>
+<td>  Test if a value is NULL                       </td>
+<td>FROM customers AS c <br />WHERE c.name IS NULL <br /> SELECT *; </td></tr>
+<tr class="a">
+<td> IS NOT NULL    </td>
+<td>  Test if a value is not NULL                   </td>
+<td> FROM customers AS c <br />WHERE c.name IS NOT NULL <br /> SELECT *; </td></tr>
+<tr class="b">
+<td> IS MISSING     </td>
+<td>  Test if a value is MISSING                    </td>
+<td> FROM customers AS c <br />WHERE c.name IS MISSING <br /> SELECT *;  </td></tr>
+<tr class="a">
+<td> IS NOT MISSING </td>
+<td>  Test if a value is not MISSING                </td>
+<td> FROM customers AS c <br />WHERE c.name IS NOT MISSING <br /> SELECT *; </td></tr>
+<tr class="b">
+<td> IS UNKNOWN     </td>
+<td>  Test if a value is NULL or MISSING            </td>
+<td> FROM customers AS c <br />WHERE c.name IS UNKNOWN <br /> SELECT *; </td></tr>
+<tr class="a">
+<td> IS NOT UNKNOWN </td>
+<td>  Test if a value is neither NULL nor MISSING   </td>
+<td> FROM customers AS c <br />WHERE c.name IS NOT UNKNOWN <br /> SELECT *; </td></tr>
+<tr class="b">
+<td> IS KNOWN (IS VALUED) </td>
+<td>  Test if a value is neither NULL nor MISSING </td>
+<td> FROM customers AS c <br />WHERE c.name IS KNOWN <br /> SELECT *;  </td></tr>
+<tr class="a">
+<td> IS NOT KNOWN (IS NOT VALUED) </td>
+<td>  Test if a value is NULL or MISSING </td>
+<td> FROM customers AS c <br />WHERE c.name IS NOT KNOWN <br /> SELECT *;  </td></tr>
+<tr class="b">
+<td> BETWEEN        </td>
+<td>  Test if a value is between a start value and a end value. The comparison is inclusive of both the start and end values. </td>
+<td>  FROM customers AS c WHERE c.rating BETWEEN 600 AND 700 SELECT *;</td></tr>
+<tr class="a">
+<td> =              </td>
+<td>  Equality test                                 </td>
+<td> FROM customers AS c <br /> WHERE c.rating = 640 <br /> SELECT *; </td></tr>
+<tr class="b">
+<td> !=             </td>
+<td>  Inequality test                               </td>
+<td> FROM customers AS c <br /> WHERE c.rating != 640 <br /> SELECT *;</td></tr>
+<tr class="a">
+<td> &lt;&gt;             </td>
+<td>  Inequality test                               </td>
+<td> FROM customers AS c <br /> WHERE c.rating &lt;&gt; 640 <br /> SELECT *;</td></tr>
+<tr class="b">
+<td> &lt;              </td>
+<td>  Less than                                     </td>
+<td> FROM customers AS c <br /> WHERE c.rating &lt; 640 <br /> SELECT *; </td></tr>
+<tr class="a">
+<td> &gt;              </td>
+<td>  Greater than                                  </td>
+<td> FROM customers AS c <br /> WHERE c.rating &gt; 640 <br /> SELECT *; </td></tr>
+<tr class="b">
+<td> &lt;=             </td>
+<td>  Less than or equal to                         </td>
+<td> FROM customers AS c <br /> WHERE c.rating &lt;= 640 <br /> SELECT *; </td></tr>
+<tr class="a">
+<td> &gt;=             </td>
+<td>  Greater than or equal to                      </td>
+<td> FROM customers AS c <br /> WHERE c.rating &gt;= 640 <br /> SELECT *; </td></tr>
+<tr class="b">
+<td> LIKE           </td>
+<td>  Test if the left side matches a pattern defined on the right side; in the pattern,  &#x201c;%&#x201d; matches any string while &#x201c;_&#x201d; matches any character. </td>
+<td> FROM customers AS c WHERE c.name LIKE &#x201c;%Dodge%&#x201d; SELECT *;</td></tr>
+<tr class="a">
+<td> NOT LIKE       </td>
+<td>  Test if the left side does not match a pattern defined on the right side; in the pattern, &#x201c;%&#x201d; matches any string while &#x201c;_&#x201d; matches any character. </td>
+<td> FROM customers AS c WHERE c.name NOT LIKE &#x201c;%Dodge%&#x201d; SELECT *;</td></tr>
+<tr class="b">
+<td> IS DISTINCT FROM </td>
+<td> Inequality test that that treats NULL values as equal to each other and MISSING values as equal to each other </td>
+<td> FROM orders AS o <br /> WHERE o.order_date IS DISTINCT FROM o.ship_date <br /> SELECT *; </td>
+<td> </td></tr>
+<tr class="a">
+<td> IS NOT DISTINCT FROM </td>
+<td> Equality test that treats NULL values as equal to each other and MISSING values as equal to each other </td>
+<td> FROM orders AS o <br /> WHERE o.order_date IS NOT DISTINCT FROM o.ship_date <br /> SELECT *;  </td></tr>
+</tbody>
+</table>
+<p>The following table summarizes how the missing value comparison operators work.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Operator </th>
+<th> Non-NULL/Non-MISSING value </th>
+<th> NULL value</th>
+<th> MISSING value</th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> IS NULL  </td>
+<td> FALSE </td>
+<td> TRUE </td>
+<td> MISSING </td></tr>
+<tr class="a">
+<td> IS NOT NULL </td>
+<td> TRUE </td>
+<td> FALSE </td>
+<td> MISSING </td></tr>
+<tr class="b">
+<td> IS MISSING  </td>
+<td> FALSE </td>
+<td> FALSE </td>
+<td> TRUE </td></tr>
+<tr class="a">
+<td> IS NOT MISSING </td>
+<td> TRUE </td>
+<td> TRUE </td>
+<td> FALSE </td></tr>
+<tr class="b">
+<td> IS UNKNOWN </td>
+<td> FALSE </td>
+<td> TRUE </td>
+<td> TRUE </td></tr>
+<tr class="a">
+<td> IS NOT UNKNOWN </td>
+<td> TRUE </td>
+<td> FALSE </td>
+<td> FALSE</td></tr>
+<tr class="b">
+<td> IS KNOWN (IS VALUED) </td>
+<td> TRUE </td>
+<td> FALSE </td>
+<td> FALSE </td></tr>
+<tr class="a">
+<td> IS NOT KNOWN (IS NOT VALUED) </td>
+<td> FALSE </td>
+<td> TRUE </td>
+<td> TRUE </td></tr>
+</tbody>
+</table></div></div></div>
+<div class="section">
+<h3><a name="Logical_Operators"></a><a name="Logical_operators" id="Logical_operators">Logical Operators</a></h3>
+<p>Logical operators perform logical <tt>NOT</tt>, <tt>AND</tt>, and <tt>OR</tt> operations over Boolean values (<tt>TRUE</tt> and <tt>FALSE</tt>) plus <tt>NULL</tt> and <tt>MISSING</tt>.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Operator </th>
+<th>  Purpose                                   </th>
+<th> Example    </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> NOT      </td>
+<td>  Returns true if the following condition is false, otherwise returns false  </td>
+<td> SELECT VALUE NOT 1 = 1; <br /> Returns FALSE  </td></tr>
+<tr class="a">
+<td> AND      </td>
+<td>  Returns true if both branches are true, otherwise returns false            </td>
+<td> SELECT VALUE 1 = 2 AND 1 = 1; <br /> Returns FALSE</td></tr>
+<tr class="b">
+<td> OR       </td>
+<td>  Returns true if one branch is true, otherwise returns false                </td>
+<td> SELECT VALUE 1 = 2 OR 1 = 1; <br /> Returns TRUE </td></tr>
+</tbody>
+</table>
+<p>The following table is the truth table for <tt>AND</tt> and <tt>OR</tt>.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> A  </th>
+<th> B  </th>
+<th> A AND B  </th>
+<th> A OR B </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> TRUE </td>
+<td> TRUE </td>
+<td> TRUE </td>
+<td> TRUE </td></tr>
+<tr class="a">
+<td> TRUE </td>
+<td> FALSE </td>
+<td> FALSE </td>
+<td> TRUE </td></tr>
+<tr class="b">
+<td> TRUE </td>
+<td> NULL </td>
+<td> NULL </td>
+<td> TRUE </td></tr>
+<tr class="a">
+<td> TRUE </td>
+<td> MISSING </td>
+<td> MISSING </td>
+<td> TRUE </td></tr>
+<tr class="b">
+<td> FALSE </td>
+<td> FALSE </td>
+<td> FALSE </td>
+<td> FALSE </td></tr>
+<tr class="a">
+<td> FALSE </td>
+<td> NULL </td>
+<td> FALSE </td>
+<td> NULL </td></tr>
+<tr class="b">
+<td> FALSE </td>
+<td> MISSING </td>
+<td> FALSE </td>
+<td> MISSING </td></tr>
+<tr class="a">
+<td> NULL </td>
+<td> NULL </td>
+<td> NULL </td>
+<td> NULL </td></tr>
+<tr class="b">
+<td> NULL </td>
+<td> MISSING </td>
+<td> MISSING </td>
+<td> NULL </td></tr>
+<tr class="a">
+<td> MISSING </td>
+<td> MISSING </td>
+<td> MISSING </td>
+<td> MISSING </td></tr>
+</tbody>
+</table>
+<p>The following table demonstrates the results of <tt>NOT</tt> on all possible inputs.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> A  </th>
+<th> NOT A </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> TRUE </td>
+<td> FALSE </td></tr>
+<tr class="a">
+<td> FALSE </td>
+<td> TRUE </td></tr>
+<tr class="b">
+<td> NULL </td>
+<td> NULL </td></tr>
+<tr class="a">
+<td> MISSING </td>
+<td> MISSING </td></tr>
+</tbody>
+</table></div></div>
+<div class="section">
+<h2><a name="Quantified_Expressions"></a><a name="Quantified_expressions" id="Quantified_expressions">Quantified Expressions</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="QuantifiedExpr"></a>QuantifiedExpr</h5>
+<p><img src="../images/diagrams/QuantifiedExpr.png" alt="" /></p>
+<p>Synonym for <tt>SOME</tt>: <tt>ANY</tt></p>
+<p>Quantified expressions are used for expressing existential or universal predicates involving the elements of a collection.</p>
+<p>The following pair of examples illustrate the use of a quantified expression to test that every (or some) element in the set [1, 2, 3] of integers is less than three. The first example yields <tt>FALSE</tt> and second example yields <tt>TRUE</tt>.</p>
+<p>It is useful to note that if the set were instead the empty set, the first expression would yield <tt>TRUE</tt> (&#x201c;every&#x201d; value in an empty set satisfies the condition) while the second expression would yield <tt>FALSE</tt> (since there isn&#x2019;t &#x201c;some&#x201d; value, as there are no values in the set, that satisfies the condition). To express a universal predicate that yields <tt>FALSE</tt> with the empty set, we would use the quantifier <tt>SOME AND EVERY</tt> in lieu of <tt>EVERY</tt>.</p>
+<p>A quantified expression will return a <tt>NULL</tt> (or <tt>MISSING</tt>) if the first expression in it evaluates to <tt>NULL</tt> (or <tt>MISSING</tt>). Otherwise, a type error will be raised if the first expression in a quantified expression does not return a collection.</p></div>
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">EVERY x IN [ 1, 2, 3 ] SATISFIES x &lt; 3 -- &#x278a;
+SOME x IN [ 1, 2, 3 ] SATISFIES x &lt; 3  -- &#x278b;
+</pre></div></div>
+
+<p>&#x2780; Returns <tt>FALSE</tt><br />
+&#x2781; Returns <tt>TRUE</tt></p></div></div></div></div>
+<div class="section">
+<h2><a name="Path_Expressions"></a><a name="Path_expressions" id="Path_expressions">Path Expressions</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="PathExpr"></a>PathExpr</h5>
+<p><img src="../images/diagrams/PathExpr.png" alt="" /></p>
+<p>Components of complex types in the data model are accessed via path expressions. Path access can be applied to the result of a query expression that yields an instance of a complex type, for example, an object or an array instance.</p>
+<p>For objects, path access is based on field names, and it accesses the field whose name was specified.</p>
+<p>For arrays, path access is based on (zero-based) array-style indexing. Array indices can be used to retrieve either a single element from an array, or a whole subset of an array. Accessing a single element is achieved by providing a single index argument (zero-based element position), while obtaining a subset of an array is achieved by providing the <tt>start</tt> and <tt>end</tt> (zero-based) index positions; the returned subset is from position <tt>start</tt> to position <tt>end - 1</tt>; the <tt>end</tt> position argument is optional. If a position argument is negative then the element position is counted from the end of the array (<tt>-1</tt> addresses the last element, <tt>-2</tt> next to last, and so on).</p>
+<p>Multisets have similar behavior to arrays, except for retrieving arbitrary items as the order of items is not fixed in multisets.</p>
+<p>Attempts to access non-existent fields or out-of-bound array elements produce the special value <tt>MISSING</tt>. Type errors will be raised for inappropriate use of a path expression, such as applying a field accessor to a numeric value.</p>
+<p>The following examples illustrate field access for an object, index-based element access or subset retrieval of an array, and also a composition thereof.</p></div>
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">({&quot;name&quot;: &quot;MyABCs&quot;, &quot;array&quot;: [ &quot;a&quot;, &quot;b&quot;, &quot;c&quot;]}).array    -- &#x278a;
+([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;])[2]                                     -- &#x278b;
+([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;])[-1]                                    -- &#x278c;
+({&quot;name&quot;: &quot;MyABCs&quot;, &quot;array&quot;: [ &quot;a&quot;, &quot;b&quot;, &quot;c&quot;]}).array[2] -- &#x278d;
+([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;])[0:2]                                   -- &#x278e;
+([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;])[0:]                                    -- &#x278f;
+([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;])[-2:-1]                                 -- &#x2790;
+</pre></div></div>
+
+<p>&#x2780; Returns <tt>[[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]]</tt><br />
+&#x2781; Returns <tt>[&quot;c&quot;]</tt><br />
+&#x2782; Returns <tt>[&quot;c&quot;]</tt><br />
+&#x2783; Returns <tt>[&quot;c&quot;]</tt><br />
+&#x2784; Returns <tt>[[&quot;a&quot;, &quot;b&quot;]]</tt><br />
+&#x2785; Returns <tt>[[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]]</tt><br />
+&#x2786; Returns <tt>[[&quot;b&quot;]]</tt></p></div></div></div></div>
+<div class="section">
+<h2><a name="Primary_Expressions"></a><a name="Primary_expressions" id="Primary_expressions">Primary Expressions</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="PrimaryExpr"></a>PrimaryExpr</h5>
+<p><img src="../images/diagrams/PrimaryExpr.png" alt="" /></p>
+<p>The most basic building block for any expression in SQL++ is Primary Expression. This can be a simple literal (constant) value, a reference to a query variable that is in scope, a parenthesized expression, a function call, or a newly constructed instance of the data model (such as a newly constructed object, array, or multiset of data model instances).</p></div></div></div>
+<div class="section">
+<h3><a name="Literals" id="Literals">Literals</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="Literal"></a>Literal</h5>
+<p><img src="../images/diagrams/Literal.png" alt="" /></p>
+<p>The simplest kind of expression is a literal that directly represents a value in JSON format. Here are some examples:</p>
+
+<div>
+<div>
+<pre class="source">-42
+&quot;Hello&quot;
+true
+false
+null
+</pre></div></div>
+
+<p>Numeric literals may include a sign and an optional decimal point. They may also be written in exponential notation, like this:</p>
+
+<div>
+<div>
+<pre class="source">5e2
+-4.73E-2
+</pre></div></div>
+
+<p>String literals may be enclosed in either single quotes or double quotes. Inside a string literal, the delimiter character for that string must be &#x201c;escaped&#x201d; by a backward slash, as in these examples:</p>
+
+<div>
+<div>
+<pre class="source">&quot;I read \&quot;War and Peace\&quot; today.&quot;
+'I don\'t believe everything I read.'
+</pre></div></div>
+
+<p>The table below shows how to escape characters in SQL++.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th>Character Name </th>
+<th>Escape Method</th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td>Single Quote</td>
+<td> <tt>\'</tt></td></tr>
+<tr class="a">
+<td>Double Quote</td>
+<td><tt>\&quot;</tt></td></tr>
+<tr class="b">
+<td>Backslash</td>
+<td><tt>\\</tt></td></tr>
+<tr class="a">
+<td>Slash</td>
+<td><tt>\/</tt></td></tr>
+<tr class="b">
+<td>Backspace</td>
+<td><tt>\b</tt></td></tr>
+<tr class="a">
+<td>Formfeed</td>
+<td><tt>\f</tt></td></tr>
+<tr class="b">
+<td>Newline</td>
+<td><tt>\n</tt></td></tr>
+<tr class="a">
+<td>CarriageReturn</td>
+<td><tt>\r</tt></td></tr>
+<tr class="b">
+<td>EscapeTab</td>
+<td><tt>\t</tt></td></tr>
+</tbody>
+</table></div></div></div>
+<div class="section">
+<h3><a name="Identifiers_and_Variable_References"></a><a name="Variable_references" id="Variable_references">Identifiers and Variable References</a></h3>
+<p>Like SQL, SQL++ makes use of a language construct called an <i>identifier</i>. An identifier starts with an alphabetic character or the underscore character _ , and contains only case-sensitive alphabetic characters, numeric digits, or the special characters _ and $. It is also possible for an identifier to include other special characters, or to be the same as a reserved word, by enclosing the identifier in back-ticks (it&#x2019;s then called a <i>delimited identifier</i>). Identifiers are used in variable names and in certain other places in SQL++ syntax, such as in path expressions, which we&#x2019;ll discuss soon. Here are some examples of identifiers:</p>
+
+<div>
+<div>
+<pre class="source">X
+customer_name
+`SELECT`
+`spaces in here`
+`@&amp;#`
+</pre></div></div>
+
+<p>A very simple kind of SQL++ expression is a variable, which is simply an identifier. As in SQL, a variable can be bound to a value, which may be an input dataset, some intermediate result during processing of a query, or the final result of a query. We&#x2019;ll learn more about variables when we discuss queries.</p>
+<p>Note that the SQL++ rules for delimiting strings and identifiers are different from the SQL rules. In SQL, strings are always enclosed in single quotes, and double quotes are used for delimited identifiers.</p></div>
+<div class="section">
+<h3><a name="Parameter_References"></a><a name="Parameter_references" id="Parameter_references">Parameter References</a></h3>
+<p>A parameter reference is an external variable. Its value is provided using the <a href="../api.html#queryservice">statement execution API</a>.</p>
+<p>Parameter references come in two forms, <i>Named Parameter References</i> and <i>Positional Parameter References</i>.</p>
+<p>Named parameter references consist of the &#x201c;$&#x201d; symbol followed by an identifier or delimited identifier.</p>
+<p>Positional parameter references can be either a &#x201c;$&#x201d; symbol followed by one or more digits or a &#x201c;?&#x201d; symbol. If numbered, positional parameters start at 1. &#x201c;?&#x201d; parameters are interpreted as $1 to $N based on the order in which they appear in the statement.</p>
+<p>Parameter references may appear as shown in the below examples:</p>
+<div class="section">
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">$id
+$1
+?
+</pre></div></div>
+
+<p>An error will be raised in the parameter is not bound at query execution time.</p></div></div></div>
+<div class="section">
+<h3><a name="Parenthesized_Expressions"></a><a name="Parenthesized_expressions" id="Parenthesized_expressions">Parenthesized Expressions</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="ParenthesizedExpr"></a>ParenthesizedExpr</h5>
+<p><img src="../images/diagrams/ParenthesizedExpr.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Subquery"></a>Subquery</h5>
+<p><img src="../images/diagrams/Subquery.png" alt="" /></p>
+<p>An expression can be parenthesized to control the precedence order or otherwise clarify a query. A <a href="#Subqueries">subquery</a> (nested <a href="#Union_all">selection</a>) may also be enclosed in parentheses. For more on these topics please see their respective sections.</p>
+<p>The following expression evaluates to the value 2.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">( 1 + 1 )
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Function_Calls"></a><a name="Function_call_expressions" id="Function_call_expressions">Function Calls</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="FunctionCall"></a>FunctionCall</h5>
+<p><img src="../images/diagrams/FunctionCall.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="OrdinaryFunctionCall"></a>OrdinaryFunctionCall</h5>
+<p><img src="../images/diagrams/OrdinaryFunctionCall.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="AggregateFunctionCall"></a>AggregateFunctionCall</h5>
+<p><img src="../images/diagrams/AggregateFunctionCall.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DataverseName"></a>DataverseName</h5>
+<p><img src="../images/diagrams/DataverseName.png" alt="" /></p>
+<p>Functions are included in SQL++, like most languages, as a way to package useful functionality or to componentize complicated or reusable computations. A function call is a legal query expression that represents the value resulting from the evaluation of its body expression with the given parameter bindings; the parameter value bindings can themselves be any expressions in SQL++.</p>
+<p>Note that Window functions, and aggregate functions used as window functions, have a more complex syntax. Window function calls are described in the section on <a href="#Over_clauses">Window Queries</a>.</p>
+<p>Also note that FILTER expressions can only be specified when calling <a href="#Aggregation_PseudoFunctions">Aggregation Pseudo-Functions</a>.</p>
+<p>The following example is a function call expression whose value is 8.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">length('a string')
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Case_Expressions"></a><a name="Case_expressions" id="Case_expressions">Case Expressions</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="CaseExpr"></a>CaseExpr</h5>
+<p><img src="../images/diagrams/CaseExpr.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="SimpleCaseExpr"></a>SimpleCaseExpr</h5>
+<p><img src="../images/diagrams/SimpleCaseExpr.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="SearchedCaseExpr"></a>SearchedCaseExpr</h5>
+<p><img src="../images/diagrams/SearchedCaseExpr.png" alt="" /></p>
+<p>In a simple <tt>CASE</tt> expression, the query evaluator searches for the first <tt>WHEN</tt> &#x2026; <tt>THEN</tt> pair in which the <tt>WHEN</tt> expression is equal to the expression following <tt>CASE</tt> and returns the expression following <tt>THEN</tt>. If none of the <tt>WHEN</tt> &#x2026; <tt>THEN</tt> pairs meet this condition, and an <tt>ELSE</tt> branch exists, it returns the <tt>ELSE</tt> expression. Otherwise, <tt>NULL</tt> is returned.</p>
+<p>In a searched CASE expression, the query evaluator searches from left to right until it finds a <tt>WHEN</tt> expression that is evaluated to <tt>TRUE</tt>, and then returns its corresponding <tt>THEN</tt> expression. If no condition is found to be <tt>TRUE</tt>, and an <tt>ELSE</tt> branch exists, it returns the <tt>ELSE</tt> expression. Otherwise, it returns <tt>NULL</tt>.</p>
+<p>The following example illustrates the form of a case expression.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CASE (2 &lt; 3) WHEN true THEN &quot;yes&quot; ELSE &quot;no&quot; END
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Constructors" id="Constructors">Constructors</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="Constructor"></a>Constructor</h5>
+<p><img src="../images/diagrams/Constructor.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ObjectConstructor"></a>ObjectConstructor</h5>
+<p><img src="../images/diagrams/ObjectConstructor.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ArrayConstructor"></a>ArrayConstructor</h5>
+<p><img src="../images/diagrams/ArrayConstructor.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ParenthesizedArrayConstructor"></a>ParenthesizedArrayConstructor</h5>
+<p><img src="../images/diagrams/ParenthesizedArrayConstructor.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="MultisetConstructor"></a>MultisetConstructor</h5>
+<p><img src="../images/diagrams/MultisetConstructor.png" alt="" /></p>
+<p>Structured JSON values can be represented by constructors, as in these examples:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;name&quot;: &quot;Bill&quot;, &quot;age&quot;: 42 } -- &#x278a;
+[ 1, 2, &quot;Hello&quot;, null ]       -- &#x278b;
+</pre></div></div>
+
+<p>&#x2780; An object<br />
+&#x2781; An array</p>
+<p>In a constructed object, the names of the fields must be strings (either literal strings or computed strings), and an object may not contain any duplicate names. Of course, structured literals can be nested, as in this example:</p>
+
+<div>
+<div>
+<pre class="source">[ {&quot;name&quot;: &quot;Bill&quot;,
+   &quot;address&quot;:
+      {&quot;street&quot;: &quot;25 Main St.&quot;,
+       &quot;city&quot;: &quot;Cincinnati, OH&quot;
+      }
+  },
+  {&quot;name&quot;: &quot;Mary&quot;,
+   &quot;address&quot;:
+      {&quot;street&quot;: &quot;107 Market St.&quot;,
+       &quot;city&quot;: &quot;St. Louis, MO&quot;
+      }
+   }
+]
+</pre></div></div>
+
+<p>The array items in an array constructor, and the field-names and field-values in an object constructor, may be represented by expressions. For example, suppose that the variables firstname, lastname, salary, and bonus are bound to appropriate values. Then structured values might be constructed by the following expressions:</p>
+<p>An object:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;name&quot;: firstname || &quot; &quot; || lastname,
+  &quot;income&quot;: salary + bonus
+}
+</pre></div></div>
+
+<p>An array:</p>
+
+<div>
+<div>
+<pre class="source">[&quot;1984&quot;, lastname, salary + bonus, null]
+</pre></div></div>
+
+<p>If only one expression is specified instead of the field-name/field-value pair in an object constructor then this expression is supposed to provide the field value. The field name is then automatically generated based on the kind of the value expression as in Q2.1:</p>
+<ul>
+
+<li>If it is a variable reference expression then the generated field name is the name of that variable.</li>
+<li>If it is a field access expression then the generated field name is the last identifier in that expression.</li>
+<li>For all other cases, a compilation error will be raised.</li>
+</ul></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q2.1)</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+WHERE c.custid = &quot;C47&quot;
+SELECT VALUE {c.name, c.rating}
+</pre></div></div>
+
+<p>This query outputs:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;name&quot;: &quot;S. Logan&quot;,
+        &quot;rating&quot;: 625
+    }
+]
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Queries" id="Queries">3. Queries</a></h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>A <i>query</i> can be an expression, or it can be constructed from blocks of code called <i>query blocks</i>. A query block may contain several clauses, including <tt>SELECT</tt>, <tt>FROM</tt>, <tt>LET</tt>, <tt>WHERE</tt>, <tt>GROUP BY</tt>, and <tt>HAVING</tt>.</p></div>
+<div class="section">
+<h5><a name="Query"></a>Query</h5>
+<p><img src="../images/diagrams/Query.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Selection"></a>Selection</h5>
+<p><img src="../images/diagrams/Selection.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="QueryBlock"></a>QueryBlock</h5>
+<p><img src="../images/diagrams/QueryBlock.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="StreamGenerator"></a>StreamGenerator</h5>
+<p><img src="../images/diagrams/StreamGenerator.png" alt="" /></p>
+<p>Note that, unlike SQL, SQL++ allows the <tt>SELECT</tt> clause to appear either at the beginning or at the end of a query block. For some queries, placing the <tt>SELECT</tt> clause at the end may make a query block easier to understand, because the <tt>SELECT</tt> clause refers to variables defined in the other clauses.</p></div></div></div></div>
+<div class="section">
+<h2><a name="SELECT_Clause"></a><a name="Select_clauses" id="Select_clauses">SELECT Clause</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="SelectClause"></a>SelectClause</h5>
+<p><img src="../images/diagrams/SelectClause.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Projection"></a>Projection</h5>
+<p><img src="../images/diagrams/Projection.png" alt="" /></p>
+<p>Synonyms for <tt>VALUE</tt>: <tt>ELEMENT</tt>, <tt>RAW</tt></p>
+<p>In a query block, the <tt>FROM</tt>, <tt>WHERE</tt>, <tt>GROUP BY</tt>, and <tt>HAVING</tt> clauses (if present) are collectively called the Stream Generator. All these clauses, taken together, generate a stream of tuples of bound variables. The <tt>SELECT</tt> clause then uses these bound variables to generate the output of the query block.</p>
+<p>For example, the clause <tt>FROM customers AS c</tt> scans over the <tt>customers</tt> collection, binding the variable <tt>c</tt> to each <tt>customer</tt> object in turn, producing a stream of bindings.</p>
+<p>Here&#x2019;s a slightly more complex example of a stream generator:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c, orders AS o
+WHERE c.custid = o.custid
+</pre></div></div>
+
+<p>In this example, the <tt>FROM</tt> clause scans over the customers and orders collections, producing a stream of variable pairs (<tt>c</tt>, <tt>o</tt>) in which <tt>c</tt> is bound to a <tt>customer</tt> object and <tt>o</tt> is bound to an <tt>order</tt> object. The <tt>WHERE</tt> clause then retains only those pairs in which the custid values of the two objects match.</p>
+<p>The output of the query block is a collection containing one output item for each tuple produced by the stream generator. If the stream generator produces no tuples, the output of the query block is an empty collection. Depending on the <tt>SELECT</tt> clause, each output item may be an object or some other kind of value.</p>
+<p>In addition to using the variables bound by previous clauses, the <tt>SELECT</tt> clause may create and bind some additional variables. For example, the clause <tt>SELECT salary + bonus AS pay</tt> creates the variable <tt>pay</tt> and binds it to the value of <tt>salary + bonus</tt>. This variable may then be used in a later <tt>ORDER BY</tt> clause.</p>
+<p>In SQL++, the <tt>SELECT</tt> clause may appear either at the beginning or at the end of a query block. Since the <tt>SELECT</tt> clause depends on variables that are bound in the other clauses, the examples in this section place <tt>SELECT</tt> at the end of the query blocks.</p></div></div></div>
+<div class="section">
+<h3><a name="SELECT_VALUE"></a><a name="Select_element" id="Select_element">SELECT VALUE</a></h3>
+<p>The <tt>SELECT VALUE</tt> clause returns an array or multiset that contains the results of evaluating the <tt>VALUE</tt> expression, with one evaluation being performed per &#x201c;binding tuple&#x201d; (i.e., per <tt>FROM</tt> clause item) satisfying the statement&#x2019;s selection criteria. If there is no <tt>FROM</tt> clause, the expression after <tt>VALUE</tt> is evaluated once with no binding tuples (except those inherited from an outer environment).</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.1)</p>
+
+<div>
+<div>
+<pre class="source">SELECT VALUE 1;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+   1
+]
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.2) The following query returns the names of all customers whose rating is above 650.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+WHERE c.rating &gt; 650
+SELECT VALUE name;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    &quot;T. Cody&quot;,
+    &quot;M. Sinclair&quot;,
+    &quot;T. Henry&quot;
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="SQL-style_SELECT"></a><a name="SQL_select" id="SQL_select">SQL-style SELECT</a></h3>
+<p>Traditional SQL-style <tt>SELECT</tt> syntax is also supported in SQL++, however the result of a query is not guaranteed to preserve the order of expressions in the <tt>SELECT</tt> clause.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.3) The following query returns the names and customers ids of any customers whose rating is 750.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+WHERE c.rating = 750
+SELECT c.name AS customer_name, c.custid AS customer_id;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;customer_id&quot;: &quot;C13&quot;,
+        &quot;customer_name&quot;: &quot;T. Cody&quot;
+    },
+    {
+        &quot;customer_id&quot;: &quot;C37&quot;,
+        &quot;customer_name&quot;: &quot;T. Henry&quot;
+    }
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="SELECT_.2A"></a><a name="Select_star" id="Select_star">SELECT *</a></h3>
+<p>As in SQL, the phrase <tt>SELECT *</tt> suggests, &#x201c;select everything.&#x201d;</p>
+<p>For each binding tuple in the stream, <tt>SELECT *</tt> produces an output object. For each variable in the binding tuple, the output object contains a field: the name of the field is the name of the variable, and the value of the field is the value of the variable. Essentially, <tt>SELECT *</tt> means, &#x201c;return all the bound variables, with their names and values.&#x201d;</p>
+<p>The effect of <tt>SELECT *</tt> can be illustrated by an example based on two small collections named <tt>ages</tt> and <tt>eyes</tt>. The contents of the two collections are as follows:</p>
+<p><tt>ages</tt>:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;name&quot;: &quot;Bill&quot;, &quot;age&quot;: 21 },
+    { &quot;name&quot;: &quot;Sue&quot;, &quot;age&quot;: 32 }
+]
+</pre></div></div>
+
+<p><tt>eyes</tt>:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;name&quot;: &quot;Bill&quot;, &quot;eyecolor&quot;: &quot;brown&quot; },
+    { &quot;name&quot;: &quot;Sue&quot;, &quot;eyecolor&quot;: &quot;blue&quot; }
+]
+</pre></div></div>
+
+<p>The following example applies <tt>SELECT *</tt> to a single collection.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.4a) Return all the information in the <tt>ages</tt> collection.</p>
+
+<div>
+<div>
+<pre class="source">FROM ages AS a
+SELECT * ;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;a&quot;: { &quot;name&quot;: &quot;Bill&quot;, &quot;age&quot;: 21 },
+    },
+    { &quot;a&quot;: { &quot;name&quot;: &quot;Sue&quot;, &quot;age&quot;: 32}
+    }
+]
+</pre></div></div>
+
+<p>Note that the variable-name <tt>a</tt> appears in the query result. If the <tt>FROM</tt> clause had been simply <tt>FROM ages</tt> (omitting <tt>AS a</tt>), the variable-name in the query result would have been <tt>ages</tt>.</p>
+<p>The next example applies <tt>SELECT *</tt> to a join of two collections.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.4b) Return all the information in a join of <tt>ages</tt> and <tt>eyes</tt> on matching name fields.</p>
+
+<div>
+<div>
+<pre class="source">FROM ages AS a, eyes AS e
+WHERE a.name = e.name
+SELECT * ;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;a&quot;: { &quot;name&quot;: &quot;Bill&quot;, &quot;age&quot;: 21 },
+      &quot;e&quot;: { &quot;name&quot;: &quot;Bill&quot;, &quot;eyecolor&quot;: &quot;Brown&quot; }
+    },
+    { &quot;a&quot;: { &quot;name&quot;: &quot;Sue&quot;, &quot;age&quot;: 32 },
+      &quot;e&quot;: { &quot;name&quot;: &quot;Sue&quot;, &quot;eyecolor&quot;: &quot;Blue&quot; }
+    }
+]
+</pre></div></div>
+
+<p>Note that the result of <tt>SELECT *</tt> in SQL++ is more complex than the result of <tt>SELECT *</tt> in SQL.</p></div></div></div>
+<div class="section">
+<h3><a name="SELECT_variable..2A"></a><a name="Select_variable_star" id="Select_variable_star">SELECT <i>variable</i>.*</a></h3>
+<p>SQL++ has an alternative version of <tt>SELECT *</tt> in which the star is preceded by a variable.</p>
+<p>Whereas the version without a named variable means, &#x201c;return all the bound variables, with their names and values,&#x201d; <tt>SELECT</tt> <i>variable</i> <tt>.*</tt> means &#x201c;return only the named variable, and return only its value, not its name.&#x201d;</p>
+<p>The following example can be compared with (Q3.4a) to see the difference between the two versions of <tt>SELECT *</tt>:</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.4c) Return all information in the <tt>ages</tt> collection.</p>
+
+<div>
+<div>
+<pre class="source">FROM ages AS a
+SELECT a.*
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;name&quot;: &quot;Bill&quot;, &quot;age&quot;: 21 },
+    { &quot;name&quot;: &quot;Sue&quot;, &quot;age&quot;: 32 }
+]
+</pre></div></div>
+
+<p>Note that, for queries over a single collection, <tt>SELECT</tt> <i>variable</i> <tt>.*</tt> returns a simpler result and therefore may be preferable to <tt>SELECT *</tt>.</p>
+<p>In fact, <tt>SELECT</tt> <i>variable</i> <tt>.*</tt>, like <tt>SELECT *</tt> in SQL, is equivalent to a <tt>SELECT</tt> clause that enumerates all the fields of the collection, as in (Q3.4d):</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.4d) Return all the information in the <tt>ages</tt> collection.</p>
+
+<div>
+<div>
+<pre class="source">FROM ages AS a
+SELECT a.name, a.age
+</pre></div></div>
+
+<p>(same result as (Q3.4c))</p>
+<p><tt>SELECT</tt> <i>variable</i> <tt>.*</tt> has an additional application. It can be used to return all the fields of a nested object. To illustrate this use, we will use the <tt>customers</tt> dataset in the example database &#x2014; see <a href="#Manual_data">Appendix 4</a>.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.4e) In the <tt>customers</tt> dataset, return all the fields of the <tt>address</tt> objects that have zipcode &#x201c;02340&#x201d;.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+WHERE c.address.zipcode = &quot;02340&quot;
+SELECT address.*  ;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;street&quot;: &quot;690 River St.&quot;,
+        &quot;city&quot;: &quot;Hanover, MA&quot;,
+        &quot;zipcode&quot;: &quot;02340&quot;
+    }
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="SELECT_DISTINCT"></a><a name="Select_distinct" id="Select_distinct">SELECT DISTINCT</a></h3>
+<p>The <tt>DISTINCT</tt> keyword is used to eliminate duplicate items from the results of a query block.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.5a) Returns all of the different cities in the <tt>customers</tt> dataset.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+SELECT DISTINCT c.address.city;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;city&quot;: &quot;Boston, MA&quot;
+    },
+    {
+        &quot;city&quot;: &quot;Hanover, MA&quot;
+    },
+    {
+        &quot;city&quot;: &quot;St. Louis, MO&quot;
+    },
+    {
+        &quot;city&quot;: &quot;Rome, Italy&quot;
+    }
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="SELECT_EXCLUDE"></a><a name="Select_exclude" id="Select_exclude">SELECT EXCLUDE</a></h3>
+<p>The <tt>EXCLUDE</tt> keyword is used to remove one or more fields that would otherwise be returned from the <tt>SELECT</tt> clause. Conceptually, the scope of the <tt>EXCLUDE</tt> clause is the output of the <tt>SELECT</tt> clause itself. In a Stream Generator with both <tt>DISTINCT</tt> and <tt>EXCLUDE</tt> clauses, the <tt>DISTINCT</tt> clause is applied after the <tt>EXCLUDE</tt> clause.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.5b) For the customer with <tt>custid = C13</tt>, return their information <i>excluding</i> the <tt>zipcode</tt> field inside the <tt>address</tt> object and the top-level <tt>name</tt> field.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+WHERE c.custid = &quot;C13&quot;
+SELECT c.* EXCLUDE address.zipcode, name;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;201 Main St.&quot;,
+            &quot;city&quot;: &quot;St. Louis, MO&quot;
+        },
+        &quot;rating&quot;: 750
+    }
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Unnamed_Projections"></a><a name="Unnamed_projections" id="Unnamed_projections">Unnamed Projections</a></h3>
+<p>Similar to standard SQL, the query language supports unnamed projections (a.k.a, unnamed <tt>SELECT</tt> clause items), for which names are generated rather than user-provided. Name generation has three cases:</p>
+<ul>
+
+<li>If a projection expression is a variable reference expression, its generated name is the name of the variable.</li>
+<li>If a projection expression is a field access expression, its generated name is the last identifier in the expression.</li>
+<li>For all other cases, the query processor will generate a unique name.</li>
+</ul>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.6) Returns the last digit and the order date of all orders for the customer whose ID is &#x201c;C41&#x201d;.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+WHERE o.custid = &quot;C41&quot;
+SELECT o.orderno % 1000,  o.order_date;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;$1&quot;: 1,
+        &quot;order_date&quot;: &quot;2020-04-29&quot;
+    },
+    {
+        &quot;$1&quot;: 6,
+        &quot;order_date&quot;: &quot;2020-09-02&quot;
+    }
+]
+</pre></div></div>
+
+<p>In the result, <tt>$1</tt> is the generated name for <tt>o.orderno % 1000</tt>, while <tt>order_date</tt> is the generated name for <tt>o.order_date</tt>. It is good practice, however, to not rely on the randomly generated names which can be confusing and irrelevant. Instead, practice good naming conventions by providing a meaningful and concise name which properly describes the selected item.</p></div></div></div>
+<div class="section">
+<h3><a name="Abbreviated_Field_Access_Expressions"></a><a name="Abbreviated_field_access_expressions" id="Abbreviated_field_access_expressions">Abbreviated Field Access Expressions</a></h3>
+<p>As in standard SQL, field access expressions can be abbreviated when there is no ambiguity. In the next example, the variable <tt>o</tt> is the only possible variable reference for fields <tt>orderno</tt> and <tt>order_date</tt> and thus could be omitted in the query. This practice is not recommended, however, as queries may have fields (such as <tt>custid</tt>) which can be present in multiple datasets. More information on abbreviated field access can be found in the appendix section on Variable Resolution.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.7) Same as Q3.6, omitting the variable reference for the order number and date and providing custom names for <tt>SELECT</tt> clause items.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+WHERE o.custid = &quot;C41&quot;
+SELECT orderno % 1000 AS last_digit, order_date;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;last_digit&quot;: 1,
+        &quot;order_date&quot;: &quot;2020-04-29&quot;
+    },
+    {
+        &quot;last_digit&quot;: 6,
+        &quot;order_date&quot;: &quot;2020-09-02&quot;
+    }
+]
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="FROM_Clause"></a><a name="From_clauses" id="From_clauses">FROM Clause</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="FromClause"></a>FromClause</h5>
+<p><img src="../images/diagrams/FromClause.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="FromTerm"></a>FromTerm</h5>
+<p><img src="../images/diagrams/FromTerm.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="NamedExpr"></a>NamedExpr</h5>
+<p><img src="../images/diagrams/NamedExpr.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="JoinStep"></a>JoinStep</h5>
+<p><img src="../images/diagrams/JoinStep.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="UnnestStep"></a>UnnestStep</h5>
+<p><img src="../images/diagrams/UnnestStep.png" alt="" /></p>
+<p>Synonyms for <tt>UNNEST</tt>: <tt>CORRELATE</tt>, <tt>FLATTEN</tt></p>
+<p>The purpose of a <tt>FROM</tt> clause is to iterate over a collection, binding a variable to each item in turn. Here&#x2019;s a query that iterates over the <tt>customers</tt> dataset, choosing certain customers and returning some of their attributes.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.8) List the customer ids and names of the customers in zipcode 63101, in order by their customer IDs.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers
+WHERE address.zipcode = &quot;63101&quot;
+SELECT custid AS customer_id, name
+ORDER BY customer_id;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;customer_id&quot;: &quot;C13&quot;,
+        &quot;name&quot;: &quot;T. Cody&quot;
+    },
+    {
+        &quot;customer_id&quot;: &quot;C31&quot;,
+        &quot;name&quot;: &quot;B. Pruitt&quot;
+    },
+    {
+        &quot;customer_id&quot;: &quot;C41&quot;,
+        &quot;name&quot;: &quot;R. Dodge&quot;
+    }
+]
+</pre></div></div>
+
+<p>Let&#x2019;s take a closer look at what this <tt>FROM</tt> clause is doing. A <tt>FROM</tt> clause always produces a stream of bindings, in which an iteration variable is bound in turn to each item in a collection. In Q3.8, since no explicit iteration variable is provided, the <tt>FROM</tt> clause defines an implicit variable named <tt>customers</tt>, the same name as the dataset that is being iterated over. The implicit iteration variable serves as the object-name for all field-names in the query block that do not have explicit object-names. Thus, <tt>address.zipcode</tt> really means <tt>customers.address.zipcode</tt>, <tt>custid</tt> really means <tt>customers.custid</tt>, and <tt>name</tt> really means <tt>customers.name</tt>.</p>
+<p>You may also provide an explicit iteration variable, as in this version of the same query:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.9) Alternative version of Q3.8 (same result).</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+WHERE c.address.zipcode = &quot;63101&quot;
+SELECT c.custid AS customer_id, c.name
+ORDER BY customer_id;
+</pre></div></div>
+
+<p>In Q3.9, the variable <tt>c</tt> is bound to each <tt>customer</tt> object in turn as the query iterates over the <tt>customers</tt> dataset. An explicit iteration variable can be used to identify the fields of the referenced object, as in <tt>c.name</tt> in the <tt>SELECT</tt> clause of Q3.9. When referencing a field of an object, the iteration variable can be omitted when there is no ambiguity. For example, <tt>c.name</tt> could be replaced by <tt>name</tt> in the <tt>SELECT</tt> clause of Q3.9. That&#x2019;s why field-names like <tt>name</tt> and <tt>custid</tt> could stand by themselves in the Q3.8 version of this query.</p>
+<p>In the examples above, the <tt>FROM</tt> clause iterates over the objects in a dataset. But in general, a <tt>FROM</tt> clause can iterate over any collection. For example, the objects in the <tt>orders</tt> dataset each contain a field called <tt>items</tt>, which is an array of nested objects. In some cases, you will write a <tt>FROM</tt> clause that iterates over a nested array like <tt>items</tt>.</p>
+<p>The stream of objects (more accurately, variable bindings) that is produced by the <tt>FROM</tt> clause does not have any particular order. The system will choose the most efficient order for the iteration. If you want your query result to have a specific order, you must use an <tt>ORDER BY</tt> clause.</p>
+<p>It&#x2019;s good practice to specify an explicit iteration variable for each collection in the <tt>FROM</tt> clause, and to use these variables to qualify the field-names in other clauses. Here are some reasons for this convention:</p>
+<ul>
+
+<li>
+
+<p>It&#x2019;s nice to have different names for the collection as a whole and an object in the collection. For example, in the clause <tt>FROM customers AS c</tt>, the name <tt>customers</tt> represents the dataset and the name <tt>c</tt> represents one object in the dataset.</p>
+</li>
+<li>
+
+<p>In some cases, iteration variables are required. For example, when joining a dataset to itself, distinct iteration variables are required to distinguish the left side of the join from the right side.</p>
+</li>
+<li>
+
+<p>In a subquery it&#x2019;s sometimes necessary to refer to an object in an outer query block (this is called a <i>correlated subquery</i>). To avoid confusion in correlated subqueries, it&#x2019;s best to use explicit variables.</p>
+</li>
+</ul></div></div></div>
+<div class="section">
+<h3><a name="Joins"></a><a name="Join_clauses" id="Join_clauses">Joins</a></h3>
+<p>A <tt>FROM</tt> clause gets more interesting when there is more than one collection involved. The following query iterates over two collections: <tt>customers</tt> and <tt>orders</tt>. The <tt>FROM</tt> clause produces a stream of binding tuples, each containing two variables, <tt>c</tt> and <tt>o</tt>. In each binding tuple, <tt>c</tt> is bound to an object from <tt>customers</tt>, and <tt>o</tt> is bound to an object from <tt>orders</tt>. Conceptually, at this point, the binding tuple stream contains all possible pairs of a customer and an order (this is called the <i>Cartesian product</i> of <tt>customers</tt> and <tt>orders</tt>). Of course, we are interested only in pairs where the <tt>custid</tt> fields match, and that condition is expressed in the <tt>WHERE</tt> clause, along with the restriction that the order number must be 1001.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.10) Create a packing list for order number 1001, showing the customer name and address and all the items in the order.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c, orders AS o
+WHERE c.custid = o.custid
+AND o.orderno = 1001
+SELECT o.orderno,
+    c.name AS customer_name,
+    c.address,
+    o.items AS items_ordered;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1001,
+        &quot;customer_name&quot;: &quot;R. Dodge&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;150 Market St.&quot;,
+            &quot;city&quot;: &quot;St. Louis, MO&quot;,
+            &quot;zipcode&quot;: &quot;63101&quot;
+        },
+        &quot;items_ordered&quot;: [
+            {
+                &quot;itemno&quot;: 347,
+                &quot;qty&quot;: 5,
+                &quot;price&quot;: 19.99
+            },
+            {
+                &quot;itemno&quot;: 193,
+                &quot;qty&quot;: 2,
+                &quot;price&quot;: 28.89
+            }
+        ]
+    }
+]
+</pre></div></div>
+
+<p>Q3.10 is called a <i>join query</i> because it joins the <tt>customers</tt> collection and the <tt>orders</tt> collection, using the join condition <tt>c.custid = o.custid</tt>. In SQL++, as in SQL, you can express this query more explicitly by a <tt>JOIN</tt> clause that includes the join condition, as follows:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.11) Alternative statement of Q3.10 (same result).</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c JOIN orders AS o
+    ON c.custid = o.custid
+WHERE o.orderno = 1001
+SELECT o.orderno,
+    c.name AS customer_name,
+    c.address,
+    o.items AS items_ordered;
+</pre></div></div>
+
+<p>Whether you express the join condition in a <tt>JOIN</tt> clause or in a <tt>WHERE</tt> clause is a matter of taste; the result is the same. This manual will generally use a comma-separated list of collection-names in the <tt>FROM</tt> clause, leaving the join condition to be expressed elsewhere. As we&#x2019;ll soon see, in some query blocks the join condition can be omitted entirely.</p>
+<p>There is, however, one case in which an explicit <tt>JOIN</tt> clause is necessary. That is when you need to join collection A to collection B, and you want to make sure that every item in collection A is present in the query result, even if it doesn&#x2019;t match any item in collection B. This kind of query is called a <i>left outer join</i>, and it is illustrated by the following example.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.12) List the customer ID and name, together with the order numbers and dates of their orders (if any) of customers T. Cody and M. Sinclair.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c LEFT OUTER JOIN orders AS o ON c.custid = o.custid
+WHERE c.name = &quot;T. Cody&quot;
+   OR c.name = &quot;M. Sinclair&quot;
+SELECT c.custid, c.name, o.orderno, o.order_date
+ORDER BY c.custid, o.order_date;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;orderno&quot;: 1002,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;order_date&quot;: &quot;2020-05-01&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;orderno&quot;: 1007,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;order_date&quot;: &quot;2020-09-13&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;orderno&quot;: 1008,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;order_date&quot;: &quot;2020-10-13&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;orderno&quot;: 1009,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;order_date&quot;: &quot;2020-10-13&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C25&quot;,
+        &quot;name&quot;: &quot;M. Sinclair&quot;
+    }
+]
+</pre></div></div>
+
+<p>As you can see from the result of this left outer join, our data includes four orders from customer T. Cody, but no orders from customer M. Sinclair. The behavior of left outer join in SQL++ is different from that of SQL. SQL would have provided M. Sinclair with an order in which all the fields were <tt>null</tt>. SQL++, on the other hand, deals with schemaless data, which permits it to simply omit the order fields from the outer join.</p>
+<p>Now we&#x2019;re ready to look at a new kind of join that was not provided (or needed) in original SQL. Consider this query:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.13) For every case in which an item is ordered in a quantity greater than 100, show the order number, date, item number, and quantity.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items AS i
+WHERE i.qty &gt; 100
+SELECT o.orderno, o.order_date, i.itemno AS item_number,
+    i.qty AS quantity
+ORDER BY o.orderno, item_number;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1002,
+        &quot;order_date&quot;: &quot;2020-05-01&quot;,
+        &quot;item_number&quot;: 680,
+        &quot;quantity&quot;: 150
+    },
+    {
+        &quot;orderno&quot;: 1005,
+        &quot;order_date&quot;: &quot;2020-08-30&quot;,
+        &quot;item_number&quot;: 347,
+        &quot;quantity&quot;: 120
+    },
+    {
+        &quot;orderno&quot;: 1006,
+        &quot;order_date&quot;: &quot;2020-09-02&quot;,
+        &quot;item_number&quot;: 460,
+        &quot;quantity&quot;: 120
+    }
+]
+</pre></div></div>
+
+<p>Q3.13 illustrates a feature called <i>left-correlation</i> in the <tt>FROM</tt> clause. Notice that we are joining <tt>orders</tt>, which is a dataset, to <tt>items</tt>, which is an array nested inside each order. In effect, for each order, we are unnesting the <tt>items</tt> array and joining it to the <tt>order</tt> as though it were a separate collection. For this reason, this kind of query is sometimes called an <i>unnesting query</i>. The keyword <tt>UNNEST</tt> may be used whenever left-correlation is used in a <tt>FROM</tt> clause, as shown in this example:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.14) Alternative statement of Q3.13 (same result).</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o UNNEST o.items AS i
+WHERE i.qty &gt; 100
+SELECT o.orderno, o.order_date, i.itemno AS item_number,
+        i.qty AS quantity
+ORDER BY o.orderno, item_number;
+</pre></div></div>
+
+<p>The results of Q3.13 and Q3.14 are exactly the same. <tt>UNNEST</tt> serves as a reminder that left-correlation is being used to join an object with its nested items. The join condition in Q3.14 is expressed by the left-correlation: each order <tt>o</tt> is joined to its own items, referenced as <tt>o.items</tt>. The result of the <tt>FROM</tt> clause is a stream of binding tuples, each containing two variables, <tt>o</tt> and <tt>i</tt>. The variable <tt>o</tt> is bound to an order and the variable <tt>i</tt> is bound to one item inside that order.</p>
+<p>Like <tt>JOIN</tt>, <tt>UNNEST</tt> has a <tt>LEFT OUTER</tt> option. Q3.14 could have specified:</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o LEFT OUTER UNNEST o.items AS i
+</pre></div></div>
+
+<p>In this case, orders that have no nested items would appear in the query result.</p></div></div></div></div>
+<div class="section">
+<h2><a name="LET_Clause"></a><a name="Let_clauses" id="Let_clauses">LET Clause</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="LetClause"></a>LetClause</h5>
+<p><img src="../images/diagrams/LetClause.png" alt="" /></p>
+<p>Synonyms for <tt>LET</tt>: <tt>LETTING</tt></p>
+<p><tt>LET</tt> clauses can be useful when a (complex) expression is used several times within a query, allowing it to be written once to make the query more concise. The word <tt>LETTING</tt> can also be used, although this is not as common. The next query shows an example.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.15) For each item in an order, the revenue is defined as the quantity times the price of that item. Find individual items for which the revenue is greater than 5000. For each of these, list the order number, item number, and revenue, in descending order by revenue.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items AS i
+LET revenue = i.qty * i.price
+WHERE revenue &gt; 5000
+SELECT o.orderno, i.itemno, revenue
+ORDER by revenue desc;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1006,
+        &quot;itemno&quot;: 460,
+        &quot;revenue&quot;: 11997.6
+    },
+    {
+        &quot;orderno&quot;: 1002,
+        &quot;itemno&quot;: 460,
+        &quot;revenue&quot;: 9594.05
+    },
+    {
+        &quot;orderno&quot;: 1006,
+        &quot;itemno&quot;: 120,
+        &quot;revenue&quot;: 5525
+    }
+]
+</pre></div></div>
+
+<p>The expression for computing revenue is defined once in the <tt>LET</tt> clause and then used three times in the remainder of the query. Avoiding repetition of the revenue expression makes the query shorter and less prone to errors.</p></div></div></div></div>
+<div class="section">
+<h2><a name="WHERE_Clause"></a><a name="Where_having_clauses" id="Where_having_clauses">WHERE Clause</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="WhereClause"></a>WhereClause</h5>
+<p><img src="../images/diagrams/WhereClause.png" alt="" /></p>
+<p>The purpose of a <tt>WHERE</tt> clause is to operate on the stream of binding tuples generated by the <tt>FROM</tt> clause, filtering out the tuples that do not satisfy a certain condition. The condition is specified by an expression based on the variable names in the binding tuples. If the expression evaluates to true, the tuple remains in the stream; if it evaluates to anything else, including <tt>null</tt> or <tt>missing</tt>, it is filtered out. The surviving tuples are then passed along to the next clause to be processed (usually either <tt>GROUP BY</tt> or <tt>SELECT</tt>).</p>
+<p>Often, the expression in a <tt>WHERE</tt> clause is some kind of comparison like <tt>quantity &gt; 100</tt>. However, any kind of expression is allowed in a <tt>WHERE</tt> clause. The only thing that matters is whether the expression returns <tt>true</tt> or not.</p></div></div></div></div>
+<div class="section">
+<h2><a name="Grouping" id="Grouping">Grouping</a></h2>
+<p>Grouping is especially important when manipulating hierarchies like the ones that are often found in JSON data. Often you will want to generate output data that includes both summary data and line items within the summaries. For this purpose, SQL++ supports several important extensions to the traditional grouping features of SQL. The familiar <tt>GROUP BY</tt> and <tt>HAVING</tt> clauses are still there, and they are joined by a new clause called <tt>GROUP AS</tt>. We&#x2019;ll illustrate these clauses by a series of examples.</p>
+<div class="section">
+<h3><a name="GROUP_BY_Clause"></a><a name="Group_By_clauses" id="Group_By_clauses">GROUP BY Clause</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="GroupByClause"></a>GroupByClause</h5>
+<p><img src="../images/diagrams/GroupByClause.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="GroupingElement"></a>GroupingElement</h5>
+<p><img src="../images/diagrams/GroupingElement.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="OrdinaryGroupingSet"></a>OrdinaryGroupingSet</h5>
+<p><img src="../images/diagrams/OrdinaryGroupingSet.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="NamedExpr"></a>NamedExpr</h5>
+<p><img src="../images/diagrams/NamedExpr.png" alt="" /></p>
+<p>We&#x2019;ll begin our discussion of grouping with an example from ordinary SQL.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.16) List the number of orders placed by each customer who has placed an order.</p>
+
+<div>
+<div>
+<pre class="source">SELECT o.custid, COUNT(o.orderno) AS `order count`
+FROM orders AS o
+GROUP BY o.custid
+ORDER BY o.custid;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;order count&quot;: 4,
+        &quot;custid&quot;: &quot;C13&quot;
+    },
+    {
+        &quot;order count&quot;: 1,
+        &quot;custid&quot;: &quot;C31&quot;
+    },
+    {
+        &quot;order count&quot;: 1,
+        &quot;custid&quot;: &quot;C35&quot;
+    },
+    {
+        &quot;order count&quot;: 1,
+        &quot;custid&quot;: &quot;C37&quot;
+    },
+    {
+        &quot;order count&quot;: 2,
+        &quot;custid&quot;: &quot;C41&quot;
+    }
+]
+</pre></div></div>
+
+<p>The input to a <tt>GROUP BY</tt> clause is the stream of binding tuples generated by the <tt>FROM</tt> and <tt>WHERE</tt>clauses. In this query, before grouping, the variable <tt>o</tt> is bound to each object in the <tt>orders</tt> collection in turn.</p>
+<p>SQL++ evaluates the expression in the <tt>GROUP BY</tt> clause, called the grouping expression, once for each of the binding tuples. It then organizes the results into groups in which the grouping expression has a common value (as defined by the <tt>=</tt> operator). In this example, the grouping expression is <tt>o.custid</tt>, and each of the resulting groups is a set of <tt>orders</tt> that have the same <tt>custid</tt>. If necessary, a group is formed for <tt>orders</tt> in which <tt>custid</tt> is <tt>null</tt>, and another group is formed for <tt>orders</tt> that have no <tt>custid</tt>. This query uses the aggregating function <tt>COUNT(o.orderno)</tt>, which counts how many order numbers are in each group. If we are sure that each order object has a distinct <tt>orderno</tt>, we could also simply count the order objects in each group by using <tt>COUNT(*)</tt> in place of <tt>COUNT(o.orderno)</tt>.</p>
+<p>In the <tt>GROUP BY</tt>clause, you may optionally define an alias for the grouping expression. For example, in Q3.16, you could have written <tt>GROUP BY o.custid AS cid</tt>. The alias <tt>cid</tt> could then be used in place of the grouping expression in later clauses. In cases where the grouping expression contains an operator, it is especially helpful to define an alias (for example, <tt>GROUP BY salary + bonus AS pay)</tt>.</p>
+<p>Q3.16 had a single grouping expression, <tt>o.custid</tt>. If a query has multiple grouping expressions, the combination of grouping expressions is evaluated for every binding tuple, and the stream of binding tuples is partitioned into groups that have values in common for all of the grouping expressions. We&#x2019;ll see an example of such a query in Q3.18.</p>
+<p>After grouping, the number of binding tuples is reduced: instead of a binding tuple for each of the input objects, there is a binding tuple for each group. The grouping expressions (identified by their aliases, if any) are bound to the results of their evaluations. However, all the non-grouping fields (that is, fields that were not named in the grouping expressions), are accessible only in a special way: as an argument of one of the special aggregation pseudo-functions such as: <tt>SUM</tt>, <tt>AVG</tt>, <tt>MAX</tt>, <tt>MIN</tt>, <tt>STDEV</tt> and <tt>COUNT</tt>. The clauses that come after grouping can access only properties of groups, including the grouping expressions and aggregate properties of the groups such as <tt>COUNT(o.orderno)</tt> or <tt>COUNT(*)</tt>. (We&#x2019;ll see an exception when we discuss the new <tt>GROUP AS</tt> clause.)</p>
+<p>You may notice that the results of Q3.16 do not include customers who have no <tt>orders</tt>. If we want to include these <tt>customers</tt>, we need to use an outer join between the <tt>customers</tt> and <tt>orders</tt> collections. This is illustrated by the following example, which also includes the name of each customer.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.17) List the number of orders placed by each customer including those customers who have placed no orders.</p>
+
+<div>
+<div>
+<pre class="source">SELECT c.custid, c.name, COUNT(o.orderno) AS `order count`
+FROM customers AS c LEFT OUTER JOIN orders AS o ON c.custid = o.custid
+GROUP BY c.custid, c.name
+ORDER BY c.custid;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;order count&quot;: 4,
+        &quot;name&quot;: &quot;T. Cody&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C25&quot;,
+        &quot;order count&quot;: 0,
+        &quot;name&quot;: &quot;M. Sinclair&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C31&quot;,
+        &quot;order count&quot;: 1,
+        &quot;name&quot;: &quot;B. Pruitt&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C35&quot;,
+        &quot;order count&quot;: 1,
+        &quot;name&quot;: &quot;J. Roberts&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C37&quot;,
+        &quot;order count&quot;: 1,
+        &quot;name&quot;: &quot;T. Henry&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C41&quot;,
+        &quot;order count&quot;: 2,
+        &quot;name&quot;: &quot;R. Dodge&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C47&quot;,
+        &quot;order count&quot;: 0,
+        &quot;name&quot;: &quot;S. Logan&quot;
+    }
+]
+</pre></div></div>
+
+<p>Notice in Q3.17 what happens when the special aggregation function <tt>COUNT</tt> is applied to a collection that does not exist, such as the orders of M. Sinclair: it returns zero. This behavior is unlike that of the other special aggregation functions <tt>SUM</tt>, <tt>AVG</tt>, <tt>MAX</tt>, and <tt>MIN</tt>, which return <tt>null</tt> if their operand does not exist. This should make you cautious about the <tt>COUNT</tt> function: If it returns zero, that may mean that the collection you are counting has zero members, or that it does not exist, or that you have misspelled the collection&#x2019;s name.</p>
+<p>Q3.17 also shows how a query block can have more than one grouping expression. In general, the <tt>GROUP BY</tt>clause produces a binding tuple for each different combination of values for the grouping expressions. In Q3.17, the <tt>c.custid</tt> field uniquely identifies a customer, so adding <tt>c.name</tt> as a grouping expression does not result in any more groups. Nevertheless, <tt>c.name</tt> must be included as a grouping expression if it is to be referenced outside (after) the <tt>GROUP BY</tt> clause. If <tt>c.name</tt> were not included in the <tt>GROUP BY</tt> clause, it would not be a group property and could not be used in the <tt>SELECT</tt> clause.</p>
+<p>Of course, a grouping expression need not be a simple field-name. In Q3.18, orders are grouped by month, using a temporal function to extract the month component of the order dates. In cases like this, it is helpful to define an alias for the grouping expression so that it can be referenced elsewhere in the query e.g. in the <tt>SELECT</tt> clause.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.18) Find the months in 2020 that had the largest numbers of orders; list the months and their numbers of orders. (Return the top three.)</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+WHERE get_year(date(o.order_date)) = 2020
+GROUP BY get_month(date(o.order_date)) AS month
+SELECT month, COUNT(*) AS order_count
+ORDER BY order_count DESC, month DESC
+LIMIT 3;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;month&quot;: 10,
+        &quot;order_count&quot;: 2
+    },
+    {
+        &quot;month&quot;: 9,
+        &quot;order_count&quot;: 2
+    },
+    {
+        &quot;month&quot;: 8,
+        &quot;order_count&quot;: 1
+    }
+]
+</pre></div></div>
+
+<p>Groups are commonly formed from named collections like <tt>customers</tt> and <tt>orders</tt>. But in some queries you need to form groups from a collection that is nested inside another collection, such as <tt>items</tt> inside <tt>orders</tt>. In SQL++ you can do this by using left-correlation in the <tt>FROM</tt> clause to unnest the inner collection, joining the inner collection with the outer collection, and then performing the grouping on the join, as illustrated in Q3.19.</p>
+<p>Q3.19 also shows how a <tt>LET</tt> clause can be used after a <tt>GROUP BY</tt> clause to define an expression that is referenced multiple times in later clauses.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.19) For each order, define the total revenue of the order as the sum of quantity times price for all the items in that order. List the total revenue for all the orders placed by the customer with id &#x201c;C13&#x201d;, in descending order by total revenue.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders as o, o.items as i
+WHERE o.custid = &quot;C13&quot;
+GROUP BY o.orderno
+LET total_revenue = sum(i.qty * i.price)
+SELECT o.orderno, total_revenue
+ORDER BY total_revenue desc;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1002,
+        &quot;total_revenue&quot;: 10906.55
+    },
+    {
+        &quot;orderno&quot;: 1008,
+        &quot;total_revenue&quot;: 1999.8
+    },
+    {
+        &quot;orderno&quot;: 1007,
+        &quot;total_revenue&quot;: 130.45
+    }
+]
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="ROLLUP"></a><a name="Rollup" id="Rollup">ROLLUP</a></h4>
+<p>The <tt>ROLLUP</tt> subclause is an aggregation feature that extends the functionality of the <tt>GROUP BY</tt> clause. It returns extra <i>super-aggregate</i> items in the query results, giving subtotals and a grand total for the aggregate functions in the query. To illustrate, first consider the following query.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.R1) List the number of orders, grouped by customer region and city.</p>
+
+<div>
+<div>
+<pre class="source">SELECT customer_region AS Region,
+       customer_city AS City,
+       COUNT(o.orderno) AS `Order Count`
+FROM customers AS c LEFT OUTER JOIN orders AS o ON c.custid = o.custid
+LET address_line = SPLIT(c.address.city, &quot;,&quot;),
+    customer_city = TRIM(address_line[0]),
+    customer_region = TRIM(address_line[1])
+GROUP BY customer_region, customer_city
+ORDER BY customer_region ASC, customer_city ASC, `Order Count` DESC;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;Region&quot;: &quot;Italy&quot;,
+    &quot;City&quot;: &quot;Rome&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;Boston&quot;,
+    &quot;Order Count&quot;: 2
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;Hanover&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;City&quot;: &quot;St. Louis&quot;,
+    &quot;Order Count&quot;: 7
+  }
+]
+</pre></div></div>
+
+<p>This query uses string functions to split each customer&#x2019;s address into city and region. The query then counts the total number of orders placed by each customer, and groups the results first by customer region, then by customer city. The aggregate results (labeled <tt>Order Count</tt>) are only shown by city, and there are no subtotals or grand total. We can add these using the <tt>ROLLUP</tt> subclause, as in the following example.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.R2) List the number of orders by customer region and city, including subtotals and a grand total.</p>
+
+<div>
+<div>
+<pre class="source">SELECT customer_region AS Region,
+       customer_city AS City,
+       COUNT(o.orderno) AS `Order Count`
+FROM customers AS c LEFT OUTER JOIN orders AS o ON c.custid = o.custid
+LET address_line = SPLIT(c.address.city, &quot;,&quot;),
+    customer_city = TRIM(address_line[0]),
+    customer_region = TRIM(address_line[1])
+GROUP BY ROLLUP(customer_region, customer_city)
+ORDER BY customer_region ASC, customer_city ASC, `Order Count` DESC;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;Region&quot;: null,
+    &quot;City&quot;: null,
+    &quot;Order Count&quot;: 9
+  },
+  {
+    &quot;Region&quot;: &quot;Italy&quot;,
+    &quot;City&quot;: null,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;Italy&quot;,
+    &quot;City&quot;: &quot;Rome&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: null,
+    &quot;Order Count&quot;: 2
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;Boston&quot;,
+    &quot;Order Count&quot;: 2
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;Hanover&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;City&quot;: null,
+    &quot;Order Count&quot;: 7
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;City&quot;: &quot;St. Louis&quot;,
+    &quot;Order Count&quot;: 7
+  }
+]
+</pre></div></div>
+
+<p>With the addition of the <tt>ROLLUP</tt> subclause, the results now include an extra item at the start of each region, giving the subtotal for that region. There is also another extra item at the very start of the results, giving the grand total for all regions.</p>
+<p>The order of the fields specified by the <tt>ROLLUP</tt> subclause determines the hierarchy of the super-aggregate items. The customer region is specified first, followed by the customer city; so the results are aggregated by region first, and then by city within each region.</p>
+<p>The grand total returns <tt>null</tt> as a value for the city and the region, and the subtotals return <tt>null</tt> as the value for the city, which may make the results hard to understand at first glance. A workaround for this is given in the next example.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.R3) List the number of orders by customer region and city, with meaningful subtotals and grand total.</p>
+
+<div>
+<div>
+<pre class="source">SELECT IFNULL(customer_region, &quot;All regions&quot;) AS Region,
+       IFNULL(customer_city, &quot;All cities&quot;) AS City,
+       COUNT(o.orderno) AS `Order Count`
+FROM customers AS c LEFT OUTER JOIN orders AS o ON c.custid = o.custid
+LET address_line = SPLIT(c.address.city, &quot;,&quot;),
+    customer_city = TRIM(address_line[0]),
+    customer_region = TRIM(address_line[1])
+GROUP BY ROLLUP(customer_region, customer_city)
+ORDER BY customer_region ASC, customer_city ASC, `Order Count` DESC;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;City&quot;: &quot;All cities&quot;,
+    &quot;Order Count&quot;: 9
+  },
+  {
+    &quot;Region&quot;: &quot;Italy&quot;,
+    &quot;City&quot;: &quot;All cities&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;Italy&quot;,
+    &quot;City&quot;: &quot;Rome&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;All cities&quot;,
+    &quot;Order Count&quot;: 2
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;Boston&quot;,
+    &quot;Order Count&quot;: 2
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;Hanover&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;City&quot;: &quot;All cities&quot;,
+    &quot;Order Count&quot;: 7
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;City&quot;: &quot;St. Louis&quot;,
+    &quot;Order Count&quot;: 7
+  }
+]
+</pre></div></div>
+
+<p>This query uses the <tt>IFNULL</tt> function to populate the region and city fields with meaningful values for the super-aggregate items. This makes the results clearer and more readable.</p></div></div>
+<div class="section">
+<h4><a name="CUBE"></a><a name="Cube" id="Cube">CUBE</a></h4>
+<p>The <tt>CUBE</tt> subclause is similar to the <tt>ROLLUP</tt> subclause, in that it returns extra super-aggregate items in the query results, giving subtotals and a grand total for the aggregate functions. Whereas <tt>ROLLUP</tt> returns a grand total and a hierarchy of subtotals based on the specified fields, the <tt>CUBE</tt> subclause returns a grand total and subtotals for every possible combination of the specified fields.</p>
+<p>The following example is a modification of Q3.R3 which illustrates the <tt>CUBE</tt> subclause.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.C) List the number of orders by customer region and order date, with all possible subtotals and a grand total.</p>
+
+<div>
+<div>
+<pre class="source">SELECT IFNULL(customer_region, &quot;All regions&quot;) AS Region,
+       IFNULL(order_month, &quot;All months&quot;) AS Month,
+       COUNT(o.orderno) AS `Order Count`
+FROM customers AS c INNER JOIN orders AS o ON c.custid = o.custid
+LET address_line = SPLIT(c.address.city, &quot;,&quot;),
+    customer_region = TRIM(address_line[1]),
+    order_month = get_month(date(o.order_date))
+GROUP BY CUBE(customer_region, order_month)
+ORDER BY customer_region ASC, order_month ASC;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 9,
+    &quot;Month&quot;: &quot;All months&quot;
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 4
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 5
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 6
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 7
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 8
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 2,
+    &quot;Month&quot;: 9
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 2,
+    &quot;Month&quot;: 10
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;Order Count&quot;: 2,
+    &quot;Month&quot;: &quot;All months&quot;
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 7
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 8
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;Order Count&quot;: 7,
+    &quot;Month&quot;: &quot;All months&quot;
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 4
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 5
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 6
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;Order Count&quot;: 2,
+    &quot;Month&quot;: 9
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;Order Count&quot;: 2,
+    &quot;Month&quot;: 10
+  }
+]
+</pre></div></div>
+
+<p>To simplify the results, this query uses an inner join, so that customers who have not placed an order are not included in the totals. The query uses string functions to extract the region from each customer&#x2019;s address, and a temporal function to extract the year from the order date.</p>
+<p>The query uses the <tt>CUBE</tt> subclause with customer region and order month. This means that there are four possible aggregates to calculate:</p>
+<ul>
+
+<li>All regions, all months</li>
+<li>All regions, each month</li>
+<li>Each region, all months</li>
+<li>Each region, each month</li>
+</ul>
+<p>The results start with the grand total, showing the total number of orders across all regions for all months. This is followed by date subtotals, showing the number of orders across all regions for each month. Following that are the regional subtotals, showing the total number of orders for all months in each region; and the result items, giving the number of orders for each month in each region.</p>
+<p>The query also uses the <tt>IFNULL</tt> function to populate the region and date fields with meaningful values for the super-aggregate items. This makes the results clearer and more readable.</p></div></div></div>
+<div class="section">
+<h3><a name="HAVING_Clause"></a><a name="Having_clauses" id="Having_clauses">HAVING Clause</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="HavingClause"></a>HavingClause</h5>
+<p><img src="../images/diagrams/HavingClause.png" alt="" /></p>
+<p>The <tt>HAVING</tt> clause is very similar to the <tt>WHERE</tt> clause, except that it comes after <tt>GROUP BY</tt> and applies a filter to groups rather than to individual objects. Here&#x2019;s an example of a <tt>HAVING</tt> clause that filters orders by applying a condition to their nested arrays of <tt>items</tt>.</p>
+<p>By adding a <tt>HAVING</tt> clause to Q3.19, we can filter the results to include only those orders whose total revenue is greater than 1000, as shown in Q3.22.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.20) Modify Q3.19 to include only orders whose total revenue is greater than 5000.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items as i
+WHERE o.custid = &quot;C13&quot;
+GROUP BY o.orderno
+LET total_revenue = sum(i.qty * i.price)
+HAVING total_revenue &gt; 5000
+SELECT o.orderno, total_revenue
+ORDER BY total_revenue desc;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1002,
+        &quot;total_revenue&quot;: 10906.55
+    }
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Aggregation_Pseudo-Functions"></a><a name="Aggregation_PseudoFunctions" id="Aggregation_PseudoFunctions">Aggregation Pseudo-Functions</a></h3>
+<p>SQL provides several special functions for performing aggregations on groups including: <tt>SUM</tt>, <tt>AVG</tt>, <tt>MAX</tt>, <tt>MIN</tt>, and <tt>COUNT</tt> (some implementations provide more). These same functions are supported in SQL++. However, it&#x2019;s worth spending some time on these special functions because they don&#x2019;t behave like ordinary functions. They are called &#x201c;pseudo-functions&#x201d; here because they don&#x2019;t evaluate their operands in the same way as ordinary functions. To see the difference, consider these two examples, which are syntactically similar:</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example_1"></a>Example 1</h5>
+
+<div>
+<div>
+<pre class="source">SELECT LENGTH(name) FROM customers
+</pre></div></div>
+
+<p>In Example 1, <tt>LENGTH</tt> is an ordinary function. It simply evaluates its operand (name) and then returns a result computed from the operand.</p></div>
+<div class="section">
+<h5><a name="Example_2"></a>Example 2</h5>
+
+<div>
+<div>
+<pre class="source">SELECT AVG(rating) FROM customers
+</pre></div></div>
+
+<p>The effect of <tt>AVG</tt> in Example 2 is quite different. Rather than performing a computation on an individual rating value, <tt>AVG</tt> has a global effect: it effectively restructures the query. As a pseudo-function, <tt>AVG</tt> requires its operand to be a group; therefore, it automatically collects all the rating values from the query block and forms them into a group.</p>
+<p>The aggregation pseudo-functions always require their operand to be a group. In some queries, the group is explicitly generated by a <tt>GROUP BY</tt> clause, as in Q3.21:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.21) List the average credit rating of customers by zipcode.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+GROUP BY c.address.zipcode AS zip
+SELECT zip, AVG(c.rating) AS `avg credit rating`
+ORDER BY zip;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;avg credit rating&quot;: 625
+    },
+    {
+        &quot;avg credit rating&quot;: 657.5,
+        &quot;zip&quot;: &quot;02115&quot;
+    },
+    {
+        &quot;avg credit rating&quot;: 690,
+        &quot;zip&quot;: &quot;02340&quot;
+    },
+    {
+        &quot;avg credit rating&quot;: 695,
+        &quot;zip&quot;: &quot;63101&quot;
+    }
+]
+</pre></div></div>
+
+<p>Note in the result of Q3.21 that one or more customers had no zipcode. These customers were formed into a group for which the value of the grouping key is missing. When the query results were returned in JSON format, the <tt>missing</tt> key simply does not appear. Also note that the group whose key is <tt>missing</tt> appears first because <tt>missing</tt> is considered to be smaller than any other value. If some customers had had <tt>null</tt> as a zipcode, they would have been included in another group, appearing after the <tt>missing</tt> group but before the other groups.</p>
+<p>When an aggregation pseudo-function is used without an explicit <tt>GROUP BY</tt> clause, it implicitly forms the entire query block into a single group, as in Q3.22:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.22) Find the average credit rating among all customers.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+SELECT AVG(c.rating) AS `avg credit rating`;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;avg credit rating&quot;: 670
+    }
+]
+</pre></div></div>
+
+<p>The aggregation pseudo-function <tt>COUNT</tt> has a special form in which its operand is <tt>*</tt> instead of an expression.</p>
+<p>For example, <tt>SELECT COUNT(*) FROM customers</tt> simply returns the total number of customers, whereas <tt>SELECT COUNT(rating) FROM customers</tt> returns the number of customers who have known ratings (that is, their ratings are not <tt>null</tt> or <tt>missing</tt>).</p>
+<p>Because the aggregation pseudo-functions sometimes restructure their operands, they can be used only in query blocks where (explicit or implicit) grouping is being done. Therefore the pseudo-functions cannot operate directly on arrays or multisets. For operating directly on JSON collections, SQL++ provides a set of ordinary functions for computing aggregations. Each ordinary aggregation function (except the ones corresponding to <tt>COUNT</tt> and <tt>ARRAY_AGG</tt>) has two versions: one that ignores <tt>null</tt> and <tt>missing</tt> values and one that returns <tt>null</tt> if a <tt>null</tt> or <tt>missing</tt> value is encountered anywhere in the collection. The names of the aggregation functions are as follows:</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Aggregation pseudo-function; operates on groups only </th>
+<th> Ordinary function: Ignores NULL or MISSING values </th>
+<th> Ordinary function: Returns NULL if NULL or MISSING are encountered</th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td>SUM</td>
+<td> ARRAY_SUM</td>
+<td> STRICT_SUM </td></tr>
+<tr class="a">
+<td> AVG </td>
+<td>ARRAY_MAX</td>
+<td> STRICT_MAX </td></tr>
+<tr class="b">
+<td> MAX </td>
+<td> ARRAY_MIN</td>
+<td> STRICT_MIN </td></tr>
+<tr class="a">
+<td> MIN </td>
+<td> ARRAY_AVG</td>
+<td> STRICT_AVG </td></tr>
+<tr class="b">
+<td> COUNT </td>
+<td>ARRAY_COUNT</td>
+<td>STRICT_COUNT (see exception below) </td></tr>
+<tr class="a">
+<td>STDDEV_SAMP</td>
+<td>ARRAY_STDDEV_SAMP</td>
+<td> STRICT_STDDEV_SAMP </td></tr>
+<tr class="b">
+<td>STDDEV_POP</td>
+<td>ARRAY_STDDEV_POP</td>
+<td> STRICT_STDDEV_POP </td></tr>
+<tr class="a">
+<td>VAR_SAMP</td>
+<td>ARRAY_VAR_SAMP</td>
+<td> STRICT_VAR_SAMP </td></tr>
+<tr class="b">
+<td>VAR_POP</td>
+<td>ARRAY_VAR_POP</td>
+<td> STRICT_VAR_POP </td></tr>
+<tr class="a">
+<td>SKEWENESS</td>
+<td>ARRAY_SKEWNESS</td>
+<td> STRICT_SKEWNESS </td></tr>
+<tr class="b">
+<td>KURTOSIS</td>
+<td>ARRAY_KURTOSIS</td>
+<td> STRICT_KURTOSIS </td></tr>
+<tr class="a">
+<td> </td>
+<td>ARRAY_AGG</td>
+<td> </td></tr>
+</tbody>
+</table>
+<p>Exception: the ordinary aggregation function STRICT_COUNT operates on any collection, and returns a count of its items, including null values in the count. In this respect, STRICT_COUNT is more similar to COUNT(*) than to COUNT(expression).</p>
+<p>Note that the ordinary aggregation functions that ignore <tt>null</tt> have names beginning with &#x201c;ARRAY&#x201d;. This naming convention has historical roots. Despite their names, the functions operate on both arrays and multisets.</p>
+<p>Because of the special properties of the aggregation pseudo-functions, SQL (and therefore SQL++) is not a pure functional language. But every query that uses a pseudo-function can be expressed as an equivalent query that uses an ordinary function. Q3.23 is an example of how queries can be expressed without pseudo-functions. A more detailed explanation of all of the functions is also available in the section on <a href="builtins.html#AggregateFunctions">Aggregate Functions</a>.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.23) Alternative form of Q3.22, using the ordinary function <tt>ARRAY_AVG</tt> rather than the aggregating pseudo-function <tt>AVG</tt>.</p>
+
+<div>
+<div>
+<pre class="source">SELECT ARRAY_AVG(
+    (SELECT VALUE c.rating
+    FROM customers AS c) ) AS `avg credit rating`;
+</pre></div></div>
+
+<p>Result (same as Q3.22):</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;avg credit rating&quot;: 670
+    }
+]
+</pre></div></div>
+
+<p>If the function <tt>STRICT_AVG</tt> had been used in Q3.23 in place of <tt>ARRAY_AVG</tt>, the average credit rating returned by the query would have been <tt>null</tt>, because at least one customer has no credit rating.</p></div></div></div>
+<div class="section">
+<h3><a name="GROUP_AS_Clause"></a><a name="Group_As_clauses" id="Group_As_clauses">GROUP AS Clause</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="GroupAsClause"></a>GroupAsClause</h5>
+<p><img src="../images/diagrams/GroupAsClause.png" alt="" /></p>
+<p>JSON is a hierarchical format, and a fully featured JSON query language needs to be able to produce hierarchies of its own, with computed data at every level of the hierarchy. The key feature of SQL++ that makes this possible is the <tt>GROUP AS</tt> clause.</p>
+<p>A query may have a <tt>GROUP AS</tt> clause only if it has a <tt>GROUP BY</tt> clause. The <tt>GROUP BY</tt> clause &#x201c;hides&#x201d; the original objects in each group, exposing only the grouping expressions and special aggregation functions on the non-grouping fields. The purpose of the <tt>GROUP AS</tt> clause is to make the original objects in the group visible to subsequent clauses. Thus the query can generate output data both for the group as a whole and for the individual objects inside the group.</p>
+<p>For each group, the <tt>GROUP AS</tt> clause preserves all the objects in the group, just as they were before grouping, and gives a name to this preserved group. The group name can then be used in the <tt>FROM</tt> clause of a subquery to process and return the individual objects in the group.</p>
+<p>To see how this works, we&#x2019;ll write some queries that investigate the customers in each zipcode and their credit ratings. This would be a good time to review the sample database in <a href="#Manual_data">Appendix 4</a>. A part of the data is summarized below.</p>
+
+<div>
+<div>
+<pre class="source">Customers in zipcode 02115:
+    C35, J. Roberts, rating 565
+    C37, T. Henry, rating 750
+
+Customers in zipcode 02340:
+    C25, M. Sinclair, rating 690
+
+Customers in zipcode 63101:
+    C13, T. Cody, rating 750
+    C31, B. Pruitt, (no rating)
+    C41, R. Dodge, rating 640
+
+Customers with no zipcode:
+    C47, S. Logan, rating 625
+</pre></div></div>
+
+<p>Now let&#x2019;s consider the effect of the following clauses:</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+GROUP BY c.address.zipcode
+GROUP AS g
+</pre></div></div>
+
+<p>This query fragment iterates over the <tt>customers</tt> objects, using the iteration variable <tt>c</tt>. The <tt>GROUP BY</tt> clause forms the objects into groups, each with a common zipcode (including one group for customers with no zipcode). After the <tt>GROUP BY</tt> clause, we can see the grouping expression, <tt>c.address.zipcode</tt>, but other fields such as <tt>c.custid</tt> and <tt>c.name</tt> are visible only to special aggregation functions.</p>
+<p>The clause <tt>GROUP AS g</tt> now makes the original objects visible again. For each group in turn, the variable <tt>g</tt> is bound to a multiset of objects, each of which has a field named <tt>c</tt>, which in turn contains one of the original objects. Thus after <tt>GROUP AS g</tt>, for the group with zipcode 02115, <tt>g</tt> is bound to the following multiset:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;c&quot;:
+        { &quot;custid&quot;: &quot;C35&quot;,
+          &quot;name&quot;: &quot;J. Roberts&quot;,
+          &quot;address&quot;:
+            { &quot;street&quot;: &quot;420 Green St.&quot;,
+              &quot;city&quot;: &quot;Boston, MA&quot;,
+              &quot;zipcode&quot;: &quot;02115&quot;
+            },
+          &quot;rating&quot;: 565
+        }
+    },
+    { &quot;c&quot;:
+        { &quot;custid&quot;: &quot;C37&quot;,
+          &quot;name&quot;: &quot;T. Henry&quot;,
+          &quot;address&quot;:
+            { &quot;street&quot;: &quot;120 Harbor Blvd.&quot;,
+              &quot;city&quot;: &quot;St. Louis, MO&quot;,
+              &quot;zipcode&quot;: &quot;02115&quot;
+            },
+          &quot;rating&quot;: 750
+        }
+    }
+]
+</pre></div></div>
+
+<p>Thus, the clauses following <tt>GROUP AS</tt> can see the original objects by writing subqueries that iterate over the multiset <tt>g</tt>.</p>
+<p>The extra level named <tt>c</tt> was introduced into this multiset because the groups might have been formed from a join of two or more collections. Suppose that the <tt>FROM</tt> clause looked like <tt>FROM customers AS c, orders AS o</tt>. Then each item in the group would contain both a <tt>customers</tt> object and an <tt>orders</tt> object, and these two objects might both have a field with the same name. To avoid ambiguity, each of the original objects is wrapped in an &#x201c;outer&#x201d; object that gives it the name of its iteration variable in the <tt>FROM</tt> clause. Consider this fragment:</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c, orders AS o
+WHERE c.custid = o.custid
+GROUP BY c.address.zipcode
+GROUP AS g
+</pre></div></div>
+
+<p>In this case, following <tt>GROUP AS g</tt>, the variable <tt>g</tt> would be bound to the following collection:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;c&quot;: { an original customers object },
+      &quot;o&quot;: { an original orders object }
+    },
+    { &quot;c&quot;: { another customers object },
+      &quot;o&quot;: { another orders object }
+    },
+    ...
+]
+</pre></div></div>
+
+<p>After using <tt>GROUP AS</tt> to make the content of a group accessible, you will probably want to write a subquery to access that content. A subquery for this purpose is written in exactly the same way as any other subquery. The name specified in the <tt>GROUP AS</tt> clause (<tt>g</tt> in the above example) is the name of a collection of objects. You can write a <tt>FROM</tt> clause to iterate over the objects in the collection, and you can specify an iteration variable to represent each object in turn. For <tt>GROUP AS</tt> queries in this manual, we&#x2019;ll use <tt>g</tt>as the name of the reconstituted group, and <tt>gi</tt> as an iteration variable representing one object inside the group. Of course, you can use any names you like for these purposes.</p>
+<p>Now we are ready to take a look at how <tt>GROUP AS</tt> might be used in a query. Suppose that we want to group customers by zipcode, and for each group we want to see the average credit rating and a list of the individual customers in the group. Here&#x2019;s a query that does that:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.24) For each zipcode, list the average credit rating in that zipcode, followed by the customer numbers and names in numeric order.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+GROUP BY c.address.zipcode AS zip
+GROUP AS g
+SELECT zip, AVG(c.rating) AS `avg credit rating`,
+    (FROM g AS gi
+     SELECT gi.c.custid, gi.c.name
+     ORDER BY gi.c.custid) AS `local customers`
+ORDER BY zip;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;avg credit rating&quot;: 625,
+        &quot;local customers&quot;: [
+            {
+                &quot;custid&quot;: &quot;C47&quot;,
+                &quot;name&quot;: &quot;S. Logan&quot;
+            }
+        ]
+    },
+    {
+        &quot;avg credit rating&quot;: 657.5,
+        &quot;local customers&quot;: [
+            {
+                &quot;custid&quot;: &quot;C35&quot;,
+                &quot;name&quot;: &quot;J. Roberts&quot;
+            },
+            {
+                &quot;custid&quot;: &quot;C37&quot;,
+                &quot;name&quot;: &quot;T. Henry&quot;
+            }
+        ],
+        &quot;zip&quot;: &quot;02115&quot;
+    },
+    {
+        &quot;avg credit rating&quot;: 690,
+        &quot;local customers&quot;: [
+            {
+                &quot;custid&quot;: &quot;C25&quot;,
+                &quot;name&quot;: &quot;M. Sinclair&quot;
+            }
+        ],
+        &quot;zip&quot;: &quot;02340&quot;
+    },
+    {
+        &quot;avg credit rating&quot;: 695,
+        &quot;local customers&quot;: [
+            {
+                &quot;custid&quot;: &quot;C13&quot;,
+                &quot;name&quot;: &quot;T. Cody&quot;
+            },
+            {
+                &quot;custid&quot;: &quot;C31&quot;,
+                &quot;name&quot;: &quot;B. Pruitt&quot;
+            },
+            {
+                &quot;custid&quot;: &quot;C41&quot;,
+                &quot;name&quot;: &quot;R. Dodge&quot;
+            }
+        ],
+        &quot;zip&quot;: &quot;63101&quot;
+    }
+]
+</pre></div></div>
+
+<p>Note that this query contains two <tt>ORDER BY</tt> clauses: one in the outer query and one in the subquery. These two clauses govern the ordering of the outer-level list of zipcodes and the inner-level lists of customers, respectively. Also note that the group of customers with no zipcode comes first in the output list.</p></div></div></div></div>
+<div class="section">
+<h2><a name="Selection_and_UNION_ALL"></a><a name="Union_all" id="Union_all">Selection and UNION ALL</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Selection"></a>Selection</h5>
+<p><img src="../images/diagrams/Selection.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="UnionOption"></a>UnionOption</h5>
+<p><img src="../images/diagrams/UnionOption.png" alt="" /></p>
+<p>In a SQL++ query, two or more query blocks can be connected by the operator <tt>UNION ALL</tt>. The result of a <tt>UNION ALL</tt> between two query blocks contains all the items returned by the first query block, and all the items returned by the second query block. Duplicate items are not eliminated from the query result.</p>
+<p>As in SQL, there is no ordering guarantee on the contents of the output stream. However, unlike SQL, the query language does not constrain what the data looks like on the input streams; in particular, it allows heterogeneity on the input and output streams. A type error will be raised if one of the inputs is not a collection.</p>
+<p>When two or more query blocks are connected by <tt>UNION ALL</tt>, they can be followed by <tt>ORDER BY</tt>, <tt>LIMIT</tt>, and <tt>OFFSET</tt> clauses that apply to the <tt>UNION</tt> query as a whole. For these clauses to be meaningful, the field-names returned by the two query blocks should match. The following example shows a <tt>UNION ALL</tt> of two query blocks, with an ordering specified for the result.</p>
+<p>In this example, a customer might be selected because he has ordered more than two different items (first query block) or because he has a high credit rating (second query block). By adding an explanatory string to each query block, the query writer can cause the output objects to be labeled to distinguish these two cases.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.25a) Find customer ids for customers who have placed orders for more than two different items or who have a credit rating greater than 700, with labels to distinguish these cases.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items AS i
+GROUP BY o.orderno, o.custid
+HAVING COUNT(*) &gt; 2
+SELECT DISTINCT o.custid AS customer_id, &quot;Big order&quot; AS reason
+
+UNION ALL
+
+FROM customers AS c
+WHERE rating &gt; 700
+SELECT c.custid AS customer_id, &quot;High rating&quot; AS reason
+ORDER BY customer_id;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;reason&quot;: &quot;High rating&quot;,
+        &quot;customer_id&quot;: &quot;C13&quot;
+    },
+    {
+        &quot;reason&quot;: &quot;Big order&quot;,
+        &quot;customer_id&quot;: &quot;C37&quot;
+    },
+    {
+        &quot;reason&quot;: &quot;High rating&quot;,
+        &quot;customer_id&quot;: &quot;C37&quot;
+    },
+    {
+        &quot;reason&quot;: &quot;Big order&quot;,
+        &quot;customer_id&quot;: &quot;C41&quot;
+    }
+]
+</pre></div></div>
+
+<p>If, on the other hand, you simply want a list of the customer ids and you don&#x2019;t care to preserve the reasons, you can simplify your output by using <tt>SELECT VALUE</tt>, as follows:</p>
+<p>(Q3.25b) Simplify Q3.25a to return a simple list of unlabeled customer ids.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items AS i
+GROUP BY o.orderno, o.custid
+HAVING COUNT(*) &gt; 2
+SELECT VALUE o.custid
+
+UNION ALL
+
+FROM customers AS c
+WHERE rating &gt; 700
+SELECT VALUE c.custid;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    &quot;C37&quot;,
+    &quot;C41&quot;,
+    &quot;C13&quot;,
+    &quot;C37&quot;
+]
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="WITH_Clause"></a><a name="With_clauses" id="With_clauses">WITH Clause</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="WithClause"></a>WithClause</h5>
+<p><img src="../images/diagrams/WithClause.png" alt="" /></p>
+<p>As in standard SQL, a <tt>WITH</tt> clause can be used to improve the modularity of a query. A <tt>WITH</tt> clause often contains a subquery that is needed to compute some result that is used later in the main query. In cases like this, you can think of the <tt>WITH</tt> clause as computing a &#x201c;temporary view&quot; of the input data. The next example uses a <tt>WITH</tt> clause to compute the total revenue of each order in 2020; then the main part of the query finds the minimum, maximum, and average revenue for orders in that year.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.26) Find the minimum, maximum, and average revenue among all orders in 2020, rounded to the nearest integer.</p>
+
+<div>
+<div>
+<pre class="source">WITH order_revenue AS
+    (FROM orders AS o, o.items AS i
+    WHERE get_year(date(o.order_date)) = 2020
+    GROUP BY o.orderno
+    SELECT o.orderno, SUM(i.qty * i.price) AS revenue
+  )
+FROM order_revenue
+SELECT AVG(revenue) AS average,
+       MIN(revenue) AS minimum,
+       MAX(revenue) AS maximum;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;average&quot;: 4669.99,
+        &quot;minimum&quot;: 130.45,
+        &quot;maximum&quot;: 18847.58
+    }
+]
+</pre></div></div>
+
+<p><tt>WITH</tt> can be particularly useful when a value needs to be used several times in a query.</p></div></div></div></div>
+<div class="section">
+<h2><a name="ORDER_BY.2C_LIMIT.2C_and_OFFSET_Clauses"></a><a name="Order_By_clauses" id="Order_By_clauses">ORDER BY, LIMIT, and OFFSET Clauses</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="OrderbyClause"></a>OrderbyClause</h5>
+<p><img src="../images/diagrams/OrderbyClause.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="LimitClause"></a>LimitClause</h5>
+<p><img src="../images/diagrams/LimitClause.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="OffsetClause"></a>OffsetClause</h5>
+<p><img src="../images/diagrams/OffsetClause.png" alt="" /></p>
+<p>The last three (optional) clauses to be processed in a query are <tt>ORDER BY</tt>, <tt>LIMIT</tt>, and <tt>OFFSET</tt>.</p>
+<p>The <tt>ORDER BY</tt> clause is used to globally sort data in either ascending order (i.e., <tt>ASC</tt>) or descending order (i.e., <tt>DESC</tt>). During ordering (if the <tt>NULLS</tt> modifier is not specified), <tt>MISSING</tt> and <tt>NULL</tt> are treated as being smaller than any other value if they are encountered in the ordering key(s). <tt>MISSING</tt> is treated as smaller than <tt>NULL</tt> if both occur in the data being sorted. The <tt>NULLS</tt> modifier determines how <tt>MISSING</tt> and <tt>NULL</tt> are ordered relative to all other values: first (<tt>NULLS</tt> <tt>FIRST</tt>) or last (<tt>NULLS</tt> <tt>LAST</tt>). The relative order between <tt>MISSING</tt> and <tt>NULL</tt> is not affected by the <tt>NULLS</tt> modifier (i.e. <tt>MISSING</tt> is still treated as smaller than <tt>NULL</tt>). The ordering of values of a given type is consistent with its type&#x2019;s <tt>&lt;=</tt> ordering; the ordering of values across types is implementation-defined but stable.</p>
+<p>The <tt>LIMIT</tt> clause is used to limit the result set to a specified maximum size. The optional <tt>OFFSET</tt> clause is used to specify a number of items in the output stream to be discarded before the query result begins. The <tt>OFFSET</tt> can also be used as a standalone clause, without the <tt>LIMIT</tt>.</p>
+<p>The following example illustrates use of the <tt>ORDER BY</tt> and <tt>LIMIT</tt> clauses.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.27) Return the top three customers by rating.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+SELECT c.custid, c.name, c.rating
+ORDER BY c.rating DESC
+LIMIT 3;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;rating&quot;: 750
+    },
+    {
+        &quot;custid&quot;: &quot;C37&quot;,
+        &quot;name&quot;: &quot;T. Henry&quot;,
+        &quot;rating&quot;: 750
+    },
+    {
+        &quot;custid&quot;: &quot;C25&quot;,
+        &quot;name&quot;: &quot;M. Sinclair&quot;,
+        &quot;rating&quot;: 690
+    }
+]
+</pre></div></div>
+
+<p>The following example illustrates the use of <tt>OFFSET</tt>:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.38) Find the customer with the third-highest credit rating.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+SELECT c.custid, c.name, c.rating
+ORDER BY c.rating DESC
+LIMIT 1 OFFSET 2;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C25&quot;,
+        &quot;name&quot;: &quot;M. Sinclair&quot;,
+        &quot;rating&quot;: 690
+    }
+]
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="Subqueries" id="Subqueries">Subqueries</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Subquery"></a>Subquery</h5>
+<p><img src="../images/diagrams/Subquery.png" alt="" /></p>
+<p>A subquery is simply a query surrounded by parentheses. In SQL++, a subquery can appear anywhere that an expression can appear. Like any query, a subquery always returns a collection, even if the collection contains only a single value or is empty. If the subquery has a SELECT clause, it returns a collection of objects. If the subquery has a SELECT VALUE clause, it returns a collection of scalar values. If a single scalar value is expected, the indexing operator [0] can be used to extract the single scalar value from the collection.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.29) (Subquery in SELECT clause) For every order that includes item no. 120, find the order number, customer id, and customer name.</p>
+<p>Here, the subquery is used to find a customer name, given a customer id. Since the outer query expects a scalar result, the subquery uses SELECT VALUE and is followed by the indexing operator [0].</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items AS i
+WHERE i.itemno = 120
+SELECT o.orderno, o.custid,
+    (FROM customers AS c
+     WHERE c.custid = o.custid
+     SELECT VALUE c.name)[0] AS name;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1003,
+        &quot;custid&quot;: &quot;C31&quot;,
+        &quot;name&quot;: &quot;B. Pruitt&quot;
+    },
+    {
+        &quot;orderno&quot;: 1006,
+        &quot;custid&quot;: &quot;C41&quot;,
+        &quot;name&quot;: &quot;R. Dodge&quot;
+    }
+]
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.30) (Subquery in WHERE clause) Find the customer number, name, and rating of all customers whose rating is greater than the average rating.</p>
+<p>Here, the subquery is used to find the average rating among all customers. Once again, SELECT VALUE and indexing [0] have been used to get a single scalar value.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c1
+WHERE c1.rating &gt;
+   (FROM customers AS c2
+    SELECT VALUE AVG(c2.rating))[0]
+SELECT c1.custid, c1.name, c1.rating;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;rating&quot;: 750
+    },
+    {
+        &quot;custid&quot;: &quot;C25&quot;,
+        &quot;name&quot;: &quot;M. Sinclair&quot;,
+        &quot;rating&quot;: 690
+    },
+    {
+        &quot;custid&quot;: &quot;C37&quot;,
+        &quot;name&quot;: &quot;T. Henry&quot;,
+        &quot;rating&quot;: 750
+    }
+]
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.31) (Subquery in FROM clause) Compute the total revenue (sum over items of quantity time price) for each order, then find the average, maximum, and minimum total revenue over all orders.</p>
+<p>Here, the FROM clause expects to iterate over a collection of objects, so the subquery uses an ordinary SELECT and does not need to be indexed. You might think of a FROM clause as a &#x201c;natural home&#x201d; for a subquery.</p>
+
+<div>
+<div>
+<pre class="source">FROM
+   (FROM orders AS o, o.items AS i
+    GROUP BY o.orderno
+    SELECT o.orderno, SUM(i.qty * i.price) AS revenue
+   ) AS r
+SELECT AVG(r.revenue) AS average,
+       MIN(r.revenue) AS minimum,
+       MAX(r.revenue) AS maximum;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;average&quot;: 4669.99,
+        &quot;minimum&quot;: 130.45,
+        &quot;maximum&quot;: 18847.58
+    }
+]
+</pre></div></div>
+
+<p>Note the similarity between Q3.26 and Q3.31. This illustrates how a subquery can often be moved into a <tt>WITH</tt> clause to improve the modularity and readability of a query.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Over_clauses" id="Over_clauses">4. Window Functions</a></h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>Window functions are special functions that compute aggregate values over a &#x201c;window&#x201d; of input data. Like an ordinary function, a window function returns a value for every item in the input dataset. But in the case of a window function, the value returned by the function can depend not only on the argument of the function, but also on other items in the same collection. For example, a window function applied to a set of employees might return the rank of each employee in the set, as measured by salary. As another example, a window function applied to a set of items, ordered by purchase date, might return the running total of the cost of the items.</p>
+<p>A window function call is identified by an <tt>OVER</tt> clause, which can specify three things: partitioning, ordering, and framing. The partitioning specification is like a <tt>GROUP BY</tt>: it splits the input data into partitions. For example, a set of employees might be partitioned by department. The window function, when applied to a given object, is influenced only by other objects in the same partition. The ordering specification is like an <tt>ORDER BY</tt>: it determines the ordering of the objects in each partition. The framing specification defines a &#x201c;frame&#x201d; that moves through the partition, defining how the result for each object depends on nearby objects. For example, the frame for a current object might consist of the two objects before and after the current one; or it might consist of all the objects before the current one in the same partition. A window function call may also specify some options that control (for example) how nulls are handled by the function.</p>
+<p>Here is an example of a window function call:</p>
+
+<div>
+<div>
+<pre class="source">SELECT deptno, purchase_date, item, cost,
+    SUM(cost) OVER (
+        PARTITION BY deptno
+        ORDER BY purchase_date
+        ROWS UNBOUNDED PRECEDING) AS running_total_cost
+FROM purchases
+ORDER BY deptno, purchase_date
+</pre></div></div>
+
+<p>This example partitions the <tt>purchases</tt> dataset by department number. Within each department, it orders the <tt>purchases</tt> by date and computes a running total cost for each item, using the frame specification <tt>ROWS UNBOUNDED PRECEDING</tt>. Note that the <tt>ORDER BY</tt> clause in the window function is separate and independent from the <tt>ORDER BY</tt> clause of the query as a whole.</p>
+<p>The general syntax of a window function call is specified in this section. SQL++ has a set of builtin window functions, which are listed and explained in the <a href="builtins.html#WindowFunctions">Window Functions</a> section of the builtin functions page. In addition, standard SQL aggregate functions such as <tt>SUM</tt> and <tt>AVG</tt> can be used as window functions if they are used with an <tt>OVER</tt> clause.</p></div></div></div></div>
+<div class="section">
+<h2><a name="Window_Function_Call"></a><a name="Window_function_call" id="Window_function_call">Window Function Call</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="WindowFunctionCall"></a>WindowFunctionCall</h5>
+<p><img src="../images/diagrams/WindowFunctionCall.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="WindowFunctionType"></a>WindowFunctionType</h5>
+<p><img src="../images/diagrams/WindowFunctionType.png" alt="" /></p>
+<p>Refer to the <a href="builtins.html#AggregateFunctions">Aggregate Functions</a> section for a list of aggregate functions.</p>
+<p>Refer to the <a href="builtins.html#WindowFunctions">Window Functions</a> section for a list of window functions.</p></div></div></div>
+<div class="section">
+<h3><a name="Window_Function_Arguments"></a><a name="Window_function_arguments" id="Window_function_arguments">Window Function Arguments</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="WindowFunctionArguments"></a>WindowFunctionArguments</h5>
+<p><img src="../images/diagrams/WindowFunctionArguments.png" alt="" /></p>
+<p>Refer to the <a href="builtins.html#AggregateFunctions">Aggregate Functions</a> section or the <a href="builtins.html#WindowFunctions">Window Functions</a> section for details of the arguments for individual functions.</p></div></div></div>
+<div class="section">
+<h3><a name="Window_Function_Options"></a><a name="Window_function_options" id="Window_function_options">Window Function Options</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="WindowFunctionOptions"></a>WindowFunctionOptions</h5>
+<p><img src="../images/diagrams/WindowFunctionOptions.png" alt="" /></p>
+<p>Window function options cannot be used with <a href="builtins.html#AggregateFunctions">aggregate functions</a>.</p>
+<p>Window function options can only be used with some <a href="builtins.html#WindowFunctions">window functions</a>, as described below.</p>
+<p>The <i>FROM modifier</i> determines whether the computation begins at the first or last tuple in the window. It is optional and can only be used with the <tt>nth_value()</tt> function. If it is omitted, the default setting is <tt>FROM FIRST</tt>.</p>
+<p>The <i>NULLS modifier</i> determines whether NULL values are included in the computation, or ignored. MISSING values are treated the same way as NULL values. It is also optional and can only be used with the <tt>first_value()</tt>, <tt>last_value()</tt>, <tt>nth_value()</tt>, <tt>lag()</tt>, and <tt>lead()</tt> functions. If omitted, the default setting is <tt>RESPECT NULLS</tt>.</p></div></div></div>
+<div class="section">
+<h3><a name="Window_Frame_Variable"></a><a name="Window_frame_variable" id="Window_frame_variable">Window Frame Variable</a></h3>
+<p>The <tt>AS</tt> keyword enables you to specify an alias for the window frame contents. It introduces a variable which will be bound to the contents of the frame. When using a built-in <a href="builtins.html#AggregateFunctions">aggregate function</a> as a window function, the function&#x2019;s argument must be a subquery which refers to this alias, for example:</p>
+
+<div>
+<div>
+<pre class="source">SELECT ARRAY_COUNT(DISTINCT (FROM alias SELECT VALUE alias.src.field))
+OVER alias AS (PARTITION BY &#x2026; ORDER BY &#x2026;)
+FROM source AS src
+</pre></div></div>
+
+<p>The alias is not necessary when using a <a href="builtins.html#WindowFunctions">window function</a>, or when using a standard SQL aggregate function with the <tt>OVER</tt> clause.</p></div>
+<div class="section">
+<h3><a name="Window_Definition"></a><a name="Window_definition" id="Window_definition">Window Definition</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="WindowDefinition"></a>WindowDefinition</h5>
+<p><img src="../images/diagrams/WindowDefinition.png" alt="" /></p>
+<p>The <i>window definition</i> specifies the partitioning, ordering, and framing for window functions.</p></div></div>
+<div class="section">
+<h4><a name="Window_Partition_Clause"></a><a name="Window_partition_clause" id="Window_partition_clause">Window Partition Clause</a></h4>
+<div class="section">
+<h5><a name="WindowPartitionClause"></a>WindowPartitionClause</h5>
+<p><img src="../images/diagrams/WindowPartitionClause.png" alt="" /></p>
+<p>The <i>window partition clause</i> divides the tuples into logical partitions using one or more expressions.</p>
+<p>This clause may be used with any <a href="builtins.html#WindowFunctions">window function</a>, or any <a href="builtins.html#AggregateFunctions">aggregate function</a> used as a window function.</p>
+<p>This clause is optional. If omitted, all tuples are united in a single partition.</p></div></div>
+<div class="section">
+<h4><a name="Window_Order_Clause"></a><a name="Window_order_clause" id="Window_order_clause">Window Order Clause</a></h4>
+<div class="section">
+<h5><a name="WindowOrderClause"></a>WindowOrderClause</h5>
+<p><img src="../images/diagrams/WindowOrderClause.png" alt="" /></p>
+<p>The <i>window order clause</i> determines how tuples are ordered within each partition. The window function works on tuples in the order specified by this clause.</p>
+<p>This clause may be used with any <a href="builtins.html#WindowFunctions">window function</a>, or any <a href="builtins.html#AggregateFunctions">aggregate function</a> used as a window function.</p>
+<p>This clause is optional. If omitted, all tuples are considered peers, i.e. their order is tied. When tuples in the window partition are tied, each window function behaves differently.</p>
+<ul>
+
+<li>
+
+<p>The <tt>row_number()</tt> function returns a distinct number for each tuple. If tuples are tied, the results may be unpredictable.</p>
+</li>
+<li>
+
+<p>The <tt>rank()</tt>, <tt>dense_rank()</tt>, <tt>percent_rank()</tt>, and <tt>cume_dist()</tt> functions return the same result for each tuple.</p>
+</li>
+<li>
+
+<p>For other functions, if the <a href="#Window_frame_clause">window frame</a> is defined by <tt>ROWS</tt>, the results may be unpredictable. If the window frame is defined by <tt>RANGE</tt> or <tt>GROUPS</tt>, the results are same for each tuple.</p>
+</li>
+</ul>
+<p><b>Note:</b> This clause does not guarantee the overall order of the query results. To guarantee the order of the final results, use the query <tt>ORDER BY</tt> clause.</p></div></div>
+<div class="section">
+<h4><a name="Window_Frame_Clause"></a><a name="Window_frame_clause" id="Window_frame_clause">Window Frame Clause</a></h4>
+<div class="section">
+<h5><a name="WindowFrameClause"></a>WindowFrameClause</h5>
+<p><img src="../images/diagrams/WindowFrameClause.png" alt="" /></p>
+<p>The <i>window frame clause</i> defines the window frame. It can be used with all <a href="builtins.html#AggregateFunctions">aggregate functions</a> and some <a href="builtins.html#WindowFunctions">window functions</a> &#x2014; refer to the descriptions of individual functions for more details.  It is optional and allowed only when the <a href="#Window_order_clause">window order clause</a> is present.</p>
+<ul>
+
+<li>
+
+<p>If this clause is omitted and there is no <a href="#Window_order_clause">window order clause</a>, the window frame is the entire partition.</p>
+</li>
+<li>
+
+<p>If this clause is omitted but there is a <a href="#Window_order_clause">window order clause</a>, the window frame becomes all tuples in the partition preceding the current tuple and its peers &#x2014; the same as <tt>RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW</tt>.</p>
+</li>
+</ul>
+<p>The window frame can be defined in the following ways:</p>
+<ul>
+
+<li>
+
+<p><tt>ROWS</tt>: Counts the exact number of tuples within the frame. If window ordering doesn&#x2019;t result in unique ordering, the function may produce unpredictable results. You can add a unique expression or more window ordering expressions to produce unique ordering.</p>
+</li>
+<li>
+
+<p><tt>RANGE</tt>: Looks for a value offset within the frame. The function produces deterministic results.</p>
+</li>
+<li>
+
+<p><tt>GROUPS</tt>: Counts all groups of tied rows within the frame. The function produces deterministic results.</p>
+</li>
+</ul>
+<p><b>Note:</b> If this clause uses <tt>RANGE</tt> with either <i>Expr</i> <tt>PRECEDING</tt> or <i>Expr</i> <tt>FOLLOWING</tt>, the <a href="#Window_order_clause">window order clause</a> must have only a single ordering term. The ordering term expression must evaluate to a number. If these conditions are not met, the window frame will be empty, which means the window function will return its default value: in most cases this is <tt>null</tt>, except for <tt>strict_count()</tt> or <tt>array_count()</tt>, whose default value is 0. This restriction does not apply when the window frame uses <tt>ROWS</tt> or <tt>GROUPS</tt>.</p>
+<p><b>Tip:</b> The <tt>RANGE</tt> window frame is commonly used to define window frames based on date or time. If you want to use <tt>RANGE</tt> with either <i>Expr</i> <tt>PRECEDING</tt> or <i>Expr</i> <tt>FOLLOWING</tt>, and you want to use an ordering expression based on date or time, the expression in <i>Expr</i> <tt>PRECEDING</tt> or <i>Expr</i> <tt>FOLLOWING</tt> must use a data type that can be added to the ordering expression.</p></div></div>
+<div class="section">
+<h4><a name="Window_Frame_Extent"></a><a name="Window_frame_extent" id="Window_frame_extent">Window Frame Extent</a></h4>
+<div class="section">
+<h5><a name="WindowFrameExtent"></a>WindowFrameExtent</h5>
+<p><img src="../images/diagrams/WindowFrameExtent.png" alt="" /></p>
+<p>The <i>window frame extent clause</i> specifies the start point and end point of the window frame. The expression before <tt>AND</tt> is the start point and the expression after <tt>AND</tt> is the end point. If <tt>BETWEEN</tt> is omitted, you can only specify the start point; the end point becomes <tt>CURRENT ROW</tt>.</p>
+<p>The window frame end point can&#x2019;t be before the start point. If this clause violates this restriction explicitly, an error will result. If it violates this restriction implicitly, the window frame will be empty, which means the window function will return its default value: in most cases this is <tt>null</tt>, except for <tt>strict_count()</tt> or <tt>array_count()</tt>, whose default value is 0.</p>
+<p>Window frame extents that result in an explicit violation are:</p>
+<ul>
+
+<li>
+
+<p><tt>BETWEEN CURRENT ROW AND</tt> <i>Expr</i> <tt>PRECEDING</tt></p>
+</li>
+<li>
+
+<p><tt>BETWEEN</tt> <i>Expr</i> <tt>FOLLOWING AND</tt> <i>Expr</i> <tt>PRECEDING</tt></p>
+</li>
+<li>
+
+<p><tt>BETWEEN</tt> <i>Expr</i> <tt>FOLLOWING AND CURRENT ROW</tt></p>
+</li>
+</ul>
+<p>Window frame extents that result in an implicit violation are:</p>
+<ul>
+
+<li>
+
+<p><tt>BETWEEN UNBOUNDED PRECEDING AND</tt> <i>Expr</i> <tt>PRECEDING</tt> &#x2014; if <i>Expr</i> is too high, some tuples may generate an empty window frame.</p>
+</li>
+<li>
+
+<p><tt>BETWEEN</tt> <i>Expr</i> <tt>PRECEDING AND</tt> <i>Expr</i> <tt>PRECEDING</tt> &#x2014; if the second  <i>Expr</i> is greater than or equal to the first <i>Expr</i>, all result sets will generate an empty window frame.</p>
+</li>
+<li>
+
+<p><tt>BETWEEN</tt> <i>Expr</i> <tt>FOLLOWING AND</tt> <i>Expr</i> <tt>FOLLOWING</tt> &#x2014; if the first <i>Expr</i> is greater than or equal to the second <i>Expr</i>, all result sets will generate an empty window frame.</p>
+</li>
+<li>
+
+<p><tt>BETWEEN</tt> <i>Expr</i> <tt>FOLLOWING AND UNBOUNDED FOLLOWING</tt> &#x2014; if <i>Expr</i> is too high, some tuples may generate an empty window frame.</p>
+</li>
+<li>
+
+<p>If the <a href="#Window_frame_exclusion">window frame exclusion clause</a> is present, any window frame specification may result in empty window frame.</p>
+</li>
+</ul>
+<p>The <i>Expr</i> must be a positive constant or an expression that evaluates as a positive number. For <tt>ROWS</tt> or <tt>GROUPS</tt>, the <i>Expr</i> must be an integer.</p></div></div>
+<div class="section">
+<h4><a name="Window_Frame_Exclusion"></a><a name="Window_frame_exclusion" id="Window_frame_exclusion">Window Frame Exclusion</a></h4>
+<div class="section">
+<h5><a name="WindowFrameExclusion"></a>WindowFrameExclusion</h5>
+<p><img src="../images/diagrams/WindowFrameExclusion.png" alt="" /></p>
+<p>The <i>window frame exclusion clause</i> enables you to exclude specified tuples from the window frame.</p>
+<p>This clause can be used with all <a href="builtins.html#AggregateFunctions">aggregate functions</a> and some <a href="builtins.html#WindowFunctions">window functions</a> &#x2014; refer to the descriptions of individual functions for more details.</p>
+<p>This clause is allowed only when the <a href="#Window_frame_clause">window frame clause</a> is present.</p>
+<p>This clause is optional. If this clause is omitted, the default is no exclusion &#x2014; the same as <tt>EXCLUDE NO OTHERS</tt>.</p>
+<ul>
+
+<li>
+
+<p><tt>EXCLUDE CURRENT ROW</tt>: If the current tuple is still part of the window frame, it is removed from the window frame.</p>
+</li>
+<li>
+
+<p><tt>EXCLUDE GROUP</tt>: The current tuple and any peers of the current tuple are removed from the window frame.</p>
+</li>
+<li>
+
+<p><tt>EXCLUDE TIES</tt>: Any peers of the current tuple, but not the current tuple itself, are removed from the window frame.</p>
+</li>
+<li>
+
+<p><tt>EXCLUDE NO OTHERS</tt>: No additional tuples are removed from the window frame.</p>
+</li>
+</ul>
+<p>If the current tuple is already removed from the window frame, then it remains removed from the window frame.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Errors" id="Errors">5. Errors</a></h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>A query can potentially result in one of the following errors:</p>
+<ul>
+
+<li>syntax error,</li>
+<li>identifier resolution error,</li>
+<li>type error,</li>
+<li>resource error.</li>
+</ul>
+<p>If the query processor runs into any error, it will terminate the ongoing processing of the query and immediately return an error message to the client.</p></div></div></div></div>
+<div class="section">
+<h2><a name="Syntax_Errors"></a><a name="Syntax_errors" id="Syntax_errors">Syntax Errors</a></h2>
+<p>A valid query must satisfy the grammar rules of the query language. Otherwise, a syntax error will be raised.</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q4.1)</p>
+
+<div>
+<div>
+<pre class="source">customers AS c
+SELECT *
+</pre></div></div>
+
+<p>Since the queryhas no <tt>FROM</tt> keyword before the dataset <tt>customers</tt>, we will get a syntax error as follows:</p>
+
+<div>
+<div>
+<pre class="source">ERROR: Code: 1 &quot;ASX1001: Syntax error: In line 2 &gt;&gt;customers AS c&lt;&lt; Encountered \&quot;AS\&quot; at column 11. &quot;
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q4.2)</p>
+
+<div>
+<div>
+<pre class="source"> FROM customers AS c
+ WHERE type=&quot;advertiser&quot;
+ SELECT *;
+</pre></div></div>
+
+<p>Since &#x201c;type&#x201d; is a reserved keyword in the query parser, we will get a syntax error as follows:</p>
+
+<div>
+<div>
+<pre class="source">ERROR: Code: 1 &quot;ASX1001: Syntax error: In line 3 &gt;&gt; WHERE type=\&quot;advertiser\&quot;&lt;&lt; Encountered \&quot;type\&quot; at column 8. &quot;;
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="Identifier_Resolution_Errors"></a><a name="Identifier_resolution_errors" id="Identifier_resolution_errors">Identifier Resolution Errors</a></h2>
+<p>Referring to an undefined identifier can cause an error if the identifier cannot be successfully resolved as a valid field access.</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q4.3)</p>
+
+<div>
+<div>
+<pre class="source"> FROM customer AS c
+ SELECT *
+</pre></div></div>
+
+<p>If we have a typo as above in &#x201c;customers&#x201d; that misses the dataset name&#x2019;s ending &#x201c;s&#x201d;, we will get an identifier resolution error as follows:</p>
+
+<div>
+<div>
+<pre class="source">ERROR: Code: 1 &quot;ASX1077: Cannot find dataset customer in dataverse Commerce nor an alias with name customer (in line 2, at column 7)&quot;
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q4.4)</p>
+
+<div>
+<div>
+<pre class="source"> FROM customers AS c JOIN orders AS o ON c.custid = o.custid
+ SELECT name, orderno;
+</pre></div></div>
+
+<p>If the compiler cannot figure out how to resolve an unqualified field name, which will occur if there is more than one variable in scope (e.g., <tt>customers AS c</tt> and <tt>orders AS o</tt> as above), we will get an identifier resolution error as follows:</p>
+
+<div>
+<div>
+<pre class="source">ERROR: Code: 1 &quot;ASX1074: Cannot resolve ambiguous alias reference for identifier name (in line 3, at column 9)&quot;
+</pre></div></div>
+
+<p>The same can happen when failing to properly identify the <tt>GROUP BY</tt> expression.</p>
+<p>(Q4.5)</p>
+
+<div>
+<div>
+<pre class="source">SELECT o.custid, COUNT(o.orderno) AS `order count`
+FROM orders AS o
+GROUP BY custid;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">ERROR: Code: 1 &quot;ASX1073: Cannot resolve alias reference for undefined identifier o (in line 2, at column 8)&quot;
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="Type_Errors"></a><a name="Type_errors" id="Type_errors">Type Errors</a></h2>
+<p>The query compiler does type checks based on its available type information. In addition, the query runtime also reports type errors if a data model instance it processes does not satisfy the type requirement.</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q4.6)</p>
+
+<div>
+<div>
+<pre class="source">get_day(10/11/2020);
+</pre></div></div>
+
+<p>Since function <tt>get_day</tt> can only process duration, daytimeduration, date, or datetime input values, we will get a type error as follows:</p>
+
+<div>
+<div>
+<pre class="source">ERROR: Code: 1 &quot;ASX0002: Type mismatch: function get-day expects its 1st input parameter to be of type duration, daytimeduration, date or datetime, but the actual input type is double (in line 2, at column 1)&quot;
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="Resource_Errors"></a><a name="Resource_errors" id="Resource_errors">Resource Errors</a></h2>
+<p>A query can potentially exhaust system resources, such as the number of open files and disk spaces. For instance, the following two resource errors could be potentially be seen when running the system:</p>
+
+<div>
+<div>
+<pre class="source">Error: no space left on device
+Error: too many open files
+</pre></div></div>
+
+<p>The &#x201c;no space left on device&#x201d; issue usually can be fixed by cleaning up disk space and reserving more disk space for the system. The &#x201c;too many open files&#x201d; issue usually can be fixed by a system administrator, following the instructions <a class="externalLink" href="https://easyengine.io/tutorials/linux/increase-open-files-limit/">here</a>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Vs_SQL-92" id="Vs_SQL-92">6. Differences from SQL-92</a></h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>SQL++ offers the following additional features beyond SQL-92:</p>
+<ul>
+
+<li>Fully composable and functional: A subquery can iterate over any intermediate collection and can appear anywhere in a query.</li>
+<li>Schema-free: The query language does not assume the existence of a static schema for any data that it processes.</li>
+<li>Correlated <tt>FROM</tt> terms: A right-side <tt>FROM</tt> term expression can refer to variables defined by <tt>FROM</tt> terms on its left.</li>
+<li>Powerful <tt>GROUP BY</tt>: In addition to a set of aggregate functions as in standard SQL, the groups created by the <tt>GROUP BY</tt> clause are directly usable in nested queries and/or to obtain nested results.</li>
+<li>Generalized <tt>SELECT</tt> clause: A <tt>SELECT</tt> clause can return any type of collection, while in SQL-92, a <tt>SELECT</tt> clause has to return a (homogeneous) collection of objects.</li>
+</ul>
+<p>The following matrix is a quick &#x201c;SQL-92 compatibility cheat sheet&#x201d; for SQL++.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Feature </th>
+<th>  SQL++ </th>
+<th> SQL-92 </th>
+<th>  Why different?  </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> SELECT * </td>
+<td> Returns nested objects </td>
+<td> Returns flattened concatenated objects </td>
+<td> Nested collections are 1st class citizens </td></tr>
+<tr class="a">
+<td> SELECT list </td>
+<td> order not preserved </td>
+<td> order preserved </td>
+<td> Fields in a JSON object are not ordered </td></tr>
+<tr class="b">
+<td> Subquery </td>
+<td> Returns a collection  </td>
+<td> The returned collection is cast into a scalar value if the subquery appears in a SELECT list or on one side of a comparison or as input to a function </td>
+<td> Nested collections are 1st class citizens </td></tr>
+<tr class="a">
+<td> LEFT OUTER JOIN </td>
+<td>  Fills in <tt>MISSING</tt>(s) for non-matches  </td>
+<td>   Fills in <tt>NULL</tt>(s) for non-matches    </td>
+<td> &#x201c;Absence&#x201d; is more appropriate than &#x201c;unknown&#x201d; here  </td></tr>
+<tr class="b">
+<td> UNION ALL       </td>
+<td> Allows heterogeneous inputs and output </td>
+<td> Input streams must be UNION-compatible and output field names are drawn from the first input stream </td>
+<td> Heterogenity and nested collections are common </td></tr>
+<tr class="a">
+<td> IN constant_expr </td>
+<td> The constant expression has to be an array or multiset, i.e., [..,..,&#x2026;] </td>
+<td> The constant collection can be represented as comma-separated items in a paren pair </td>
+<td> Nested collections are 1st class citizens </td></tr>
+<tr class="b">
+<td> String literal </td>
+<td> Double quotes or single quotes </td>
+<td> Single quotes only </td>
+<td> Double quoted strings are pervasive in JSON</td></tr>
+<tr class="a">
+<td> Delimited identifiers </td>
+<td> Backticks </td>
+<td> Double quotes </td>
+<td> Double quoted strings are pervasive in JSON </td></tr>
+</tbody>
+</table>
+<p>The following SQL-92 features are not implemented yet. However, SQL++ does not conflict with these features:</p>
+<ul>
+
+<li>CROSS JOIN, NATURAL JOIN, UNION JOIN</li>
+<li>FULL OUTER JOIN</li>
+<li>INTERSECT, EXCEPT, UNION with set semantics</li>
+<li>CAST expression</li>
+<li>ALL and SOME predicates for linking to subqueries</li>
+<li>UNIQUE predicate (tests a collection for duplicates)</li>
+<li>MATCH predicate (tests for referential integrity)</li>
+<li>Row and Table constructors</li>
+<li>Preserved order for expressions in a SELECT list</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="DDL_and_DML_statements" id="DDL_and_DML_statements">7. DDL and DML statements</a></h1>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Stmnt"></a>Stmnt</h5>
+<p><img src="../images/diagrams/Stmnt.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="SingleStmnt"></a>SingleStmnt</h5>
+<p><img src="../images/diagrams/SingleStmnt.png" alt="" /></p>
+<p>In addition to queries, an implementation of SQL++ needs to support statements for data definition and manipulation purposes as well as controlling the context to be used in evaluating query expressions. This section details the DDL and DML statements supported in SQL++ as realized today in Apache AsterixDB.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div></div>
+<div class="section">
+<h2><a name="Lifecycle_Management_Statements"></a><a name="Lifecycle_management_statements" id="Lifecycle_management_statements">Lifecycle Management Statements</a></h2>
+<div class="section">
+<h3><a name="Use_Statement"></a><a name="Use" id="Use">Use Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="UseStmnt"></a>UseStmnt</h5>
+<p><img src="../images/diagrams/UseStmnt.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DataverseName"></a>DataverseName</h5>
+<p><img src="../images/diagrams/DataverseName.png" alt="" /></p>
+<p>At the uppermost level, the world of data is organized into data namespaces called <b>dataverses</b>. To set the default dataverse for statements, the <tt>USE</tt> statement is provided.</p>
+<p>As an example, the following statement sets the default dataverse to be <tt>Commerce</tt>.</p>
+
+<div>
+<div>
+<pre class="source">USE Commerce;
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Set_Statement"></a><a name="Sets" id="Sets"> Set Statement</a></h3>
+<p>The <tt>SET</tt> statement can be used to override certain configuration parameters. More information about <tt>SET</tt> can be found in <a href="#Performance_tuning">Appendix 2</a>.</p></div>
+<div class="section">
+<h3><a name="Function_Declaration"></a><a name="Functions" id="Functions"> Function Declaration</a></h3>
+<p>When writing a complex query, it can sometimes be helpful to define one or more auxiliary functions that each address a sub-piece of the overall query.</p>
+<p>The <tt>DECLARE FUNCTION</tt> statement supports the creation of such helper functions. In general, the function body (expression) can be any legal query expression.</p>
+<p>The function named in the <tt>DECLARE FUNCTION</tt> statement is accessible only in the current query. To create a persistent function for use in multiple queries, use the <tt>CREATE FUNCTION</tt> statement.</p>
+<div class="section">
+<div class="section">
+<h5><a name="FunctionDeclaration"></a>FunctionDeclaration</h5>
+<p><img src="../images/diagrams/FunctionDeclaration.png" alt="" /></p>
+<p>The following is a simple example of a temporary function definition and its use.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">DECLARE FUNCTION nameSearch(customerId){
+    (SELECT c.custid, c.name
+    FROM customers AS c
+    WHERE c.custid = customerId)[0]
+ };
+
+
+SELECT VALUE nameSearch(&quot;C25&quot;);
+</pre></div></div>
+
+<p>For our sample data set, this returns:</p>
+
+<div>
+<div>
+<pre class="source">[
+  { &quot;custid&quot;: &quot;C25&quot;, &quot;name&quot;: &quot;M. Sinclair&quot; }
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Create_Statement"></a><a name="Create" id="Create"> Create Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="CreateStmnt"></a>CreateStmnt</h5>
+<p><img src="../images/diagrams/CreateStmnt.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DataverseName"></a>DataverseName</h5>
+<p><img src="../images/diagrams/DataverseName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="QualifiedName"></a>QualifiedName</h5>
+<p><img src="../images/diagrams/QualifiedName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DoubleQualifiedName"></a>DoubleQualifiedName</h5>
+<p><img src="../images/diagrams/DoubleQualifiedName.png" alt="" /></p>
+<p>The <tt>CREATE</tt> statement is used for creating dataverses as well as other persistent artifacts in a dataverse. It can be used to create new dataverses, datatypes, datasets, indexes, and user-defined query functions.</p></div></div>
+<div class="section">
+<h4><a name="Create_Dataverse"></a><a name="Dataverses" id="Dataverses"> Create Dataverse</a></h4>
+<div class="section">
+<h5><a name="CreateDataverse"></a>CreateDataverse</h5>
+<p><img src="../images/diagrams/CreateDataverse.png" alt="" /></p>
+<p>The <tt>CREATE DATAVERSE</tt> statement is used to create new dataverses. To ease the authoring of reusable query scripts, an optional <tt>IF NOT EXISTS</tt> clause is included to allow creation to be requested either unconditionally or only if the dataverse does not already exist. If this clause is absent, an error is returned if a dataverse with the indicated name already exists.</p>
+<p>The following example creates a new dataverse named <tt>Commerce</tt> if one does not already exist.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE DATAVERSE Commerce IF NOT EXISTS;
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Create_Type"></a><a name="Types" id="Types"> Create Type </a></h4>
+<div class="section">
+<h5><a name="CreateType"></a>CreateType</h5>
+<p><img src="../images/diagrams/CreateType.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ObjectTypeDef"></a>ObjectTypeDef</h5>
+<p><img src="../images/diagrams/ObjectTypeDef.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ObjectField"></a>ObjectField</h5>
+<p><img src="../images/diagrams/ObjectField.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="TypeExpr"></a>TypeExpr</h5>
+<p><img src="../images/diagrams/TypeExpr.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ArrayTypeDef"></a>ArrayTypeDef</h5>
+<p><img src="../images/diagrams/ArrayTypeDef.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="MultisetTypeDef"></a>MultisetTypeDef</h5>
+<p><img src="../images/diagrams/MultisetTypeDef.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="TypeReference"></a>TypeReference</h5>
+<p><img src="../images/diagrams/TypeReference.png" alt="" /></p>
+<p>The <tt>CREATE TYPE</tt> statement is used to create a new named datatype. This type can then be used to create stored collections or utilized when defining one or more other datatypes. Much more information about the data model is available in the <a href="../datamodel.html">data model reference guide</a>. A new type can be a object type, a renaming of another type, an array type, or a multiset type. A object type can be defined as being either open or closed. Instances of a closed object type are not permitted to contain fields other than those specified in the create type statement. Instances of an open object type may carry additional fields, and open is the default for new types if neither option is specified.</p>
+<p>The following example creates three new object types called <tt>addressType</tt>, <tt>customerType</tt>, and <tt>itemType</tt>. Their fields are essentially traditional typed name/value pairs (much like SQL fields). Since it is defined as (defaulting to) being an open type, instances will be permitted to contain more than what is specified in the type definition. Indeed many of the customer objects contain a rating as well, however this is not necessary for the customer object to be created. As can be seen in the sample data, customers can exist without ratings or with part (or all) of the address missing.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE TYPE addressType AS {
+    street:                     string,
+    city:                       string,
+    zipcode:                    string?
+};
+
+CREATE TYPE customerType AS {
+    custid:                     string,
+    name:                       string,
+    address:                    addressType?
+};
+
+CREATE TYPE itemType AS {
+    itemno:                     int,
+    qty:                        int,
+    price:                      int
+};
+</pre></div></div>
+
+<p>Optionally, you may wish to create a type that has an automatically generated primary key field. The example below shows an alternate form of <tt>itemType</tt> which achieves this by setting its primary key, <tt>itemno</tt>, to UUID. (Refer to the Datasets section later for more details on such fields.)</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE TYPE itemType AS {
+    itemno:                     uuid,
+    qty:                        int,
+    price:                      int
+};
+</pre></div></div>
+
+<p>Note that the type of the <tt>itemno</tt> in this example is UUID. This field type can be used if you want to have an autogenerated-PK field. (Refer to the Datasets section later for more details on such fields.)</p>
+<p>The next example creates a new object type, closed this time, called <tt>orderType</tt>. Instances of this closed type will not be permitted to have extra fields, although the <tt>ship_date</tt> field is marked as optional and may thus be <tt>NULL</tt> or <tt>MISSING</tt> in legal instances of the type. The items field is an array of instances of another object type, <tt>itemType</tt>.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE TYPE orderType AS CLOSED {
+    orderno:                    int,
+    custid:                     string,
+    order_date:                 string,
+    ship_date:                  string?,
+    items:                      [ itemType ]
+};
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Create_Dataset"></a><a name="Datasets" id="Datasets"> Create Dataset</a></h4>
+<div class="section">
+<h5><a name="CreateDataset"></a>CreateDataset</h5>
+<p><img src="../images/diagrams/CreateDataset.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="CreateInternalDataset"></a>CreateInternalDataset</h5>
+<p><img src="../images/diagrams/CreateInternalDataset.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="CreateExternalDataset"></a>CreateExternalDataset</h5>
+<p><img src="../images/diagrams/CreateExternalDataset.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DatasetTypeDef"></a>DatasetTypeDef</h5>
+<p><img src="../images/diagrams/DatasetTypeDef.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DatasetFieldDef"></a>DatasetFieldDef</h5>
+<p><img src="../images/diagrams/DatasetFieldDef.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="TypeReference"></a>TypeReference</h5>
+<p><img src="../images/diagrams/TypeReference.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="PrimaryKey"></a>PrimaryKey</h5>
+<p><img src="../images/diagrams/PrimaryKey.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="NestedField"></a>NestedField</h5>
+<p><img src="../images/diagrams/NestedField.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="AdapterName"></a>AdapterName</h5>
+<p><img src="../images/diagrams/AdapterName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Configuration"></a>Configuration</h5>
+<p><img src="../images/diagrams/Configuration.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="KeyValuePair"></a>KeyValuePair</h5>
+<p><img src="../images/diagrams/KeyValuePair.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Properties"></a>Properties</h5>
+<p><img src="../images/diagrams/Properties.png" alt="" /></p>
+<p>The <tt>CREATE DATASET</tt> statement is used to create a new dataset. Datasets are named, multisets of object type instances; they are where data lives persistently and are the usual targets for queries. Datasets are typed, and the system ensures that their contents conform to their type definitions. An Internal dataset (the default kind) is a dataset whose content lives within and is managed by the system. It is required to have a specified unique primary key field which uniquely identifies the contained objects. (The primary key is also used in secondary indexes to identify the indexed primary data objects.)</p>
+<p>Internal datasets contain several advanced options that can be specified when appropriate. One such option is that random primary key (UUID) values can be auto-generated by declaring the field to be UUID and putting <tt>AUTOGENERATED</tt> after the <tt>PRIMARY KEY</tt> identifier. In this case, unlike other non-optional fields, a value for the auto-generated PK field should not be provided at insertion time by the user since each object&#x2019;s primary key field value will be auto-generated by the system.</p>
+<p>Another advanced option, when creating an Internal dataset, is to specify the merge policy to control which of the underlying LSM storage components to be merged. (The system supports Log-Structured Merge tree based physical storage for Internal datasets.) Currently the system supports four different component merging policies that can be chosen per dataset: no-merge, constant, prefix, and correlated-prefix. The no-merge policy simply never merges disk components. The constant policy merges disk components when the number of components reaches a constant number k that can be configured by the user. The prefix policy relies on both component sizes and the number of components to decide which components to merge. It works by first trying to identify the smallest ordered (oldest to newest) sequence of components such that the sequence does not contain a single component that exceeds some threshold size M and that either the sum of the component&#x2019;s sizes exceeds M or the number of components in the sequence exceeds another threshold C. If such a sequence exists, the components in the sequence are merged together to form a single component. Finally, the correlated-prefix policy is similar to the prefix policy, but it delegates the decision of merging the disk components of all the indexes in a dataset to the primary index. When the correlated-prefix policy decides that the primary index needs to be merged (using the same decision criteria as for the prefix policy), then it will issue successive merge requests on behalf of all other indexes associated with the same dataset. The system&#x2019;s default policy is the prefix policy except when there is a filter on a dataset, where the preferred policy for filters is the correlated-prefix.</p>
+<p>Another advanced option shown in the syntax above, related to performance and mentioned above, is that a <b>filter</b> can optionally be created on a field to further optimize range queries with predicates on the filter&#x2019;s field. Filters allow some range queries to avoid searching all LSM components when the query conditions match the filter. (Refer to <a href="../sqlpp/filters.html">Filter-Based LSM Index Acceleration</a> for more information about filters.)</p>
+<p>An External dataset, in contrast to an Internal dataset, has data stored outside of the system&#x2019;s control. Files living in HDFS or in the local filesystem(s) of a cluster&#x2019;s nodes are currently supported. External dataset support allows queries to treat foreign data as though it were stored in the system, making it possible to query &#x201c;legacy&#x201d; file data (for example, Hive data) without having to physically import it. When defining an External dataset, an appropriate adapter type must be selected for the desired external data. (See the <a href="../aql/externaldata.html">Guide to External Data</a> for more information on the available adapters.)</p>
+<p>The following example creates an Internal dataset for storing <tt>customerType</tt> objects. It specifies that their <tt>custid</tt> field is their primary key.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INTERNAL DATASET customers(customerType) PRIMARY KEY custid;
+</pre></div></div>
+
+<p>The next example creates an Internal dataset (the default kind when no dataset kind is specified) for storing <tt>itemType</tt> objects might look like. It specifies that the <tt>itemno</tt> field should be used as the primary key for the dataset. It also specifies that the <tt>itemno</tt> field is an auto-generated field, meaning that a randomly generated UUID value should be assigned to each incoming object by the system. (A user should therefore not attempt to provide a value for this field.)</p>
+<p>Note that the <tt>itemno</tt> field&#x2019;s declared type must be UUID in this case.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE DATASET MyItems(itemType) PRIMARY KEY itemno AUTOGENERATED;
+</pre></div></div>
+
+<p>Alternatively the dataset object type can be specified using inline type definition syntax.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE DATASET MyItems(itemno INT NOT UNKNOWN, qty INT NOT UNKNOWN, price INT NOT UNKNOWN) PRIMARY KEY itemno AUTOGENERATED;
+</pre></div></div>
+
+<p>The next example creates an External dataset for querying LineItemType objects. The choice of the <tt>hdfs</tt> adapter means that this dataset&#x2019;s data actually resides in HDFS. The example <tt>CREATE</tt> statement also provides parameters used by the hdfs adapter: the URL and path needed to locate the data in HDFS and a description of the data format.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE EXTERNAL DATASET LineItem(LineItemType) USING hdfs (
+  (&quot;hdfs&quot;=&quot;hdfs://HOST:PORT&quot;),
+  (&quot;path&quot;=&quot;HDFS_PATH&quot;),
+  (&quot;input-format&quot;=&quot;text-input-format&quot;),
+  (&quot;format&quot;=&quot;delimited-text&quot;),
+  (&quot;delimiter&quot;=&quot;|&quot;));
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Create_Index"></a><a name="Indices" id="Indices">Create Index</a></h4>
+<div class="section">
+<h5><a name="CreateIndex"></a>CreateIndex</h5>
+<p><img src="../images/diagrams/CreateIndex.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="CreateSecondaryIndex"></a>CreateSecondaryIndex</h5>
+<p><img src="../images/diagrams/CreateSecondaryIndex.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="CreatePrimaryKeyIndex"></a>CreatePrimaryKeyIndex</h5>
+<p><img src="../images/diagrams/CreatePrimaryKeyIndex.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="IndexedElement"></a>IndexedElement</h5>
+<p><b><img src="../images/diagrams/IndexedElement.png" alt="" /></b></p></div>
+<div class="section">
+<h5><a name="ArrayIndexElement"></a>ArrayIndexElement</h5>
+<p><b><img src="../images/diagrams/ArrayIndexElement.png" alt="" /></b></p></div>
+<div class="section">
+<h5><a name="IndexField"></a>IndexField</h5>
+<p><b><img src="../images/diagrams/IndexField.png" alt="" /></b></p></div>
+<div class="section">
+<h5><a name="NestedField"></a>NestedField</h5>
+<p><img src="../images/diagrams/NestedField.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="IndexType"></a>IndexType</h5>
+<p><img src="../images/diagrams/IndexType.png" alt="" /></p>
+<p>The <tt>CREATE INDEX</tt> statement creates a secondary index on one or more fields of a specified dataset. Supported index types include <tt>BTREE</tt> for totally ordered datatypes, <tt>RTREE</tt> for spatial data, and <tt>KEYWORD</tt> and <tt>NGRAM</tt> for textual (string) data. An index can be created on a nested field (or fields) by providing a valid path expression as an index field identifier. An array index can be created on an array or multiset datatype by providing a sequence of <tt>UNNEST</tt> and <tt>SELECT</tt>s to identify the field(s) to be indexed.</p>
+<p>An indexed field is not required to be part of the datatype associated with a dataset if the dataset&#x2019;s datatype is declared as open <b>and</b> if the field&#x2019;s type is provided along with its name and if the <tt>ENFORCED</tt> keyword is specified at the end of the index definition. <tt>ENFORCING</tt> an open field introduces a check that makes sure that the actual type of the indexed field (if the optional field exists in the object) always matches this specified (open) field type.</p>
+<p>The following example creates a btree index called <tt>cCustIdx</tt> on the <tt>custid</tt> field of the orders dataset. This index can be useful for accelerating exact-match queries, range search queries, and joins involving the <tt>custid</tt> field.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX cCustIdx ON orders(custid) TYPE BTREE;
+</pre></div></div>
+
+<p>The following example creates a btree index called <tt>oCNameIdx</tt> on the <tt>cname</tt> field of the orders dataset, but does not insert <tt>NULL</tt> and <tt>MISSING</tt> values into the index. By default, if <tt>INCLUDE/EXCLUDE UNKNOWN KEY</tt> is not specified, unknown values will be inserted into btree indexes.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX oCNametIdx ON orders(cname) EXCLUDE UNKNOWN KEY;
+</pre></div></div>
+
+<p>The following example creates an open btree index called <tt>oCreatedTimeIdx</tt> on the (non-declared) <tt>createdTime</tt> field of the <tt>orders</tt> dataset having <tt>datetime</tt> type. This index can be useful for accelerating exact-match queries, range search queries, and joins involving the <tt>createdTime</tt> field. The index is enforced so that records that do not have the <tt>createdTime</tt> field or have a mismatched type on the field cannot be inserted into the dataset.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX oCreatedTimeIdx ON orders(createdTime: datetime?) TYPE BTREE ENFORCED;
+</pre></div></div>
+
+<p>The following example creates an open btree index called <tt>cAddedTimeIdx</tt> on the (non-declared) <tt>addedTime</tt> field of the <tt>customers</tt> dataset having datetime type. This index can be useful for accelerating exact-match queries, range search queries, and joins involving the <tt>addedTime</tt> field. The index is not enforced so that records that do not have the <tt>addedTime</tt> field or have a mismatched type on the field can still be inserted into the dataset.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX cAddedTimeIdx ON customers(addedTime: datetime?);
+</pre></div></div>
+
+<p>The following example creates a btree index called <tt>oOrderUserNameIdx</tt> on <tt>orderUserName</tt>, a nested field residing within a object-valued user field in the <tt>orders</tt> dataset. This index can be useful for accelerating exact-match queries, range search queries, and joins involving the nested <tt>orderUserName</tt> field.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX oOrderUserNameIdx ON orders(order.orderUserName) TYPE BTREE;
+</pre></div></div>
+
+<p>The following example creates an array index called <tt>oItemsPriceIdx</tt> on the <tt>price</tt> field inside the <tt>items</tt> array of the <tt>orders</tt> dataset. This index can be useful for accelerating membership queries, existential or universal quantification queries, or joins involving the <tt>price</tt> field inside this array. Unknown values cannot currently be stored inside array indexes, so <tt>EXCLUDE UNKNOWN KEY</tt> must be specified.</p></div></div>
+<div class="section">
+<h4><a name="Example"></a>Example</h4>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX oItemsPriceIdx ON orders(UNNEST items SELECT price) EXCLUDE UNKNOWN KEY;
+</pre></div></div>
+
+<p>The following example creates an open rtree index called <tt>oOrderLocIdx</tt> on the order-location field of the <tt>orders</tt> dataset. This index can be useful for accelerating queries that use the <a href="builtins.html#spatial_intersect"><tt>spatial-intersect</tt> function</a> in a predicate involving the sender-location field.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX oOrderLocIDx ON orders(`order-location` : point?) TYPE RTREE ENFORCED;
+</pre></div></div>
+
+<p>The following example creates a 3-gram index called <tt>cUserIdx</tt> on the name field of the <tt>customers</tt> dataset. This index can be used to accelerate some similarity or substring maching queries on the name field. For details refer to the document on <a href="similarity.html#NGram_Index">similarity queries</a>.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX cUserIdx ON customers(name) TYPE NGRAM(3);
+</pre></div></div>
+
+<p>The following example creates a keyword index called <tt>oCityIdx</tt> on the <tt>city</tt> within the <tt>address</tt> field of the <tt>customers</tt> dataset. This keyword index can be used to optimize queries with token-based similarity predicates on the <tt>address</tt> field. For details refer to the document on <a href="similarity.html#Keyword_Index">similarity queries</a>.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX oCityIdx ON customers(address.city) TYPE KEYWORD;
+</pre></div></div>
+
+<p>The following example creates a special secondary index which holds only the primary keys. This index is useful for speeding up aggregation queries which involve only primary keys. The name of the index is optional. If the name is not specified, the system will generate one. When the user would like to drop this index, the metadata can be queried to find the system-generated name.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE PRIMARY INDEX cus_pk_idx ON customers;
+</pre></div></div>
+
+<p>An example query that can be accelerated using the primary-key index:</p>
+
+<div>
+<div>
+<pre class="source">SELECT COUNT(*) FROM customers;
+</pre></div></div>
+
+<p>To look up the the above primary-key index, issue the following query:</p>
+
+<div>
+<div>
+<pre class="source">SELECT VALUE i
+FROM Metadata.`Index` i
+WHERE i.DataverseName = &quot;Commerce&quot; AND i.DatasetName = &quot;customers&quot;;
+</pre></div></div>
+
+<p>The query returns:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;DataverseName&quot;: &quot;Commerce&quot;,
+        &quot;DatasetName&quot;: &quot;customers&quot;,
+        &quot;IndexName&quot;: &quot;cus_pk_idx&quot;,
+        &quot;IndexStructure&quot;: &quot;BTREE&quot;,
+        &quot;SearchKey&quot;: [],
+        &quot;IsPrimary&quot;: false,
+        &quot;Timestamp&quot;: &quot;Fri Sep 18 14:15:51 PDT 2020&quot;,
+        &quot;PendingOp&quot;: 0
+    },
+    {
+        &quot;DataverseName&quot;: &quot;Commerce&quot;,
+        &quot;DatasetName&quot;: &quot;customers&quot;,
+        &quot;IndexName&quot;: &quot;customers&quot;,
+        &quot;IndexStructure&quot;: &quot;BTREE&quot;,
+        &quot;SearchKey&quot;: [
+            [
+                &quot;custid&quot;
+            ]
+        ],
+        &quot;IsPrimary&quot;: true,
+        &quot;Timestamp&quot;: &quot;Thu Jul 16 13:07:37 PDT 2020&quot;,
+        &quot;PendingOp&quot;: 0
+    }
+]
+</pre></div></div>
+
+<p>Remember that <tt>CREATE PRIMARY INDEX</tt> creates a secondary index. That is the reason the <tt>IsPrimary</tt> field is false. The primary-key index can be identified by the fact that the <tt>SearchKey</tt> field is empty since it only contains primary key fields.</p></div></div>
+<div class="section">
+<h4><a name="Create_Synonym"></a><a name="Synonyms" id="Synonyms"> Create Synonym</a></h4>
+<div class="section">
+<h5><a name="CreateSynonym"></a>CreateSynonym</h5>
+<p><img src="../images/diagrams/CreateSynonym.png" alt="" /></p>
+<p>The <tt>CREATE SYNONYM</tt> statement creates a synonym for a given dataset or a view. This synonym may be used instead of the dataset name in <tt>SELECT</tt>, <tt>INSERT</tt>, <tt>UPSERT</tt>, <tt>DELETE</tt>, and <tt>LOAD</tt> statements, or instead of the view name in <tt>SELECT</tt> statements. The target dataset or view does not need to exist when the synonym is created. A synonym may be created for another synonym.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE DATASET customers(customersType) PRIMARY KEY custid;
+
+CREATE SYNONYM customersSynonym FOR customers;
+
+SELECT * FROM customersSynonym;
+</pre></div></div>
+
+<p>More information on how synonyms are resolved can be found in <a href="#Variable_bindings_and_name_resolution">Appendix 3. Variable Bindings and Name Resolution</a>.</p></div></div>
+<div class="section">
+<h4><a name="Create_Function"></a><a name="Create_function" id="Create_function">Create Function</a></h4>
+<p>The <tt>CREATE FUNCTION</tt> statement creates a <b>named</b> function that can then be used and reused in queries. The body of a function can be any query expression involving the function&#x2019;s parameters.</p>
+<div class="section">
+<h5><a name="CreateFunction"></a>CreateFunction</h5>
+<p><img src="../images/diagrams/CreateFunction.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="FunctionParameters"></a>FunctionParameters</h5>
+<p><img src="../images/diagrams/FunctionParameters.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ExternalFunctionDef"></a>ExternalFunctionDef</h5>
+<p><img src="../images/diagrams/ExternalFunctionDef.png" alt="" /></p>
+<p>The following is an example of a <tt>CREATE FUNCTION</tt> statement which is similar to our earlier <tt>DECLARE FUNCTION</tt> example.</p>
+<p>It differs from that example in that it results in a function that is persistently registered by name in the specified dataverse (the current dataverse being used, if not otherwise specified).</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE FUNCTION nameSearch(customerId) {
+    (SELECT c.custid, c.name
+     FROM customers AS c
+     WHERE u.custid = customerId)[0]
+ };
+</pre></div></div>
+
+<p>The following is an example of CREATE FUNCTION statement that replaces an existing function.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE OR REPLACE FUNCTION friendInfo(userId) {
+    (SELECT u.id, u.name
+     FROM GleambookUsers u
+     WHERE u.id = userId)[0]
+ };
+</pre></div></div>
+
+<p>The following is an example of CREATE FUNCTION statement that introduces a function with a variable number of arguments. The arguments are accessible in the function body via <tt>args</tt> array parameter.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE FUNCTION strJoin(...) {
+    string_join(args, &quot;,&quot;)
+};
+</pre></div></div>
+
+<p>External functions can also be loaded into Libraries via the <a href="../udf.html">UDF API</a>. Given an already loaded library <tt>pylib</tt>, a function <tt>sentiment</tt> mapping to a Python method <tt>sent_model.sentiment</tt> in <tt>sentiment_mod</tt> would be as follows</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE FUNCTION sentiment(a) AS &quot;sentiment_mod&quot;, &quot;sent_model.sentiment&quot; AT pylib;
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Create_View"></a><a name="Create_view" id="Create_view">Create View</a></h4>
+<p>The <tt>CREATE VIEW</tt> statement creates a <b>named</b> view that can then be used in queries. The body of a view can be any <tt>SELECT</tt> statement.</p>
+<div class="section">
+<h5><a name="CreateView"></a>CreateView</h5>
+<p><img src="../images/diagrams/CreateView.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE DATASET customers(customersType) PRIMARY KEY custid;
+
+CREATE VIEW customersView AS 
+    SELECT c.custid, c.name
+    FROM customers AS c 
+    WHERE c.address.city = &quot;Boston, MA&quot;;
+
+SELECT * FROM customersView;
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Drop_Statement"></a><a name="Removal" id="Removal">Drop Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="DropStmnt"></a>DropStmnt</h5>
+<p><img src="../images/diagrams/DropStmnt.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DataverseName"></a>DataverseName</h5>
+<p><img src="../images/diagrams/DataverseName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="QualifiedName"></a>QualifiedName</h5>
+<p><img src="../images/diagrams/QualifiedName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DoubleQualifiedName"></a>DoubleQualifiedName</h5>
+<p><img src="../images/diagrams/DoubleQualifiedName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="FunctionSignature"></a>FunctionSignature</h5>
+<p><img src="../images/diagrams/FunctionSignature.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="FunctionParameters"></a>FunctionParameters</h5>
+<p><img src="../images/diagrams/FunctionParameters.png" alt="" /></p>
+<p>The <tt>DROP</tt> statement is the inverse of the <tt>CREATE</tt> statement. It can be used to drop dataverses, datatypes, datasets, indexes, functions, and synonyms.</p>
+<p>The following examples illustrate some uses of the <tt>DROP</tt> statement.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">DROP DATASET customers IF EXISTS;
+
+DROP INDEX orders.orderidIndex;
+
+DROP TYPE customers2.customersType;
+
+DROP FUNCTION nameSearch@1;
+
+DROP SYNONYM customersSynonym;
+
+DROP VIEW customersView;
+
+DROP DATAVERSE CommerceData;
+</pre></div></div>
+
+<p>When an artifact is dropped, it will be droppped from the current dataverse if none is specified (see the <tt>DROP DATASET</tt> example above) or from the specified dataverse (see the <tt>DROP TYPE</tt> example above) if one is specified by fully qualifying the artifact name in the <tt>DROP</tt> statement. When specifying an index to drop, the index name must be qualified by the dataset that it indexes. When specifying a function to drop, since the query language allows functions to be overloaded by their number of arguments, the identifying name of the function to be dropped must explicitly include that information. (<tt>nameSearch@1</tt> above denotes the 1-argument function named <tt>nameSearch</tt> in the current dataverse.)</p></div></div></div>
+<div class="section">
+<h3><a name="Load_Statement"></a><a name="Load_statement" id="Load_statement">Load Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="LoadStmnt"></a>LoadStmnt</h5>
+<p><img src="../images/diagrams/LoadStmnt.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="AdapterName"></a>AdapterName</h5>
+<p><img src="../images/diagrams/AdapterName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Configuration"></a>Configuration</h5>
+<p><img src="../images/diagrams/Configuration.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="KeyValuePair"></a>KeyValuePair</h5>
+<p><img src="../images/diagrams/KeyValuePair.png" alt="" /></p>
+<p>The <tt>LOAD</tt> statement is used to initially populate a dataset via bulk loading of data from an external file. An appropriate adapter must be selected to handle the nature of the desired external data. The <tt>LOAD</tt> statement accepts the same adapters and the same parameters as discussed earlier for External datasets. (See the <a href="../aql/externaldata.html">guide to external data</a> for more information on the available adapters.) If a dataset has an auto-generated primary key field, the file to be imported should not include that field in it.</p>
+<p>The target dataset name may be a synonym introduced by <tt>CREATE SYNONYM</tt> statement.</p>
+<p>The following example shows how to bulk load the <tt>customers</tt> dataset from an external file containing data that has been prepared in ADM (Asterix Data Model) format.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source"> LOAD DATASET customers USING localfs
+    ((&quot;path&quot;=&quot;127.0.0.1:///Users/bignosqlfan/commercenew/gbu.adm&quot;),(&quot;format&quot;=&quot;adm&quot;));
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="Modification_statements" id="Modification_statements">Modification statements</a></h2>
+<div class="section">
+<h3><a name="Insert_Statement"></a><a name="Inserts" id="Inserts">Insert Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="InsertStmnt"></a>InsertStmnt</h5>
+<p><img src="../images/diagrams/InsertStmnt.png" alt="" /></p>
+<p>The <tt>INSERT</tt> statement is used to insert new data into a dataset. The data to be inserted comes from a query expression. This expression can be as simple as a constant expression, or in general it can be any legal query. In case the dataset has an auto-generated primary key, when performing an <tt>INSERT</tt> operation, the system allows the user to manually add the auto-generated key field in the <tt>INSERT</tt> statement, or skip that field and the system will automatically generate it and add it. However, it is important to note that if the a record already exists in the dataset with the auto-generated key provided by the user, then that operation is going to fail. As a general rule, insertion will fail if the dataset already has data with the primary key value(s) being inserted.</p>
+<p>Inserts are processed transactionally by the system. The transactional scope of each insert transaction is the insertion of a single object plus its affiliated secondary index entries (if any). If the query part of an insert returns a single object, then the <tt>INSERT</tt> statement will be a single, atomic transaction. If the query part returns multiple objects, each object being inserted will be treated as a separate tranaction.</p>
+<p>The target dataset name may be a synonym introduced by <tt>CREATE SYNONYM</tt> statement.</p>
+<p>The following example illustrates a query-based insertion.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">INSERT INTO custCopy (SELECT VALUE c FROM customers c)
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Upsert_Statement"></a><a name="Upserts" id="Upserts">Upsert Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="UpsertStmnt"></a>UpsertStmnt</h5>
+<p><img src="../images/diagrams/UpsertStmnt.png" alt="" /></p>
+<p>The <tt>UPSERT</tt> statement syntactically mirrors the <tt>INSERT</tt>statement discussed above. The difference lies in its semantics, which for <tt>UPSERT</tt> are &#x201c;add or replace&#x201d; instead of the <tt>INSERT</tt> &#x201c;add if not present, else error&#x201d; semantics. Whereas an <tt>INSERT</tt> can fail if another object already exists with the specified key, the analogous <tt>UPSERT</tt> will replace the previous object&#x2019;s value with that of the new object in such cases. Like the <tt>INSERT</tt> statement, the system allows the user to manually provide the auto-generated key for datasets with an auto-generated key as its primary key. This operation will insert the record if no record with that key already exists, but if a record with the key already exists, then the operation will be converted to a replace/update operation.</p>
+<p>The target dataset name may be a synonym introduced by <tt>CREATE SYNONYM</tt> statement.</p>
+<p>The following example illustrates a query-based upsert operation.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">UPSERT INTO custCopy (SELECT VALUE c FROM customers c)
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Delete_Statement"></a><a name="Deletes" id="Deletes">Delete Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="DeleteStmnt"></a>DeleteStmnt</h5>
+<p><img src="../images/diagrams/DeleteStmnt.png" alt="" /></p>
+<p>The <tt>DELETE</tt> statement is used to delete data from a target dataset. The data to be deleted is identified by a boolean expression involving the variable bound to the target dataset in the <tt>DELETE</tt> statement.</p>
+<p>Deletes are processed transactionally by the system. The transactional scope of each delete transaction is the deletion of a single object plus its affiliated secondary index entries (if any). If the boolean expression for a delete identifies a single object, then the <tt>DELETE</tt> statement itself will be a single, atomic transaction. If the expression identifies multiple objects, then each object deleted will be handled as a separate transaction.</p>
+<p>The target dataset name may be a synonym introduced by <tt>CREATE SYNONYM</tt> statement.</p>
+<p>The following examples illustrate single-object deletions.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">DELETE FROM customers c WHERE c.custid = &quot;C41&quot;;
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">DELETE FROM customers WHERE custid = &quot;C47&quot;;
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Reserved_keywords" id="Reserved_keywords">Appendix 1. Reserved keywords</a></h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>All reserved keywords are listed in the following table:</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th>     </th>
+<th>     </th>
+<th>       </th>
+<th>    </th>
+<th>     </th>
+<th>    </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> ADAPTER </td>
+<td> ALL </td>
+<td> AND </td>
+<td> ANY </td>
+<td> APPLY </td>
+<td> AS </td></tr>
+<tr class="a">
+<td> ASC </td>
+<td> AT </td>
+<td> AUTOGENERATED </td>
+<td> BETWEEN </td>
+<td> BTREE </td>
+<td> BY </td></tr>
+<tr class="b">
+<td> CASE </td>
+<td> CLOSED </td>
+<td> COLLECTION </td>
+<td> CREATE </td>
+<td> COMPACTION </td>
+<td> COMPACT </td></tr>
+<tr class="a">
+<td> CONNECT </td>
+<td> CORRELATE </td>
+<td> DATASET </td>
+<td> DATAVERSE </td>
+<td> DECLARE </td>
+<td> DEFINITION </td></tr>
+<tr class="b">
+<td> DELETE </td>
+<td> DESC </td>
+<td> DISCONNECT </td>
+<td> DISTINCT </td>
+<td> DIV </td>
+<td> DROP </td></tr>
+<tr class="a">
+<td> ELEMENT </td>
+<td> EXPLAIN </td>
+<td> ELSE </td>
+<td> ENFORCED </td>
+<td> END </td>
+<td> EVERY </td></tr>
+<tr class="b">
+<td> EXCEPT </td>
+<td> EXIST </td>
+<td> EXTERNAL </td>
+<td> FEED </td>
+<td> FILTER </td>
+<td> FLATTEN </td></tr>
+<tr class="a">
+<td> FOR </td>
+<td> FROM </td>
+<td> FULL </td>
+<td> FULLTEXT </td>
+<td> FUNCTION </td>
+<td> GROUP </td></tr>
+<tr class="b">
+<td> HAVING </td>
+<td> HINTS </td>
+<td> IF </td>
+<td> INTO </td>
+<td> IN </td>
+<td> INDEX </td></tr>
+<tr class="a">
+<td> INGESTION </td>
+<td> INNER </td>
+<td> INSERT </td>
+<td> INTERNAL </td>
+<td> INTERSECT </td>
+<td> IS </td></tr>
+<tr class="b">
+<td> JOIN </td>
+<td> KEYWORD </td>
+<td> LEFT </td>
+<td> LETTING </td>
+<td> LET </td>
+<td> LIKE </td></tr>
+<tr class="a">
+<td> LIMIT </td>
+<td> LOAD </td>
+<td> MISSING </td>
+<td> NODEGROUP </td>
+<td> NGRAM </td>
+<td> NOT </td></tr>
+<tr class="b">
+<td> NULL </td>
+<td> OFFSET </td>
+<td> ON </td>
+<td> OPEN </td>
+<td> OR </td>
+<td> ORDER </td></tr>
+<tr class="a">
+<td> OUTER </td>
+<td> OUTPUT </td>
+<td> OVER </td>
+<td> PATH </td>
+<td> POLICY </td>
+<td> PRE-SORTED </td></tr>
+<tr class="b">
+<td> PRIMARY </td>
+<td> RAW </td>
+<td> REFRESH </td>
+<td> RETURN </td>
+<td> RETURNING </td>
+<td> RIGHT </td></tr>
+<tr class="a">
+<td> RTREE </td>
+<td> RUN </td>
+<td> SATISFIES </td>
+<td> SECONDARY </td>
+<td> SELECT </td>
+<td> SET </td></tr>
+<tr class="b">
+<td> SOME </td>
+<td> START </td>
+<td> STOP </td>
+<td> SYNONYM </td>
+<td> TEMPORARY </td>
+<td> THEN </td></tr>
+<tr class="a">
+<td> TO </td>
+<td> TRUE </td>
+<td> TYPE </td>
+<td> UNION </td>
+<td> UNKNOWN </td>
+<td> UNNEST </td></tr>
+<tr class="b">
+<td> UPDATE </td>
+<td> UPSERT </td>
+<td> USE </td>
+<td> USING </td>
+<td> VALUE </td>
+<td> VALUED </td></tr>
+<tr class="a">
+<td> WHEN </td>
+<td> WHERE </td>
+<td> WITH </td>
+<td> WRITE </td>
+<td>     </td>
+<td>     </td></tr>
+</tbody>
+</table><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div></div>
+<div class="section">
+<h2><a name="Appendix_2._Performance_Tuning"></a><a name="Performance_tuning" id="Performance_tuning">Appendix 2. Performance Tuning</a></h2><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>The <tt>SET</tt> statement can be used to override some cluster-wide configuration parameters for a specific request:</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="SetStmnt"></a>SetStmnt</h5>
+<p><img src="../images/diagrams/SetStmnt.png" alt="" /></p>
+<p>As parameter identifiers are qualified names (containing a &#x2018;.&#x2019;) they have to be escaped using backticks (``). Note that changing query parameters will not affect query correctness but only impact performance characteristics, such as response time and throughput.</p></div></div></div></div>
+<div class="section">
+<h2><a name="Parallelism_Parameter"></a><a name="Parallelism_parameter" id="Parallelism_parameter">Parallelism Parameter</a></h2>
+<p>The system can execute each request using multiple cores on multiple machines (a.k.a., partitioned parallelism) in a cluster. A user can manually specify the maximum execution parallelism for a request to scale it up and down using the following parameter:</p>
+<ul>
+
+<li><b>compiler.parallelism</b>: the maximum number of CPU cores can be used to process a query. There are three cases of the value <i>p</i> for compiler.parallelism:
+<ul>
+
+<li>
+
+<p><i>p</i> &lt; 0 or <i>p</i> &gt; the total number of cores in a cluster:  the system will use all available cores in the cluster;</p>
+</li>
+<li>
+
+<p><i>p</i> = 0 (the default):  the system will use the storage parallelism (the number of partitions of stored datasets) as the maximum parallelism for query processing;</p>
+</li>
+<li>
+
+<p>all other cases:  the system will use the user-specified number as the maximum number of CPU cores to use for executing the query.</p>
+</li>
+</ul>
+</li>
+</ul>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">SET `compiler.parallelism` &quot;16&quot;;
+
+SELECT c.name AS cname, o.orderno AS orderno
+FROM customers c JOIN orders o ON c.custid = o.custid;
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="Memory_Parameters"></a><a name="Memory_parameters" id="Memory_parameters">Memory Parameters</a></h2>
+<p>In the system, each blocking runtime operator such as join, group-by and order-by works within a fixed memory budget, and can gracefully spill to disks if the memory budget is smaller than the amount of data they have to hold. A user can manually configure the memory budget of those operators within a query. The supported configurable memory parameters are:</p>
+<ul>
+
+<li>
+
+<p><b>compiler.groupmemory</b>: the memory budget that each parallel group-by operator instance can use; 32MB is the default budget.</p>
+</li>
+<li>
+
+<p><b>compiler.sortmemory</b>: the memory budget that each parallel sort operator instance can use; 32MB is the default budget.</p>
+</li>
+<li>
+
+<p><b>compiler.joinmemory</b>: the memory budget that each parallel hash join operator instance can use; 32MB is the default budget.</p>
+</li>
+<li>
+
+<p><b>compiler.windowmemory</b>: the memory budget that each parallel window aggregate operator instance can use; 32MB is the default budget.</p>
+</li>
+</ul>
+<p>For each memory budget value, you can use a 64-bit integer value with a 1024-based binary unit suffix (for example, B, KB, MB, GB). If there is no user-provided suffix, &#x201c;B&#x201d; is the default suffix. See the following examples.</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">SET `compiler.groupmemory` &quot;64MB&quot;;
+
+SELECT c.custid, COUNT(*)
+FROM customers c
+GROUP BY c.custid;
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">SET `compiler.sortmemory` &quot;67108864&quot;;
+
+SELECT VALUE o
+FROM orders AS o
+ORDER BY ARRAY_LENGTH(o.items) DESC;
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">SET `compiler.joinmemory` &quot;132000KB&quot;;
+
+SELECT c.name AS cname, o.ordeno AS orderno
+FROM customers c JOIN orders o ON c.custid = o.custid;
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div></div>
+<div class="section">
+<h2><a name="Parallel_Sort_Parameter"></a><a name="Parallel_sort_parameter" id="Parallel_sort_parameter">Parallel Sort Parameter</a></h2>
+<p>The following parameter enables you to activate or deactivate full parallel sort for order-by operations.</p>
+<p>When full parallel sort is inactive (<tt>false</tt>), each existing data partition is sorted (in parallel), and then all data partitions are merged into a single node.</p>
+<p>When full parallel sort is active (<tt>true</tt>), the data is first sampled, and then repartitioned so that each partition contains data that is greater than the previous partition. The data in each partition is then sorted (in parallel), but the sorted partitions are not merged into a single node.</p>
+<ul>
+
+<li><b>compiler.sort.parallel</b>: A boolean specifying whether full parallel sort is active (<tt>true</tt>) or inactive (<tt>false</tt>). The default value is <tt>true</tt>.</li>
+</ul>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">SET `compiler.sort.parallel` &quot;true&quot;;
+
+SELECT VALUE o
+FROM orders AS o
+ORDER BY ARRAY_LENGTH(o.items) DESC;
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div></div>
+<div class="section">
+<h2><a name="Controlling_Index-Only-Plan_Parameter"></a><a name="Index_Only" id="Index_Only">Controlling Index-Only-Plan Parameter</a></h2>
+<p>By default, the system tries to build an index-only plan whenever utilizing a secondary index is possible. For example, if a <tt>SELECT</tt> or <tt>JOIN</tt> query can utilize an enforced B+Tree or R-Tree index on a field, the optimizer checks whether a secondary-index search alone can generate the result that the query asks for. It mainly checks two conditions: (1) predicates used in <tt>WHERE</tt> only uses the primary key field and/or secondary key field and (2) the result does not return any other fields. If these two conditions hold, it builds an index-only plan. Since an index-only plan only searches a secondary-index to answer a query, it is faster than a non-index-only plan that needs to search the primary index. However, this index-only plan can be turned off per query by setting the following parameter.</p>
+<ul>
+
+<li><b>compiler.indexonly</b>: if this is set to false, the index-only-plan will not be applied; the default value is true.</li>
+</ul>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">set `compiler.indexonly` &quot;false&quot;;
+
+SELECT o.order_date AS orderdate
+FROM orders o where o.order_date = &quot;2020-05-01&quot;;
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div></div>
+<div class="section">
+<h2><a name="Controlling_Array-Index_Access_Method_Plan_Parameter"></a><a name="ArrayIndexFlag" id="ArrayIndexFlag">Controlling Array-Index Access Method Plan Parameter</a></h2>
+<p>By default, the system attempts to utilize array indexes as an access method if an array index is present and is applicable. If you believe that your query will not benefit from an array index, toggle the parameter below.</p>
+<ul>
+
+<li><b>compiler.arrayindex</b>: if this is set to true, array indexes will be considered as an access method for applicable queries; the default value is true.</li>
+</ul>
+<div class="section">
+<div class="section">
+<h4><a name="Example"></a>Example</h4>
+
+<div>
+<div>
+<pre class="source">set `compiler.arrayindex` &quot;false&quot;;
+
+SELECT o.orderno
+FROM orders o
+WHERE SOME i IN o.items
+SATISFIES i.price = 19.91;
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div>
+<div class="section">
+<h2><a name="Query_Hints"></a><a name="Query_hints" id="Query_hints">Query Hints</a></h2>
+<div class="section">
+<div class="section">
+<h4><a name="a.E2.80.9Chash.E2.80.9D_GROUP_BY_hint"></a><a name="hash_groupby" id="hash_groupby">&#x201c;hash&#x201d; GROUP BY hint</a></h4>
+<p>The system supports two algorithms for GROUP BY clause evaluation: pre-sorted and hash-based. By default it uses the pre-sorted approach: The input data is first sorted on the grouping fields and then aggregation is performed on that sorted data. The alternative is a hash-based strategy which can be enabled via a <tt>/*+ hash */</tt> GROUP BY hint: The data is aggregated using an in-memory hash-table (that can spill to disk if necessary). This approach is recommended for low-cardinality grouping fields.</p>
+<div class="section">
+<h5><a name="Example:"></a>Example:</h5>
+
+<div>
+<div>
+<pre class="source">SELECT c.address.state, count(*)
+FROM Customers AS c
+/*+ hash */ GROUP BY c.address.state
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="a.E2.80.9Chash-bcast.E2.80.9D_JOIN_hint"></a><a name="hash_bcast_join" id="hash_bcast_join">&#x201c;hash-bcast&#x201d; JOIN hint</a></h4>
+<p>By default the system uses a partitioned-parallel hash join strategy to parallelize the execution of an equi-join. In this approach both sides of the join are repartitioned (if necessary) on a hash of the join key; potentially matching data items thus arrive at the same partition to be joined locally. This strategy is robust, but not always the fastest when one of the join sides is low cardinality and the other is high cardinality (since it scans and potentially moves the data from both sides). This special case can be better handled by broadcasting (replicating) the smaller side to all data partitions of the larger side and not moving the data from the other (larger) side. The system provides a join hint to enable this strategy: <tt>/*+ hash-bcast */</tt>. This hint forces the right side of the join to be replicated while the left side retains its original partitioning.</p>
+<div class="section">
+<h5><a name="Example:"></a>Example:</h5>
+
+<div>
+<div>
+<pre class="source">SELECT *
+FROM Orders AS o JOIN Customers AS c
+ON o.customer_id /*+ hash-bcast */ = c.customer_id
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div></div>
+<div class="section">
+<h2><a name="Appendix_3._Variable_Bindings_and_Name_Resolution"></a><a name="Variable_bindings_and_name_resolution" id="Variable_bindings_and_name_resolution">Appendix 3. Variable Bindings and Name Resolution</a></h2><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>In this Appendix, we&#x2019;ll look at how variables are bound and how names are resolved. Names can appear in every clause of a query. Sometimes a name consists of just a single identifier, e.g., <tt>region</tt> or <tt>revenue</tt>. More often a name will consist of two identifiers separated by a dot, e.g., <tt>customer.address</tt>. Occasionally a name may have more than two identifiers, e.g., <tt>policy.owner.address.zipcode</tt>. <i>Resolving</i> a name means determining exactly what the (possibly multi-part) name refers to. It is necessary to have well-defined rules for how to resolve a name in cases of ambiguity. (In the absence of schemas, such cases arise more commonly, and also differently, than they do in SQL.)</p>
+<p>The basic job of each clause in a query block is to bind variables. Each clause sees the variables bound by previous clauses and may bind additional variables. Names are always resolved with respect to the variables that are bound (&#x201c;in scope&#x201d;) at the place where the name use in question occurs. It is possible that the name resolution process will fail, which may lead to an empty result or an error message.</p>
+<p>One important bit of background: When the system is reading a query and resolving its names, it has a list of all the available dataverses and datasets. As a result, it knows whether <tt>a.b</tt> is a valid name for dataset <tt>b</tt> in dataverse <tt>a</tt>. However, the system does not in general have knowledge of the schemas of the data inside the datasets; remember that this is a much more open world. As a result, in general the system cannot know whether any object in a particular dataset will have a field named <tt>c</tt>. These assumptions affect how errors are handled. If you try to access dataset <tt>a.b</tt> and no dataset by that name exists, you will get an error and your query will not run. However, if you try to access a field <tt>c</tt> in a collection of objects, your query will run and return <tt>missing</tt> for each object that doesn&#x2019;t have a field named <tt>c</tt> - this is because it&#x2019;s possible that some object (someday) could have such a field.</p></div>
+<div class="section">
+<h2><a name="Binding_Variables"></a><a name="Binding_variables" id="Binding_variables">Binding Variables</a></h2>
+<p>Variables can be bound in the following ways:</p>
+<ol style="list-style-type: decimal">
+
+<li>
+
+<p><tt>WITH</tt> and <tt>LET</tt> clauses bind a variable to the result of an expression in a straightforward way</p>
+<p>Examples:</p>
+<p><tt>WITH cheap_parts AS (SELECT partno FROM parts WHERE price &lt; 100)</tt> binds the variable <tt>cheap_parts</tt> to the result of the subquery.</p>
+<p><tt>LET pay = salary + bonus</tt> binds the variable <tt>pay</tt> to the result of evaluating the expression <tt>salary + bonus</tt>.</p>
+</li>
+<li>
+
+<p><tt>FROM</tt>, <tt>GROUP BY</tt>, and <tt>SELECT</tt> clauses have optional <tt>AS</tt> subclauses that contain an expression and a name (called an <i>iteration variable</i> in a <tt>FROM</tt> clause, or an alias in <tt>GROUP BY</tt> or <tt>SELECT</tt>).</p>
+<p>Examples:</p>
+<p><tt>FROM customer AS c, order AS o</tt></p>
+<p><tt>GROUP BY salary + bonus AS total_pay</tt></p>
+<p><tt>SELECT MAX(price) AS highest_price</tt></p>
+<p>An <tt>AS</tt> subclause always binds the name (as a variable) to the result of the expression (or, in the case of a <tt>FROM</tt> clause, to the <i>individual members</i> of the collection identified by the expression).</p>
+<p>It&#x2019;s always a good practice to use the keyword <tt>AS</tt> when defining an alias or iteration variable. However, as in SQL, the syntax allows the keyword <tt>AS</tt> to be omitted. For example, the <tt>FROM</tt> clause above could have been written like this:</p>
+<p><tt>FROM customer c, order o</tt></p>
+<p>Omitting the keyword <tt>AS</tt> does not affect the binding of variables. The FROM clause in this example binds variables c and o whether the keyword AS is used or not.</p>
+<p>In certain cases, a variable is automatically bound even if no alias or variable-name is specified. Whenever an expression could have been followed by an AS subclause, if the expression consists of a simple name or a path expression, that expression binds a variable whose name is the same as the simple name or the last step in the path expression. Here are some examples:</p>
+<p><tt>FROM customer, order</tt> binds iteration variables named <tt>customer</tt> and <tt>order</tt></p>
+<p><tt>GROUP BY address.zipcode</tt> binds a variable named <tt>zipcode</tt></p>
+<p><tt>SELECT item[0].price</tt> binds a variable named <tt>price</tt></p>
+<p>Note that a <tt>FROM</tt> clause iterates over a collection (usually a dataset), binding a variable to each member of the collection in turn. The name of the collection remains in scope, but it is not a variable. For example, consider this <tt>FROM</tt> clause used in a self-join:</p>
+<p><tt>FROM customer AS c1, customer AS c2</tt></p>
+<p>This <tt>FROM</tt> clause joins the customer dataset to itself, binding the iteration variables <tt>c1</tt> and <tt>c2</tt> to objects in the left-hand-side and right-hand-side of the join, respectively. After the <tt>FROM</tt> clause, <tt>c1</tt> and <tt>c2</tt> are in scope as variables, and customer remains accessible as a dataset name but not as a variable.</p>
+</li>
+<li>
+
+<p>Special rules for <tt>GROUP BY</tt>:</p>
+<ul>
+
+<li>
+
+<p>(3A): If a <tt>GROUP BY</tt> clause specifies an expression that has no explicit alias, it binds a pseudo-variable that is lexicographically identical to the expression itself. For example:</p>
+<p><tt>GROUP BY salary + bonus</tt> binds a pseudo-variable named <tt>salary + bonus</tt>.</p>
+<p>This rule allows subsequent clauses to refer to the grouping expression (salary + bonus) even though its constituent variables (salary and bonus) are no longer in scope. For example, the following query is valid:</p>
+
+<div>
+<div>
+<pre class="source">FROM employee
+GROUP BY salary + bonus
+HAVING salary + bonus &gt; 1000
+SELECT salary + bonus, COUNT(*) AS how_many
+</pre></div></div>
+
+<p>While it might have been more elegant to explicitly require an alias in cases like this, the pseudo-variable rule is retained for SQL compatibility. Note that the expression <tt>salary + bonus</tt> is not <i>actually</i> evaluated in the <tt>HAVING</tt> and <tt>SELECT</tt> clauses (and could not be since <tt>salary</tt> and <tt>bonus</tt> are no longer individually in scope). Instead, the expression <tt>salary + bonus</tt> is treated as a reference to the pseudo-variable defined in the <tt>GROUP BY</tt> clause.</p>
+</li>
+<li>
+
+<p>(3B): The <tt>GROUP BY</tt> clause may be followed by a <tt>GROUP AS</tt> clause that binds a variable to the group. The purpose of this variable is to make the individual objects inside the group visible to subqueries that may need to iterate over them.</p>
+<p>The <tt>GROUP AS</tt> variable is bound to a multiset of objects. Each object represents one of the members of the group. Since the group may have been formed from a join, each of the member-objects contains a nested object for each variable bound by the nearest <tt>FROM</tt> clause (and its <tt>LET</tt> subclause, if any). These nested objects, in turn, contain the actual fields of the group-member. To understand this process, consider the following query fragment:</p>
+
+<div>
+<div>
+<pre class="source">FROM parts AS p, suppliers AS s
+WHERE p.suppno = s.suppno
+GROUP BY p.color GROUP AS g
+</pre></div></div>
+
+<p>Suppose that the objects in <tt>parts</tt> have fields <tt>partno</tt>, <tt>color</tt>, and <tt>suppno</tt>. Suppose that the objects in suppliers have fields <tt>suppno</tt> and <tt>location</tt>.</p>
+<p>Then, for each group formed by the <tt>GROUP BY</tt>, the variable g will be bound to a multiset with the following structure:</p>
+
+<div>
+<div>
+<pre class="source">[ { &quot;p&quot;: { &quot;partno&quot;: &quot;p1&quot;, &quot;color&quot;: &quot;red&quot;, &quot;suppno&quot;: &quot;s1&quot; },
+    &quot;s&quot;: { &quot;suppno&quot;: &quot;s1&quot;, &quot;location&quot;: &quot;Denver&quot; } },
+  { &quot;p&quot;: { &quot;partno&quot;: &quot;p2&quot;, &quot;color&quot;: &quot;red&quot;, &quot;suppno&quot;: &quot;s2&quot; },
+    &quot;s&quot;: { &quot;suppno&quot;: &quot;s2&quot;, &quot;location&quot;: &quot;Atlanta&quot; } },
+  ...
+]
+</pre></div></div>
+</li>
+</ul>
+</li>
+</ol></div>
+<div class="section">
+<h2><a name="Scoping" id="Scoping">Scoping</a></h2>
+<p>In general, the variables that are in scope at a particular position are those variables that were bound earlier in the current query block, in outer (enclosing) query blocks, or in a <tt>WITH</tt> clause at the beginning of the query. More specific rules follow.</p>
+<p>The clauses in a query block are conceptually processed in the following order:</p>
+<ul>
+
+<li><tt>FROM</tt> (followed by LET subclause, if any)</li>
+<li><tt>WHERE</tt></li>
+<li><tt>GROUP BY</tt> (followed by LET subclause, if any)</li>
+<li><tt>HAVING</tt></li>
+<li><tt>SELECT</tt> or <tt>SELECT VALUE</tt></li>
+<li><tt>ORDER BY</tt></li>
+<li><tt>OFFSET</tt></li>
+<li><tt>LIMIT</tt></li>
+</ul>
+<p>During processing of each clause, the variables that are in scope are those variables that are bound in the following places:</p>
+<ol style="list-style-type: decimal">
+
+<li>
+
+<p>In earlier clauses of the same query block (as defined by the ordering given above).</p>
+<p>Example: <tt>FROM orders AS o SELECT o.date</tt> The variable <tt>o</tt> in the <tt>SELECT</tt> clause is bound, in turn, to each object in the dataset <tt>orders</tt>.</p>
+</li>
+<li>
+
+<p>In outer query blocks in which the current query block is nested. In case of duplication, the innermost binding wins.</p>
+</li>
+<li>
+
+<p>In the <tt>WITH</tt> clause (if any) at the beginning of the query.</p>
+</li>
+</ol>
+<p>However, in a query block where a <tt>GROUP BY</tt> clause is present:</p>
+<ol style="list-style-type: decimal">
+
+<li>
+
+<p>In clauses processed before <tt>GROUP BY</tt>, scoping rules are the same as though no GROUP BY were present.</p>
+</li>
+<li>
+
+<p>In clauses processed after <tt>GROUP BY</tt>, the variables bound in the nearest <tt>FROM</tt>-clause (and its <tt>LET</tt> subclause, if any) are removed from scope and replaced by the variables bound in the <tt>GROUP BY</tt> clause (and its <tt>LET</tt> subclause, if any). However, this replacement does not apply inside the arguments of the five SQL special aggregating functions (<tt>MIN</tt>, <tt>MAX</tt>, <tt>AVG</tt>, <tt>SUM</tt>, and <tt>COUNT</tt>). These functions still need to see the individual data items over which they are computing an aggregation. For example, after <tt>FROM employee AS e GROUP BY deptno</tt>, it would not be valid to reference <tt>e.salary</tt>, but <tt>AVG(e.salary)</tt> would be valid.</p>
+</li>
+</ol>
+<p>Special case: In an expression inside a <tt>FROM</tt> clause, a variable is in scope if it was bound in an earlier expression in the same <tt>FROM</tt> clause. Example:</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items AS i
+</pre></div></div>
+
+<p>The reason for this special case is to support iteration over nested collections.</p>
+<p>Note that, since the <tt>SELECT</tt> clause comes <i>after</i> the <tt>WHERE</tt> and <tt>GROUP BY</tt> clauses in conceptual processing order, any variables defined in <tt>SELECT</tt> are not visible in <tt>WHERE</tt> or <tt>GROUP BY</tt>. Therefore the following query will not return what might be the expected result (since in the WHERE clause, <tt>pay</tt> will be interpreted as a field in the <tt>emp</tt> object rather than as the computed value <tt>salary + bonus</tt>):</p>
+
+<div>
+<div>
+<pre class="source">SELECT name, salary + bonus AS pay
+FROM emp
+WHERE pay &gt; 1000
+ORDER BY pay
+</pre></div></div>
+
+<p>The likely intent of the query above can be accomplished as follows:</p>
+
+<div>
+<div>
+<pre class="source">FROM emp AS e
+LET pay = e.salary + e.bonus
+WHERE pay &gt; 1000
+SELECT e.name, pay
+ORDER BY pay
+</pre></div></div>
+
+<p>Note that in the phrase <i>expr1</i> <tt>JOIN</tt> <i>expr2</i> <tt>ON</tt> <i>expr3</i>, variables defined in <i>expr1</i> are visible in <i>expr3</i> but not in <i>expr2</i>. Here&#x2019;s an example that will not work:</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o JOIN o.items AS i ON 1 = 1
+</pre></div></div>
+
+<p>The variable <tt>o</tt>, defined in the phrase before <tt>JOIN</tt>, cannot be used in the phrase immediately following <tt>JOIN</tt>. The probable intent of this example could be accomplished in either of the following ways:</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o UNNEST o.items AS i
+
+FROM orders AS o, o.items AS i
+</pre></div></div>
+
+<p>To summarize this rule: You may not use left-correlation in an explicit <tt>JOIN</tt> clause.</p></div>
+<div class="section">
+<h2><a name="Resolving_Names"></a><a name="Resolving_names" id="Resolving_names">Resolving Names</a></h2>
+<p>The process of name resolution begins with the leftmost identifier in the name. The rules for resolving the leftmost identifier are:</p>
+<ol style="list-style-type: decimal">
+
+<li>
+
+<p><i>In a <tt>FROM</tt> clause</i>: Names in a <tt>FROM</tt> clause identify the collections over which the query block will iterate. These collections may be stored datasets, views, synonyms, or may be the results of nested query blocks. A stored dataset may be in a named dataverse or in the default dataverse. Thus, if the two-part name <tt>a.b</tt> is in a <tt>FROM</tt> clause, a might represent a dataverse and <tt>b</tt> might represent a dataset in that dataverse. Another example of a two-part name in a <tt>FROM</tt> clause is <tt>FROM orders AS o, o.items AS i</tt>. In <tt>o.items</tt>, <tt>o</tt> represents an order object bound earlier in the <tt>FROM</tt> clause, and items represents the items object inside that order.</p>
+<p>The rules for resolving the leftmost identifier in a <tt>FROM</tt> clause (including a <tt>JOIN</tt> subclause), or in the expression following <tt>IN</tt> in a quantified predicate, are as follows:</p>
+<ul>
+
+<li>
+
+<p>(1A):  If the identifier matches a variable-name that is in scope, it resolves to the binding of that variable. (Note that in the case of a subquery, an in-scope variable might have been bound in an outer query block; this is called a correlated subquery).</p>
+</li>
+<li>
+
+<p>(1B):  Otherwise, if the identifier is the first part of a two-part name like <tt>a.b</tt>, the name is treated as <tt>dataverse.dataset</tt>. If the identifier stands alone as a one-part name, it is treated as the name of a dataset in the default dataverse. If the designated dataset exists then the identifier is resolved to that dataset, othwerise if a view with given name exists then the identifier is resolved to that view, otherwise if a synonym with given name exists then the identifier is resolved to the target dataset or the target view of that synonym (potentially recursively if this synonym points to another synonym). An error will result if the designated dataset, view, or a synonym with this name does not exist.</p>
+<p>Datasets and views take precedence over synonyms, so if both a dataset (or a view) and a synonym have the same name then the resolution is to the dataset. Note that there cannot be a dataset and a view with the same name.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p><i>Elsewhere in a query block</i>: In clauses other than <tt>FROM</tt>, a name typically identifies a field of some object. For example, if the expression <tt>a.b</tt> is in a <tt>SELECT</tt> or <tt>WHERE</tt> clause, it&#x2019;s likely that <tt>a</tt> represents an object and <tt>b</tt> represents a field in that object.</p>
+<p>The rules for resolving the leftmost identifier in clauses other than the ones listed in Rule 1 are:</p>
+<ul>
+
+<li>
+
+<p>(2A):  If the identifier matches a variable-name that is in scope, it resolves to the binding of that variable. (In the case of a correlated subquery, the in-scope variable might have been bound in an outer query block).</p>
+</li>
+<li>
+
+<p>(2B):  (The &#x201c;Single Variable Rule&#x201d;): Otherwise, if the <tt>FROM</tt> clause in the current query block binds exactly one variable, the identifier is treated as a field access on the object bound to that variable. For example, in the query <tt>FROM customer SELECT address</tt>, the identifier address is treated as a field in the object bound to the variable <tt>customer</tt>. At runtime, if the object bound to <tt>customer</tt> has no <tt>address</tt> field, the <tt>address</tt> expression will return <tt>missing</tt>. If the <tt>FROM</tt> clause in the current query block binds multiple variables, name resolution fails with an &#x201c;ambiguous name&#x201d; error. If there&#x2019;s no <tt>FROM</tt> clause in the current query block, name resolution fails with an &#x201c;undefined identifier&#x201d; error. Note that the Single Variable Rule searches for bound variables only in the current query block, not in outer (containing) blocks. The purpose of this rule is to permit the compiler to resolve field-references unambiguously without relying on any schema information. Also note that variables defined by <tt>LET</tt> clauses do not participate in the resolution process performed by this rule.</p>
+<p>Exception: In a query that has a <tt>GROUP BY</tt> clause, the Single Variable Rule does not apply in any clauses that occur after the <tt>GROUP BY</tt> because, in these clauses, the variables bound by the <tt>FROM</tt> clause are no longer in scope. In clauses after <tt>GROUP BY</tt>, only Rule (2A) applies.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>In an <tt>ORDER BY</tt> clause following a <tt>UNION ALL</tt> expression:</p>
+<p>The leftmost identifier is treated as a field-access on the objects that are generated by the <tt>UNION ALL</tt>. For example:</p>
+
+<div>
+<div>
+<pre class="source">query-block-1
+UNION ALL
+query-block-2
+ORDER BY salary
+</pre></div></div>
+
+<p>In the result of this query, objects that have a foo field will be ordered by the value of this field; objects that have no foo field will appear at at the beginning of the query result (in ascending order) or at the end (in descending order.)</p>
+</li>
+<li>
+
+<p><i>In a standalone expression</i>: If a query consists of a standalone expression then identifiers inside that expression are resolved according to Rule 1. For example, if the whole query is <tt>ARRAY_COUNT(a.b)</tt> then <tt>a.b</tt> will be treated as dataset <tt>b</tt> contained in dataverse <tt>a</tt>. Note that this rule only applies to identifiers which are located directly inside a standalone expression. Identifiers inside <tt>SELECT</tt> statements in a standalone expression are still resolved according to Rules 1-3. For example, if the whole query is <tt>ARRAY_SUM( (FROM employee AS e SELECT VALUE salary) )</tt> then <tt>salary</tt> is resolved as <tt>e.salary</tt> following the &#x201c;Single Variable Rule&#x201d; (Rule (2B)).</p>
+</li>
+<li>
+
+<p>Once the leftmost identifier has been resolved, the following dots and identifiers in the name (if any) are treated as a path expression that navigates to a field nested inside that object. The name resolves to the field at the end of the path. If this field does not exist, the value <tt>missing</tt> is returned.</p>
+</li>
+</ol><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Appendix_4._Example_Data"></a><a name="Manual_data" id="Manual_data">Appendix 4. Example Data</a></h2><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>This appendix lists the data definitions and the datasets used for the examples provided throughout this manual.</p>
+<div class="section">
+<h3><a name="Data_Definitions"></a><a name="definition_statements" id="definition_statements">Data Definitions</a></h3>
+
+<div>
+<div>
+<pre class="source">CREATE DATAVERSE Commerce IF NOT EXISTS;
+
+USE Commerce;
+
+CREATE TYPE addressType AS {
+    street:			string,
+    city:			string,
+    zipcode:			string?
+};
+
+CREATE TYPE customerType AS {
+    custid:			string,
+    name:			string,
+    address:			addressType?
+};
+
+CREATE DATASET customers(customerType)
+    PRIMARY KEY custid;
+
+CREATE TYPE itemType AS {
+    itemno:			int,
+    qty:			int,
+    price:			int
+};
+
+CREATE TYPE orderType AS {
+    orderno:			int,
+    custid:			string,
+    order_date:			string,
+    ship_date:			string?,
+    items:			[ itemType ]
+};
+
+CREATE DATASET orders(orderType)
+    PRIMARY KEY orderno;
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Customers_Data"></a><a name="customers_data" id="customers_data">Customers Data</a></h3>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;201 Main St.&quot;,
+            &quot;city&quot;: &quot;St. Louis, MO&quot;,
+            &quot;zipcode&quot;: &quot;63101&quot;
+        },
+        &quot;rating&quot;: 750
+    },
+    {
+        &quot;custid&quot;: &quot;C25&quot;,
+        &quot;name&quot;: &quot;M. Sinclair&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;690 River St.&quot;,
+            &quot;city&quot;: &quot;Hanover, MA&quot;,
+            &quot;zipcode&quot;: &quot;02340&quot;
+        },
+        &quot;rating&quot;: 690
+    },
+    {
+        &quot;custid&quot;: &quot;C31&quot;,
+        &quot;name&quot;: &quot;B. Pruitt&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;360 Mountain Ave.&quot;,
+            &quot;city&quot;: &quot;St. Louis, MO&quot;,
+            &quot;zipcode&quot;: &quot;63101&quot;
+        }
+    },
+    {
+        &quot;custid&quot;: &quot;C35&quot;,
+        &quot;name&quot;: &quot;J. Roberts&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;420 Green St.&quot;,
+            &quot;city&quot;: &quot;Boston, MA&quot;,
+            &quot;zipcode&quot;: &quot;02115&quot;
+        },
+        &quot;rating&quot;: 565
+    },
+    {
+        &quot;custid&quot;: &quot;C37&quot;,
+        &quot;name&quot;: &quot;T. Henry&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;120 Harbor Blvd.&quot;,
+            &quot;city&quot;: &quot;Boston, MA&quot;,
+            &quot;zipcode&quot;: &quot;02115&quot;
+        },
+        &quot;rating&quot;: 750
+    },
+    {
+        &quot;custid&quot;: &quot;C41&quot;,
+        &quot;name&quot;: &quot;R. Dodge&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;150 Market St.&quot;,
+            &quot;city&quot;: &quot;St. Louis, MO&quot;,
+            &quot;zipcode&quot;: &quot;63101&quot;
+        },
+        &quot;rating&quot;: 640
+    },
+    {
+        &quot;custid&quot;: &quot;C47&quot;,
+        &quot;name&quot;: &quot;S. Logan&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;Via del Corso&quot;,
+            &quot;city&quot;: &quot;Rome, Italy&quot;
+        },
+        &quot;rating&quot;: 625
+    }
+]
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Orders_Data"></a><a name="orders_data" id="orders_data">Orders Data</a></h3>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1001,
+        &quot;custid&quot;: &quot;C41&quot;,
+        &quot;order_date&quot;: &quot;2020-04-29&quot;,
+        &quot;ship_date&quot;: &quot;2020-05-03&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 347,
+                &quot;qty&quot;: 5,
+                &quot;price&quot;: 19.99
+            },
+            {
+                &quot;itemno&quot;: 193,
+                &quot;qty&quot;: 2,
+                &quot;price&quot;: 28.89
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1002,
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;order_date&quot;: &quot;2020-05-01&quot;,
+        &quot;ship_date&quot;: &quot;2020-05-03&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 460,
+                &quot;qty&quot;: 95,
+                &quot;price&quot;: 100.99
+            },
+            {
+                &quot;itemno&quot;: 680,
+                &quot;qty&quot;: 150,
+                &quot;price&quot;: 8.75
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1003,
+        &quot;custid&quot;: &quot;C31&quot;,
+        &quot;order_date&quot;: &quot;2020-06-15&quot;,
+        &quot;ship_date&quot;: &quot;2020-06-16&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 120,
+                &quot;qty&quot;: 2,
+                &quot;price&quot;: 88.99
+            },
+            {
+                &quot;itemno&quot;: 460,
+                &quot;qty&quot;: 3,
+                &quot;price&quot;: 99.99
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1004,
+        &quot;custid&quot;: &quot;C35&quot;,
+        &quot;order_date&quot;: &quot;2020-07-10&quot;,
+        &quot;ship_date&quot;: &quot;2020-07-15&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 680,
+                &quot;qty&quot;: 6,
+                &quot;price&quot;: 9.99
+            },
+            {
+                &quot;itemno&quot;: 195,
+                &quot;qty&quot;: 4,
+                &quot;price&quot;: 35
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1005,
+        &quot;custid&quot;: &quot;C37&quot;,
+        &quot;order_date&quot;: &quot;2020-08-30&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 460,
+                &quot;qty&quot;: 2,
+                &quot;price&quot;: 99.98
+            },
+            {
+                &quot;itemno&quot;: 347,
+                &quot;qty&quot;: 120,
+                &quot;price&quot;: 22
+            },
+            {
+                &quot;itemno&quot;: 780,
+                &quot;qty&quot;: 1,
+                &quot;price&quot;: 1500
+            },
+            {
+                &quot;itemno&quot;: 375,
+                &quot;qty&quot;: 2,
+                &quot;price&quot;: 149.98
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1006,
+        &quot;custid&quot;: &quot;C41&quot;,
+        &quot;order_date&quot;: &quot;2020-09-02&quot;,
+        &quot;ship_date&quot;: &quot;2020-09-04&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 680,
+                &quot;qty&quot;: 51,
+                &quot;price&quot;: 25.98
+            },
+            {
+                &quot;itemno&quot;: 120,
+                &quot;qty&quot;: 65,
+                &quot;price&quot;: 85
+            },
+            {
+                &quot;itemno&quot;: 460,
+                &quot;qty&quot;: 120,
+                &quot;price&quot;: 99.98
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1007,
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;order_date&quot;: &quot;2020-09-13&quot;,
+        &quot;ship_date&quot;: &quot;2020-09-20&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 185,
+                &quot;qty&quot;: 5,
+                &quot;price&quot;: 21.99
+            },
+            {
+                &quot;itemno&quot;: 680,
+                &quot;qty&quot;: 1,
+                &quot;price&quot;: 20.5
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1008,
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;order_date&quot;: &quot;2020-10-13&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 460,
+                &quot;qty&quot;: 20,
+                &quot;price&quot;: 99.99
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1009,
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;order_date&quot;: &quot;2020-10-13&quot;,
+        &quot;items&quot;: []
+    }
+]
+</pre></div></div></div></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/content/docs/0.9.9/udf.html b/content/docs/0.9.9/udf.html
new file mode 100644
index 0000000..b9be9ec
--- /dev/null
+++ b/content/docs/0.9.9/udf.html
@@ -0,0 +1,411 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/udf.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; User-defined Functions</title>
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="./css/site.css" />
+    <link rel="stylesheet" href="./css/print.css" media="print" />
+    <script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href="./" id="bannerLeft"><img src="images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li class="active"><a href="#"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href="./" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>User-defined Functions</h1>
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="atoc" id="#toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#introduction">Introduction</a></li>
+<li><a href="#installingUDF">Installing an UDF Library</a></li>
+<li><a href="#UDFOnFeeds">Attaching an UDF on Data Feeds</a></li>
+<li><a href="#udfConfiguration">A quick look of the UDF configuration</a></li>
+<li><a href="#adapter">User defined Feed Adapters</a></li>
+<li><a href="#uninstall">Unstalling an UDF Library</a><!--
+! Licensed to the Apache Software Foundation (ASF) under one
+! or more contributor license agreements.  See the NOTICE file
+! distributed with this work for additional information
+! regarding copyright ownership.  The ASF licenses this file
+! to you under the Apache License, Version 2.0 (the
+! "License"); you may not use this file except in compliance
+! with the License.  You may obtain a copy of the License at
+!
+!   http://www.apache.org/licenses/LICENSE-2.0
+!
+! Unless required by applicable law or agreed to in writing,
+! software distributed under the License is distributed on an
+! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+! KIND, either express or implied.  See the License for the
+! specific language governing permissions and limitations
+! under the License.
+!--></li>
+</ul></div>
+<div class="section">
+<h2><a name="Introduction"></a><a name="introduction">Introduction</a></h2>
+<p>Apache AsterixDB supports three languages for writing user-defined functions (UDFs): SQL++, Java, and Python A user can encapsulate data processing logic into a UDF and invoke it later repeatedly. For SQL++ functions, a user can refer to <a href="sqlpp/manual.html#Functions">SQL++ Functions</a> for their usages. This document will focus on UDFs in languages other than SQL++</p></div>
+<div class="section">
+<h2><a name="Endpoints_and_Authentication"></a><a name="authentication">Endpoints and Authentication</a></h2>
+<p>The UDF API endpoint used to deploy functions is not enabled by default until authentication has been configured properly. Even if the endpoint is enabled, it is only accessible on the loopback interface on each NC to restrict access.</p>
+<p>To enable it, we need to set the path to the credential file and populate it with our username and password.</p>
+<p>The credential file is a simple <tt>/etc/passwd</tt> style text file with usernames and corresponding <tt>bcrypt</tt> hashed and salted passwords. You can populate this on your own if you would like, but the <tt>asterixhelper</tt> utility can write the entries as well. We can invoke <tt>asterixhelper</tt> like so:</p>
+
+<div>
+<div>
+<pre class="source">$ bin/asterixhelper -u admin -p admin -cp opt/local/conf add_credential
+</pre></div></div>
+
+<p>Then, in your <tt>cc.conf</tt>, in the <tt>[cc]</tt> section, add the correct <tt>credential.file</tt> path</p>
+
+<div>
+<div>
+<pre class="source">[nc]
+address = 127.0.0.1
+...
+...
+credential.file = conf/passwd
+</pre></div></div>
+
+<p>Now,restart the cluster if it was already started to allow the Cluster Controller to find the new credentials.</p></div>
+<div class="section">
+<h2><a name="Installing_a_Java_UDF_Library"></a><a name="installingUDF">Installing a Java UDF Library</a></h2>
+<p>To install a UDF package to the cluster, we need to send a Multipart Form-data HTTP request to the <tt>/admin/udf</tt> endpoint of the CC at the normal API port (<tt>19004</tt> by default). Any suitable tool will do, but for the example here I will use <tt>curl</tt> which is widely available.</p>
+<p>For example, to install a library with the following criteria:</p>
+<ul>
+
+<li><tt>udfs</tt> dataverse name</li>
+<li>with a new Library name of <tt>testlib</tt></li>
+<li>from <tt>lib.zip</tt> in the present working directory</li>
+<li>to the cluster at <tt>localhost</tt> with API port <tt>19004</tt> of the Asterix CC</li>
+<li>with credentials being a username and password of <tt>admin:admin</tt></li>
+</ul>
+<p>we would execute</p>
+
+<div>
+<div>
+<pre class="source">curl -v -u admin:admin -X POST -F 'data=@./lib.zip' -F 'type=java' localhost:19004/admin/udf/udfs/testlib
+</pre></div></div>
+
+<p>Any response other than <tt>200</tt> indicates an error in deployment.</p>
+<p>In the AsterixDB source release, we provide several sample UDFs that you can try out. You need to build the AsterixDB source to get the compiled UDF package. It can be found under the <tt>asterix-external-data</tt> sub-project under the path <tt>asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/library</tt>. After compilation, the UDFs will be packed in a zip file at <tt>asterixdb/asterix-external-data/target/asterix-external-data-$VERSION-testlib.zip</tt> which you can use to upload to the AsterixDB cluster.</p>
+<p>Assuming that these UDFs have been installed into the <tt>testlib</tt> library in<tt>udfs</tt> dataverse, here is an example that uses the sample UDF <tt>mysum</tt> to compute the sum of two input integers.</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CREATE FUNCTION mysum(a: int32, b: int32)
+RETURNS int32
+  AS &quot;org.apache.asterix.external.library.MySumFactory&quot; AT testlib;
+</pre></div></div>
+</div>
+<div class="section">
+<h2><a name="Creating_a_Python_UDF"></a><a name="PythonUDF" id="PythonUDF">Creating a Python UDF</a></h2>
+<p>Python UDFs need to be rolled into a <a class="externalLink" href="https://github.com/linkedin/shiv">shiv</a> package with all their dependencies. By default AsterixDB will use the Python interpreter located at <tt>/usr/bin/python3</tt>. This can be changed in the cluster config <tt>[common]</tt> section using the <tt>python.path</tt> configuration variable.</p>
+<p>First, let&#x2019;s devise a function that we would like to use in AsterixDB, <tt>sentiment_mod.py</tt></p>
+
+<div>
+<div>
+<pre class="source">import os
+from typing import Tuple
+class sent_model:
+
+    def __init__(self):
+        good_words = os.path.join(os.path.dirname(__file__), 'good.txt')
+        with open(good_words) as f:
+            self.whitelist = f.read().splitlines()
+
+    def sentiment(self, arg: Tuple[str])-&gt; str:
+        words = arg[0].split()
+        for word in words:
+            if word in self.whitelist:
+                return 'great'
+
+        return 'eh'
+</pre></div></div>
+
+<p>Furthermore, let&#x2019;s assume &#x2018;good.txt&#x2019; contains the following entries</p>
+
+<div>
+<div>
+<pre class="source">spam
+eggs
+ham
+</pre></div></div>
+
+<p>Now, in the module directory, execute <tt>shiv</tt> with all the dependencies of the module listed. We don&#x2019;t actually use scikit-learn here (our method is obviously better!), but it&#x2019;s just included as an example of a real dependency.</p>
+
+<div>
+<div>
+<pre class="source">shiv -o lib.pyz --site-packages . scikit-learn
+</pre></div></div>
+
+<p>Then, deploy it the same as the Java UDF was, with the library name <tt>pylib</tt> in <tt>udfs</tt> dataverse</p>
+
+<div>
+<div>
+<pre class="source">curl -v -u admin:admin -X POST -F 'data=@./lib.pyz' -F 'type=python' localhost:19002/admin/udf/udfs/pylib
+</pre></div></div>
+
+<p>With the library deployed, we can define a function within it for use. For example, to expose the Python function <tt>sentiment</tt> in the module <tt>sentiment_mod</tt> in the class <tt>sent_model</tt>, the <tt>CREATE FUNCTION</tt> would be as follows</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CREATE FUNCTION sentiment(a)
+RETURNS TweetType
+  AS &quot;sentiment_mod&quot;, &quot;sent_model.sentiment&quot; AT pylib;
+</pre></div></div>
+
+<p>By default, AsterixDB will treat all external functions as deterministic. It means the function must return the same result for the same input, irrespective of when or how many times the function is called on that input. This particular function behaves the same on each input, so it satisfies the deterministic property. This enables better optimization of queries including this function. If a function is not deterministic then it should be declared as such by using a <tt>WITH</tt> sub-clause:</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CREATE FUNCTION sentiment(text)
+  AS &quot;sentiment_mod&quot;, &quot;sent_model.sentiment&quot; AT pylib
+  WITH { &quot;deterministic&quot;: false }
+</pre></div></div>
+
+<p>With the function now defined, it can then be used as any other scalar SQL++ function would be. For example:</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+INSERT INTO Tweets([
+  {&quot;id&quot;:1, &quot;msg&quot;:&quot;spam is great&quot;},
+  {&quot;id&quot;:2, &quot;msg&quot;:&quot;i will not eat green eggs and ham&quot;},
+  {&quot;id&quot;:3, &quot;msg&quot;:&quot;bacon is better&quot;}
+]);
+
+SELECT t.msg as msg, sentiment(t.msg) as sentiment
+FROM Tweets t;
+</pre></div></div>
+</div>
+<div class="section">
+<h2><a name="Python_Type_Mappings"></a><a name="pytpes">Python Type Mappings</a></h2>
+<p>Currently only a subset of AsterixDB types are supported in Python UDFs. The supported types are as follows:</p>
+<ul>
+
+<li>Integer types (int8,16,32,64)</li>
+<li>Floating point types (float, double)</li>
+<li>String</li>
+<li>Boolean</li>
+<li>Arrays, Sets (cast to lists)</li>
+<li>Objects (cast to dict)</li>
+</ul>
+<p>Unsupported types can be cast to these in SQL++ first in order to be passed to a Python UDF</p></div>
+<div class="section">
+<h2><a name="Execution_Model_For_UDFs"></a><a name="execution">Execution Model For UDFs</a></h2>
+<p>AsterixDB queries are deployed across the cluster as Hyracks jobs. A Hyracks job has a lifecycle that can be simplified for the purposes of UDFs to - A pre-run phase which allocates resources, <tt>open</tt> - The time during which the job has data flowing through it, <tt>nextFrame</tt> - Cleanup and shutdown in <tt>close</tt>.</p>
+<p>If a SQL++ function is defined as a member of a class in the library, the class will be instantiated during <tt>open</tt>. The class will exist in memory for the lifetime of the query. Therefore if your function needs to reference files or other data that would be costly to load per-call, making it a member variable that is initialized in the constructor of the object will greatly increase the performance of the SQL++ function.</p>
+<p>For each function invoked during a query, there will be an independent instance of the function per data partition. This means that the function must not assume there is any global state or that it can assume things about the layout of the data. The execution of the function will be parallel to the same degree as the level of data parallelism in the cluster.</p>
+<p>After initialization, the function bound in the SQL++ function definition is called once per tuple during the query execution (i.e. <tt>nextFrame</tt>). Unless the function specifies <tt>null-call</tt> in the <tt>WITH</tt> clause, <tt>NULL</tt> values will be skipped.</p>
+<p>At the close of the query, the function is torn down and not re-used in any way. All functions should assume that nothing will persist in-memory outside of the lifetime of a query, and any behavior contrary to this is undefined.</p></div>
+<div class="section">
+<h2><a name="Attaching_a_UDF_on_Data_Feeds"></a><a name="UDFOnFeeds" id="UDFOnFeeds">Attaching a UDF on Data Feeds</a></h2>
+<p>In <a href="feeds.html">Data Ingestion using feeds</a>, we introduced an efficient way for users to get data into AsterixDB. In some use cases, users may want to pre-process the incoming data before storing it into the dataset. To meet this need, AsterixDB allows the user to attach a UDF onto the ingestion pipeline. Following the example in <a href="feeds.html">Data Ingestion</a>, here we show an example of how to attach a UDF that extracts the user names mentioned from the incoming Tweet text, storing the processed Tweets into a dataset.</p>
+<p>We start by creating the datatype and dataset that will be used for the feed and UDF. One thing to keep in mind is that data flows from the feed to the UDF and then to the dataset. This means that the feed&#x2019;s datatype should be the same as the input type of the UDF, and the output datatype of the UDF should be the same as the dataset&#x2019;s datatype. Thus, users should make sure that their datatypes are consistent in the UDF configuration. Users can also take advantage of open datatypes in AsterixDB by creating a minimum description of the data for simplicity. Here we use open datatypes:</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CREATE TYPE TweetType IF NOT EXISTS AS OPEN {
+    id: int64
+};
+
+CREATE DATASET ProcessedTweets(TweetType) PRIMARY KEY id;
+</pre></div></div>
+
+<p>As the <tt>TweetType</tt> is an open datatype, processed Tweets can be stored into the dataset after they are annotated with an extra attribute. Given the datatype and dataset above, we can create a Twitter Feed with the same datatype. Please refer to section <a href="feeds.html">Data Ingestion</a> if you have any trouble in creating feeds.</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CREATE FEED TwitterFeed WITH {
+  &quot;adapter-name&quot;: &quot;push_twitter&quot;,
+  &quot;type-name&quot;: &quot;TweetType&quot;,
+  &quot;format&quot;: &quot;twitter-status&quot;,
+  &quot;consumer.key&quot;: &quot;************&quot;,
+  &quot;consumer.secret&quot;: &quot;************&quot;,
+  &quot;access.token&quot;: &quot;**********&quot;,
+  &quot;access.token.secret&quot;: &quot;*************&quot;
+};
+</pre></div></div>
+
+<p>Then we define the function we want to apply to the feed</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CREATE FUNCTION addMentionedUsers(t: TweetType)
+  AS &quot;org.apache.asterix.external.library.AddMentionedUsersFactory&quot; AT testlib
+  WITH { &quot;resources&quot;: { &quot;textFieldName&quot;: &quot;text&quot; } };
+</pre></div></div>
+
+<p>After creating the feed, we attach the UDF onto the feed pipeline and start the feed with following statements:</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CONNECT FEED TwitterFeed TO DATASET ProcessedTweets APPLY FUNCTION addMentionedUsers;
+
+START FEED TwitterFeed;
+</pre></div></div>
+
+<p>You can check the annotated Tweets by querying the <tt>ProcessedTweets</tt> dataset:</p>
+
+<div>
+<div>
+<pre class="source">SELECT * FROM ProcessedTweets LIMIT 10;
+</pre></div></div>
+</div>
+<div class="section">
+<h2><a name="Installing_a_user-defined_Feed_Adapter"></a><a name="adapter">Installing a user-defined Feed Adapter</a></h2>
+<p>First, upload a zip file packaged the same way as a Java UDF, but also containing the adapter you would like to use. Next, issue a <tt>CREATE ADAPTER</tt> statement referencing the class name. For example:</p>
+
+<div>
+<div>
+<pre class="source">CREATE ADAPTER TweetAdapter
+  AS &quot;org.apache.asterix.external.library.adapter.TestTypedAdapterFactory&quot; AT testlib;
+</pre></div></div>
+
+<p>Then, the adapter can be used like any other adapter in a feed.</p>
+
+<div>
+<div>
+<pre class="source">CREATE FEED TweetFeed WITH {
+  &quot;adapter-name&quot;: &quot;TweetAdapter&quot;,
+  &quot;type-name&quot; : &quot;TweetType&quot;,
+  &quot;num_output_records&quot;: 4
+};
+</pre></div></div>
+</div>
+<div class="section">
+<h2><a name="Unstalling_an_UDF_Library"></a><a name="uninstall">Unstalling an UDF Library</a></h2>
+<p>If you want to uninstall the UDF library, simply issue a <tt>DELETE</tt> against the endpoint you <tt>POST</tt>ed against once all functions declared with the library are removed. First we&#x2019;ll drop the function we declared earlier:</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+DROP FUNCTION mysum(a,b);
+</pre></div></div>
+
+<p>Then issue the proper <tt>DELETE</tt> request</p>
+
+<div>
+<div>
+<pre class="source">curl -u admin:admin -X DELETE localhost:19002/admin/udf/udfs/testlib
+</pre></div></div>
+
+<p>The library will also be dropped if you drop the dataverse entirely.</p></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/docs/0.9.9/ansible.html b/docs/0.9.9/ansible.html
new file mode 100644
index 0000000..c1894a7
--- /dev/null
+++ b/docs/0.9.9/ansible.html
@@ -0,0 +1,299 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/ansible.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Installation using Ansible</title>
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="./css/site.css" />
+    <link rel="stylesheet" href="./css/print.css" media="print" />
+    <script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href="./" id="bannerLeft"><img src="images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li class="active"><a href="#"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href="./" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>Installation using Ansible</h1>
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="atoc" id="#toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#Introduction">Introduction</a></li>
+<li><a href="#Prerequisites">Prerequisites</a></li>
+<li><a href="#config">Cluster Configuration</a></li>
+<li><a href="#lifecycle">Cluster Lifecycle Management</a></li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Introduction" id="Introduction">Introduction</a></h2>
+<p>This installation option provides several wrapped <a class="externalLink" href="https://www.ansible.com/">Ansible</a>-based scripts to deploy, start, stop, and erase an AsterixDB instance on a multi-node cluster without requiring users to interact with each individual node in the cluster.</p></div>
+<div class="section">
+<h2><a name="Prerequisites" id="Prerequisites">Prerequisites</a></h2>
+<ul>
+
+<li>
+
+<p>Supported operating systems: <b>Linux</b> and <b>MacOS</b></p>
+</li>
+<li>
+
+<p>Install pip on your client machine:</p>
+<p>CentOS</p>
+
+<div>
+<div>
+<pre class="source"> $ sudo yum install python-pip
+</pre></div></div>
+
+<p>Ubuntu</p>
+
+<div>
+<div>
+<pre class="source"> $ sudo apt-get install python-pip
+</pre></div></div>
+
+<p>macOS</p>
+
+<div>
+<div>
+<pre class="source"> $ brew install pip
+</pre></div></div>
+</li>
+<li>
+
+<p>Install Ansible, boto, and boto3 on your client machine:</p>
+
+<div>
+<div>
+<pre class="source"> $ pip install ansible
+ $ pip install boto
+ $ pip install boto3
+</pre></div></div>
+
+<p>Note that you might need <tt>sudo</tt> depending on your system configuration.</p>
+<p><b>Make sure that the version of Ansible is no less than 2.2.1.0</b>:</p>
+
+<div>
+<div>
+<pre class="source"> $ ansible --version
+ ansible 2.2.1.0
+</pre></div></div>
+</li>
+<li>
+
+<p>Download the AsterixDB distribution package, unzip it, and navigate to <tt>opt/ansible/</tt></p>
+
+<div>
+<div>
+<pre class="source"> $ cd opt/ansible
+</pre></div></div>
+
+<p>The following files and directories are in the directory <tt>opt/ansible</tt>:</p>
+
+<div>
+<div>
+<pre class="source"> README  bin  conf  yaml
+</pre></div></div>
+
+<p><tt>bin</tt> contains scripts that deploy, start, stop and erase a multi-node AsterixDB cluster, according to the configuration specified in files under <tt>conf</tt>, and <tt>yaml</tt> contains internal Ansible scripts that the shell scripts in <tt>bin</tt> use.</p>
+</li>
+</ul></div>
+<div class="section">
+<h2><a name="Cluster_Configuration"></a><a name="config" id="config">Cluster Configuration</a></h2>
+<ul>
+
+<li>
+
+<p><b>Nodes and account</b>. Edit the inventory file <tt>conf/inventory</tt> when necessary. You mostly only need to specify the node DNS names (or IPs) for the cluster controller, i.e., the master node, in the <b>[cc]</b> section, and node controllers, i.e., slave nodes, in the <b>[ncs]</b> section. The following example configures a cluster with two slave nodes (172.0.1.11 and 172.0.1.12) and one master node (172.0.1.10).</p>
+
+<div>
+<div>
+<pre class="source"> [cc]
+ 172.0.1.10
+
+ [ncs]
+ 172.0.1.11
+ 172.0.1.12
+</pre></div></div>
+
+<p><b>Configure passwordless ssh from your current client that runs the scripts to all nodes listed in <tt>conf/inventory</tt> as well as <tt>localhost</tt>.</b> If the ssh user account for target machines is different from your current username, please uncomment and edit the following two lines:</p>
+
+<div>
+<div>
+<pre class="source"> ;[all:vars]
+ ;ansible_ssh_user=&lt;fill with your ssh account username&gt;
+</pre></div></div>
+
+<p>If you want to specify advanced Ansible builtin variables, please refer to the <a class="externalLink" href="http://docs.ansible.com/ansible/intro_inventory.html">Ansible documentation</a>.</p>
+</li>
+<li>
+
+<p><b>Remote working directories</b>. Edit <tt>conf/instance_settings.yml</tt> to change the remote binary directory (the variable &#x201c;binarydir&#x201d;) when necessary. By default, the binary directory will be under the home directory (as the value of Ansible builtin variable ansible_env.HOME) of the ssh user account on each node.</p>
+</li>
+</ul></div>
+<div class="section">
+<h2><a name="Cluster_Lifecycle_Management"></a><a name="lifecycle" id="lifecycle">Cluster Lifecycle Management</a></h2>
+<ul>
+
+<li>
+
+<p>Deploy the binary to all nodes:</p>
+
+<div>
+<div>
+<pre class="source"> $ bin/deploy.sh
+</pre></div></div>
+</li>
+<li>
+
+<p>Every time before starting the AsterixDB cluster, you can edit the instance configuration file <tt>conf/instance/cc.conf</tt>, except that IP addresses/DNS names are generated and cannot be changed. All available parameters and their usage can be found <a href="ncservice.html#Parameters">here</a>.</p>
+</li>
+<li>
+
+<p>Launch your AsterixDB cluster:</p>
+
+<div>
+<div>
+<pre class="source"> $ bin/start.sh
+</pre></div></div>
+
+<p>Now you can use the multi-node AsterixDB cluster by opening the master node listed in <tt>conf/inventory</tt> at port <tt>19001</tt> (which can be customized in <tt>conf/instance/cc.conf</tt>) in your browser.</p>
+</li>
+<li>
+
+<p>If you want to stop the the multi-node AsterixDB cluster, run the following script:</p>
+
+<div>
+<div>
+<pre class="source"> $ bin/stop.sh
+</pre></div></div>
+</li>
+<li>
+
+<p>If you want to remove the binary on all nodes, run the following script:</p>
+
+<div>
+<div>
+<pre class="source"> $ bin/erase.sh
+</pre></div></div>
+</li>
+</ul></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/docs/0.9.9/aql/builtins.html b/docs/0.9.9/aql/builtins.html
new file mode 100644
index 0000000..1dd3e91
--- /dev/null
+++ b/docs/0.9.9/aql/builtins.html
@@ -0,0 +1,12409 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/aql/builtins.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Builtin Functions</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+    <script type="text/javascript" src="../js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href=".././" id="bannerLeft"><img src="../images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="../index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="../ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="../ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="../aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="../sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="../datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="../sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="../SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="../sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="../api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="../csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="../aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="../feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="../udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="../sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="../sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="../sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="../geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="../geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="../interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="../spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="../sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="../aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li class="active"><a href="#"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href=".././" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="../images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>Builtin Functions</h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="toc" id="toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#NumericFunctions">Numeric Functions</a></li>
+<li><a href="#StringFunctions">String Functions</a></li>
+<li><a href="#BinaryFunctions">Binary Functions</a></li>
+<li><a href="#SpatialFunctions">Spatial Functions</a></li>
+<li><a href="#SimilarityFunctions">Similarity Functions</a></li>
+<li><a href="#TokenizingFunctions">Tokenizing Functions</a></li>
+<li><a href="#TemporalFunctions">Temporal Functions</a></li>
+<li><a href="#ObjectFunctions">Object Functions</a></li>
+<li><a href="#AggregateFunctions">Aggregate Functions (Array Functions)</a></li>
+<li><a href="#ComparisonFunctions">Comparison Functions</a></li>
+<li><a href="#TypeFunctions">Type Functions</a></li>
+<li><a href="#ConditionalFunctions">Conditional Functions</a></li>
+<li><a href="#MiscFunctions">Miscellaneous Functions</a></li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<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><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Numeric_Functions"></a><a name="NumericFunctions" id="NumericFunctions">Numeric Functions</a></h2>
+<div class="section">
+<h3><a name="abs"></a>abs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">abs(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the absolute value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The absolute value of the argument with the same type as the input argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="acos"></a>acos</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">acos(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc cosine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error,</li>
+<li>&#x201c;NaN&#x201d; for other legitimate numeric values.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="asin"></a>asin</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">asin(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc sine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error,</li>
+<li>&#x201c;NaN&#x201d; for other legitimate numeric values.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="atan"></a>atan</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">atan(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc tangent value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> arc tangent in radians for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="atan2"></a>atan2</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">atan2(numeric_value1, numeric_value2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc tangent value of numeric_value2/numeric_value1.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> arc tangent in radians for <tt>numeric_value1</tt> and <tt>numeric_value2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 0.4636476090008061, &quot;v2&quot;: 0.0, &quot;v3&quot;: 2.356194490192345 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ceil"></a>ceil</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ceil(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The ceiling value for the given number in the same type as the input argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: ceil(2013),
+  &quot;v2&quot;: ceil(-4036),
+  &quot;v3&quot;: ceil(0.3),
+  &quot;v4&quot;: ceil(float(&quot;-2013.2&quot;)),
+  &quot;v5&quot;: ceil(double(&quot;-2013.893823748327284&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="cos"></a>cos</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">cos(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the cosine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> cosine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="cosh"></a>cosh</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">cosh(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the hyperbolic cosine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> hyperbolic cosine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="degrees"></a>degrees</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">degrees(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts radians to degrees</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The degrees value for the given radians value. The returned value has type <tt>double</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: degrees(pi()) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 180.0 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="e"></a>e</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">e()
+</pre></div></div>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>e (base of the natural logarithm)</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: e() };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 2.718281828459045 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="exp"></a>exp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">exp(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes e<sup>numeric_value</sup>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>e<sup>numeric_value</sup>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="floor"></a>floor</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">floor(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The floor value for the given number in the same type as the input argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: floor(2013),
+  &quot;v2&quot;: floor(-4036),
+  &quot;v3&quot;: floor(0.8),
+  &quot;v4&quot;: floor(float(&quot;-2013.2&quot;)),
+  &quot;v5&quot;: floor(double(&quot;-2013.893823748327284&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ln"></a>ln</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ln(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes log<sub>e</sub>numeric_value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>log<sub>e</sub>numeric_value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="log"></a>log</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">log(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes log<sub>10</sub>numeric_value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>log<sub>10</sub>numeric_value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="pi"></a>pi</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">pi()
+</pre></div></div>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>Pi</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: pi() };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 3.141592653589793 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="power"></a>power</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">power(numeric_value1, numeric_value2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes numeric_value1<sup>numeric_value2</sup>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>numeric_value1<sup>numeric_value2</sup>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 1, &quot;v3&quot;: 0, &quot;v4&quot;: 1.4142135623730951 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="radians"></a>radians</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">radians(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts degrees to radians</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The radians value for the given degrees value. The returned value has type <tt>double</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: radians(180) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 3.141592653589793 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="round"></a>round</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">round(numeric_value[, round_digit])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The rounded value for the given number. The returned value has the following type:
+<ul>
+
+<li><tt>bigint</tt> if the input value has type <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt> or <tt>bigint</tt>,</li>
+<li><tt>float</tt> if the input value has type <tt>float</tt>,</li>
+<li><tt>double</tt> if the input value has type <tt>double</tt>;</li>
+</ul>
+</li>
+<li><tt>missing</tt> if the input value is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the input value is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will return a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: round(2013),
+  &quot;v2&quot;: round(-4036),
+  &quot;v3&quot;: round(0.8),
+  &quot;v4&quot;: round(float(&quot;-2013.256&quot;)),
+  &quot;v5&quot;: round(double(&quot;-2013.893823748327284&quot;))
+  &quot;v6&quot;: round(123456, -1),
+  &quot;v7&quot;: round(456.456, 2),
+  &quot;v8&quot;: round(456.456, -1),
+  &quot;v9&quot;: round(-456.456, -2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sign"></a>sign</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sign(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the sign of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the sign (a <tt>tinyint</tt>) of the argument, -1 for negative values, 0 for 0, and 1 for positive values,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 1, &quot;v2&quot;: 1, &quot;v3&quot;: 0, &quot;v4&quot;: 1, &quot;v5&quot;: -1 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sin"></a>sin</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sin(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the sine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> sine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sinh"></a>sinh</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sinh(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the hyperbolic sine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> hyperbolic sine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sqrt"></a>sqrt</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sqrt(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the square root of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> square root value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="tan"></a>tan</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">tan(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the tangent value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> tangent value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="tanh"></a>tanh</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">tanh(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the hyperbolic tangent value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> hyperbolic tangent value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="trunc"></a>trunc</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">trunc(numeric_value, number_digits)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<li><tt>number_digits</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> tangent value for the argument,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is <tt>missing</tt>,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-numeric value,</li>
+<li>the second argument is any other non-tinyint, non-smallint, non-integer, and non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="round_half_to_even"></a>round_half_to_even</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">round_half_to_even(numeric_value, [precision])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The rounded value for the given number in the same type as the input argument,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-numeric value,</li>
+<li>or, the second argument is any other non-tinyint, non-smallint, non-integer, or non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: round_half_to_even(2013),
+  &quot;v2&quot;: round_half_to_even(-4036),
+  &quot;v3&quot;: round_half_to_even(0.8),
+  &quot;v4&quot;: round_half_to_even(float(&quot;-2013.256&quot;)),
+  &quot;v5&quot;: round_half_to_even(double(&quot;-2013.893823748327284&quot;)),
+  &quot;v6&quot;: round_half_to_even(double(&quot;-2013.893823748327284&quot;), 2),
+  &quot;v7&quot;: round_half_to_even(2013, 4),
+  &quot;v8&quot;: round_half_to_even(float(&quot;-2013.256&quot;), 5)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="String_Functions"></a><a name="StringFunctions" id="StringFunctions">String Functions</a></h2>
+<div class="section">
+<h3><a name="concat"></a>concat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">concat(string1, string2, ...)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a concatenated string from arguments.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string1</tt>: a string value,</li>
+<li><tt>string2</tt>: a string value,</li>
+<li>&#x2026;.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a concatenated string from arguments,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">concat(&quot;test &quot;, &quot;driven &quot;, &quot;development&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;test driven development&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="contains"></a>contains</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">contains(string, substring_to_contain)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> contains the string <tt>substring_to_contain</tt></p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the given substring,</li>
+<li><tt>substring_to_contain</tt> : a target <tt>string</tt> that might be contained.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value, <tt>true</tt> if <tt>string</tt> contains <tt>substring_to_contain</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error,</li>
+<li><tt>false</tt> otherwise.</li>
+</ul>
+</li>
+<li>
+
+<p>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</p>
+</li>
+<li>Example:
+
+<div>
+<div>
+<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;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ends_with"></a>ends_with</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ends_with(string, substring_to_end_with)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> ends with the string <tt>substring_to_end_with</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might end with the given string,</li>
+<li><tt>substring_to_end_with</tt> : a <tt>string</tt> that might be contained as the ending substring.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value, <tt>true</tt> if <tt>string</tt> contains <tt>substring_to_contain</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error,</li>
+<li><tt>false</tt> otherwise.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: ends_with(&quot; love product-b its shortcut_menu is awesome:)&quot;, &quot;:)&quot;),
+  &quot;v2&quot;: ends_with(&quot; awsome:)&quot;, &quot;:-)&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="initcap_.28or_title.29"></a>initcap (or title)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">initcap(string)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> as the title form of the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: initcap(&quot;ASTERIXDB is here!&quot;), &quot;v2&quot;: title(&quot;ASTERIXDB is here!&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;Asterixdb Is Here!&quot;, &quot;v2&quot;: &quot;Asterixdb Is Here!&quot; }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="length"></a>length</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">length(string)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> or <tt>null</tt> that represents the string to be checked.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> that represents the length of <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">length(&quot;test string&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">11
+</pre></div></div>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">length(&quot;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (the emoji character &#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466; has 7 code points):</p>
+
+<div>
+<div>
+<pre class="source">7
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="lower"></a>lower</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">lower(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts a given string <tt>string</tt> to its lowercase form.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> as the lowercase form of the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">lower(&quot;ASTERIXDB&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;asterixdb&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ltrim"></a>ltrim</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ltrim(string[, chars]);
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
+<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a trimmed, new <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Related functions: see <tt>trim()</tt>, <tt>rtrim()</tt></li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">ltrim(&quot;me like x-phone&quot;, &quot;eml&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot; like x-phone&quot;
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
+
+<div>
+<div>
+<pre class="source">ltrim(&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;, &quot;&#x1f468;&#x200d;&#x1f466;&quot;)
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (only woman, girl and boy are left in the family):</p>
+
+<div>
+<div>
+<pre class="source">&quot;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="position"></a>position</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">position(string, string_pattern)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<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>
+<ul>
+
+<li>0-based: <tt>position</tt>, <tt>pos</tt>, <tt>position0</tt>, <tt>pos0</tt>.</li>
+<li>1-based: <tt>position1</tt>, <tt>pos1</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: position(&quot;ppphonepp&quot;, &quot;phone&quot;),
+  &quot;v2&quot;: position(&quot;hone&quot;, &quot;phone&quot;),
+  &quot;v3&quot;: position1(&quot;ppphonepp&quot;, &quot;phone&quot;),
+  &quot;v4&quot;: position1(&quot;hone&quot;, &quot;phone&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 2, &quot;v2&quot;: -1, v3&quot;: 3, &quot;v4&quot;: -1 }
+</pre></div></div>
+</li>
+<li>
+
+<p>Example of multi-code-point character:</p>
+
+<div>
+<div>
+<pre class="source">position(&quot;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x1f3c0;&quot;, &quot;&#x1f3c0;&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (the emoji family character has 7 code points):</p>
+
+<div>
+<div>
+<pre class="source">7
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_contains"></a>regexp_contains</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_contains(string, string_pattern[, string_flags])
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the strings <tt>string</tt> contains the regular expression pattern <tt>string_pattern</tt> (a Java regular expression pattern).</p>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li><tt>regexp_contains</tt>, <tt>regex_contains</tt>, <tt>contains_regexp</tt>, <tt>contains_regex</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: regexp_contains(&quot;pphonepp&quot;, &quot;p*hone&quot;),
+  &quot;v2&quot;: regexp_contains(&quot;hone&quot;, &quot;p+hone&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_like"></a>regexp_like</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_like(string, string_pattern[, string_flags])
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> exactly matches the regular expression pattern <tt>string_pattern</tt> (a Java regular expression pattern).</p>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li><tt>regexp_like</tt>, <tt>regex_like</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> that might be contained.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: regexp_like(&quot; can't stand acast the network is horrible:(&quot;, &quot;.*acast.*&quot;),
+  &quot;v2&quot;: regexp_like(&quot;acast&quot;, &quot;.*acst.*&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_position"></a>regexp_position</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_position(string, string_pattern[, string_flags])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<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>
+<li>1-Based: <tt>regexp_position1</tt>, <tt>regexp_pos1</tt>, <tt>regex_position1</tt> <tt>regex_pos1</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: regexp_position(&quot;pphonepp&quot;, &quot;p*hone&quot;),
+  &quot;v2&quot;: regexp_position(&quot;hone&quot;, &quot;p+hone&quot;),
+  &quot;v3&quot;: regexp_position1(&quot;pphonepp&quot;, &quot;p*hone&quot;),
+  &quot;v4&quot;: regexp_position1(&quot;hone&quot;, &quot;p+hone&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 0, &quot;v2&quot;: -1, &quot;v3&quot;: 1, &quot;v4&quot;: -1 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_replace"></a>regexp_replace</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_replace(string, string_pattern, string_replacement[, string_flags])
+regexp_replace(string, string_pattern, string_replacement[, replacement_limit])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li><tt>regexp_replace</tt>, <tt>regex_replace</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+<li><tt>string_replacement</tt> : a pattern <tt>string</tt> to be used as the replacement.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during replace.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>Returns a <tt>string</tt> that is obtained after the replacements.</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;like product-a the voicemail_service is awesome&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="repeat"></a>repeat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">repeat(string, n)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a string formed by repeating the input <tt>string</tt> <tt>n</tt> times.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be repeated,</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a string that repeats the input <tt>string</tt> <tt>n</tt> times,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-string value,</li>
+<li>or, the second argument is not a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt>.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">repeat(&quot;test&quot;, 3);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;testtesttest&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="replace"></a>replace</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">replace(string, search_string, replacement_string[, limit])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : an input <tt>string</tt>,</li>
+<li><tt>search_string</tt> : a <tt>string</tt>  substring to be searched for,</li>
+<li><tt>replacement_string</tt> : a <tt>string</tt> to be used as the replacement,</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>Returns a <tt>string</tt> that is obtained after the replacements,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value or non-integer <tt>limit</tt> will cause a type error,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: replace(&quot; like x-phone the voicemail_service is awesome&quot;, &quot; like x-phone&quot;, &quot;like product-a&quot;),
+  &quot;v2&quot;: replace(&quot;x-phone and x-phone&quot;, &quot;x-phone&quot;, &quot;product-a&quot;, 1)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: &quot;like product-a the voicemail_service is awesome&quot;,
+  &quot;v2&quot;: &quot;product-a and x-phone&quot;
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="reverse"></a>reverse</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">reverse(string)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be reversed</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a string containing characters from the the input <tt>string</tt> in the reverse order,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-string value</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">reverse(&quot;hello&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;olleh&quot;
+</pre></div></div>
+</li>
+<li>
+
+<p>Example of multi-code-point character (Korean):</p>
+
+<div>
+<div>
+<pre class="source">reverse(&quot;&#x1112;&#x1161;&#x11ab;&#x1100;&#x1173;&#x11af;&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (the Korean characters are splitted into code points and then the code points are reversed):</p>
+
+<div>
+<div>
+<pre class="source">&quot;&#x11af;&#x1173;&#x1100;&#x11ab;&#x1161;&#x1112;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="rtrim"></a>rtrim</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">rtrim(string[, chars]);
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
+<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a trimmed, new <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Related functions: see <tt>trim()</tt>, <tt>ltrim()</tt></li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: rtrim(&quot;i like x-phone&quot;, &quot;x-phone&quot;),
+  &quot;v2&quot;: rtrim(&quot;i like x-phone&quot;, &quot;onexph&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;i like &quot;, &quot;v2&quot;: &quot;i like x-&quot; }
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
+
+<div>
+<div>
+<pre class="source">rtrim(&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;, &quot;&#x1f468;&#x200d;&#x1f466;&quot;)
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (only man, woman and girl are left in the family):</p>
+
+<div>
+<div>
+<pre class="source">&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="split"></a>split</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">split(string, sep)
+</pre></div></div>
+</li>
+<li>
+
+<p>Splits the input <tt>string</tt> into an array of substrings separated by the string <tt>sep</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be split.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an array of substrings by splitting the input <tt>string</tt> by <tt>sep</tt>,</li>
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">split(&quot;test driven development&quot;, &quot; &quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;test&quot;, &quot;driven&quot;, &quot;development&quot; ]
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with two consecutive <tt>sep</tt>s in the <tt>string</tt>:</p>
+
+<div>
+<div>
+<pre class="source">split(&quot;123//456&quot;, &quot;/&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;123&quot;, &quot;&quot;, &quot;456&quot; ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="starts_with"></a>starts_with</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">starts_with(string, substring_to_start_with)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> starts with the string <tt>substring_to_start_with</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might start with the given string.</li>
+<li><tt>substring_to_start_with</tt> : a <tt>string</tt> that might be contained as the starting substring.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt>, returns <tt>true</tt> if <tt>string</tt> starts with the string <tt>substring_to_start_with</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error,</li>
+<li><tt>false</tt> otherwise.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot; : starts_with(&quot; like the plan, amazing&quot;, &quot; like&quot;),
+  &quot;v2&quot; : starts_with(&quot;I like the plan, amazing&quot;, &quot; like&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="substr"></a>substr</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">substr(string, offset[, length])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li>0-Based: <tt>substring</tt>, <tt>substr</tt>, <tt>substring0</tt>, <tt>substr0</tt>.</li>
+<li>1-Based: <tt>substring1</tt>, <tt>substr1</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the substring,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<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>
+<li>a <tt>null</tt> will be returned if:
+<ul>
+
+<li>the first argument is any other non-string value.</li>
+<li>the second argument is not a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt>.</li>
+<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>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: substr(&quot;test string&quot;, 6, 3), &quot;v2&quot;: substr1(&quot;test string&quot;, 6, 3) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;tri&quot;, &quot;v2&quot;: &quot;str&quot; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>substring</tt>.</p></div>
+<div class="section">
+<h3><a name="trim"></a>trim</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">trim(string[, chars]);
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
+<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a trimmed, new <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Related functions: see <tt>ltrim()</tt>, <tt>rtrim()</tt></li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">trim(&quot;i like x-phone&quot;, &quot;xphoen&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot; like &quot;
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
+<p>trim(&#x201c;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x201d;, &#x201c;&#x1f468;&#x200d;&#x1f466;&#x201d;)</p>
+</li>
+<li>
+
+<p>The expected result is (only woman and girl are left in the family):</p>
+
+<div>
+<div>
+<pre class="source"> &quot;&#x1f469;&#x200d;&#x1f467;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="upper"></a>upper</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">upper(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts a given string <tt>string</tt> to its uppercase form.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> as the uppercase form of the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">upper(&quot;hello&quot;)
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;HELLO&quot;
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="string_concat"></a>string_concat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">string_concat(array)
+</pre></div></div>
+</li>
+<li>
+
+<p>Concatenates an array of strings <tt>array</tt> into a single string.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the concatenated <tt>string</tt> value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-integer element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">string_concat([&quot;ASTERIX&quot;, &quot; &quot;, &quot;ROCKS!&quot;]);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;ASTERIX ROCKS!&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="string_join"></a>string_join</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">string_join(array, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Joins an array or multiset of strings <tt>array</tt> with the given separator <tt>string</tt> into a single string.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array</tt> : an <tt>array</tt> or <tt>multiset</tt> of strings (could be <tt>null</tt>) to be joined.</li>
+<li><tt>string</tt> : a <tt>string</tt> to serve as the separator.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the joined <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if the first argument array contains a <tt>missing</tt>,</li>
+<li><tt>null</tt> if the first argument array contains a <tt>null</tt> but does not contain a <tt>missing</tt>,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-array value, or contains any other non-string value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">string_join([&quot;ASTERIX&quot;, &quot;ROCKS~&quot;], &quot;!! &quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;ASTERIX!! ROCKS~&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="string_to_codepoint"></a>string_to_codepoint</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">string_to_codepoint(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts the string <tt>string</tt> to its code_based representation.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that will be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> of the code points for the string <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">string_to_codepoint(&quot;Hello ASTERIX!&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ 72, 101, 108, 108, 111, 32, 65, 83, 84, 69, 82, 73, 88, 33 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="codepoint_to_string"></a>codepoint_to_string</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">codepoint_to_string(array)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts the ordered code_based representation <tt>array</tt> to the corresponding string.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array</tt> : an <tt>array</tt> of integer code_points.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> representation of <tt>array</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-integer element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">codepoint_to_string([72, 101, 108, 108, 111, 32, 65, 83, 84, 69, 82, 73, 88, 33]);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;Hello ASTERIX!&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="substring_before"></a>substring_before</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">substring_before(string, string_pattern)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the substring from the given string <tt>string</tt> before the given pattern <tt>string_pattern</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
+<li><tt>string_pattern</tt> : a <tt>string</tt> pattern to be searched.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the substring,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">substring_before(&quot; like x-phone&quot;, &quot;x-phone&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot; like &quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="substring_after"></a>substring_after</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>substring_after(string, string_pattern);</p>
+</li>
+<li>
+
+<p>Returns the substring from the given string <tt>string</tt> after the given pattern <tt>string_pattern</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
+<li><tt>string_pattern</tt> : a <tt>string</tt> pattern to be searched.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the substring,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">substring_after(&quot; like x-phone&quot;, &quot;xph&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;one&quot;
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Binary_Functions"></a><a name="BinaryFunctions" id="BinaryFunctions">Binary Functions</a></h2>
+<div class="section">
+<h3><a name="parse_binary"></a>parse_binary</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>parse_binary(string, encoding)</p>
+</li>
+<li>
+
+<p>Creates a <tt>binary</tt> from an string encoded in <tt>encoding</tt> format.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : an encoded <tt>string</tt>,</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>binary</tt> that is decoded from the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<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>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>[ hex(&#x201c;ABCDEF0123456789&#x201d;), hex(&#x201c;ABCDEF0123456789&#x201d;), hex(&#x201c;4173746572697801&#x201d;) ]</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="print_binary"></a>print_binary</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>print_binary(binary, encoding)</p>
+</li>
+<li>
+
+<p>Prints a <tt>binary</tt> to the required encoding <tt>string</tt> format.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>binary</tt> : a <tt>binary</tt> data need to be printed.</li>
+<li><tt>encoding</tt> : a string notation specifies the expected encoding type. Currently we support <tt>hex</tt> and <tt>base64</tt> format.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the encoded format of a <tt>binary</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">[ print_binary(hex(&quot;ABCDEF0123456789&quot;), &quot;base64&quot;), print_binary(base64(&quot;q83vASNFZ4k=&quot;), &quot;hex&quot;) ]
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result are:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;q83vASNFZ4k=&quot;, &quot;ABCDEF0123456789&quot; ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="binary_length"></a>binary_length</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>binary_length(binary)</p>
+</li>
+<li>
+
+<p>Returns the number of bytes storing the binary data.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>binary</tt> : a <tt>binary</tt> value to be checked.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> that represents the number of bytes,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-binary input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">binary_length(hex(&quot;00AA&quot;))
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>2</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sub_binary"></a>sub_binary</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>sub_binary(binary, offset[, length])</p>
+</li>
+<li>
+
+<p>Returns the sub binary from the given <tt>binary</tt> based on the given start offset with the optional <tt>length</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>binary</tt> : a <tt>binary</tt> to be extracted,</li>
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>binary</tt> that represents the sub binary,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-binary value,</li>
+<li>or, the second argument is any other non-integer value,</li>
+<li>or, the third argument is any other non-integer value, if it is present.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">sub_binary(hex(&quot;AABBCCDD&quot;), 4);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is</p>
+
+<div>
+<div>
+<pre class="source">hex(&quot;DD&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="binary_concat"></a>binary_concat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>binary_concat(array)</p>
+</li>
+<li>
+
+<p>Concatenates a binary <tt>array</tt> or <tt>multiset</tt> into a single binary.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value  :
+<ul>
+
+<li>the concatenated <tt>binary</tt> value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-binary element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>binary_concat([hex(&#x201c;42&#x201d;), hex(&quot;&quot;), hex(&#x2018;42&#x2019;)]);</p>
+</li>
+<li>
+
+<p>The expected result is</p>
+<p>hex(&#x201c;4242&#x201d;)</p>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Spatial_Functions"></a><a name="SpatialFunctions" id="SpatialFunctions">Spatial Functions</a></h2>
+<div class="section">
+<h3><a name="create_point"></a>create_point</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_point(x, y)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>point</tt> using an <tt>x</tt> and <tt>y</tt> value.</p>
+</li>
+<li>Arguments:</li>
+<li><tt>x</tt> : a <tt>double</tt> that represents the x-coordinate,</li>
+<li><tt>y</tt> : a <tt>double</tt> that represents the y-coordinate.</li>
+<li>Return Value:</li>
+<li>a <tt>point</tt> representing the ordered pair (<tt>x</tt>, <tt>y</tt>),</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-double input value will cause a type error.</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;point&quot;: create_point(30.0,70.0) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;point&quot;: point(&quot;30.0,70.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_line"></a>create_line</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_line(point1, point2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>line</tt> using <tt>point1</tt> and <tt>point2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt> that represents the start point of the line.</li>
+<li><tt>point2</tt> : a <tt>point</tt> that represents the end point of the line.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a spatial <tt>line</tt> created using the points provided in <tt>point1</tt> and <tt>point2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;line&quot;: create_line(create_point(30.0,70.0), create_point(50.0,90.0)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;line&quot;: line(&quot;30.0,70.0 50.0,90.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_rectangle"></a>create_rectangle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_rectangle(point1, point2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>rectangle</tt> using <tt>point1</tt> and <tt>point2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt> that represents the lower_left point of the rectangle.</li>
+<li><tt>point2</tt> : a <tt>point</tt> that represents the upper_right point of the rectangle.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a spatial <tt>rectangle</tt> created using the points provided in <tt>point1</tt> and <tt>point2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;rectangle&quot;: create_rectangle(create_point(30.0,70.0), create_point(50.0,90.0)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;rectangle&quot;: rectangle(&quot;30.0,70.0 50.0,90.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_circle"></a>create_circle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_circle(point, radius)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>circle</tt> using <tt>point</tt> and <tt>radius</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point</tt> : a <tt>point</tt> that represents the center of the circle.</li>
+<li><tt>radius</tt> : a <tt>double</tt> that represents the radius of the circle.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a spatial <tt>circle</tt> created using the center point and the radius provided in <tt>point</tt> and <tt>radius</tt>.</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-point value,</li>
+<li>or, the second argument is any other non-double value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;circle&quot;: create_circle(create_point(30.0,70.0), 5.0) }
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;circle&quot;: circle(&quot;30.0,70.0 5.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_polygon"></a>create_polygon</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_polygon(array)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array</tt> : an array of doubles representing the points of the polygon.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>polygon</tt>, represents a spatial simple polygon created using the points provided in <tt>array</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-double element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;polygon&quot;: create_polygon([1.0,1.0,2.0,2.0,3.0,3.0,4.0,4.0]) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_x.2Fget_y"></a>get_x/get_y</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_x(point) or get_y(point)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the x or y coordinates of a point <tt>point</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point</tt> : a <tt>point</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> representing the x or y coordinates of the point <tt>point</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;x_coordinate&quot;: 2.3, &quot;y_coordinate&quot;: 5.0 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_points"></a>get_points</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_points(spatial_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an ordered array of the points forming the spatial object <tt>spatial_object</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>spatial_object</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> of the points forming the spatial object <tt>spatial_object</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-spatial-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_points(create_polygon([1.0,1.0,2.0,2.0,3.0,3.0,4.0,4.0]))
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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;) ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_center.2Fget_radius"></a>get_center/get_radius</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_center(circle_expression) or get_radius(circle_expression)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the center and the radius of a circle <tt>circle_expression</tt>, respectively.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>circle_expression</tt> : a <tt>circle</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>point</tt> or <tt>double</tt>, represent the center or radius of the circle <tt>circle_expression</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-circle input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;circle_radius&quot;: get_radius(create_circle(create_point(6.0,3.0), 1.0)),
+  &quot;circle_center&quot;: get_center(create_circle(create_point(6.0,3.0), 1.0))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;circle_radius&quot;: 1.0, &quot;circle_center&quot;: point(&quot;6.0,3.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_distance"></a>spatial_distance</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_distance(point1, point2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the Euclidean distance between <tt>point1</tt> and <tt>point2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt>.</li>
+<li><tt>point2</tt> : a <tt>point</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> as the Euclidean distance between <tt>point1</tt> and <tt>point2</tt>.</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">spatial_distance(point(&quot;47.44,80.65&quot;), create_point(30.0,70.0));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">20.434678857275934
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_area"></a>spatial_area</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_area(spatial_2d_expression)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the spatial area of <tt>spatial_2d_expression</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>spatial_2d_expression</tt> : a <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> representing the area of <tt>spatial_2d_expression</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-2d-spatial-object will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">spatial_area(create_circle(create_point(0.0,0.0), 5.0));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">78.53981625
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_intersect"></a>spatial_intersect</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_intersect(spatial_object1, spatial_object2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether <tt>@arg1</tt> and <tt>@arg2</tt> spatially intersect each other.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>spatial_object1</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+<li><tt>spatial_object2</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> representing whether <tt>spatial_object1</tt> and <tt>spatial_object2</tt> spatially overlap with each other,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-spatial-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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)));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">true
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_cell"></a>spatial_cell</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_cell(point1, point2, x_increment, y_increment)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the grid cell that <tt>point1</tt> belongs to.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt> representing the point of interest that its grid cell will be returned.</li>
+<li><tt>point2</tt> : a <tt>point</tt> representing the origin of the grid.</li>
+<li><tt>x_increment</tt> : a <tt>double</tt>, represents X increments.</li>
+<li><tt>y_increment</tt> : a <tt>double</tt>, represents Y increments.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>rectangle</tt> representing the grid cell that <tt>point1</tt> belongs to,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-point value,</li>
+<li>or, the second or third argument is any other non-double value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">spatial_cell(point(&quot;39.28,70.48&quot;), create_point(20.0,50.0), 5.5, 6.0);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">rectangle(&quot;36.5,68.0 42.0,74.0&quot;);
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Similarity_Functions"></a><a name="SimilarityFunctions" id="SimilarityFunctions">Similarity Functions</a></h2>
+<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>
+<div class="section">
+<h3><a name="edit_distance"></a>edit_distance</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">edit_distance(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the edit distance of <tt>expression1</tt> and <tt>expression2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
+<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> that represents the edit distance between <tt>expression1</tt> and <tt>expression2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">edit_distance(&quot;SuzannaTillson&quot;, &quot;Suzanna Tilson&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">2
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="edit_distance_check"></a>edit_distance_check</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">edit_distance_check(expression1, expression2, threshold)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the edit distance of <tt>expression1</tt> and <tt>expression2</tt> is within a given threshold.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
+<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
+<li><tt>threshold</tt> : a <tt>bigint</tt> that represents the distance threshold.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> with two items:
+<ul>
+
+<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>
+<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>
+<li>If the first item is false, then the second item is set to 2147483647.</li>
+</ul>
+</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-string value,</li>
+<li>or, the third argument is any other non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">edit_distance_check(&quot;happy&quot;,&quot;hapr&quot;,2);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ true, 2 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="edit_distance_contains"></a>edit_distance_contains</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">edit_distance_contains(expression1, expression2, threshold)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
+<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
+<li><tt>threshold</tt> : a <tt>bigint</tt> that represents the distance threshold.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> with two items:
+<ul>
+
+<li>The first item contains a <tt>boolean</tt> value representing whether <tt>expression1</tt> can contain <tt>expression2</tt>.</li>
+<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>
+</ul>
+</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-string value,</li>
+<li>or, the third argument is any other non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">edit_distance_contains(&quot;happy&quot;,&quot;hapr&quot;,2);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ true, 1 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="similarity_jaccard"></a>similarity_jaccard</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">similarity_jaccard(array1, array2)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array1</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+<li><tt>array2</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>float</tt> that represents the Jaccard similarity of <tt>array1</tt> and <tt>array2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if any element in any input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-integer element in any input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Note: a <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">keyword index</a> can be utilized for this function.</p>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">similarity_jaccard([1,5,8,9], [1,5,9,10]);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0.6
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="similarity_jaccard_check"></a>similarity_jaccard_check</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">similarity_jaccard_check(array1, array2, threshold)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>array1</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+<li><tt>array2</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+<li><tt>threshold</tt> : a <tt>double</tt> that represents the similarity threshold.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> with two items:
+<ul>
+
+<li>The first item contains a <tt>boolean</tt> value representing whether <tt>array1</tt> and <tt>array2</tt> are similar.</li>
+<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>
+</ul>
+</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if any element in any input array is <tt>missing</tt>,</li>
+<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>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-array value,
+<ul>
+
+<li>or, the third argument is any other non-double value.</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Note: a <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">keyword index</a> can be utilized for this function.</p>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">similarity_jaccard_check([1,5,8,9], [1,5,9,10], 0.6);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ false, 0.0 ]
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Tokenizing_Functions"></a><a name="TokenizingFunctions" id="TokenizingFunctions">Tokenizing Functions</a></h2>
+<div class="section">
+<h3><a name="word_tokens"></a>word_tokens</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">word_tokens(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an array of word tokens of <tt>string</tt> using non_alphanumeric characters as delimiters.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that will be tokenized.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> of <tt>string</tt> word tokens,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">word_tokens(&quot;I like the phone, awesome!&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;i&quot;, &quot;like&quot;, &quot;the&quot;, &quot;phone&quot;, &quot;awesome&quot; ]
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Temporal_Functions"></a><a name="TemporalFunctions" id="TemporalFunctions">Temporal Functions</a></h2>
+<div class="section">
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_year/get_month/get_day/get_hour/get_minute/get_second/get_millisecond(temporal_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Accessors for accessing fields in a temporal value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> value representing the field to be extracted,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;year&quot;: get_year(date(&quot;2010-10-30&quot;)),
+  &quot;month&quot;: get_month(datetime(&quot;1987-11-19T23:49:23.938&quot;)),
+  &quot;day&quot;: get_day(date(&quot;2010-10-30&quot;)),
+  &quot;hour&quot;: get_hour(time(&quot;12:23:34.930&quot;)),
+  &quot;min&quot;: get_minute(duration(&quot;P3Y73M632DT49H743M3948.94S&quot;)),
+  &quot;second&quot;: get_second(datetime(&quot;1987-11-19T23:49:23.938&quot;)),
+  &quot;ms&quot;: get_millisecond(duration(&quot;P3Y73M632DT49H743M3948.94S&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;year&quot;: 2010, &quot;month&quot;: 11, &quot;day&quot;: 30, &quot;hour&quot;: 12, &quot;min&quot;: 28, &quot;second&quot;: 23, &quot;ms&quot;: 94 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="adjust_datetime_for_timezone"></a>adjust_datetime_for_timezone</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">adjust_datetime_for_timezone(datetime, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Adjusts the given datetime <tt>datetime</tt> by applying the timezone information <tt>string</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt> : a <tt>datetime</tt> value to be adjusted.</li>
+<li><tt>string</tt> : a <tt>string</tt> representing the timezone information.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> value representing the new datetime after being adjusted by the timezone information,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-datetime value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">adjust_datetime_for_timezone(datetime(&quot;2008-04-26T10:10:00&quot;), &quot;+08:00&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;2008-04-26T18:10:00.000+08:00&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="adjust_time_for_timezone"></a>adjust_time_for_timezone</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">adjust_time_for_timezone(time, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Adjusts the given time <tt>time</tt> by applying the timezone information <tt>string</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>time</tt> : a <tt>time</tt> value to be adjusted.</li>
+<li><tt>string</tt> : a <tt>string</tt> representing the timezone information.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> value representing the new time after being adjusted by the timezone information,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-time value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">adjust_time_for_timezone(get_time_from_datetime(datetime(&quot;2008-04-26T10:10:00&quot;)), &quot;+08:00&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;18:10:00.000+08:00&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="calendar_duration_from_datetime"></a>calendar_duration_from_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">calendar_duration_from_datetime(datetime, duration_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a user_friendly representation of the duration <tt>duration_value</tt> based on the given datetime <tt>datetime</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt> : a <tt>datetime</tt> value to be used as the reference time point.</li>
+<li><tt>duration_value</tt> : a <tt>duration</tt> value to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>duration</tt> value with the duration as <tt>duration_value</tt> but with a user_friendly representation,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-datetime value,</li>
+<li>or, the second argument is any other non-duration input value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">calendar_duration_from_datetime(
+      datetime(&quot;2016-03-26T10:10:00&quot;),
+      datetime(&quot;2016-03-26T10:10:00&quot;) - datetime(&quot;2011-01-01T00:00:00&quot;)
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">duration(&quot;P5Y2M24DT10H10M&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_year_month_duration.2Fget_day_time_duration"></a>get_year_month_duration/get_day_time_duration</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_year_month_duration/get_day_time_duration(duration_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Extracts the correct <tt>duration</tt> subtype from <tt>duration_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>duration_value</tt> : a <tt>duration</tt> value to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>year_month_duration</tt> value or a <tt>day_time_duration</tt> value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_year_month_duration(duration(&quot;P12M50DT10H&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">year_month_duration(&quot;P1Y&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">months_from_year_month_duration/ms_from_day_time_duration(duration_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Extracts the number of months or the number of milliseconds from the <tt>duration</tt> subtype.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>duration_value</tt> : a <tt>duration</tt> of the correct subtype.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> representing the number of months/milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;months&quot;: months_from_year_month_duration(get_year_month_duration(duration(&quot;P5Y7MT50M&quot;))),
+    &quot;milliseconds&quot;: ms_from_day_time_duration(get_day_time_duration(duration(&quot;P5Y7MT50M&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{&quot;months&quot;: 67, &quot;milliseconds&quot;: 3000000}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="duration_from_months.2Fduration_from_ms"></a>duration_from_months/duration_from_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">duration_from_months/duration_from_ms(number_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates a <tt>duration</tt> from <tt>number_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>number_value</tt> : a <tt>bigint</tt> representing the number of months/milliseconds</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>duration</tt> containing <tt>number_value</tt> value for months/milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">duration_from_months(8);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">duration(&quot;P8M&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="duration_from_interval"></a>duration_from_interval</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">duration_from_interval(interval_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates a <tt>duration</tt> from <tt>interval_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval_value</tt> : an <tt>interval</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>duration</tt> representing the time in the <tt>interval_value</tt></li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;dr1&quot; : duration_from_interval(interval(date(&quot;2010-10-30&quot;), date(&quot;2010-12-21&quot;))),
+  &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;))),
+  &quot;dr3&quot; : duration_from_interval(interval(time(&quot;12:32:38&quot;), time(&quot;20:29:20&quot;))),
+  &quot;dr4&quot; : duration_from_interval(null)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;dr1&quot;: day_time_duration(&quot;P52D&quot;),
+  &quot;dr2&quot;: day_time_duration(&quot;P31DT1H1M1.111S&quot;),
+  &quot;dr3&quot;: day_time_duration(&quot;PT7H56M42S&quot;),
+  &quot;dr4&quot;: null
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="current_date"></a>current_date</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">current_date()
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the current date.</p>
+</li>
+<li>Arguments: None</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date</tt> value of the date when the function is called.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="current_time"></a>current_time</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">current_time()
+</pre></div></div>
+</li>
+<li>
+
+<p>Get the current time</p>
+</li>
+<li>Arguments: None</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt> value of the time when the function is called.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="current_datetime"></a>current_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">current_datetime()
+</pre></div></div>
+</li>
+<li>
+
+<p>Get the current datetime</p>
+</li>
+<li>Arguments: None</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value of the datetime when the function is called.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_date_from_datetime"></a>get_date_from_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_date_from_datetime(datetime)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the date value from the given datetime value <tt>datetime</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt>: a <tt>datetime</tt> value to be extracted from.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date</tt> value from the datetime,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>get_date_from_datetime(datetime(&#x201c;2016-03-26T10:10:00&#x201d;));</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>date(&#x201c;2016-03-26&#x201d;)</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_time_from_datetime"></a>get_time_from_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_time_from_datetime(datetime)
+</pre></div></div>
+</li>
+<li>
+
+<p>Get the time value from the given datetime value <tt>datetime</tt></p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt>: a <tt>datetime</tt> value to be extracted from.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt> value from the datetime.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_time_from_datetime(datetime(&quot;2016-03-26T10:10:00&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time(&quot;10:10:00.000&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="day_of_week"></a>day_of_week</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">day_of_week(date[, week_start_day])
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the day of the week for a given date (1_7)</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+<li><tt>week_start_day</tt>: (Optional) an integer or a string value (case-insensitive) specifying the day of the week to start counting from: 1=Sun[day], 2=Mon[day], &#x2026;, 7=Sat[urday]. If omitted, the default is 1 (Sunday).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the day of the week (1_7),</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;day_1&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;)),
+  &quot;day_2&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), 2),
+  &quot;day_3&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), &quot;Monday&quot;),
+  &quot;day_4&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), &quot;MON&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;day_1&quot;: 1, &quot;day_2&quot;: 7, &quot;day_3&quot;: 7, &quot;day_4&quot;: 7 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="day_of_year"></a>day_of_year</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">day_of_year(date)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the day of the year for a given date</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the day of the year,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">day_of_year(date(&quot;2011-12-31&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">365
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="week_of_year"></a>week_of_year</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">week_of_year(date[, week_start_day])
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the week of the year for a given date</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+<li><tt>week_start_day</tt>: (Optional) an integer or a string value (case-insensitive) specifying the day of the week to start counting from: 1=Sun[day], 2=Mon[day], &#x2026;, 7=Sat[urday]. If omitted, the default is 1 (Sunday).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the week of the year,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;week_1&quot;: week_of_year(date(&quot;2012-12-01&quot;)),
+  &quot;week_2&quot;: week_of_year(date(&quot;2012-12-01&quot;), 2),
+  &quot;week_3&quot;: week_of_year(date(&quot;2012-12-01&quot;), &quot;Monday&quot;),
+  &quot;week_4&quot;: week_of_year(date(&quot;2012-12-01&quot;), &quot;MON&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;week_1&quot;: 48, &quot;week_2&quot;: 49, &quot;week_3&quot;: 49, &quot;week_4&quot;: 49 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="quarter_of_year"></a>quarter_of_year</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">quarter_of_year(date)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the quarter of the year for a given date</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the quarter of the year (1_4),</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">quarter_of_year(date(&quot;2011-12-31&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">4
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="datetime_from_date_time"></a>datetime_from_date_time</h3>
+<ul>
+
+<li>Syntax:</li>
+</ul>
+<p>datetime_from_date_time(date,time)</p>
+<ul>
+
+<li>Gets a datetime representing the combination of <tt>date</tt> and <tt>time</tt>
+<ul>
+
+<li>Arguments:</li>
+<li><tt>date</tt>: a <tt>date</tt> value</li>
+<li><tt>time</tt> a <tt>time</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value by combining <tt>date</tt> and <tt>time</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if
+<ul>
+
+<li>the first argument is any other non-date value,</li>
+<li>or, the second argument is any other non-time value.</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="date_from_unix_time_in_days"></a>date_from_unix_time_in_days</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">date_from_unix_time_in_days(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a date representing the time after <tt>numeric_value</tt> days since 1970-01-01.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date</tt> value as the time after <tt>numeric_value</tt> days since 1970-01-01,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">date_from_unix_time_in_days(15800);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>date(&#x201c;2013-04-05&#x201d;)</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="datetime_from_unix_time_in_ms"></a>datetime_from_unix_time_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">datetime_from_unix_time_in_ms(numeric_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a datetime representing the time after <tt>numeric_value</tt> milliseconds since 1970-01-01T00:00:00Z.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<li><tt>string</tt> : (Optional) a string representing the target timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value as the time in the target time zone after <tt>numeric_value</tt> milliseconds since 1970-01-01T00:00:00Z,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+   &quot;datetime_1&quot;: datetime_from_unix_time_in_ms(1365139700000),
+   &quot;datetime_2&quot;: datetime_from_unix_time_in_ms(1365139700000, &quot;America/Los_Angeles&quot;)
+ };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;datetime_1&#x201d;: datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;), &#x201c;datetime_2&#x201d;: datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;) }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="datetime_from_unix_time_in_secs"></a>datetime_from_unix_time_in_secs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">datetime_from_unix_time_in_secs(numeric_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a datetime representing the time after <tt>numeric_value</tt> seconds since 1970-01-01T00:00:00Z.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<li><tt>string</tt> : (Optional) a string representing the target timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value as the time in the target time zone after <tt>numeric_value</tt> seconds since 1970-01-01T00:00:00Z,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;datetime_1&quot;: datetime_from_unix_time_in_secs(1365139700),
+  &quot;datetime_2&quot;: datetime_from_unix_time_in_secs(1365139700, &quot;America/Los_Angeles&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;datetime_1&#x201d;: datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;), &#x201c;datetime_2&#x201d;: datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;) }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="time_from_unix_time_in_ms"></a>time_from_unix_time_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">time_from_unix_time_in_ms(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a time representing the time after <tt>numeric_value</tt> milliseconds since 00:00:00.000.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt> value as the time after <tt>numeric_value</tt> milliseconds since 00:00:00.000,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">time_from_unix_time_in_ms(3748);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time(&quot;00:00:03.748&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_date_in_days"></a>unix_time_from_date_in_days</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_date_in_days(date_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the number of days since 1970-01-01 for <tt>date_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date_value</tt>: a <tt>date</tt> value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of days,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>unix_time_from_date_in_days(date(&#x201c;2013-04-05&#x201d;));</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>15800</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_datetime_in_ms"></a>unix_time_from_datetime_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_datetime_in_ms(datetime_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the time in milliseconds since 1970-01-01T00:00:00Z for <tt>datetime_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime_value</tt> : a <tt>datetime</tt> value.</li>
+<li><tt>string</tt> : (Optional) a string representing the source timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: unix_time_from_datetime_in_ms(datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;)), &#x201c;unix_time_2&#x201d;: unix_time_from_datetime_in_ms(datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;), &#x201c;America/Los_Angeles&#x201d;) };</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: 1365139700000, &#x201c;unix_time_2&#x201d;: 1365139700000 }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_datetime_in_secs"></a>unix_time_from_datetime_in_secs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_datetime_in_secs(datetime_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the time in seconds since 1970-01-01T00:00:00Z for <tt>datetime_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime_value</tt> : a <tt>datetime</tt> value.</li>
+</ul>
+</li>
+<li><tt>string</tt> : (Optional) a string representing the source timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of seconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: unix_time_from_datetime_in_secs(datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;)), &#x201c;unix_time_2&#x201d;: unix_time_from_datetime_in_secs(datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;), &#x201c;America/Los_Angeles&#x201d;) };</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: 1365139700, &#x201c;unix_time_2&#x201d;: 1365139700 }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_time_in_ms"></a>unix_time_from_time_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_time_in_ms(time_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the time the milliseconds since 00:00:00.000 for <tt>time_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>time_value</tt> : a <tt>time</tt> value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_time_in_ms(time(&quot;00:00:03.748&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3748
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="parse_date.2Fparse_time.2Fparse_datetime"></a>parse_date/parse_time/parse_datetime</h3>
+<ul>
+
+<li>Syntax:</li>
+</ul>
+<p>parse_date/parse_time/parse_datetime(date,formatting_expression)</p>
+<ul>
+
+<li>Creates a <tt>date/time/date_time</tt> value by treating <tt>date</tt> with formatting <tt>formatting_expression</tt></li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>string</tt> value representing the <tt>date/time/datetime</tt>.</li>
+<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>
+<li><tt>h</tt> hours</li>
+<li><tt>m</tt> minutes</li>
+<li><tt>s</tt> seconds</li>
+<li><tt>n</tt> (or <tt>S</tt>) milliseconds</li>
+<li><tt>a</tt> am/pm</li>
+<li><tt>z</tt> timezone (parsed and ignored)</li>
+<li><tt>Y</tt> year</li>
+<li><tt>Q</tt> quarter of year (1-4)</li>
+<li><tt>QQ</tt> quarter of year (01-04)</li>
+<li><tt>M</tt> month</li>
+<li><tt>D</tt> day</li>
+<li><tt>EEE</tt> weekday (abbreviated name, parsed and ignored)</li>
+<li><tt>EEEE</tt> weekday (full name, parsed and ignored)</li>
+<li><tt>_</tt>, <tt>'</tt>, <tt>/</tt>, <tt>.</tt>, <tt>,</tt>, <tt>T</tt> seperators for both time and date</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date/time/date_time</tt> value corresponding to <tt>date</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:</li>
+<li>the first argument is any other non-date value,</li>
+<li>the second argument is any other non-string value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">parse_time(&quot;30:30&quot;,&quot;m:s&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time(&quot;00:30:30.000&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="print_date.2Fprint_time.2Fprint_datetime"></a>print_date/print_time/print_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">print_date/print_time/print_datetime(date,formatting_expression)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date/time/datetime</tt> value.</li>
+<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>
+<li><tt>h</tt> hours</li>
+<li><tt>m</tt> minutes</li>
+<li><tt>s</tt> seconds</li>
+<li><tt>n</tt> (or <tt>S</tt>) milliseconds</li>
+<li><tt>a</tt> am/pm</li>
+<li><tt>Y</tt> year</li>
+<li><tt>Q</tt> quarter of year (1-4)</li>
+<li><tt>QQ</tt> quarter of year (01-04)</li>
+<li><tt>M</tt> month</li>
+<li><tt>MMM</tt> month (abbreviated name)</li>
+<li><tt>MMMM</tt> month (full name)</li>
+<li><tt>D</tt> day</li>
+<li><tt>DDD</tt> day of year</li>
+<li><tt>EEE</tt> weekday (abbreviated name)</li>
+<li><tt>EEEE</tt> weekday (full name)</li>
+<li><tt>_</tt>, <tt>'</tt>, <tt>/</tt>, <tt>.</tt>, <tt>,</tt>, <tt>T</tt> seperators for both time and date</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> value corresponding to <tt>date</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-date value,</li>
+<li>the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">print_time(time(&quot;00:30:30.000&quot;),&quot;m:s&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;30:30&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_interval_start.2C_get_interval_end"></a>get_interval_start, get_interval_end</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_interval_start/get_interval_end(interval)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the start/end of the given interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval</tt>: the interval to be accessed.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-interval value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;start&quot;: get_interval_start(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
+  &quot;end&quot;: get_interval_end(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;start&quot;: date(&quot;1984-01-01&quot;), &quot;end&quot;: date(&quot;1985-01-01&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<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)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the start/end of the given interval for the specific date/datetime/time type.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval</tt>: the interval to be accessed.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt>, <tt>date</tt>, or <tt>datetime</tt> (depending on the function) representing the starting or ending time,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-interval value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;start1&quot;: get_interval_start_date(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
+  &quot;end1&quot;: get_interval_end_date(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
+  &quot;start2&quot;: get_interval_start_datetime(interval_start_from_datetime(&quot;1984-01-01T08:30:00.000&quot;, &quot;P1Y1H&quot;)),
+  &quot;end2&quot;: get_interval_end_datetime(interval_start_from_datetime(&quot;1984-01-01T08:30:00.000&quot;, &quot;P1Y1H&quot;)),
+  &quot;start3&quot;: get_interval_start_time(interval_start_from_time(&quot;08:30:00.000&quot;, &quot;P1H&quot;)),
+  &quot;end3&quot;: get_interval_end_time(interval_start_from_time(&quot;08:30:00.000&quot;, &quot;P1H&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;start1&quot;: date(&quot;1984-01-01&quot;),
+  &quot;end1&quot;: date(&quot;1985-01-01&quot;),
+  &quot;start2&quot;: datetime(&quot;1984-01-01T08:30:00.000&quot;),
+  &quot;end2&quot;: datetime(&quot;1985-01-01T09:30:00.000&quot;),
+  &quot;start3&quot;: time(&quot;08:30:00.000&quot;),
+  &quot;end3&quot;: time(&quot;09:30:00.000&quot;)
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_overlapping_interval"></a>get_overlapping_interval</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_overlapping_interval(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the start/end of the given interval for the specific date/datetime/time type.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>: an <tt>interval</tt> value</li>
+<li><tt>interval2</tt>: an <tt>interval</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;))),
+  &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;))),
+  &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;))),
+  &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;))),
+  &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;))),
+  &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;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;overlap1&quot;: interval(time(&quot;12:23:39.000&quot;), time(&quot;18:27:19.000&quot;)),
+  &quot;overlap2&quot;: null,
+  &quot;overlap3&quot;: null,
+  &quot;overlap4&quot;: interval(date(&quot;2013-01-01&quot;), date(&quot;2014-01-01&quot;)),
+  &quot;overlap5&quot;: interval(datetime(&quot;1989-03-04T12:23:39.000&quot;), datetime(&quot;2000-10-30T18:27:19.000&quot;)),
+  &quot;overlap6&quot;: null
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_bin"></a>interval_bin</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_bin(time_to_bin, time_bin_anchor, duration_bin_size)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the <tt>interval</tt> value representing the bin containing the <tt>time_to_bin</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>time_to_bin</tt>: a date/time/datetime value representing the time to be binned.</li>
+<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>
+<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:
+<ul>
+
+<li>datetime +|_ year_month_duration</li>
+<li>datetime +|_ day_time_duration</li>
+<li>date +|_ year_month_duration</li>
+<li>date +|_ day_time_duration</li>
+<li>time +|_ day_time_duration</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:</li>
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument or the second argument is any other non-date/non-time/non-datetime value,</li>
+<li>or, the second argument is any other non-year_month_duration/non-day_time_duration value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>{ &#x201c;bin1&#x201d;: interval_bin(date(&#x201c;2010-10-30&#x201d;), date(&#x201c;1990-01-01&#x201d;), year_month_duration(&#x201c;P1Y&#x201d;)), &#x201c;bin2&#x201d;: interval_bin(datetime(&#x201c;1987-11-19T23:49:23.938&#x201d;), datetime(&#x201c;1990-01-01T00:00:00.000&#x201d;), year_month_duration(&#x201c;P6M&#x201d;)), &#x201c;bin3&#x201d;: interval_bin(time(&#x201c;12:23:34.930+07:00&#x201d;), time(&#x201c;00:00:00&#x201d;), day_time_duration(&#x201c;PT1M&#x201d;)), &#x201c;bin4&#x201d;: interval_bin(datetime(&#x201c;1987-11-19T23:49:23.938&#x201d;), datetime(&#x201c;2013-01-01T00:00:00.000&#x201d;), day_time_duration(&#x201c;PT24H&#x201d;)) };</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;bin1&#x201d;: interval(date(&#x201c;2010-01-01&#x201d;), date(&#x201c;2011-01-01&#x201d;)), &#x201c;bin2&#x201d;: interval(datetime(&#x201c;1987-07-01T00:00:00.000&#x201d;), datetime(&#x201c;1988-01-01T00:00:00.000&#x201d;)), &#x201c;bin3&#x201d;: interval(time(&#x201c;12:23:00.000&#x201d;), time(&#x201c;12:24:00.000&#x201d;)), &#x201c;bin4&#x201d;: interval(datetime(&#x201c;1987-11-19T00:00:00.000&#x201d;), datetime(&#x201c;1987-11-20T00:00:00.000&#x201d;)) }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_start_from_date.2Ftime.2Fdatetime"></a>interval_start_from_date/time/datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_start_from_date/time/datetime(date/time/datetime, duration)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>interval</tt> value representing the interval starting from the given time point with the length of duration,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument or the second argument is any other non-date/non-time/non-datetime value,</li>
+<li>or, the second argument is any other non-duration value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval1&quot;: interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;),
+  &quot;interval2&quot;: interval_start_from_time(time(&quot;02:23:28.394&quot;), &quot;PT3H24M&quot;),
+  &quot;interval3&quot;: interval_start_from_datetime(&quot;1999-09-09T09:09:09.999&quot;, duration(&quot;P2M30D&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval1&quot;: interval(date(&quot;1984-01-01&quot;), date(&quot;1985-01-01&quot;)),
+  &quot;interval2&quot;: interval(time(&quot;02:23:28.394&quot;), time(&quot;05:47:28.394&quot;)),
+  &quot;interval3&quot;: interval(datetime(&quot;1999-09-09T09:09:09.999&quot;), datetime(&quot;1999-12-09T09:09:09.999&quot;))
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="overlap_bins"></a>overlap_bins</h3>
+<ul>
+
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<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>
+</ul>
+</li>
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source"> overlap_bins(interval, time_bin_anchor, duration_bin_size)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an ordered list of <tt>interval</tt> values representing each bin that is overlapping the <tt>interval</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval</tt>: an <tt>interval</tt> value</li>
+<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>
+<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:
+<ul>
+
+<li>datetime +|_ year_month_duration</li>
+<li>datetime +|_ day_time_duration</li>
+<li>date +|_ year_month_duration</li>
+<li>date +|_ day_time_duration</li>
+<li>time +|_ day_time_duration</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first arugment is any other non-interval value,</li>
+<li>or, the second argument is any other non-date/non-time/non-datetime value,</li>
+<li>or, the second argument is any other non-year_month_duration/non-day_time_duration value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &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;)),
+  &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;)),
+  &quot;datetimebins&quot;: overlap_bins(interval(datetime(&quot;1800-01-01T23:59:48.938&quot;), datetime(&quot;2015-07-26T13:28:30.218&quot;)),
+                              datetime(&quot;1900-01-01T00:00:00.000&quot;), year_month_duration(&quot;P100Y&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;timebins&#x201d;: [ interval(time(&#x201c;17:00:00.000&#x201d;), time(&#x201c;17:30:00.000&#x201d;)), interval(time(&#x201c;17:30:00.000&#x201d;), time(&#x201c;18:00:00.000&#x201d;)), interval(time(&#x201c;18:00:00.000&#x201d;), time(&#x201c;18:30:00.000&#x201d;)), interval(time(&#x201c;18:30:00.000&#x201d;), time(&#x201c;19:00:00.000&#x201d;))                      ], &#x201c;datebins&#x201d;: [ interval(date(&#x201c;1980-01-01&#x201d;), date(&#x201c;1990-01-01&#x201d;)), interval(date(&#x201c;1990-01-01&#x201d;), date(&#x201c;2000-01-01&#x201d;)), interval(date(&#x201c;2000-01-01&#x201d;), date(&#x201c;2010-01-01&#x201d;)), interval(date(&#x201c;2010-01-01&#x201d;), date(&#x201c;2020-01-01&#x201d;))                      ], &#x201c;datetimebins&#x201d;: [ interval(datetime(&#x201c;1800-01-01T00:00:00.000&#x201d;), datetime(&#x201c;1900-01-01T00:00:00.000&#x201d;)), interval(datetime(&#x201c;1900-01-01T00:00:00.000&#x201d;), datetime(&#x201c;2000-01-01T00:00:00.000&#x201d;)), interval(datetime(&#x201c;2000-01-01T00:00:00.000&#x201d;), datetime(&#x201c;2100-01-01T00:00:00.000&#x201d;))                      ] };</p>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="interval_before.2C_interval_after"></a>interval_before, interval_after</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_before(interval1, interval2)
+interval_after(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether an interval happens before/after another interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_before&quot;: interval_before(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                     interval(date(&quot;2005-05-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;interval_after&quot;: interval_after(interval(date(&quot;2005-05-01&quot;), date(&quot;2012-09-09&quot;)),
+                                   interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_before&quot;: true, &quot;interval_after&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_covers.2C_interval_covered_by"></a>interval_covers, interval_covered_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_covers(interval1, interval2)
+interval_covered_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether one interval covers the other interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>
+
+<p>a <tt>boolean</tt> value. Specifically, <tt>interval_covers(interval1, interval2)</tt> is true if and only if</p>
+<p>interval1.start &lt;= interval2.start AND interval1.end &gt;= interval2.end</p>
+<p><tt>interval_covered_by(interval1, interval2)</tt> is true if and only if</p>
+<p>interval2.start &lt;= interval1.start AND interval2.end &gt;= interval1.end</p>
+</li>
+<li>
+
+<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_covers&quot;: interval_covers(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                     interval(date(&quot;2000-03-01&quot;), date(&quot;2004-09-09&quot;))),
+  &quot;interval_covered_by&quot;: interval_covered_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                             interval(date(&quot;2004-09-10&quot;), date(&quot;2012-08-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_covers&quot;: true, &quot;interval_covered_by&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_overlaps.2C_interval_overlapped_by"></a>interval_overlaps, interval_overlapped_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_overlaps(interval1, interval2)
+interval_overlapped_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These functions check whether two intervals overlap with each other.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value. Specifically, <tt>interval_overlaps(interval1, interval2)</tt> is true if and only if
+<p>interval1.start &lt; interval2.start AND interval2.end &gt; interval1.end AND interval1.end &gt; interval2.start</p></li>
+</ul>
+<p><tt>interval_overlapped_by(interval1, interval2)</tt> is true if and only if</p>
+
+<div>
+<div>
+<pre class="source">interval2.start &lt; interval1.start
+AND interval1.end &gt; interval2.end
+AND interval2.end &gt; interval1.start
+</pre></div></div>
+
+<ul>
+
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+<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>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;overlaps&quot;: interval_overlaps(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;overlapped_by&quot;: interval_overlapped_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                          interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;overlaps&quot;: true, &quot;overlapped_by&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_overlapping"></a>interval_overlapping</h3>
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_overlapping(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>This functions check whether two intervals share any points with each other.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>
+
+<p>a <tt>boolean</tt> value. Specifically, <tt>interval_overlapping(interval1, interval2)</tt> is true if</p>
+<p>interval1.start &lt; interval2.end AND interval1.end &gt; interval2.start</p>
+</li>
+<li>
+
+<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;overlapping1&quot;: interval_overlapping(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                       interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;overlapping2&quot;: interval_overlapping(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                       interval(date(&quot;2004-09-10&quot;), date(&quot;2006-12-31&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;overlapping1&quot;: true, &quot;overlapping2&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_meets.2C_interval_met_by"></a>interval_meets, interval_met_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_meets(interval1, interval2)
+interval_met_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether an interval meets with another interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;meets&quot;: interval_meets(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                          interval(date(&quot;2005-01-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;metby&quot;: interval_met_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                           interval(date(&quot;2004-09-10&quot;), date(&quot;2006-08-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;meets&quot;: true, &quot;metby&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_starts.2C_interval_started_by"></a>interval_starts, interval_started_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_starts(interval1, interval2)
+interval_started_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether one interval starts with the other interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value. Specifically, <tt>interval_starts(interval1, interval2)</tt> returns true if and only if
+<p>interval1.start = interval2.start AND interval1.end &lt;= interval2.end</p></li>
+</ul>
+<p><tt>interval_started_by(interval1, interval2)</tt> returns true if and only if</p>
+
+<div>
+<div>
+<pre class="source">interval1.start = interval2.start
+AND interval2.end &lt;= interval1.end
+</pre></div></div>
+
+<ul>
+
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_starts&quot;: interval_starts(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                     interval(date(&quot;2000-01-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;interval_started_by&quot;: interval_started_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                             interval(date(&quot;2006-08-01&quot;), date(&quot;2006-08-02&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_starts&quot;: true, &quot;interval_started_by&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_ends.2C_interval_ended_by"></a>interval_ends, interval_ended_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_ends(interval1, interval2)
+interval_ended_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether one interval ends with the other interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>
+
+<p>a <tt>boolean</tt> value. Specifically, <tt>interval_ends(interval1, interval2)</tt> returns true if and only if</p>
+<p>interval1.end = interval2.end AND interval1.start &gt;= interval2.start</p>
+<p><tt>interval_ended_by(interval1, interval2)</tt> returns true if and only if</p>
+<p>interval2.end = interval1.end AND interval2.start &gt;= interval1.start</p>
+</li>
+<li>
+
+<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_ends&quot;: interval_ends(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                 interval(date(&quot;1998-01-01&quot;), date(&quot;2005-01-01&quot;))),
+  &quot;interval_ended_by&quot;: interval_ended_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                         interval(date(&quot;2006-09-10&quot;), date(&quot;2007-03-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_ends&quot;: true, &quot;interval_ended_by&quot;: true }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Object_Functions"></a><a name="ObjectFunctions" id="ObjectFunctions">Object Functions</a></h2>
+<div class="section">
+<h3><a name="get_object_fields"></a>get_object_fields</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_object_fields(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Access the object field names, type and open status for a given object.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : a object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_object_fields(
+                  {
+                    &quot;id&quot;: 1,
+                    &quot;project&quot;: &quot;AsterixDB&quot;,
+                    &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+                    &quot;related&quot;: [&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                  }
+                 );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  { &quot;field-name&quot;: &quot;id&quot;, &quot;field-type&quot;: &quot;INT64&quot;, &quot;is-open&quot;: false },
+  { &quot;field-name&quot;: &quot;project&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false },
+  { &quot;field-name&quot;: &quot;address&quot;, &quot;field-type&quot;: &quot;RECORD&quot;, &quot;is-open&quot;: false,
+    &quot;nested&quot;: [
+                { &quot;field-name&quot;: &quot;city&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false },
+                { &quot;field-name&quot;: &quot;state&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false }
+              ]
+  },
+  { &quot;field-name&quot;:
+        &quot;related&quot;,
+        &quot;field-type&quot;: &quot;ORDEREDLIST&quot;,
+        &quot;is-open&quot;: false,
+        &quot;list&quot;: [
+                  { &quot;field-type&quot;: &quot;STRING&quot; },
+                  { &quot;field-type&quot;: &quot;STRING&quot; },
+                  { &quot;field-type&quot;: &quot;STRING&quot; }
+                ]
+  }
+]
+</pre></div></div>
+</li>
+</ul>
+<p>]</p></div>
+<div class="section">
+<h3><a name="get_object_field_value"></a>get_object_field_value</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_object_field_value(input_object, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Access the field name given in the <tt>string_expression</tt> from the <tt>object_expression</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : a <tt>object</tt> value.</li>
+<li><tt>string</tt> : a <tt>string</tt> representing the top level field name.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>any</tt> value saved in the designated field of the object,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-object value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_object_field_value({
+                         &quot;id&quot;: 1,
+                         &quot;project&quot;: &quot;AsterixDB&quot;,
+                         &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+                         &quot;related&quot;: [&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                        },
+                        &quot;project&quot;
+                       );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;AsterixDB&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_remove_fields"></a>object_remove_fields</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_remove_fields(input_object, field_names)
+</pre></div></div>
+</li>
+<li>
+
+<p>Remove indicated fields from a object given a list of field names.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt>:  a object value.</li>
+<li><tt>field_names</tt>: an array of strings and/or array of array of strings.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>a new object value without the fields listed in the second argument,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-object value,</li>
+<li>or, the second argument is any other non-array value or recursively contains non-string items.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_remove_fields(
+                       {
+                         &quot;id&quot;:1,
+                         &quot;project&quot;:&quot;AsterixDB&quot;,
+                         &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+                         &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                       },
+                       [[&quot;address&quot;, &quot;city&quot;], &quot;related&quot;]
+                     );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;:1,
+  &quot;project&quot;:&quot;AsterixDB&quot;,
+  &quot;address&quot;:{ &quot;state&quot;: &quot;CA&quot; }
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_add_fields"></a>object_add_fields</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_add_fields(input_object, fields)
+</pre></div></div>
+</li>
+<li>
+
+<p>Add fields to a object given a list of field names.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : a object value.</li>
+<li><tt>fields</tt>: an array of field descriptor objects where each object has field_name and  field_value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a new object value with the new fields included,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-object value,</li>
+<li>the second argument is any other non-array value, or contains non-object items.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_add_fields(
+                   {
+                     &quot;id&quot;:1,
+                     &quot;project&quot;:&quot;AsterixDB&quot;,
+                     &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+                     &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                    },
+                    [{&quot;field-name&quot;:&quot;employment_location&quot;, &quot;field-value&quot;:create_point(30.0,70.0)}]
+                  );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+   &quot;id&quot;:1,
+   &quot;project&quot;:&quot;AsterixDB&quot;,
+   &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+   &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+   &quot;employment_location&quot;: point(&quot;30.0,70.0&quot;)
+ }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_merge"></a>object_merge</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_merge(object1, object2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Merge two different objects into a new object.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>object1</tt> : a object value.</li>
+<li><tt>object2</tt> : a object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_merge(
+              {
+                &quot;id&quot;:1,
+                &quot;project&quot;:&quot;AsterixDB&quot;,
+                &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+                &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+              },
+              {
+                &quot;user_id&quot;: 22,
+                &quot;employer&quot;: &quot;UC Irvine&quot;,
+                &quot;employment_type&quot;: &quot;visitor&quot;
+              }
+            );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;employment_type&quot;: &quot;visitor&quot;,
+  &quot;address&quot;: {
+    &quot;city&quot;: &quot;Irvine&quot;,
+    &quot;state&quot;: &quot;CA&quot;
+  },
+  &quot;related&quot;: [
+    &quot;Hivestrix&quot;,
+    &quot;Preglix&quot;,
+    &quot;Apache VXQuery&quot;
+  ],
+  &quot;user_id&quot;: 22,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+  &quot;employer&quot;: &quot;UC Irvine&quot;,
+  &quot;id&quot;: 1
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_length"></a>object_length</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_length(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns number of top-level fields in the given object</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an integer that represents the number of top-level fields in the given object,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value or any other non-object value</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_length(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+               }
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_names"></a>object_names</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_names(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns names of top-level fields in the given object</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an array with top-level field names of the given object,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value or any other non-object value</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_names(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+               }
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;id&quot;, &quot;project&quot;, &quot;address&quot; ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_remove"></a>object_remove</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_remove(input_object, field_name)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a new object that has the same fields as the input object except the field to be removed</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>field_name</tt> : a string field name.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>A new object that has the same fields as <tt>input_object</tt> except the field <tt>field_name</tt>,</li>
+<li><tt>missing</tt> if the argument <tt>input_object</tt> or <tt>field_name</tt> is missing,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_remove(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;address&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_rename"></a>object_rename</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_rename(input_object, old_field, new_field)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>old_field</tt> : a string representing the old (original) field name inside the object <tt>input_object</tt>.</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_rename(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;address&quot;
+               , &quot;location&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_unwrap"></a>object_unwrap</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_unwrap(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the value of the single name-value pair that appears in <tt>input_object</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value that consists of exactly one name-value pair.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The value of the single name-value pair that appears in <tt>input_object</tt>,</li>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_unwrap(
+             {
+               &quot;id&quot;: 1
+             }
+           );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  1
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_replace"></a>object_replace</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_replace(input_object, old_value, new_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>old_value</tt> : a primitive type value to be replaced by <tt>new_value</tt>.</li>
+<li><tt>new_value</tt> : a value to replace <tt>old_value</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if <tt>input_object</tt>  or <tt>old_value</tt> is null,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li><tt>old_value</tt> is not a primitive type value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_replace(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;AsterixDB&quot;
+               , &quot;Apache AsterixDB&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;Apache AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_add"></a>object_add</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_add(input_object, field_name, field_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>field_name</tt> : a string representing a field name to be added.</li>
+<li><tt>field_value</tt> : a value to be assigned to the new field <tt>field_name</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>missing</tt>,</li>
+<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>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_add(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;company&quot;
+               , &quot;Apache&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+  &quot;company&quot;: &quot;Apache&quot;
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_put"></a>object_put</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_put(input_object, field_name, field_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Adds, modifies, or removes a field of an object.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>field_name</tt> : a string representing a field name to be added.</li>
+<li><tt>field_value</tt> : a value to be assigned to the new field <tt>field_name</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>missing</tt>,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_put(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;project&quot;
+               , &quot;Apache AsterixDB&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;Apache AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_values"></a>object_values</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_values(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an array of the values of the fields in <tt>input_object</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>An array of the values of the fields in <tt>input_object</tt>,</li>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<li><tt>null</tt> if <tt>input_object</tt> is null or any non-object value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_values(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  1,
+  &quot;AsterixDB&quot;,
+  {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_pairs"></a>object_pairs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_pairs(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>An array of the <tt>name</tt>/<tt>value</tt> pairs of the fields in <tt>input_object</tt>,</li>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<li><tt>null</tt> if <tt>input_object</tt> is null or any non-object value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_pairs(
+              {
+                &quot;id&quot;: 1,
+                &quot;project&quot;: &quot;AsterixDB&quot;,
+                &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+              }
+            );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  { &quot;name&quot;: &quot;id&quot;, &quot;value&quot;: 1 },
+  { &quot;name&quot;: &quot;project&quot;, &quot;value&quot;: &quot;AsterixDB&quot; },
+  { &quot;name&quot;: &quot;address&quot;, &quot;value&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;} }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="pairs"></a>pairs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">pairs(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>input_object</tt> : an object value (or an array or a multiset)</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<li><tt>null</tt> if <tt>input_object</tt> is null or a value of a primitive data type.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">pairs(
+       {
+         &quot;id&quot;: 1,
+         &quot;project&quot;: &quot;AsterixDB&quot;,
+         &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+       }
+     );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  [ &quot;id&quot;, 1 ],
+  [ &quot;project&quot;, &quot;AsterixDB&quot; ],
+  [ &quot;address&quot;, { &quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot; } ],
+  [ &quot;city&quot;, &quot;Irvine&quot; ],
+  [ &quot;state&quot;, &quot;CA&quot; ]
+]
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Aggregate_Functions_.28Array_Functions.29"></a><a name="AggregateFunctions" id="AggregateFunctions">Aggregate Functions (Array Functions) </a></h2>
+<p>This section contains detailed descriptions of the built-in aggregate functions in the query language.</p>
+<p>The query language also supports standard SQL aggregate functions (e.g., <tt>MIN</tt>, <tt>MAX</tt>, <tt>SUM</tt>, <tt>COUNT</tt>, and <tt>AVG</tt>). Note that these are not real functions in the query language, but just syntactic sugars over corresponding builtin aggregate functions (e.g., <tt>ARRAY_MIN</tt>, <tt>ARRAY_MAX</tt>, <tt>ARRAY_SUM</tt>, <tt>ARRAY_COUNT</tt>, and <tt>ARRAY_AVG</tt>). Refer to <a href="manual.html#Aggregation_PseudoFunctions">Aggregation Pseudo-Functions</a> for details.</p>
+<p>The <tt>DISTINCT</tt> keyword may be used with built-in aggregate functions and standard SQL aggregate functions. It may also be used with aggregate functions used as window functions. It determines whether the function aggregates all values in the group, or distinct values only. Refer to <a href="manual.html#Function_call_expressions">Function Calls</a> for details.</p>
+<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>
+<div class="section">
+<h3><a name="array_count"></a>array_count</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_count(collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the number of non-null and non-missing items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> to be counted,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of non-null and non-missing items in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li>any other non-array and non-multiset input value will cause an error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_count( ['hello', 'world', 1, 2, 3, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">5
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_avg"></a>array_avg</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_avg(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the average value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the average of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_avg( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.725
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_sum"></a>array_sum</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_sum(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sum of non-null and non-missing items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_sum( [1.2, 2.3, 3.4, 0, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">6.9
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_min"></a>array_min</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_min(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the min value of non-null and non-missing comparable items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_min( [1.2, 2.3, 3.4, 0, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_max"></a>array_max</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_max(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the max value of the non-null and non-missing comparable items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_max( [1.2, 2.3, 3.4, 0, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3.4
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_stddev_samp"></a>array_stddev_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample standard deviation value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample standard deviation of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_samp( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.4591664287073858
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_stddev_pop"></a>array_stddev_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population standard deviation value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population standard deviation of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_pop( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.2636751956100112
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_var_samp"></a>array_var_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_var_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample variance value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample variance of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_var_samp( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">2.1291666666666664
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_var_pop"></a>array_var_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_var_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population variance value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population variance of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_var_pop( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.5968749999999998
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_skewness"></a>array_skewness</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_skewness(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the skewness value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the skewness of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_skewness( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">-0.04808451539164242
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_kurtosis"></a>array_kurtosis</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_kurtosis(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the kurtosis value from the normal distribution of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_kurtosis( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">-1.342049701096427
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_count"></a>strict_count</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_count(collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the number of items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing the items to be counted,</li>
+<li>or a <tt>null</tt> value,</li>
+<li>or a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of items in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_count( [1, 2, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">4
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_avg"></a>strict_avg</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_avg(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the average value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the average of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_avg( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">200.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_sum"></a>strict_sum</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_sum(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sum of the items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_sum( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">600
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_min"></a>strict_min</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_min(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the min value of comparable items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_min( [10.2, 100, 5] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">5.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_max"></a>strict_max</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_max(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the max value of numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_max( [10.2, 100, 5] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">100.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_stddev_samp"></a>strict_stddev_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample standard deviation value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample standard deviation of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_samp( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">100.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_stddev_pop"></a>strict_stddev_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population standard deviation value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population standard deviation of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_pop( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">81.64965809277261
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_var_samp"></a>strict_var_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample variance value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample variance of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_samp( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">10000.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_var_pop"></a>strict_var_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population variance value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population variance of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_pop( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">6666.666666666667
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_skewness"></a>strict_skewness</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_skewness(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the skewness value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the skewness of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_skewness( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_kurtosis"></a>strict_kurtosis</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_kurtosis(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the kurtosis value from the normal distribution of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the kurtosis from a normal distribution of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_kurtosis( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">-1.5
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Comparison_Functions"></a><a name="ComparisonFunctions" id="ComparisonFunctions">Comparison Functions</a></h2>
+<div class="section">
+<h3><a name="greatest"></a>greatest</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">greatest(numeric_value1, numeric_value2, ...)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the greatest value among arguments.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+<li>&#x2026;.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> if any argument is a <tt>missing</tt> value or <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 3, &quot;v2&quot;: 5000.0 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="least"></a>least</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">least(numeric_value1, numeric_value2, ...)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the least value among arguments.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+<li>&#x2026;.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> if any argument is a <tt>missing</tt> value or <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 1, &quot;v2&quot;: -0.5 }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Type_Functions"></a><a name="TypeFunctions" id="TypeFunctions">Type Functions</a></h2>
+<div class="section">
+<h3><a name="is_array"></a>is_array</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_array(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be an <tt>array</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is an <tt>array</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_array(true),
+  &quot;b&quot;: is_array(false),
+  &quot;c&quot;: isarray(null),
+  &quot;d&quot;: isarray(missing),
+  &quot;e&quot;: isarray(&quot;d&quot;),
+  &quot;f&quot;: isarray(4.0),
+  &quot;g&quot;: isarray(5),
+  &quot;h&quot;: isarray([&quot;1&quot;, 2]),
+  &quot;i&quot;: isarray({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isarray</tt>.</p></div>
+<div class="section">
+<h3><a name="is_multiset"></a>is_multiset</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_multiset(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be an <tt>multiset</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is an <tt>multiset</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_multiset(true),
+  &quot;b&quot;: is_multiset(false),
+  &quot;c&quot;: is_multiset(null),
+  &quot;d&quot;: is_multiset(missing),
+  &quot;e&quot;: is_multiset(&quot;d&quot;),
+  &quot;f&quot;: ismultiset(4.0),
+  &quot;g&quot;: ismultiset([&quot;1&quot;, 2]),
+  &quot;h&quot;: ismultiset({&quot;a&quot;:1}),
+  &quot;i&quot;: ismultiset({{&quot;hello&quot;, 9328, &quot;world&quot;, [1, 2, null]}})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ismultiset</tt>.</p></div>
+<div class="section">
+<h3><a name="is_atomic_.28is_atom.29"></a>is_atomic (is_atom)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_atomic(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a value of a <a href="../datamodel.html#PrimitiveTypes">primitive</a> type.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a primitive type or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_atomic(true),
+  &quot;b&quot;: is_atomic(false),
+  &quot;c&quot;: isatomic(null),
+  &quot;d&quot;: isatomic(missing),
+  &quot;e&quot;: isatomic(&quot;d&quot;),
+  &quot;f&quot;: isatom(4.0),
+  &quot;g&quot;: isatom(5),
+  &quot;h&quot;: isatom([&quot;1&quot;, 2]),
+  &quot;i&quot;: isatom({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isatomic</tt>, <tt>is_atom</tt>, and <tt>isatom</tt>.</p></div>
+<div class="section">
+<h3><a name="is_boolean_.28is_bool.29"></a>is_boolean (is_bool)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_boolean(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>boolean</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>boolean</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: isboolean(true),
+  &quot;b&quot;: isboolean(false),
+  &quot;c&quot;: is_boolean(null),
+  &quot;d&quot;: is_boolean(missing),
+  &quot;e&quot;: isbool(&quot;d&quot;),
+  &quot;f&quot;: isbool(4.0),
+  &quot;g&quot;: isbool(5),
+  &quot;h&quot;: isbool([&quot;1&quot;, 2]),
+  &quot;i&quot;: isbool({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isboolean</tt>, <tt>is_bool</tt>, and <tt>isbool</tt>.</p></div>
+<div class="section">
+<h3><a name="is_number_.28is_num.29"></a>is_number (is_num)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_number(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a numeric value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_number(true),
+  &quot;b&quot;: is_number(false),
+  &quot;c&quot;: isnumber(null),
+  &quot;d&quot;: isnumber(missing),
+  &quot;e&quot;: isnumber(&quot;d&quot;),
+  &quot;f&quot;: isnum(4.0),
+  &quot;g&quot;: isnum(5),
+  &quot;h&quot;: isnum([&quot;1&quot;, 2]),
+  &quot;i&quot;: isnum({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isnumber</tt>, <tt>is_num</tt>, and <tt>isnum</tt>.</p></div>
+<div class="section">
+<h3><a name="is_object_.28is_obj.29"></a>is_object (is_obj)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_object(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>object</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>object</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_object(true),
+  &quot;b&quot;: is_object(false),
+  &quot;c&quot;: isobject(null),
+  &quot;d&quot;: isobject(missing),
+  &quot;e&quot;: isobj(&quot;d&quot;),
+  &quot;f&quot;: isobj(4.0),
+  &quot;g&quot;: isobj(5),
+  &quot;h&quot;: isobj([&quot;1&quot;, 2]),
+  &quot;i&quot;: isobj({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<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>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isobject</tt>, <tt>is_obj</tt>, and <tt>isobj</tt>.</p></div>
+<div class="section">
+<h3><a name="is_string_.28is_str.29"></a>is_string (is_str)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_string(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>string</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>string</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_string(true),
+  &quot;b&quot;: isstring(false),
+  &quot;c&quot;: isstring(null),
+  &quot;d&quot;: isstr(missing),
+  &quot;e&quot;: isstr(&quot;d&quot;),
+  &quot;f&quot;: isstr(4.0),
+  &quot;g&quot;: isstr(5),
+  &quot;h&quot;: isstr([&quot;1&quot;, 2]),
+  &quot;i&quot;: isstr({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isstring</tt>, <tt>is_str</tt>, and <tt>isstr</tt>.</p></div>
+<div class="section">
+<h3><a name="is_null"></a>is_null</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_null(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>null</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the variable is a <tt>null</tt> or not,</li>
+<li>a <tt>missing</tt> if the input is <tt>missing</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: is_null(null), &quot;v2&quot;: is_null(1), &quot;v3&quot;: is_null(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isnull</tt>.</p></div>
+<div class="section">
+<h3><a name="is_missing"></a>is_missing</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_missing(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>missing</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the variable is a <tt>missing</tt> or not.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: is_missing(null), &quot;v2&quot;: is_missing(1), &quot;v3&quot;: is_missing(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: false, &quot;v3&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ismissing</tt>.</p></div>
+<div class="section">
+<h3><a name="is_unknown"></a>is_unknown</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_unknown(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given variable is a <tt>null</tt> value or a <tt>missing</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: is_unknown(null), &quot;v2&quot;: is_unknown(1), &quot;v3&quot;: is_unknown(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false, &quot;v3&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isunknown</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="is_binary_.28is_bin.29"></a>is_binary (is_bin)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_binary(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>binary</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>binary</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_binary(true),
+  &quot;b&quot;: is_binary(false),
+  &quot;c&quot;: isbinary(null),
+  &quot;d&quot;: isbinary(missing),
+  &quot;e&quot;: isbin(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isbin(hex(&quot;ABCDEF0123456789&quot;)),
+  &quot;g&quot;: is_bin(sub_binary(hex(&quot;AABBCCDD&quot;), 4)),
+  &quot;h&quot;: is_bin(2),
+  &quot;i&quot;: is_bin({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isbinary</tt>, <tt>is_bin</tt>, and <tt>isbin</tt>.</p></div>
+<div class="section">
+<h3><a name="is_uuid"></a>is_uuid</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_uuid(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>uuid</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>uuid</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_uuid(true),
+  &quot;b&quot;: is_uuid(false),
+  &quot;c&quot;: is_uuid(null),
+  &quot;d&quot;: is_uuid(missing),
+  &quot;e&quot;: isuuid(4.0),
+  &quot;f&quot;: isuuid(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isuuid(uuid(&quot;5c848e5c-6b6a-498f-8452-8847a2957421&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isuuid</tt>.</p></div>
+<div class="section">
+<h3><a name="is_point"></a>is_point</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_point(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>point</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>point</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_point(true),
+  &quot;b&quot;: is_point(false),
+  &quot;c&quot;: is_point(null),
+  &quot;d&quot;: is_point(missing),
+  &quot;e&quot;: is_point(point(&quot;1,2&quot;)),
+  &quot;f&quot;: ispoint(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: ispoint(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: ispoint(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: ispoint(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: ispoint(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ispoint</tt>.</p></div>
+<div class="section">
+<h3><a name="is_line"></a>is_line</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_line(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>line</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>line</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_line(true),
+  &quot;b&quot;: is_line(false),
+  &quot;c&quot;: is_line(null),
+  &quot;d&quot;: is_line(missing),
+  &quot;e&quot;: is_line(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isline(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: isline(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: isline(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: isline(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: isline(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isline</tt>.</p></div>
+<div class="section">
+<h3><a name="is_rectangle"></a>is_rectangle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_rectangle(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>rectangle</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>rectangle</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_rectangle(true),
+  &quot;b&quot;: is_rectangle(false),
+  &quot;c&quot;: is_rectangle(null),
+  &quot;d&quot;: is_rectangle(missing),
+  &quot;e&quot;: is_rectangle(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isrectangle(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: isrectangle(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: isrectangle(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: isrectangle(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: isrectangle(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isrectangle</tt>.</p></div>
+<div class="section">
+<h3><a name="is_circle"></a>is_circle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_circle(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>circle</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>circle</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_circle(true),
+  &quot;b&quot;: is_circle(false),
+  &quot;c&quot;: is_circle(null),
+  &quot;d&quot;: is_circle(missing),
+  &quot;e&quot;: is_circle(point(&quot;1,2&quot;)),
+  &quot;f&quot;: iscircle(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: iscircle(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: iscircle(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: iscircle(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: iscircle(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>iscircle</tt>.</p></div>
+<div class="section">
+<h3><a name="is_polygon"></a>is_polygon</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_polygon(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>polygon</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>polygon</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_polygon(true),
+  &quot;b&quot;: is_polygon(false),
+  &quot;c&quot;: is_polygon(null),
+  &quot;d&quot;: is_polygon(missing),
+  &quot;e&quot;: is_polygon(point(&quot;1,2&quot;)),
+  &quot;f&quot;: ispolygon(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: ispolygon(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: ispolygon(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: ispolygon(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: ispolygon(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ispolygon</tt>.</p></div>
+<div class="section">
+<h3><a name="is_spatial"></a>is_spatial</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_spatial(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a spatial value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_spatial(true),
+  &quot;b&quot;: is_spatial(false),
+  &quot;c&quot;: is_spatial(null),
+  &quot;d&quot;: is_spatial(missing),
+  &quot;e&quot;: is_spatial(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isspatial(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: isspatial(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: isspatial(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: isspatial(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: isspatial(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isspatial</tt>.</p></div>
+<div class="section">
+<h3><a name="is_date"></a>is_date</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_date(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>date</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>date</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_date(true),
+  &quot;b&quot;: is_date(false),
+  &quot;c&quot;: is_date(null),
+  &quot;d&quot;: is_date(missing),
+  &quot;e&quot;: is_date(date(&quot;-19700101&quot;)),
+  &quot;f&quot;: isdate(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isdate(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: isdate(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: isdate(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: isdate(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: isdate(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isdate</tt>.</p></div>
+<div class="section">
+<h3><a name="is_datetime_.28is_timestamp.29"></a>is_datetime (is_timestamp)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_datetime(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>datetime</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>datetime</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_datetime(true),
+  &quot;b&quot;: is_datetime(false),
+  &quot;c&quot;: is_datetime(null),
+  &quot;d&quot;: is_datetime(missing),
+  &quot;e&quot;: is_datetime(datetime(&quot;2016-02-02T12:09:22.023Z&quot;)),
+  &quot;f&quot;: isdatetime(datetime(&quot;2011-03-03T12:10:42.011Z&quot;)),
+  &quot;g&quot;: isdatetime(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: is_timestamp(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: is_timestamp(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: istimestamp(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: istimestamp(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isdatetime</tt>, <tt>is_timestamp</tt>, and <tt>istimestamp</tt>.</p></div>
+<div class="section">
+<h3><a name="is_time"></a>is_time</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_time(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>time</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>time</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_time(true),
+  &quot;b&quot;: is_time(false),
+  &quot;c&quot;: is_time(null),
+  &quot;d&quot;: is_time(missing),
+  &quot;e&quot;: is_time(time(&quot;08:00:00.000Z&quot;)),
+  &quot;f&quot;: istime(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: istime(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: istime(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: istime(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: istime(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: istime(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>istime</tt>.</p></div>
+<div class="section">
+<h3><a name="is_duration"></a>is_duration</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_duration(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a duration value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>duration/year_month_duration/day_time_duration</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_duration(true),
+  &quot;b&quot;: is_duration(false),
+  &quot;c&quot;: is_duration(null),
+  &quot;d&quot;: is_duration(missing),
+  &quot;e&quot;: is_duration(duration(&quot;-PT20.943S&quot;)),
+  &quot;f&quot;: isduration(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isduration(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: isduration(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: isduration(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: isduration(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: isduration(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isduration</tt>.</p></div>
+<div class="section">
+<h3><a name="is_interval"></a>is_interval</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_interval(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>interval</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>interval</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_interval(true),
+  &quot;b&quot;: is_interval(false),
+  &quot;c&quot;: is_interval(null),
+  &quot;d&quot;: is_interval(missing),
+  &quot;e&quot;: is_interval(interval(datetime(&quot;2013-01-01T00:01:01.000Z&quot;), datetime(&quot;2013-05-05T13:39:01.049Z&quot;))),
+  &quot;f&quot;: isinterval(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isinterval(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: isinterval(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: isinterval(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: isinterval(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: isinterval(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isinterval</tt>.</p></div>
+<div class="section">
+<h3><a name="is_temporal"></a>is_temporal</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_temporal(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a temporal value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_temporal(true),
+  &quot;b&quot;: is_temporal(false),
+  &quot;c&quot;: is_temporal(null),
+  &quot;d&quot;: is_temporal(missing),
+  &quot;e&quot;: is_temporal(duration(&quot;-PT20.943S&quot;)),
+  &quot;f&quot;: istemporal(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: istemporal(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: istemporal(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: istemporal(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: istemporal(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: istemporal(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>istemporal</tt>.</p></div>
+<div class="section">
+<h3><a name="get_type"></a>get_type</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_type(expr)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: get_type(true),
+  &quot;b&quot;: get_type(false),
+  &quot;c&quot;: get_type(null),
+  &quot;d&quot;: get_type(missing),
+  &quot;e&quot;: get_type(&quot;d&quot;),
+  &quot;f&quot;: gettype(4.0),
+  &quot;g&quot;: gettype(5),
+  &quot;h&quot;: gettype([&quot;1&quot;, 2]),
+  &quot;i&quot;: gettype({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>gettype</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="to_array"></a>to_array</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_array(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to an <tt>array</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of <tt>array</tt> type then it is returned as is</li>
+<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>
+<li>otherwise an <tt>array</tt> containing the input expression as its single item is returned</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_array(&quot;asterix&quot;),
+  &quot;v2&quot;: to_array([&quot;asterix&quot;]),
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: [&quot;asterix&quot;], &quot;v2&quot;: [&quot;asterix&quot;] }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>toarray</tt>.</p></div>
+<div class="section">
+<h3><a name="to_atomic_.28to_atom.29"></a>to_atomic (to_atom)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_atomic(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a <a href="../datamodel.html#PrimitiveTypes">primitive</a> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of primitive type then it is returned as is</li>
+<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>
+<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>
+<li>otherwise <tt>null</tt> is returned</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_atomic(&quot;asterix&quot;),
+  &quot;v2&quot;: to_atomic([&quot;asterix&quot;]),
+  &quot;v3&quot;: to_atomic([0, 1]),
+  &quot;v4&quot;: to_atomic({&quot;value&quot;: &quot;asterix&quot;}),
+  &quot;v5&quot;: to_number({&quot;x&quot;: 1, &quot;y&quot;: 2})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>toatomic</tt>, <tt>to_atom</tt>, and <tt>toatom</tt>.</p></div>
+<div class="section">
+<h3><a name="to_boolean_.28to_bool.29"></a>to_boolean (to_bool)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_boolean(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a <tt>boolean</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of <tt>boolean</tt> type then it is returned as is</li>
+<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>
+<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>
+<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>
+<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>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_boolean(0),
+  &quot;v2&quot;: to_boolean(1),
+  &quot;v3&quot;: to_boolean(&quot;&quot;),
+  &quot;v4&quot;: to_boolean(&quot;asterix&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: true, &quot;v3&quot;: false, &quot;v4&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>toboolean</tt>, <tt>to_bool</tt>, and <tt>tobool</tt>.</p></div>
+<div class="section">
+<h3><a name="to_bigint"></a>to_bigint</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_bigint(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to an integer value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<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>
+<li>if the argument is of numeric integer type then it is returned as the same value of <tt>bigint</tt> type</li>
+<li>if the argument is of numeric <tt>float</tt>/<tt>double</tt> type then it is converted to <tt>bigint</tt> type</li>
+<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>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_bigint(false),
+  &quot;v2&quot;: to_bigint(true),
+  &quot;v3&quot;: to_bigint(10),
+  &quot;v4&quot;: to_bigint(float(&quot;1e100&quot;)),
+  &quot;v5&quot;: to_bigint(double(&quot;1e1000&quot;)),
+  &quot;v6&quot;: to_bigint(&quot;20&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>tobigint</tt>.</p></div>
+<div class="section">
+<h3><a name="to_double"></a>to_double</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_double(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a <tt>double</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<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>
+<li>if the argument is of numeric type then it is returned as the value of <tt>double</tt> type</li>
+<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>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_double(false),
+  &quot;v2&quot;: to_double(true),
+  &quot;v3&quot;: to_double(10),
+  &quot;v4&quot;: to_double(11.5),
+  &quot;v5&quot;: to_double(&quot;12.5&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>todouble</tt>.</p></div>
+<div class="section">
+<h3><a name="to_number_.28to_num.29"></a>to_number (to_num)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_number(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a numeric value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of numeric type then it is returned as is</li>
+<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>
+<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>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_number(false),
+  &quot;v2&quot;: to_number(true),
+  &quot;v3&quot;: to_number(10),
+  &quot;v4&quot;: to_number(11.5),
+  &quot;v5&quot;: to_number(&quot;12.5&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>tonumber</tt>, <tt>to_num</tt>, and <tt>tonum</tt>.</p></div>
+<div class="section">
+<h3><a name="to_object_.28to_obj.29"></a>to_object (to_obj)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_object(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to an <tt>object</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of <tt>object</tt> type then it is returned as is</li>
+<li>otherwise an empty <tt>object</tt> is returned</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_object({&quot;value&quot;: &quot;asterix&quot;}),
+  &quot;v2&quot;: to_object(&quot;asterix&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: {&quot;value&quot;: &quot;asterix&quot;}, &quot;v2&quot;: {} }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>toobject</tt>, <tt>to_obj</tt>, and <tt>toobj</tt>.</p></div>
+<div class="section">
+<h3><a name="to_string_.28to_str.29"></a>to_string (to_str)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_string(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a string value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<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>
+<li>if the argument is of numeric type then its string representation is returned</li>
+<li>if the argument is of <tt>string</tt> type then it is returned as is</li>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_string(false),
+  &quot;v2&quot;: to_string(true),
+  &quot;v3&quot;: to_string(10),
+  &quot;v4&quot;: to_string(11.5),
+  &quot;v5&quot;: to_string(&quot;asterix&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>tostring</tt>, <tt>to_str</tt>, and <tt>tostr</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Conditional_Functions"></a><a name="ConditionalFunctions" id="ConditionalFunctions">Conditional Functions</a></h2>
+<div class="section">
+<h3><a name="if_null_.28ifnull.29"></a>if_null (ifnull)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_null(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which value is not <tt>null</tt> and returns that value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>null</tt> if all arguments evaluate to <tt>null</tt> or no arguments specified</li>
+<li>a value of the first non-<tt>null</tt> argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: if_null(),
+    &quot;b&quot;: if_null(null),
+    &quot;c&quot;: if_null(null, &quot;asterixdb&quot;),
+    &quot;d&quot;: is_missing(if_null(missing))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot;, &quot;d&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifnull</tt>.</p></div>
+<div class="section">
+<h3><a name="if_missing_.28ifmissing.29"></a>if_missing (ifmissing)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_missing(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which value is not <tt>missing</tt> and returns that value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>null</tt> if all arguments evaluate to <tt>missing</tt> or no arguments specified</li>
+<li>a value of the first non-<tt>missing</tt> argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: if_missing(),
+    &quot;b&quot;: if_missing(missing),
+    &quot;c&quot;: if_missing(missing, &quot;asterixdb&quot;),
+    &quot;d&quot;: if_missing(null, &quot;asterixdb&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot;, &quot;d&quot;: null }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifmissing</tt>.</p></div>
+<div class="section">
+<h3><a name="if_missing_or_null_.28ifmissingornull.2C_coalesce.29"></a>if_missing_or_null (ifmissingornull, coalesce)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_missing_or_null(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which value is not <tt>null</tt> or <tt>missing</tt> and returns that value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>null</tt> if all arguments evaluate to either <tt>null</tt> or <tt>missing</tt>, or no arguments specified</li>
+<li>a value of the first non-<tt>null</tt>, non-<tt>missing</tt> argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: if_missing_or_null(),
+    &quot;b&quot;: if_missing_or_null(null, missing),
+    &quot;c&quot;: if_missing_or_null(null, missing, &quot;asterixdb&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has two aliases: <tt>ifmissingornull</tt> and <tt>coalesce</tt>.</p></div>
+<div class="section">
+<h3><a name="if_inf_.28ifinf.29"></a>if_inf (ifinf)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_inf(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which is a non-infinite (<tt>INF</tt> or<tt>-INF</tt>) number</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>missing</tt> if <tt>missing</tt> argument was encountered before the first non-infinite number argument</li>
+<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>
+<li>the first non-infinite number argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: is_null(if_inf(null)),
+    &quot;b&quot;: is_missing(if_inf(missing)),
+    &quot;c&quot;: is_null(if_inf(double(&quot;INF&quot;))),
+    &quot;d&quot;: if_inf(1, null, missing) ],
+    &quot;e&quot;: is_null(if_inf(null, missing, 1)) ],
+    &quot;f&quot;: is_missing(if_inf(missing, null, 1)) ],
+    &quot;g&quot;: if_inf(float(&quot;INF&quot;), 1) ],
+    &quot;h&quot;: to_string(if_inf(float(&quot;INF&quot;), double(&quot;NaN&quot;), 1)) ]
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifinf</tt>.</p></div>
+<div class="section">
+<h3><a name="if_nan_.28ifnan.29"></a>if_nan (ifnan)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_nan(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which is a non-<tt>NaN</tt> number</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>missing</tt> if <tt>missing</tt> argument was encountered before the first non-<tt>NaN</tt> number argument</li>
+<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>
+<li>the first non-<tt>NaN</tt> number argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: is_null(if_nan(null)),
+    &quot;b&quot;: is_missing(if_nan(missing)),
+    &quot;c&quot;: is_null(if_nan(double(&quot;NaN&quot;))),
+    &quot;d&quot;: if_nan(1, null, missing) ],
+    &quot;e&quot;: is_null(if_nan(null, missing, 1)) ],
+    &quot;f&quot;: is_missing(if_nan(missing, null, 1)) ],
+    &quot;g&quot;: if_nan(float(&quot;NaN&quot;), 1) ],
+    &quot;h&quot;: to_string(if_nan(float(&quot;NaN&quot;), double(&quot;INF&quot;), 1)) ]
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifnan</tt>.</p></div>
+<div class="section">
+<h3><a name="if_nan_or_inf_.28ifnanorinf.29"></a>if_nan_or_inf (ifnanorinf)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_nan_or_inf(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which is a non-infinite (<tt>INF</tt> or<tt>-INF</tt>) and non-<tt>NaN</tt> number</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<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>
+<li>the first non-infinite and non-<tt>NaN</tt> number argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: is_null(if_nan_or_inf(null)),
+    &quot;b&quot;: is_missing(if_nan_or_inf(missing)),
+    &quot;c&quot;: is_null(if_nan_or_inf(double(&quot;NaN&quot;), double(&quot;INF&quot;))),
+    &quot;d&quot;: if_nan_or_inf(1, null, missing) ],
+    &quot;e&quot;: is_null(if_nan_or_inf(null, missing, 1)) ],
+    &quot;f&quot;: is_missing(if_nan_or_inf(missing, null, 1)) ],
+    &quot;g&quot;: if_nan_or_inf(float(&quot;NaN&quot;), float(&quot;INF&quot;), 1) ],
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifnanorinf</tt>.</p></div>
+<div class="section">
+<h3><a name="null_if_.28nullif.29"></a>null_if (nullif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">null_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>null</tt> if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if
+<ul>
+
+<li>any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value, or</li>
+<li><tt>argument1</tt> = <tt>argument2</tt></li>
+</ul>
+</li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: null_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;),
+    &quot;b&quot;: null_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>nullif</tt>.</p></div>
+<div class="section">
+<h3><a name="missing_if_.28missingif.29"></a>missing_if (missingif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">missing_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>missing</tt> if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if
+<ul>
+
+<li>any argument is a <tt>missing</tt> value, or</li>
+<li>no argument is a <tt>null</tt> value and <tt>argument1</tt> = <tt>argument2</tt></li>
+</ul>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: missing_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)
+    &quot;b&quot;: missing_if(1, 2),
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>missingif</tt>.</p></div>
+<div class="section">
+<h3><a name="nan_if_.28nanif.29"></a>nan_if (nanif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">nan_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>NaN</tt> value if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li><tt>NaN</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: to_string(nan_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
+    &quot;b&quot;: nan_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: &quot;NaN&quot;, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>nanif</tt>.</p></div>
+<div class="section">
+<h3><a name="posinf_if_.28posinfif.29"></a>posinf_if (posinfif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">posinf_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>+INF</tt> value if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li><tt>+INF</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: to_string(posinf_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
+    &quot;b&quot;: posinf_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: &quot;+INF&quot;, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>posinfif</tt>.</p></div>
+<div class="section">
+<h3><a name="neginf_if_.28neginfif.29"></a>neginf_if (neginfif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">neginf_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>-INF</tt> value if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li><tt>-INF</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: to_string(neginf_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
+    &quot;b&quot;: neginf_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: &quot;-INF&quot;, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>neginfif</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Miscellaneous_Functions"></a><a name="MiscFunctions" id="MiscFunctions">Miscellaneous Functions</a></h2>
+<div class="section">
+<h3><a name="uuid"></a>uuid</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">uuid()
+</pre></div></div>
+</li>
+<li>
+
+<p>Generates a <tt>uuid</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li>none</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a generated, random <tt>uuid</tt>.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="len"></a>len</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>len(array)</p>
+</li>
+<li>
+
+<p>Returns the length of the array array.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>integer</tt> that represents the length of input array or the size of the input multiset,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">len([&quot;Hello&quot;, &quot;World&quot;])
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">2
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="not"></a>not</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">not(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Inverts a <tt>boolean</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt>, the inverse of <tt>expr</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>other non-boolean argument value will cause a type error.</li>
+</ul>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: `not`(true), &quot;v2&quot;: `not`(false), &quot;v3&quot;: `not`(null), &quot;v4&quot;: `not`(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: true, &quot;v3&quot;: null }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="random"></a>random</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">random( [seed_value] )
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a random number, accepting an optional seed value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>A random number of type <tt>double</tt> between 0 and 1,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value or a non-numeric value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: random(),
+  &quot;v2&quot;: random(unix_time_from_datetime_in_ms(current_datetime()))
+};
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="range"></a>range</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">range(start_numeric_value, end_numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:</li>
+<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>
+<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>
+<li>Return Value:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">range(0, 3);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ 0, 1, 2, 3 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="switch_case"></a>switch_case</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">switch_case(
+    condition,
+    case1, case1_result,
+    case2, case2_result,
+    ...,
+    default, default_result
+)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>condition</tt>: a variable (any type is allowed).</li>
+<li><tt>caseI/default</tt>: a variable (any type is allowed).</li>
+<li><tt>caseI/default_result</tt>: a variable (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>caseI_result</tt> if <tt>condition</tt> matches <tt>caseI</tt>, otherwise <tt>default_result</tt>.</li>
+</ul>
+</li>
+<li>Example 1:
+
+<div>
+<div>
+<pre class="source">switch_case(
+    &quot;a&quot;,
+    &quot;a&quot;, 0,
+    &quot;x&quot;, 1,
+    &quot;y&quot;, 2,
+    &quot;z&quot;, 3
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0
+</pre></div></div>
+</li>
+<li>
+
+<p>Example 2:</p>
+
+<div>
+<div>
+<pre class="source">switch_case(
+    &quot;a&quot;,
+    &quot;x&quot;, 1,
+    &quot;y&quot;, 2,
+    &quot;z&quot;, 3
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="deep_equal"></a>deep_equal</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">deep_equal(expr1, expr2)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr1</tt> : an expression,</li>
+<li><tt>expr2</tt> : an expression.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>true</tt> or <tt>false</tt> depending on the data equality,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">deep_equal(
+           {
+             &quot;id&quot;:1,
+             &quot;project&quot;:&quot;AsterixDB&quot;,
+             &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+             &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+           },
+           {
+             &quot;id&quot;:1,
+             &quot;project&quot;:&quot;AsterixDB&quot;,
+             &quot;address&quot;:{&quot;city&quot;:&quot;San Diego&quot;, &quot;state&quot;:&quot;CA&quot;},
+             &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+           }
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">false
+</pre></div></div>
+</li>
+</ul></div></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/docs/0.9.9/aws.html b/docs/0.9.9/aws.html
new file mode 100644
index 0000000..375eb07
--- /dev/null
+++ b/docs/0.9.9/aws.html
@@ -0,0 +1,390 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/aws.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Installation using Amazon Web Services</title>
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="./css/site.css" />
+    <link rel="stylesheet" href="./css/print.css" media="print" />
+    <script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href="./" id="bannerLeft"><img src="images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li class="active"><a href="#"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href="./" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>Installation using Amazon Web Services</h1>
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="atoc" id="#toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#Introduction">Introduction</a></li>
+<li><a href="#Prerequisites">Prerequisites</a></li>
+<li><a href="#config">Cluster Configuration</a></li>
+<li><a href="#lifecycle">Cluster Lifecycle Management</a></li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Introduction" id="Introduction">Introduction</a></h2>
+<p>Note that you can always manually launch a number of Amazon Web Services EC2 instances and then run the Ansible cluster installation scripts as described <a href="ansible.html">here</a> separately to manage the lifecycle of an AsterixDB cluster on those EC2 instances.</p>
+<p>However, via this installation option, we provide a combo solution for automating both AWS EC2 and AsterixDB, where you can run only one script to deploy, start, stop, and terminate an AsterixDB cluster on AWS.</p></div>
+<div class="section">
+<h2><a name="Prerequisites" id="Prerequisites">Prerequisites</a></h2>
+<ul>
+
+<li>
+
+<p>Supported operating systems for the client: <b>Linux</b> and <b>MacOS</b></p>
+</li>
+<li>
+
+<p>Supported operating systems for Amazon Web Services instances: <b>Linux</b></p>
+</li>
+<li>
+
+<p>Install pip on your client machine:</p>
+<p>CentOS</p>
+
+<div>
+<div>
+<pre class="source"> $ sudo yum install python-pip
+</pre></div></div>
+
+<p>Ubuntu</p>
+
+<div>
+<div>
+<pre class="source"> $ sudo apt-get install python-pip
+</pre></div></div>
+
+<p>macOS</p>
+
+<div>
+<div>
+<pre class="source"> $ brew install pip
+</pre></div></div>
+</li>
+<li>
+
+<p>Install Ansible, boto, and boto3 on your client machine:</p>
+
+<div>
+<div>
+<pre class="source"> $ pip install ansible
+ $ pip install boto
+ $ pip install boto3
+</pre></div></div>
+
+<p>Note that you might need <tt>sudo</tt> depending on your system configuration.</p>
+<p><b>Make sure that the version of Ansible is no less than 2.2.1.0</b>:</p>
+
+<div>
+<div>
+<pre class="source"> $ ansible --version
+ ansible 2.2.1.0
+</pre></div></div>
+
+<p><b>For users with macOS 10.11+</b>, please create a user-level Ansible configuration file at:</p>
+
+<div>
+<div>
+<pre class="source"> ~/.ansible.cfg
+</pre></div></div>
+
+<p>and add the following configuration:</p>
+
+<div>
+<div>
+<pre class="source"> [ssh_connection]
+ control_path = %(directory)s/%%C
+</pre></div></div>
+</li>
+<li>
+
+<p>Download the AsterixDB distribution package, unzip it, navigate to <tt>opt/aws/</tt></p>
+
+<div>
+<div>
+<pre class="source"> $ cd opt/aws
+</pre></div></div>
+
+<p>The following files and directories are in the directory <tt>opt/aws</tt>:</p>
+
+<div>
+<div>
+<pre class="source"> README  bin  conf  yaml
+</pre></div></div>
+
+<p><tt>bin</tt> contains scripts that start and terminate an AWS-based cluster instance, according to the configuration specified in files under <tt>conf</tt>, and <tt>yaml</tt> contains internal Ansible scripts that the shell scripts in <tt>bin</tt> use.</p>
+</li>
+<li>
+
+<p>Create an AWS account and an IAM user.</p>
+<p>Set up a security group that you&#x2019;d like to use for your AWS cluster. <b>The security group should at least allow all TCP connections from anywhere.</b> Provide the name of the security group as the value for the <tt>group</tt> field in <tt>conf/aws_settings.yml</tt>.</p>
+</li>
+<li>
+
+<p>Retrieve your AWS EC2 key pair name and use that as the <tt>keypair</tt> in <tt>conf/aws_settings.yml</tt>;</p>
+<p>retrieve your AWS IAM <tt>access key ID</tt> and use that as the <tt>access_key_id</tt> in <tt>conf/aws_settings.yml</tt>;</p>
+<p>retrieve your AWS IAM <tt>secret access key</tt> and use that as the <tt>secret_access_key</tt> in <tt>conf/aws_settings.yml</tt>.</p>
+<p>Note that you can only read or download <tt>access key ID</tt> and <tt>secret access key</tt> once from your AWS console. If you forget them, you have to create new keys and delete the old ones.</p>
+</li>
+<li>
+
+<p>Configure your ssh setting by editing <tt>~/.ssh/config</tt> and adding the following entry:</p>
+
+<div>
+<div>
+<pre class="source"> Host *.amazonaws.com
+      IdentityFile &lt;path_of_private_key&gt;
+</pre></div></div>
+
+<p>Note that &lt;path_of_private_key&gt; should be replaced by the path to the file that stores the private key for the key pair that you uploaded to AWS and used in <tt>conf/aws_settings</tt>. For example:</p>
+
+<div>
+<div>
+<pre class="source"> Host *.amazonaws.com
+      IdentityFile ~/.ssh/id_rsa
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h2><a name="Cluster_Configuration"></a><a name="config" id="config">Cluster Configuration</a></h2>
+<ul>
+
+<li>
+
+<p><b>AWS settings</b>.  Edit <tt>conf/instance_settings.yml</tt>. The meaning of each parameter is listed as follows:</p>
+
+<div>
+<div>
+<pre class="source"> # The OS image id for ec2 instances.
+ image: ami-76fa4116
+
+ # The data center region for ec2 instances.
+ region: us-west-2
+
+ # The tag for each ec2 machine. Use different tags for isolation.
+ tag: scale_test
+
+ # The name of a security group that appears in your AWS console.
+ group: default
+
+ # The name of a key pair that appears in your AWS console.
+ keypair: &lt;to be filled&gt;
+
+ # The AWS access key id for your IAM user.
+ access_key_id: &lt;to be filled&gt;
+
+ # The AWS secret key for your IAM user.
+ secret_access_key: &lt;to be filled&gt;
+
+ # The AWS instance type. A full list of available types are listed at:
+ # https://aws.amazon.com/ec2/instance-types/
+ instance_type: t2.micro
+
+ # The number of ec2 instances that construct a cluster.
+ count: 3
+
+ # The user name.
+ user: ec2-user
+
+ # Whether to reuse one slave machine to host the master process.
+ cc_on_nc: false
+</pre></div></div>
+
+<p><b>As described in <a href="#Prerequisites">prerequisites</a>, the following parameters must be customized:</b></p>
+
+<div>
+<div>
+<pre class="source"> # The tag for each ec2 machine. Use different tags for isolation.
+ tag: scale_test
+
+ # The name of a security group that appears in your AWS console.
+ group: default
+
+ # The name of a key pair that appears in your AWS console.
+ keypair: &lt;to be filled&gt;
+
+ # The AWS access key id for your IAM user.
+ access_key_id: &lt;to be filled&gt;
+
+ # The AWS secrety key for your IAM user.
+ secret_access_key: &lt;to be filled&gt;
+</pre></div></div>
+</li>
+<li>
+
+<p><b>Remote working directories</b>. Edit <tt>conf/instance_settings.yml</tt> to change the remote binary directory (the variable &#x201c;binarydir&#x201d;) when necessary. By default, the binary directory will be under the home directory (as the value of Ansible builtin variable ansible_env.HOME) of the ssh user account on each node.</p>
+</li>
+</ul></div>
+<div class="section">
+<h2><a name="Cluster_Lifecycle_Management"></a><a name="lifecycle" id="lifecycle">Cluster Lifecycle Management</a></h2>
+<ul>
+
+<li>
+
+<p>Allocate AWS EC2 nodes (the number of nodes is specified in <tt>conf/instance_settings.yml</tt>) and deploy the binary to all allocated EC2 nodes:</p>
+
+<div>
+<div>
+<pre class="source"> bin/deploy.sh
+</pre></div></div>
+</li>
+<li>
+
+<p>Before starting the AsterixDB cluster, you the instance configuration file <tt>conf/instance/cc.conf</tt> can be modified with the exception of the IP addresses/DNS names which are are generated and cannot be changed. All available parameters and their usage can be found <a href="ncservice.html#Parameters">here</a>.</p>
+</li>
+<li>
+
+<p>Launch your AsterixDB cluster on EC2:</p>
+
+<div>
+<div>
+<pre class="source"> bin/start.sh
+</pre></div></div>
+
+<p>Now you can use the multi-node AsterixDB cluster on EC2 by by opening the master node listed in <tt>conf/instance/inventory</tt> at port <tt>19001</tt> (which can be customized in <tt>conf/instance/cc.conf</tt>) in your browser.</p>
+</li>
+<li>
+
+<p>If you want to stop the AWS-based AsterixDB cluster, run the following script:</p>
+
+<div>
+<div>
+<pre class="source"> bin/stop.sh
+</pre></div></div>
+
+<p>Note that this only stops AsterixDB but does not stop the EC2 nodes.</p>
+</li>
+<li>
+
+<p>If you want to terminate the EC2 nodes that run the AsterixDB cluster, run the following script:</p>
+
+<div>
+<div>
+<pre class="source"> bin/terminate.sh
+</pre></div></div>
+
+<p><b>Note that it will destroy everything in the AsterixDB cluster you installed and terminate all EC2 nodes for the cluster.</b></p>
+</li>
+</ul></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/docs/0.9.9/datamodel.html b/docs/0.9.9/datamodel.html
new file mode 100644
index 0000000..07e2af4
--- /dev/null
+++ b/docs/0.9.9/datamodel.html
@@ -0,0 +1,784 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/datamodel.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; The Asterix Data Model (ADM)</title>
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="./css/site.css" />
+    <link rel="stylesheet" href="./css/print.css" media="print" />
+    <script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href="./" id="bannerLeft"><img src="images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li class="active"><a href="#"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href="./" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>The Asterix Data Model (ADM)</h1>
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="toc" id="toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#PrimitiveTypes">Primitive Types</a>
+<ul>
+
+<li><a href="#PrimitiveTypesBoolean">Boolean</a></li>
+<li><a href="#PrimitiveTypesString">String</a></li>
+<li><a href="#PrimitiveTypesInt">Tinyint / Smallint / Integer (Int) / Bigint</a></li>
+<li><a href="#PrimitiveTypesFloat">Float</a></li>
+<li><a href="#PrimitiveTypesDouble">Double (Double Precision)</a></li>
+<li><a href="#PrimitiveTypesBinary">Binary</a></li>
+<li><a href="#PrimitiveTypesPoint">Point</a></li>
+<li><a href="#PrimitiveTypesLine">Line</a></li>
+<li><a href="#PrimitiveTypesRectangle">Rectangle</a></li>
+<li><a href="#PrimitiveTypesCircle">Circle</a></li>
+<li><a href="#PrimitiveTypesPolygon">Polygon</a></li>
+<li><a href="#PrimitiveTypesDate">Date</a></li>
+<li><a href="#PrimitiveTypesTime">Time</a></li>
+<li><a href="#PrimitiveTypesDateTime">Datetime (Timestamp)</a></li>
+<li><a href="#PrimitiveTypesDuration">Duration/Year_month_duration/Day_time_duration</a></li>
+<li><a href="#PrimitiveTypesInterval">Interval</a></li>
+<li><a href="#PrimitiveTypesUUID">UUID</a></li>
+</ul>
+</li>
+<li><a href="#IncompleteInformationTypes">Incomplete Information Types</a>
+<ul>
+
+<li><a href="#IncompleteInformationTypesNull">Null</a></li>
+<li><a href="#IncompleteInformationTypesMissing">Missing</a></li>
+</ul>
+</li>
+<li><a href="#DerivedTypes">Derived Types</a>
+<ul>
+
+<li><a href="#DerivedTypesObject">Object</a></li>
+<li><a href="#DerivedTypesArray">Array</a></li>
+<li><a href="#DerivedTypesMultiset">Multiset</a></li>
+</ul>
+</li>
+</ul>
+<p>An instance of Asterix data model (ADM) can be a <i><i>primitive type</i></i> (<tt>boolean</tt>, <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, <tt>bigint</tt>, <tt>string</tt>, <tt>float</tt>, <tt>double</tt>, <tt>date</tt>, <tt>time</tt>, <tt>datetime</tt>, etc.), a <i><i>special type</i></i> (<tt>null</tt> or <tt>missing</tt>), or a <i><i>derived type</i></i>.</p>
+<p>The type names are case-insensitive, e.g., both <tt>BIGINT</tt> and <tt>bigint</tt> are acceptable.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Primitive_Types"></a><a name="PrimitiveTypes" id="PrimitiveTypes">Primitive Types</a></h2>
+<div class="section">
+<h3><a name="Boolean"></a><a name="PrimitiveTypesBoolean" id="PrimitiveTypesBoolean">Boolean</a></h3>
+<p><tt>boolean</tt> data type can have one of the two values: <i>true</i> or <i>false</i>.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;true&quot;: true, &quot;false&quot;: false };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;true&quot;: true, &quot;false&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="String"></a><a name="PrimitiveTypesString" id="PrimitiveTypesString">String</a></h3>
+<p><tt>string</tt> represents a sequence of characters. The total length of the sequence can be up to 2,147,483,648.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: string(&quot;This is a string.&quot;), &quot;v2&quot;: string(&quot;\&quot;This is a quoted string\&quot;&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;This is a string.&quot;, &quot;v2&quot;: &quot;\&quot;This is a quoted string\&quot;&quot; }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="Tinyint_.2F_Smallint_.2F_Integer_.28Int.29_.2F_Bigint"></a><a name="PrimitiveTypesInt" id="PrimitiveTypesInt">Tinyint / Smallint / Integer (Int) / Bigint</a></h3>
+<p>Integer types using 8, 16, 32, or 64 bits. The ranges of these types are:</p>
+<ul>
+
+<li><tt>tinyint</tt>: -128 to 127</li>
+<li><tt>smallint</tt>: -32768 to 32767</li>
+<li><tt>integer</tt>: -2147483648 to 2147483647</li>
+<li><tt>bigint</tt>: -9223372036854775808 to 9223372036854775807</li>
+</ul>
+<p><tt>int</tt> is an abbreviated alias for integer.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;tinyint&quot;: tiny(&quot;125&quot;), &quot;smallint&quot;: smallint(&quot;32765&quot;), &quot;integer&quot;: 294967295, &quot;bigint&quot;: bigint(&quot;1700000000000000000&quot;)};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;tinyint&quot;: 125, &quot;smallint&quot;: 32765, &quot;integer&quot;: 294967295, &quot;bigint&quot;: 1700000000000000000 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Float"></a><a name="PrimitiveTypesFloat" id="PrimitiveTypesFloat">Float</a></h3>
+<p><tt>float</tt> represents approximate numeric data values using 4 bytes. The range of a float value can be from 2^(-149) to (2-2^(-23)&#xb7;2^(127) for both positive and negative. Beyond these ranges will get <tt>INF</tt> or <tt>-INF</tt>.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: float(&quot;NaN&quot;), &quot;v2&quot;: float(&quot;INF&quot;), &quot;v3&quot;: float(&quot;-INF&quot;), &quot;v4&quot;: float(&quot;-2013.5&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;NaN&quot;, &quot;v2&quot;: &quot;INF&quot;, &quot;v3&quot;: &quot;-INF&quot;, &quot;v4&quot;: -2013.5 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Double_.28double_precision.29"></a><a name="PrimitiveTypesDouble" id="PrimitiveTypesDouble">Double (double precision)</a></h3>
+<p><tt>double</tt> represents approximate numeric data values using 8 bytes. The range of a double value can be from (2^(-1022)) to (2-2^(-52))&#xb7;2^(1023) for both positive and negative. Beyond these ranges will get <tt>INF</tt> or <tt>-INF</tt>.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: double(&quot;NaN&quot;), &quot;v2&quot;: double(&quot;INF&quot;), &quot;v3&quot;: double(&quot;-INF&quot;), &quot;v4&quot;: &quot;-2013.593823748327284&quot; };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;NaN&quot;, &quot;v2&quot;: &quot;INF&quot;, &quot;v3&quot;: &quot;-INF&quot;, &quot;v4&quot;: -2013.5938237483274 }
+</pre></div></div>
+</li>
+</ul>
+<p><tt>Double precision</tt> is an alias of <tt>double</tt>.</p></div>
+<div class="section">
+<h3><a name="Binary"></a><a name="PrimitiveTypesBinary" id="PrimitiveTypesBinary">Binary</a></h3>
+<p><tt>binary</tt> represents a sequence of bytes. It can be constructed from a <tt>hex</tt> or a <tt>base64</tt> string sequence. The total length of the byte sequence can be up to 2,147,483,648.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;hex1&quot; : hex(&quot;ABCDEF0123456789&quot;),
+  &quot;hex2&quot;: hex(&quot;abcdef0123456789&quot;),
+  &quot;base64_1&quot; : base64(&quot;0123456789qwertyui+/&quot;),
+  &quot;base64_2&quot; : base64('QXN0ZXJpeA==')
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The default output format is in <tt>hex</tt> format. Thus, the expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;hex1&quot;: hex(&quot;ABCDEF0123456789&quot;),
+  &quot;hex2&quot;: hex(&quot;ABCDEF0123456789&quot;),
+  &quot;base64_1&quot;: hex(&quot;D35DB7E39EBBF3DAB07ABB72BA2FBF&quot;),
+  &quot;base64_2&quot;: hex(&quot;41737465726978&quot;)
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Point"></a><a name="PrimitiveTypesPoint" id="PrimitiveTypesPoint">Point</a></h3>
+<p><tt>point</tt> is the fundamental two-dimensional building block for spatial types. It consists of two <tt>double</tt> coordinates x and y.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: point(&quot;80.10d, -10E5&quot;), &quot;v2&quot;: point(&quot;5.10E-10d, -10E5&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: point(&quot;80.1,-1000000.0&quot;), &quot;v2&quot;: point(&quot;5.1E-10,-1000000.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Line"></a><a name="PrimitiveTypesLine" id="PrimitiveTypesLine">Line</a></h3>
+<p><tt>line</tt> consists of two points that represent the start and the end points of a line segment.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: line(&quot;10.1234,11.1e-1 +10.2E-2,-11.22&quot;), &quot;v2&quot;: line(&quot;0.1234,-1.00e-10 +10.5E-2,-01.02&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: line(&quot;10.1234,1.11 0.102,-11.22&quot;), &quot;v2&quot;: line(&quot;0.1234,-1.0E-10 0.105,-1.02&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Rectangle"></a><a name="PrimitiveTypesRectangle" id="PrimitiveTypesRectangle">Rectangle</a></h3>
+<p><tt>rectangle</tt> consists of two points that represent the <i><i>bottom left</i></i> and <i><i>upper right</i></i> corners of a rectangle.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: rectangle(&quot;5.1,11.8 87.6,15.6548&quot;), &quot;v2&quot;: rectangle(&quot;0.1234,-1.00e-10 5.5487,0.48765&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: rectangle(&quot;5.1,11.8 87.6,15.6548&quot;), &quot;v2&quot;: rectangle(&quot;0.1234,-1.0E-10 5.5487,0.48765&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Circle"></a><a name="PrimitiveTypesCircle" id="PrimitiveTypesCircle">Circle</a></h3>
+<p><tt>circle</tt> consists of one point that represents the center of the circle and a radius of type <tt>double</tt>.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: circle(&quot;10.1234,11.1e-1 +10.2E-2&quot;), &quot;v2&quot;: circle(&quot;0.1234,-1.00e-10 +10.5E-2&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: circle(&quot;10.1234,1.11 0.102&quot;), &quot;v2&quot;: circle(&quot;0.1234,-1.0E-10 0.105&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Polygon"></a><a name="PrimitiveTypesPolygon" id="PrimitiveTypesPolygon">Polygon</a></h3>
+<p><tt>polygon</tt> consists of <i><i>n</i></i> points that represent the vertices of a <i><i>simple closed</i></i> polygon.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: polygon(&quot;-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81&quot;),
+  &quot;v2&quot;: polygon(&quot;-1.0,+10.5e2 -02.15E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: polygon(&quot;-1.2,130.0 -214000.0,2.15 -350.0,3.6 -0.0046,4.81&quot;),
+  &quot;v2&quot;: polygon(&quot;-1.0,1050.0 -2.15E50,2.5 -1.0,3300.0 -250000.0,20.15 350.0,3.6 -0.0046,4.75 -2.0,100.0 -200000.0,20.1 30.5,3.25 -0.00433,4.75&quot;) }
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Date"></a><a name="PrimitiveTypesDate" id="PrimitiveTypesDate">Date</a></h3>
+<p><tt>date</tt> represents a time point along the Gregorian calendar system specified by the year, month and day. ASTERIX supports the date from <tt>-9999-01-01</tt> to <tt>9999-12-31</tt>.</p>
+<p>A date value can be represented in two formats, extended format and basic format.</p>
+<ul>
+
+<li>Extended format is represented as <tt>[-]yyyy-mm-dd</tt> for <tt>year-month-day</tt>. Each field should be padded if there are less digits than the format specified.</li>
+<li>Basic format is in the format of <tt>[-]yyyymmdd</tt>.</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: date(&quot;2013-01-01&quot;), &quot;v2&quot;: date(&quot;-19700101&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: date(&quot;2013-01-01&quot;), &quot;v2&quot;: date(&quot;-1970-01-01&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Time"></a><a name="PrimitiveTypesTime" id="PrimitiveTypesTime">Time</a></h3>
+<p><tt>time</tt> type describes the time within the range of a day. It is represented by three fields: hour, minute and second. Millisecond field is optional as the fraction of the second field. Its extended format is as <tt>hh:mm:ss[.mmm]</tt> and the basic format is <tt>hhmmss[mmm]</tt>. The value domain is from <tt>00:00:00.000</tt> to <tt>23:59:59.999</tt>.</p>
+<p>Timezone field is optional for a time value. Timezone is represented as <tt>[+|-]hh:mm</tt> for extended format or <tt>[+|-]hhmm</tt> for basic format. Note that the sign designators cannot be omitted. <tt>Z</tt> can also be used to represent the UTC local time. If no timezone information is given, it is UTC by default.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: time(&quot;12:12:12.039Z&quot;), &quot;v2&quot;: time(&quot;000000000-0800&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: time(&quot;12:12:12.039Z&quot;), &quot;v2&quot;: time(&quot;08:00:00.000Z&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Datetime_.28Timestamp.29"></a><a name="PrimitiveTypesDateTime" id="PrimitiveTypesDateTime">Datetime (Timestamp)</a></h3>
+<p>A <tt>datetime</tt> value is a combination of an <tt>date</tt> and <tt>time</tt>, representing a fixed time point along the Gregorian calendar system. The value is among <tt>-9999-01-01 00:00:00.000</tt> and <tt>9999-12-31 23:59:59.999</tt>.</p>
+<p>A <tt>datetime</tt> value is represented as a combination of the representation of its <tt>date</tt> part and <tt>time</tt> part, separated by a separator <tt>T</tt>. Either extended or basic format can be used, and the two parts should be the same format.</p>
+<p>Millisecond field and timezone field are optional, as specified in the <tt>time</tt> type.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: datetime(&quot;2013-01-01T12:12:12.039Z&quot;), &quot;v2&quot;: datetime(&quot;-19700101T000000000-0800&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: datetime(&quot;2013-01-01T12:12:12.039Z&quot;), &quot;v2&quot;: datetime(&quot;-1970-01-01T08:00:00.000Z&quot;) }
+</pre></div></div>
+</li>
+</ul>
+<p><tt>timestamp</tt> is an alias of <tt>datetime</tt>.</p></div>
+<div class="section">
+<h3><a name="Duration.2FYear_month_duration.2FDay_time_duration"></a><a name="PrimitiveTypesDuration" id="PrimitiveTypesDuration">Duration/Year_month_duration/Day_time_duration</a></h3>
+<p><tt>duration</tt> represents a duration of time. A duration value is specified by integers on at least one of the following fields: year, month, day, hour, minute, second, and millisecond.</p>
+<p>A duration value is in the format of <tt>[-]PnYnMnDTnHnMn.mmmS</tt>. The millisecond part (as the fraction of the second field) is optional, and when no millisecond field is used, the decimal point should also be absent.</p>
+<p>Negative durations are also supported for the arithmetic operations between time instance types (<tt>date</tt>, <tt>time</tt> and <tt>datetime</tt>), and is used to roll the time back for the given duration. For example <tt>date(&quot;2012-01-01&quot;) + duration(&quot;-P3D&quot;)</tt> will return <tt>date(&quot;2011-12-29&quot;)</tt>.</p>
+<p>There are also two sub-duration types, namely <tt>year_month_duration</tt> and <tt>day_time_duration</tt>. <tt>year_month_duration</tt> represents only the years and months of a duration, while <tt>day_time_duration</tt> represents only the day to millisecond fields. Different from the <tt>duration</tt> type, both these two subtypes are totally ordered, so they can be used for comparison and index construction.</p>
+<p>Note that a canonical representation of the duration is always returned, regardless whether the duration is in the canonical representation or not from the user&#x2019;s input. More information about canonical representation can be found from <a class="externalLink" href="http://www.w3.org/TR/xpath-functions/#canonical-dayTimeDuration">XPath dayTimeDuration Canonical Representation</a> and <a class="externalLink" href="http://www.w3.org/TR/xpath-functions/#canonical-yearMonthDuration">yearMonthDuration Canonical Representation</a>.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: duration(&quot;P100Y12MT12M&quot;), &quot;v2&quot;: duration(&quot;-PT20.943S&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: duration(&quot;P101YT12M&quot;), &quot;v2&quot;: duration(&quot;-PT20.943S&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Interval"></a><a name="PrimitiveTypesInterval" id="PrimitiveTypesInterval">Interval</a></h3>
+<p><tt>interval</tt> represents inclusive-exclusive ranges of time. It is defined by two time point values with the same temporal type(<tt>date</tt>, <tt>time</tt> or <tt>datetime</tt>).</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;)),
+  &quot;v2&quot;: interval(time(&quot;00:01:01&quot;), time(&quot;213901049+0800&quot;)),
+  &quot;v3&quot;: interval(datetime(&quot;2013-01-01T00:01:01&quot;), datetime(&quot;20130505T213901049+0800&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: interval(date(&quot;2013-01-01&quot;), date(&quot;2013-05-05&quot;)),
+  &quot;v2&quot;: interval(time(&quot;00:01:01.000Z&quot;), time(&quot;13:39:01.049Z&quot;)),
+  &quot;v3&quot;: interval(datetime(&quot;2013-01-01T00:01:01.000Z&quot;), datetime(&quot;2013-05-05T13:39:01.049Z&quot;))
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="UUID"></a><a name="PrimitiveTypesUUID" id="PrimitiveTypesUUID">UUID</a></h3>
+<p><tt>uuid</tt> represents a UUID value, which stands for Universally unique identifier. It is defined by a canonical format using hexadecimal text with inserted hyphen characters. (E.g.: 5a28ce1e-6a74-4201-9e8f-683256e5706f). This type is generally used to store auto-generated primary key values.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">return { &quot;v1&quot;:uuid(&quot;5c848e5c-6b6a-498f-8452-8847a2957421&quot;) }
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: uuid(&quot;5c848e5c-6b6a-498f-8452-8847a2957421&quot;) }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Incomplete_Information_Types"></a><a name="IncompleteInformationTypes" id="IncompleteInformationTypes">Incomplete Information Types</a></h2>
+<div class="section">
+<h3><a name="Null"></a><a name="IncompleteInformationTypesNull" id="IncompleteInformationTypesNull">Null</a></h3>
+<p><tt>null</tt> is a special value that is often used to represent an unknown value. For example, a user might not be able to know the value of a field and let it be <tt>null</tt>.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;field&quot;: null };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;field&quot;: null }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="Missing"></a><a name="IncompleteInformationTypesMissing" id="IncompleteInformationTypesMissing">Missing</a></h3>
+<p><tt>missing</tt> indicates that a name-value pair is missing from an object. If a missing name-value pair is accessed, an empty result value is returned by the query.</p>
+<p>As neither the data model nor the system enforces homogeneity for datasets or collections, items in a dataset or collection can be of heterogeneous types and so a field can be present in one object and <tt>missing</tt> in another.</p>
+<ul>
+
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;field&quot;: missing };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{  }
+</pre></div></div>
+</li>
+</ul>
+<p>Since a field with value <tt>missing</tt> means the field is absent, we get an empty object.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Derived_Types"></a><a name="DerivedTypes" id="DerivedTypes">Derived Types</a></h2>
+<div class="section">
+<h3><a name="Object"></a><a name="DerivedTypesObject" id="DerivedTypesObject">Object</a></h3>
+<p>An <tt>object</tt> contains a set of &#xfb01;elds, where each &#xfb01;eld is described by its name and type. An object type may be defined as either open or closed. Open objects (instances of open object types) are permitted to contain &#xfb01;elds that are not part of the type de&#xfb01;nition, while closed objects do not permit their instances to carry extra fields. An example type definition for an object is:</p>
+
+<div>
+<div>
+<pre class="source">    create type SoldierType as open {
+        name: string?,
+        rank: string,
+        serialno: int
+    };
+</pre></div></div>
+
+<p>Syntactically, object constructors are surrounded by curly braces &#x201c;{&#x2026;}&#x201d;. Some examples of legitimate instances of the above type include:</p>
+
+<div>
+<div>
+<pre class="source">    { &quot;name&quot;: &quot;Joe Blow&quot;, &quot;rank&quot;: &quot;Sergeant&quot;, &quot;serialno&quot;: 1234567 }
+    { &quot;rank&quot;: &quot;Private&quot;, &quot;serialno&quot;: 9876543 }
+    { &quot;name&quot;: &quot;Sally Forth&quot;, &quot;rank&quot;: &quot;Major&quot;, &quot;serialno&quot;: 2345678, &quot;gender&quot;: &quot;F&quot; }
+</pre></div></div>
+
+<p>The first instance has all of the type&#x2019;s prescribed content. The second instance is missing the name field, which is fine because it is optional (due to the ?). The third instance has an extra field; that is fine because the type definition specifies that it is open (which is also true by default, if open is not specified). To more tightly control object content, specifying closed instead of open in the type definition for SoldierType would have made the third example instance an invalid instance of the type.</p></div>
+<div class="section">
+<h3><a name="Array"></a><a name="DerivedTypesArray" id="DerivedTypesArray">Array</a></h3>
+<p>An <tt>array</tt> is a container that holds a fixed number of values. Array constructors are denoted by brackets: &#x201c;[&#x2026;]&#x201d;.</p>
+<p>An example would be</p>
+
+<div>
+<div>
+<pre class="source">    [&quot;alice&quot;, 123, &quot;bob&quot;, null]
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Multiset"></a><a name="DerivedTypesMultiset" id="DerivedTypesMultiset">Multiset</a></h3>
+<p>A <tt>multiset</tt> is a generalization of the concept of a set that, unlike a set, allows multiple instances of the multiset&#x2019;s elements. Multiset constructors are denoted by two opening curly braces followed by data and two closing curly braces, like &#x201c;{{&#x2026;}}&#x201d;.</p>
+<p>An example would be</p>
+
+<div>
+<div>
+<pre class="source">    {{&quot;hello&quot;, 9328, &quot;world&quot;, [1, 2, null]}}
+</pre></div></div></div></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/docs/0.9.9/feeds.html b/docs/0.9.9/feeds.html
new file mode 100644
index 0000000..1210a3f
--- /dev/null
+++ b/docs/0.9.9/feeds.html
@@ -0,0 +1,422 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/feeds.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Data Ingestion with Feeds</title>
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="./css/site.css" />
+    <link rel="stylesheet" href="./css/print.css" media="print" />
+    <script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href="./" id="bannerLeft"><img src="images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li class="active"><a href="#"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href="./" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>Data Ingestion with Feeds</h1>
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="atoc" id="#toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#Introduction">Introduction</a></li>
+<li><a href="#FeedAdapters">Feed Adapters</a></li>
+<li><a href="#FeedPolicies">Feed Policies</a><!--
+! Licensed to the Apache Software Foundation (ASF) under one
+! or more contributor license agreements.  See the NOTICE file
+! distributed with this work for additional information
+! regarding copyright ownership.  The ASF licenses this file
+! to you under the Apache License, Version 2.0 (the
+! "License"); you may not use this file except in compliance
+! with the License.  You may obtain a copy of the License at
+!
+!   http://www.apache.org/licenses/LICENSE-2.0
+!
+! Unless required by applicable law or agreed to in writing,
+! software distributed under the License is distributed on an
+! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+! KIND, either express or implied.  See the License for the
+! specific language governing permissions and limitations
+! under the License.
+!--></li>
+</ul></div>
+<div class="section">
+<h2><a name="Introduction">Introduction</a></h2>
+<p>In this document, we describe the support for data ingestion in AsterixDB. Data feeds are a new mechanism for having continuous data arrive into a BDMS from external sources and incrementally populate a persisted dataset and associated indexes. We add a new BDMS architectural component, called a data feed, that makes a Big Data system the caretaker for functionality that used to live outside, and we show how it improves users&#x2019; lives and system performance.</p></div>
+<div class="section">
+<h2><a name="Feed_Adapters"></a><a name="FeedAdapters">Feed Adapters</a></h2>
+<p>The functionality of establishing a connection with a data source and receiving, parsing and translating its data into ADM objects (for storage inside AsterixDB) is contained in a feed adapter. A feed adapter is an implementation of an interface and its details are specific to a given data source. An adapter may optionally be given parameters to configure its runtime behavior. Depending upon the data transfer protocol/APIs offered by the data source, a feed adapter may operate in a push or a pull mode. Push mode involves just one initial request by the adapter to the data source for setting up the connection. Once a connection is authorized, the data source &#x201c;pushes&#x201d; data to the adapter without any subsequent requests by the adapter. In contrast, when operating in a pull mode, the adapter makes a separate request each time to receive data. AsterixDB currently provides built-in adapters for several popular data sources such as Twitter and RSS feeds. AsterixDB additionally provides a generic socket-based adapter that can be used to ingest data that is directed at a prescribed socket.</p>
+<p>In this tutorial, we shall describe building two example data ingestion pipelines that cover the popular scenarios of ingesting data from (a) Twitter (b) RSS  (c) Socket Feed source.</p>
+<div class="section">
+<div class="section">
+<h4><a name="Ingesting_Twitter_Stream"></a>Ingesting Twitter Stream</h4>
+<p>We shall use the built-in push-based Twitter adapter. As a pre-requisite, we must define a Tweet using the AsterixDB Data Model (ADM) and the query language SQL++. Given below are the type definitions in SQL++ that create a Tweet datatype which is representative of a real tweet as obtained from Twitter.</p>
+
+<div>
+<div>
+<pre class="source">    drop dataverse feeds if exists;
+
+    create dataverse feeds;
+    use feeds;
+
+    create type TwitterUser as closed {
+        screen_name: string,
+        lang: string,
+        friends_count: int32,
+        statuses_count: int32
+    };
+
+    create type Tweet as open {
+        id: int64,
+        user: TwitterUser
+    };
+
+    create dataset Tweets (Tweet) primary key id;
+</pre></div></div>
+
+<p>We also create a dataset that we shall use to persist the tweets in AsterixDB. Next we make use of the <tt>create feed</tt> SQL++ statement to define our example data feed.</p>
+<div class="section">
+<h5><a name="Using_the_.E2.80.9Cpush_twitter.E2.80.9D_feed_adapter"></a>Using the &#x201c;push_twitter&#x201d; feed adapter</h5>
+<p>The &#x201c;push_twitter&#x201d; adapter requires setting up an application account with Twitter. To retrieve tweets, Twitter requires registering an application. Registration involves providing a name and a brief description for the application. Each application has associated OAuth authentication credentials that include OAuth keys and tokens. Accessing the Twitter API requires providing the following.</p>
+<ol style="list-style-type: decimal">
+
+<li>Consumer Key (API Key)</li>
+<li>Consumer Secret (API Secret)</li>
+<li>Access Token</li>
+<li>Access Token Secret</li>
+</ol>
+<p>The &#x201c;push_twitter&#x201d; adapter takes as configuration the above mentioned parameters. End users are required to obtain the above authentication credentials prior to using the &#x201c;push_twitter&#x201d; adapter. For further information on obtaining OAuth keys and tokens and registering an application with Twitter, please visit <a class="externalLink" href="http://apps.twitter.com">http://apps.twitter.com</a>.</p>
+<p>Note that AsterixDB uses the Twitter4J API for getting data from Twitter. Due to a license conflict, Apache AsterixDB cannot ship the Twitter4J library. To use the Twitter adapter in AsterixDB, please download the necessary dependencies (<tt>twitter4j-core-4.0.x.jar</tt> and <tt>twitter4j-stream-4.0.x.jar</tt>) and drop them into the <tt>repo/</tt> directory before AsterixDB starts.</p>
+<p>Given below is an example SQL++ statement that creates a feed called &#x201c;TwitterFeed&#x201d; by using the &#x201c;push_twitter&#x201d; adapter.</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    create feed TwitterFeed with {
+      &quot;adapter-name&quot;: &quot;push_twitter&quot;,
+      &quot;type-name&quot;: &quot;Tweet&quot;,
+      &quot;format&quot;: &quot;twitter-status&quot;,
+      &quot;consumer.key&quot;: &quot;************&quot;,
+      &quot;consumer.secret&quot;: &quot;************&quot;,
+      &quot;access.token&quot;: &quot;**********&quot;,
+      &quot;access.token.secret&quot;: &quot;*************&quot;
+    };
+</pre></div></div>
+
+<p>It is required that the above authentication parameters are provided valid. Note that the <tt>create feed</tt> statement does not initiate the flow of data from Twitter into the AsterixDB instance. Instead, the <tt>create feed</tt> statement only results in registering the feed with the instance. The flow of data along a feed is initiated when it is connected to a target dataset using the connect feed statement and activated using the start feed statement.</p>
+<p>The Twitter adapter also supports several Twitter streaming APIs as follow:</p>
+<ol style="list-style-type: decimal">
+
+<li>Track filter <tt>&quot;keywords&quot;: &quot;AsterixDB, Apache&quot;</tt></li>
+<li>Locations filter <tt>&quot;locations&quot;: &quot;-29.7, 79.2, 36.7, 72.0; -124.848974,-66.885444, 24.396308, 49.384358&quot;</tt></li>
+<li>Language filter <tt>&quot;language&quot;: &quot;en&quot;</tt></li>
+<li>Filter level <tt>&quot;filter-level&quot;: &quot;low&quot;</tt></li>
+</ol>
+<p>An example of Twitter adapter tracking tweets with keyword &#x201c;news&#x201d; can be described using following ddl:</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    create feed TwitterFeed with {
+      &quot;adapter-name&quot;: &quot;push_twitter&quot;,
+      &quot;type-name&quot;: &quot;Tweet&quot;,
+      &quot;format&quot;: &quot;twitter-status&quot;,
+      &quot;consumer.key&quot;: &quot;************&quot;,
+      &quot;consumer.secret&quot;: &quot;************&quot;,
+      &quot;access.token&quot;: &quot;**********&quot;,
+      &quot;access.token.secret&quot;: &quot;*************&quot;,
+      &quot;keywords&quot;: &quot;news&quot;
+    };
+</pre></div></div>
+
+<p>For more details about these APIs, please visit <a class="externalLink" href="https://dev.twitter.com/streaming/overview/request-parameters">https://dev.twitter.com/streaming/overview/request-parameters</a></p></div></div>
+<div class="section">
+<h4><a name="Lifecycle_of_a_Feed"></a>Lifecycle of a Feed</h4>
+<p>A feed is a logical artifact that is brought to life (i.e., its data flow is initiated) only when it is activated using the <tt>start feed</tt> statement. Before we active a feed, we need to designate the dataset where the data to be persisted using <tt>connect feed</tt> statement. Subsequent to a <tt>connect feed</tt> statement, the feed is said to be in the connected state. After that, <tt>start feed</tt> statement will activate the feed, and start the dataflow from feed to its connected dataset. Multiple feeds can simultaneously be connected to a dataset such that the contents of the dataset represent the union of the connected feeds. Also one feed can be simultaneously connected to multiple target datasets.</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    connect feed TwitterFeed to dataset Tweets;
+
+    start feed TwitterFeed;
+</pre></div></div>
+
+<p>The <tt>connect feed</tt> statement above directs AsterixDB to persist the data from <tt>TwitterFeed</tt> feed into the <tt>Tweets</tt> dataset. The <tt>start feed</tt> statement will activate the feed and start the dataflow. If it is required (by the high-level application) to also retain the raw tweets obtained from Twitter, the end user may additionally choose to connect TwitterFeed to a different dataset.</p>
+<p>Let the feed run for a minute, then run the following query to see the latest tweets that are stored into the data set.</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    select * from Tweets limit 10;
+</pre></div></div>
+
+<p>The dataflow of data from a feed can be terminated explicitly by <tt>stop feed</tt> statement.</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    stop feed TwitterFeed;
+</pre></div></div>
+
+<p>The <tt>disconnnect statement</tt> can be used to disconnect the feed from certain dataset.</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    disconnect feed TwitterFeed from dataset Tweets;
+</pre></div></div>
+</div></div>
+<div class="section">
+<h3><a name="Ingesting_with_Other_Adapters"></a>Ingesting with Other Adapters</h3>
+<p>AsterixDB has several builtin feed adapters for data ingestion. User can also implement their own adapters and plug them into AsterixDB. Here we introduce <tt>socket_adapter</tt> and <tt>localfs</tt> feed adapter that cover most of the common application scenarios.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Using_the_.E2.80.9Csocket_adapter.E2.80.9D_feed_adapter"></a>Using the &#x201c;socket_adapter&#x201d; feed adapter</h5>
+<p><tt>socket_adapter</tt> feed opens a web socket on the given node which allows user to push data into AsterixDB directly. Here is an example:</p>
+
+<div>
+<div>
+<pre class="source">    drop dataverse feeds if exists;
+    create dataverse feeds;
+    use feeds;
+
+    create type TestDataType as open {
+       screenName: string
+    };
+
+    create dataset TestDataset(TestDataType) primary key screenName;
+
+    create feed TestSocketFeed with {
+      &quot;adapter-name&quot;: &quot;socket_adapter&quot;,
+      &quot;sockets&quot;: &quot;127.0.0.1:10001&quot;,
+      &quot;address-type&quot;: &quot;IP&quot;,
+      &quot;type-name&quot;: &quot;TestDataType&quot;,
+      &quot;format&quot;: &quot;adm&quot;
+    };
+
+    connect feed TestSocketFeed to dataset TestDataset;
+
+    use feeds;
+    start feed TestSocketFeed;
+</pre></div></div>
+
+<p>The above statements create a socket feed which is listening to &#x201c;10001&#x201d; port of the host machine. This feed accepts data records in &#x201c;adm&#x201d; format. As an example, you can download the sample dataset <a href="../data/chu.adm">Chirp Users</a> and push them line by line into the socket feed using any socket client you like. Following is a socket client example in Python:</p>
+
+<div>
+<div>
+<pre class="source">    from socket import socket
+
+    ip = '127.0.0.1'
+    port1 = 10001
+    filePath = 'chu.adm'
+
+    sock1 = socket()
+    sock1.connect((ip, port1))
+
+    with open(filePath) as inputData:
+        for line in inputData:
+            sock1.sendall(line)
+        sock1.close()
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Using_the_.E2.80.9Clocalfs.E2.80.9D_feed_adapter"></a>Using the &#x201c;localfs&#x201d; feed adapter</h4>
+<p><tt>localfs</tt> adapter enables data ingestion from local file system. It allows user to feed data records on local disk into a dataset. A DDL example for creating a <tt>localfs</tt> feed is given as follow:</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    create type TestDataType as open {
+       screenName: string
+    };
+
+    create dataset TestDataset(TestDataType) primary key screenName;
+
+    create feed TestFileFeed with {
+      &quot;adapter-name&quot;: &quot;localfs&quot;,
+      &quot;type-name&quot;: &quot;TestDataType&quot;,
+      &quot;path&quot;: &quot;HOSTNAME://LOCAL_FILE_PATH&quot;,
+      &quot;format&quot;: &quot;adm&quot;
+    };
+
+    connect feed TestFileFeed to dataset TestDataset;
+
+    start feed TestFileFeed;
+</pre></div></div>
+
+<p>Similar to previous examples, we need to define the datatype and dataset this feed uses. The &#x201c;path&#x201d; parameter refers to the local data file that we want to ingest data from. <tt>HOSTNAME</tt> can either be the IP address or node name of the machine which holds the file. <tt>LOCAL_FILE_PATH</tt> indicates the absolute path to the file on that machine. Similarly to <tt>socket_adapter</tt>, this feed takes <tt>adm</tt> formatted data records.</p></div></div>
+<div class="section">
+<h3><a name="Datatype_for_feed_and_target_dataset"></a>Datatype for feed and target dataset</h3>
+<p>The &#x201c;type-name&#x201d; parameter in create feed statement defines the <tt>datatype</tt> of the datasource. In most use cases, feed will have the same <tt>datatype</tt> as the target dataset. However, if we want to perform certain preprocess before the data records gets into the target dataset (append autogenerated key, apply user defined functions, etc.), we will need to define the datatypes for feed and dataset separately.</p>
+<div class="section">
+<h4><a name="Ingestion_with_autogenerated_key"></a>Ingestion with autogenerated key</h4>
+<p>AsterixDB supports using autogenerated uuid as the primary key for dataset. When we use this feature, we will need to define a datatype with the primary key field, and specify that field to be autogenerated when creating the dataset. Use that same datatype in feed definition will cause a type discrepancy since there is no such field in the datasource. Thus, we will need to define two separate datatypes for feed and dataset:</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    create type DBLPFeedType as closed {
+      dblpid: string,
+      title: string,
+      authors: string,
+      misc: string
+    }
+
+    create type DBLPDataSetType as open {
+      id: uuid,
+      dblpid: string,
+      title: string,
+      authors: string,
+      misc: string
+    }
+    create dataset DBLPDataset(DBLPDataSetType) primary key id autogenerated;
+
+    create feed DBLPFeed with {
+      &quot;adapter-name&quot;: &quot;socket_adapter&quot;,
+      &quot;sockets&quot;: &quot;127.0.0.1:10001&quot;,
+      &quot;address-type&quot;: &quot;IP&quot;,
+      &quot;type-name&quot;: &quot;DBLPFeedType&quot;,
+      &quot;format&quot;: &quot;adm&quot;
+    };
+
+    connect feed DBLPFeed to dataset DBLPDataset;
+
+    start feed DBLPFeed;
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h2><a name="Policies_for_Feed_Ingestion"></a><a name="FeedPolicies">Policies for Feed Ingestion</a></h2>
+<p>Multiple feeds may be concurrently operational on an AsterixDB cluster, each competing for resources (CPU cycles, network bandwidth, disk IO) to maintain pace with their respective data sources. As a data management system, AsterixDB is able to manage a set of concurrent feeds and make dynamic decisions related to the allocation of resources, resolving resource bottlenecks and the handling of failures. Each feed has its own set of constraints, influenced largely by the nature of its data source and the applications that intend to consume and process the ingested data. Consider an application that intends to discover the trending topics on Twitter by analyzing tweets that are being processed. Losing a few tweets may be acceptable. In contrast, when ingesting from a data source that provides a click-stream of ad clicks, losing data would translate to a loss of revenue for an application that tracks revenue by charging advertisers per click.</p>
+<p>AsterixDB allows a data feed to have an associated ingestion policy that is expressed as a collection of parameters and associated values. An ingestion policy dictates the runtime behavior of the feed in response to resource bottlenecks and failures. AsterixDB provides a set of policies that help customize the system&#x2019;s runtime behavior when handling excess objects.</p>
+<div class="section">
+<div class="section">
+<h4><a name="Policies"></a>Policies</h4>
+<ul>
+
+<li>
+
+<p><i>Spill</i>: Objects that cannot be processed by an operator for lack of resources (referred to as excess objects hereafter) should be persisted to the local disk for deferred processing.</p>
+</li>
+<li>
+
+<p><i>Discard</i>: Excess objects should be discarded.</p>
+</li>
+</ul>
+<p>Note that the end user may choose to form a custom policy.  For example, it is possible in AsterixDB to create a custom policy that spills excess objects to disk and subsequently resorts to throttling if the spillage crosses a configured threshold. In all cases, the desired ingestion policy is specified as part of the <tt>connect feed</tt> statement or else the &#x201c;Basic&#x201d; policy will be chosen as the default.</p>
+
+<div>
+<div>
+<pre class="source">    use feeds;
+
+    connect feed TwitterFeed to dataset Tweets using policy Basic;
+</pre></div></div></div></div></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/docs/0.9.9/interval_join.html b/docs/0.9.9/interval_join.html
new file mode 100644
index 0000000..61c2141
--- /dev/null
+++ b/docs/0.9.9/interval_join.html
@@ -0,0 +1,216 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/interval_join.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Interval Joins</title>
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="./css/site.css" />
+    <link rel="stylesheet" href="./css/print.css" media="print" />
+    <script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href="./" id="bannerLeft"><img src="images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li class="active"><a href="#"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href="./" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>Interval Joins</h1>
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="atoc" id="#toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#Interval_joins">Introduction</a></li>
+<li><a href="#Range_hint">Range Hints</a></li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Interval_Joins"></a><a name="Interval_joins" id="Interval_joins">Interval Joins</a></h2>
+<p>This system allows for the 13 types of Allen&#x2019;s interval-join relations. The default, when using these joins, is either Nested Loop, or Hybrid Hash Join. The optimal algorithm will be automatically selected based on the query. Hybrid Hash Join will be selected in cases where the relation includes an equality; these cases are: <tt>interval_starts()</tt>, <tt>interval_started_by()</tt>, <tt>interval_ends()</tt>, <tt>interval_ended_by()</tt>, <tt>interval_meets()</tt>, and <tt>interval_met_by()</tt>. Otherwise, the system will default to nested loop join. To use interval merge join you must include a range hint. Adding a range hint allows for the system to pick interval merge join.</p>
+<p>The 13 interval functions are <tt>interval_after()</tt>, <tt>interval_before()</tt>, <tt>interval_covers()</tt>, <tt>interval_covered_by()</tt>, <tt>interval_ends()</tt>, <tt>interval_ended_by()</tt>, <tt>interval_meets()</tt>, <tt>interval_met_by()</tt>, <tt>interval_overlaps()</tt>, <tt>interval_overlapping()</tt>, <tt>interval_overlapped_by()</tt>, <tt>interval_starts()</tt>, and <tt>interval_started_by()</tt>.</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="How_to_use_an_interval_join"></a>How to use an interval join</h5>
+
+<div>
+<div>
+<pre class="source">select f.name as staff, d.name as student
+from Staff as f, Students as d
+where interval_after(f.employment, d.attendance)
+</pre></div></div>
+
+<p>In this scenario, <tt>interval_after()</tt> can be replaced with any of the 13 join functions. Here is what each of the functions represent if A represents the first interval parameter, and B represents the second set interval parameter:</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Function </th>
+<th> Condition </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> Before(A, B) and After(B, A) </td>
+<td> A.end &lt; B.start </td></tr>
+<tr class="a">
+<td> Covers(A, B) and Covered_by(B, A) </td>
+<td> A.start &lt;= B.start and A.end &gt;= B.end </td></tr>
+<tr class="b">
+<td> Ends(A, B) and Ended_by(B, A) </td>
+<td> A.end = B.end and A.start &gt;= B.start </td></tr>
+<tr class="a">
+<td> Meets(A, B) and Met_by(B, A) </td>
+<td> A.end = B.start </td></tr>
+<tr class="b">
+<td> Overlaps(A, B) and Overlapped_by(B, A) </td>
+<td> A.start &lt; B.start and B.start &gt; A.end and A.end &gt; B.start </td></tr>
+<tr class="a">
+<td> Overlapping(A, B)</td>
+<td> (A.start &gt;= B.start and B.start &lt; A.end) or (B.end &lt;= A.end and B.end &lt; A.start)</td></tr>
+<tr class="b">
+<td> Starts(A, B) and Started_by(B, A) </td>
+<td> A.start = B.start and A.end &lt;= B.end </td></tr>
+</tbody>
+</table></div></div></div>
+<div class="section">
+<h3><a name="Using_a_Range_Hint"></a><a name="Range_hint" id="Range_hint"> Using a Range Hint </a></h3>
+<p>To use an efficient interval join the data must be partitioned with the details in a range hint. Interval joins with a range hint currently work for intervals types of date, datetime, or time; the range hint type must match the interval type. Adding a range hint directly before the interval join function will cause the system to pick interval merge join for these interval functions: <tt>interval_after()</tt>, <tt>interval_before()</tt>, <tt>interval_covers()</tt>, <tt>interval_covered_by()</tt>, <tt>interval_overlaps()</tt>, <tt>interval_overlapping()</tt>, <tt>interval_overlapped_by()</tt>. The other relations will ignore the range hint and pick Hybrid Hash Join as described earlier.</p>
+<p>Here is an example of how interval joins work with a range hint for all the supported data types. Suppose that we have two sets of data, a data set of staff members with an interval for length of employment and an id. The other dataset represents students, which may include an interval for attendance and an id. Each partition receives data based on the split points; The split points in the range hint must be strategically set by the user so that the data divides evenly among partitions. For example, if your query contains 1 split point, and the system is using two partitions, the data before the split point will be sent to the first partition, and the data after the split point will be sent to the second partition. This continues to work respectively based on the number of split points and number of partitions. Ideally, the number of split points should equal the number of partitions - 1.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Range_Hint_Example"></a>Range Hint Example</h5>
+
+<div>
+<div>
+<pre class="source">/*+ range [&lt;Expression&gt;, ..., ] */
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Range_Hint_Example_with_Date"></a>Range Hint Example with Date</h5>
+
+<div>
+<div>
+<pre class="source">select f.name as staff, d.name as student
+from Staff as f, Students as d
+where
+/*+ range [date(&quot;2003-06-30&quot;), date(&quot;2005-12-31&quot;), date(&quot;2008-06-30&quot;)] */
+interval_after(f.employment, d.attendance)
+order by f.name, d.name;
+</pre></div></div></div></div></div></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/docs/0.9.9/sqlpp/builtins.html b/docs/0.9.9/sqlpp/builtins.html
new file mode 100644
index 0000000..c869680
--- /dev/null
+++ b/docs/0.9.9/sqlpp/builtins.html
@@ -0,0 +1,15389 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/sqlpp/builtins.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Builtin Functions</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+    <script type="text/javascript" src="../js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href=".././" id="bannerLeft"><img src="../images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="../index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="../ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="../ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="../aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="../sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="../datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="../sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="../SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li class="active"><a href="#"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="../api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="../csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="../aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="../feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="../udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="../sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="../sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="../sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="../geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="../geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="../interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="../spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="../sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="../aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="../aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href=".././" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="../images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>Builtin Functions</h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="toc" id="toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#NumericFunctions">Numeric Functions</a></li>
+<li><a href="#StringFunctions">String Functions</a></li>
+<li><a href="#BinaryFunctions">Binary Functions</a></li>
+<li><a href="#SpatialFunctions">Spatial Functions</a></li>
+<li><a href="#SimilarityFunctions">Similarity Functions</a></li>
+<li><a href="#TokenizingFunctions">Tokenizing Functions</a></li>
+<li><a href="#TemporalFunctions">Temporal Functions</a></li>
+<li><a href="#ObjectFunctions">Object Functions</a></li>
+<li><a href="#AggregateFunctions">Aggregate Functions (Array Functions)</a></li>
+<li><a href="#ComparisonFunctions">Comparison Functions</a></li>
+<li><a href="#TypeFunctions">Type Functions</a></li>
+<li><a href="#ConditionalFunctions">Conditional Functions</a></li>
+<li><a href="#MiscFunctions">Miscellaneous Functions</a></li>
+<li><a href="#BitwiseFunctions">Bitwise Functions</a></li>
+<li><a href="#WindowFunctions">Window Functions</a></li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<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><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Numeric_Functions"></a><a name="NumericFunctions" id="NumericFunctions">Numeric Functions</a></h2>
+<div class="section">
+<h3><a name="abs"></a>abs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">abs(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the absolute value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The absolute value of the argument with the same type as the input argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="acos"></a>acos</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">acos(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc cosine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error,</li>
+<li>&#x201c;NaN&#x201d; for other legitimate numeric values.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="asin"></a>asin</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">asin(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc sine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error,</li>
+<li>&#x201c;NaN&#x201d; for other legitimate numeric values.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="atan"></a>atan</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">atan(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc tangent value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> arc tangent in radians for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="atan2"></a>atan2</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">atan2(numeric_value1, numeric_value2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the arc tangent value of numeric_value2/numeric_value1.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> arc tangent in radians for <tt>numeric_value1</tt> and <tt>numeric_value2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 0.4636476090008061, &quot;v2&quot;: 0.0, &quot;v3&quot;: 2.356194490192345 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ceil"></a>ceil</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ceil(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The ceiling value for the given number in the same type as the input argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: ceil(2013),
+  &quot;v2&quot;: ceil(-4036),
+  &quot;v3&quot;: ceil(0.3),
+  &quot;v4&quot;: ceil(float(&quot;-2013.2&quot;)),
+  &quot;v5&quot;: ceil(double(&quot;-2013.893823748327284&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="cos"></a>cos</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">cos(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the cosine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> cosine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="cosh"></a>cosh</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">cosh(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the hyperbolic cosine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> hyperbolic cosine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="degrees"></a>degrees</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">degrees(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts radians to degrees</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The degrees value for the given radians value. The returned value has type <tt>double</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: degrees(pi()) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 180.0 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="e"></a>e</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">e()
+</pre></div></div>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>e (base of the natural logarithm)</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: e() };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 2.718281828459045 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="exp"></a>exp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">exp(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes e<sup>numeric_value</sup>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>e<sup>numeric_value</sup>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="floor"></a>floor</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">floor(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The floor value for the given number in the same type as the input argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: floor(2013),
+  &quot;v2&quot;: floor(-4036),
+  &quot;v3&quot;: floor(0.8),
+  &quot;v4&quot;: floor(float(&quot;-2013.2&quot;)),
+  &quot;v5&quot;: floor(double(&quot;-2013.893823748327284&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ln"></a>ln</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ln(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes log<sub>e</sub>numeric_value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>log<sub>e</sub>numeric_value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="log"></a>log</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">log(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes log<sub>10</sub>numeric_value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>log<sub>10</sub>numeric_value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="pi"></a>pi</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">pi()
+</pre></div></div>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>Pi</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: pi() };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 3.141592653589793 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="power"></a>power</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">power(numeric_value1, numeric_value2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes numeric_value1<sup>numeric_value2</sup>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>numeric_value1<sup>numeric_value2</sup>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 1, &quot;v3&quot;: 0, &quot;v4&quot;: 1.4142135623730951 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="radians"></a>radians</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">radians(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts degrees to radians</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The radians value for the given degrees value. The returned value has type <tt>double</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: radians(180) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 3.141592653589793 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="round"></a>round</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">round(numeric_value[, round_digit])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The rounded value for the given number. The returned value has the following type:
+<ul>
+
+<li><tt>bigint</tt> if the input value has type <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt> or <tt>bigint</tt>,</li>
+<li><tt>float</tt> if the input value has type <tt>float</tt>,</li>
+<li><tt>double</tt> if the input value has type <tt>double</tt>;</li>
+</ul>
+</li>
+<li><tt>missing</tt> if the input value is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the input value is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will return a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: round(2013),
+  &quot;v2&quot;: round(-4036),
+  &quot;v3&quot;: round(0.8),
+  &quot;v4&quot;: round(float(&quot;-2013.256&quot;)),
+  &quot;v5&quot;: round(double(&quot;-2013.893823748327284&quot;))
+  &quot;v6&quot;: round(123456, -1),
+  &quot;v7&quot;: round(456.456, 2),
+  &quot;v8&quot;: round(456.456, -1),
+  &quot;v9&quot;: round(-456.456, -2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sign"></a>sign</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sign(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the sign of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the sign (a <tt>tinyint</tt>) of the argument, -1 for negative values, 0 for 0, and 1 for positive values,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 1, &quot;v2&quot;: 1, &quot;v3&quot;: 0, &quot;v4&quot;: 1, &quot;v5&quot;: -1 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sin"></a>sin</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sin(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the sine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> sine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sinh"></a>sinh</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sinh(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the hyperbolic sine value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> hyperbolic sine value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sqrt"></a>sqrt</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">sqrt(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the square root of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> square root value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="tan"></a>tan</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">tan(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the tangent value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> tangent value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="tanh"></a>tanh</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">tanh(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the hyperbolic tangent value of the argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> hyperbolic tangent value for the argument,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="trunc"></a>trunc</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">trunc(numeric_value, number_digits)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<li><tt>number_digits</tt>: a <tt>tinyint</tt>/<tt>smallint</tt>/<tt>integer</tt>/<tt>bigint</tt> value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the <tt>double</tt> tangent value for the argument,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is <tt>missing</tt>,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-numeric value,</li>
+<li>the second argument is any other non-tinyint, non-smallint, non-integer, and non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="round_half_to_even"></a>round_half_to_even</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">round_half_to_even(numeric_value, [precision])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The rounded value for the given number in the same type as the input argument,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-numeric value,</li>
+<li>or, the second argument is any other non-tinyint, non-smallint, non-integer, or non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: round_half_to_even(2013),
+  &quot;v2&quot;: round_half_to_even(-4036),
+  &quot;v3&quot;: round_half_to_even(0.8),
+  &quot;v4&quot;: round_half_to_even(float(&quot;-2013.256&quot;)),
+  &quot;v5&quot;: round_half_to_even(double(&quot;-2013.893823748327284&quot;)),
+  &quot;v6&quot;: round_half_to_even(double(&quot;-2013.893823748327284&quot;), 2),
+  &quot;v7&quot;: round_half_to_even(2013, 4),
+  &quot;v8&quot;: round_half_to_even(float(&quot;-2013.256&quot;), 5)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="String_Functions"></a><a name="StringFunctions" id="StringFunctions">String Functions</a></h2>
+<div class="section">
+<h3><a name="concat"></a>concat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">concat(string1, string2, ...)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a concatenated string from arguments.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string1</tt>: a string value,</li>
+<li><tt>string2</tt>: a string value,</li>
+<li>&#x2026;.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a concatenated string from arguments,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">concat(&quot;test &quot;, &quot;driven &quot;, &quot;development&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;test driven development&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="contains"></a>contains</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">contains(string, substring_to_contain)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> contains the string <tt>substring_to_contain</tt></p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the given substring,</li>
+<li><tt>substring_to_contain</tt> : a target <tt>string</tt> that might be contained.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value, <tt>true</tt> if <tt>string</tt> contains <tt>substring_to_contain</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error,</li>
+<li><tt>false</tt> otherwise.</li>
+</ul>
+</li>
+<li>
+
+<p>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</p>
+</li>
+<li>Example:
+
+<div>
+<div>
+<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;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ends_with"></a>ends_with</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ends_with(string, substring_to_end_with)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> ends with the string <tt>substring_to_end_with</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might end with the given string,</li>
+<li><tt>substring_to_end_with</tt> : a <tt>string</tt> that might be contained as the ending substring.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value, <tt>true</tt> if <tt>string</tt> contains <tt>substring_to_contain</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error,</li>
+<li><tt>false</tt> otherwise.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: ends_with(&quot; love product-b its shortcut_menu is awesome:)&quot;, &quot;:)&quot;),
+  &quot;v2&quot;: ends_with(&quot; awsome:)&quot;, &quot;:-)&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="initcap_.28or_title.29"></a>initcap (or title)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">initcap(string)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> as the title form of the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: initcap(&quot;ASTERIXDB is here!&quot;), &quot;v2&quot;: title(&quot;ASTERIXDB is here!&quot;) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;Asterixdb Is Here!&quot;, &quot;v2&quot;: &quot;Asterixdb Is Here!&quot; }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="length"></a>length</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">length(string)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> or <tt>null</tt> that represents the string to be checked.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> that represents the length of <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">length(&quot;test string&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">11
+</pre></div></div>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">length(&quot;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (the emoji character &#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466; has 7 code points):</p>
+
+<div>
+<div>
+<pre class="source">7
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="lower"></a>lower</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">lower(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts a given string <tt>string</tt> to its lowercase form.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> as the lowercase form of the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">lower(&quot;ASTERIXDB&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;asterixdb&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ltrim"></a>ltrim</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ltrim(string[, chars]);
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
+<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a trimmed, new <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Related functions: see <tt>trim()</tt>, <tt>rtrim()</tt></li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">ltrim(&quot;me like x-phone&quot;, &quot;eml&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot; like x-phone&quot;
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
+
+<div>
+<div>
+<pre class="source">ltrim(&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;, &quot;&#x1f468;&#x200d;&#x1f466;&quot;)
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (only woman, girl and boy are left in the family):</p>
+
+<div>
+<div>
+<pre class="source">&quot;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="position"></a>position</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">position(string, string_pattern)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<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>
+<ul>
+
+<li>0-based: <tt>position</tt>, <tt>pos</tt>, <tt>position0</tt>, <tt>pos0</tt>.</li>
+<li>1-based: <tt>position1</tt>, <tt>pos1</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: position(&quot;ppphonepp&quot;, &quot;phone&quot;),
+  &quot;v2&quot;: position(&quot;hone&quot;, &quot;phone&quot;),
+  &quot;v3&quot;: position1(&quot;ppphonepp&quot;, &quot;phone&quot;),
+  &quot;v4&quot;: position1(&quot;hone&quot;, &quot;phone&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 2, &quot;v2&quot;: -1, v3&quot;: 3, &quot;v4&quot;: -1 }
+</pre></div></div>
+</li>
+<li>
+
+<p>Example of multi-code-point character:</p>
+
+<div>
+<div>
+<pre class="source">position(&quot;&#x1f469;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x1f3c0;&quot;, &quot;&#x1f3c0;&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (the emoji family character has 7 code points):</p>
+
+<div>
+<div>
+<pre class="source">7
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_contains"></a>regexp_contains</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_contains(string, string_pattern[, string_flags])
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the strings <tt>string</tt> contains the regular expression pattern <tt>string_pattern</tt> (a Java regular expression pattern).</p>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li><tt>regexp_contains</tt>, <tt>regex_contains</tt>, <tt>contains_regexp</tt>, <tt>contains_regex</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: regexp_contains(&quot;pphonepp&quot;, &quot;p*hone&quot;),
+  &quot;v2&quot;: regexp_contains(&quot;hone&quot;, &quot;p+hone&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_like"></a>regexp_like</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_like(string, string_pattern[, string_flags])
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> exactly matches the regular expression pattern <tt>string_pattern</tt> (a Java regular expression pattern).</p>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li><tt>regexp_like</tt>, <tt>regex_like</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> that might be contained.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: regexp_like(&quot; can't stand acast the network is horrible:(&quot;, &quot;.*acast.*&quot;),
+  &quot;v2&quot;: regexp_like(&quot;acast&quot;, &quot;.*acst.*&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_position"></a>regexp_position</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_position(string, string_pattern[, string_flags])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<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>
+<li>1-Based: <tt>regexp_position1</tt>, <tt>regexp_pos1</tt>, <tt>regex_position1</tt> <tt>regex_pos1</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during regular expression matching.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: regexp_position(&quot;pphonepp&quot;, &quot;p*hone&quot;),
+  &quot;v2&quot;: regexp_position(&quot;hone&quot;, &quot;p+hone&quot;),
+  &quot;v3&quot;: regexp_position1(&quot;pphonepp&quot;, &quot;p*hone&quot;),
+  &quot;v4&quot;: regexp_position1(&quot;hone&quot;, &quot;p+hone&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 0, &quot;v2&quot;: -1, &quot;v3&quot;: 1, &quot;v4&quot;: -1 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="regexp_replace"></a>regexp_replace</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">regexp_replace(string, string_pattern, string_replacement[, string_flags])
+regexp_replace(string, string_pattern, string_replacement[, replacement_limit])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li><tt>regexp_replace</tt>, <tt>regex_replace</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might contain the pattern.</li>
+<li><tt>string_pattern</tt> : a pattern <tt>string</tt> to be matched.</li>
+<li><tt>string_replacement</tt> : a pattern <tt>string</tt> to be used as the replacement.</li>
+<li><tt>string_flag</tt> : (Optional) a <tt>string</tt> with flags to be used during replace.
+<ul>
+
+<li>The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).</li>
+</ul>
+</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>Returns a <tt>string</tt> that is obtained after the replacements.</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value.</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+<li>any other non-string input value will return a <tt>null</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;like product-a the voicemail_service is awesome&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="repeat"></a>repeat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">repeat(string, n)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a string formed by repeating the input <tt>string</tt> <tt>n</tt> times.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be repeated,</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a string that repeats the input <tt>string</tt> <tt>n</tt> times,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-string value,</li>
+<li>or, the second argument is not a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt>.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">repeat(&quot;test&quot;, 3);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;testtesttest&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="replace"></a>replace</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">replace(string, search_string, replacement_string[, limit])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : an input <tt>string</tt>,</li>
+<li><tt>search_string</tt> : a <tt>string</tt>  substring to be searched for,</li>
+<li><tt>replacement_string</tt> : a <tt>string</tt> to be used as the replacement,</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>Returns a <tt>string</tt> that is obtained after the replacements,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value or non-integer <tt>limit</tt> will cause a type error,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: replace(&quot; like x-phone the voicemail_service is awesome&quot;, &quot; like x-phone&quot;, &quot;like product-a&quot;),
+  &quot;v2&quot;: replace(&quot;x-phone and x-phone&quot;, &quot;x-phone&quot;, &quot;product-a&quot;, 1)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: &quot;like product-a the voicemail_service is awesome&quot;,
+  &quot;v2&quot;: &quot;product-a and x-phone&quot;
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="reverse"></a>reverse</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">reverse(string)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be reversed</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a string containing characters from the the input <tt>string</tt> in the reverse order,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-string value</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">reverse(&quot;hello&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;olleh&quot;
+</pre></div></div>
+</li>
+<li>
+
+<p>Example of multi-code-point character (Korean):</p>
+
+<div>
+<div>
+<pre class="source">reverse(&quot;&#x1112;&#x1161;&#x11ab;&#x1100;&#x1173;&#x11af;&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (the Korean characters are splitted into code points and then the code points are reversed):</p>
+
+<div>
+<div>
+<pre class="source">&quot;&#x11af;&#x1173;&#x1100;&#x11ab;&#x1161;&#x1112;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="rtrim"></a>rtrim</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">rtrim(string[, chars]);
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
+<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a trimmed, new <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Related functions: see <tt>trim()</tt>, <tt>ltrim()</tt></li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: rtrim(&quot;i like x-phone&quot;, &quot;x-phone&quot;),
+  &quot;v2&quot;: rtrim(&quot;i like x-phone&quot;, &quot;onexph&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;i like &quot;, &quot;v2&quot;: &quot;i like x-&quot; }
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
+
+<div>
+<div>
+<pre class="source">rtrim(&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&quot;, &quot;&#x1f468;&#x200d;&#x1f466;&quot;)
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (only man, woman and girl are left in the family):</p>
+
+<div>
+<div>
+<pre class="source">&quot;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="split"></a>split</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">split(string, sep)
+</pre></div></div>
+</li>
+<li>
+
+<p>Splits the input <tt>string</tt> into an array of substrings separated by the string <tt>sep</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be split.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an array of substrings by splitting the input <tt>string</tt> by <tt>sep</tt>,</li>
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">split(&quot;test driven development&quot;, &quot; &quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;test&quot;, &quot;driven&quot;, &quot;development&quot; ]
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with two consecutive <tt>sep</tt>s in the <tt>string</tt>:</p>
+
+<div>
+<div>
+<pre class="source">split(&quot;123//456&quot;, &quot;/&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;123&quot;, &quot;&quot;, &quot;456&quot; ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="starts_with"></a>starts_with</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">starts_with(string, substring_to_start_with)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the string <tt>string</tt> starts with the string <tt>substring_to_start_with</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that might start with the given string.</li>
+<li><tt>substring_to_start_with</tt> : a <tt>string</tt> that might be contained as the starting substring.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt>, returns <tt>true</tt> if <tt>string</tt> starts with the string <tt>substring_to_start_with</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error,</li>
+<li><tt>false</tt> otherwise.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot; : starts_with(&quot; like the plan, amazing&quot;, &quot; like&quot;),
+  &quot;v2&quot; : starts_with(&quot;I like the plan, amazing&quot;, &quot; like&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="substr"></a>substr</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">substr(string, offset[, length])
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Aliases:</p>
+<ul>
+
+<li>0-Based: <tt>substring</tt>, <tt>substr</tt>, <tt>substring0</tt>, <tt>substr0</tt>.</li>
+<li>1-Based: <tt>substring1</tt>, <tt>substr1</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the substring,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<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>
+<li>a <tt>null</tt> will be returned if:
+<ul>
+
+<li>the first argument is any other non-string value.</li>
+<li>the second argument is not a <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, or <tt>bigint</tt>.</li>
+<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>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: substr(&quot;test string&quot;, 6, 3), &quot;v2&quot;: substr1(&quot;test string&quot;, 6, 3) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: &quot;tri&quot;, &quot;v2&quot;: &quot;str&quot; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>substring</tt>.</p></div>
+<div class="section">
+<h3><a name="trim"></a>trim</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">trim(string[, chars]);
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be trimmed,</li>
+<li><tt>chars</tt> : a <tt>string</tt> that contains characters that are used to trim.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a trimmed, new <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Related functions: see <tt>ltrim()</tt>, <tt>rtrim()</tt></li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">trim(&quot;i like x-phone&quot;, &quot;xphoen&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot; like &quot;
+</pre></div></div>
+</li>
+<li>
+
+<p>Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy):</p>
+<p>trim(&#x201c;&#x1f468;&#x200d;&#x1f469;&#x200d;&#x1f467;&#x200d;&#x1f466;&#x201d;, &#x201c;&#x1f468;&#x200d;&#x1f466;&#x201d;)</p>
+</li>
+<li>
+
+<p>The expected result is (only woman and girl are left in the family):</p>
+
+<div>
+<div>
+<pre class="source"> &quot;&#x1f469;&#x200d;&#x1f467;&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="upper"></a>upper</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">upper(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts a given string <tt>string</tt> to its uppercase form.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> as the uppercase form of the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">upper(&quot;hello&quot;)
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;HELLO&quot;
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="string_concat"></a>string_concat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">string_concat(array)
+</pre></div></div>
+</li>
+<li>
+
+<p>Concatenates an array of strings <tt>array</tt> into a single string.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the concatenated <tt>string</tt> value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-integer element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">string_concat([&quot;ASTERIX&quot;, &quot; &quot;, &quot;ROCKS!&quot;]);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;ASTERIX ROCKS!&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="string_join"></a>string_join</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">string_join(array, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Joins an array or multiset of strings <tt>array</tt> with the given separator <tt>string</tt> into a single string.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array</tt> : an <tt>array</tt> or <tt>multiset</tt> of strings (could be <tt>null</tt>) to be joined.</li>
+<li><tt>string</tt> : a <tt>string</tt> to serve as the separator.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>the joined <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if the first argument array contains a <tt>missing</tt>,</li>
+<li><tt>null</tt> if the first argument array contains a <tt>null</tt> but does not contain a <tt>missing</tt>,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-array value, or contains any other non-string value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">string_join([&quot;ASTERIX&quot;, &quot;ROCKS~&quot;], &quot;!! &quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;ASTERIX!! ROCKS~&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="string_to_codepoint"></a>string_to_codepoint</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">string_to_codepoint(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts the string <tt>string</tt> to its code_based representation.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that will be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> of the code points for the string <tt>string</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">string_to_codepoint(&quot;Hello ASTERIX!&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ 72, 101, 108, 108, 111, 32, 65, 83, 84, 69, 82, 73, 88, 33 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="codepoint_to_string"></a>codepoint_to_string</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">codepoint_to_string(array)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts the ordered code_based representation <tt>array</tt> to the corresponding string.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array</tt> : an <tt>array</tt> of integer code_points.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> representation of <tt>array</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-integer element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">codepoint_to_string([72, 101, 108, 108, 111, 32, 65, 83, 84, 69, 82, 73, 88, 33]);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;Hello ASTERIX!&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="substring_before"></a>substring_before</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">substring_before(string, string_pattern)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the substring from the given string <tt>string</tt> before the given pattern <tt>string_pattern</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
+<li><tt>string_pattern</tt> : a <tt>string</tt> pattern to be searched.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the substring,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">substring_before(&quot; like x-phone&quot;, &quot;x-phone&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot; like &quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="substring_after"></a>substring_after</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>substring_after(string, string_pattern);</p>
+</li>
+<li>
+
+<p>Returns the substring from the given string <tt>string</tt> after the given pattern <tt>string_pattern</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> to be extracted.</li>
+<li><tt>string_pattern</tt> : a <tt>string</tt> pattern to be searched.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the substring,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">substring_after(&quot; like x-phone&quot;, &quot;xph&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;one&quot;
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Binary_Functions"></a><a name="BinaryFunctions" id="BinaryFunctions">Binary Functions</a></h2>
+<div class="section">
+<h3><a name="parse_binary"></a>parse_binary</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>parse_binary(string, encoding)</p>
+</li>
+<li>
+
+<p>Creates a <tt>binary</tt> from an string encoded in <tt>encoding</tt> format.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : an encoded <tt>string</tt>,</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>binary</tt> that is decoded from the given <tt>string</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<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>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>[ hex(&#x201c;ABCDEF0123456789&#x201d;), hex(&#x201c;ABCDEF0123456789&#x201d;), hex(&#x201c;4173746572697801&#x201d;) ]</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="print_binary"></a>print_binary</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>print_binary(binary, encoding)</p>
+</li>
+<li>
+
+<p>Prints a <tt>binary</tt> to the required encoding <tt>string</tt> format.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>binary</tt> : a <tt>binary</tt> data need to be printed.</li>
+<li><tt>encoding</tt> : a string notation specifies the expected encoding type. Currently we support <tt>hex</tt> and <tt>base64</tt> format.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> that represents the encoded format of a <tt>binary</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">[ print_binary(hex(&quot;ABCDEF0123456789&quot;), &quot;base64&quot;), print_binary(base64(&quot;q83vASNFZ4k=&quot;), &quot;hex&quot;) ]
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result are:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;q83vASNFZ4k=&quot;, &quot;ABCDEF0123456789&quot; ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="binary_length"></a>binary_length</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>binary_length(binary)</p>
+</li>
+<li>
+
+<p>Returns the number of bytes storing the binary data.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>binary</tt> : a <tt>binary</tt> value to be checked.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> that represents the number of bytes,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-binary input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">binary_length(hex(&quot;00AA&quot;))
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>2</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="sub_binary"></a>sub_binary</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>sub_binary(binary, offset[, length])</p>
+</li>
+<li>
+
+<p>Returns the sub binary from the given <tt>binary</tt> based on the given start offset with the optional <tt>length</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>binary</tt> : a <tt>binary</tt> to be extracted,</li>
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>binary</tt> that represents the sub binary,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-binary value,</li>
+<li>or, the second argument is any other non-integer value,</li>
+<li>or, the third argument is any other non-integer value, if it is present.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">sub_binary(hex(&quot;AABBCCDD&quot;), 4);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is</p>
+
+<div>
+<div>
+<pre class="source">hex(&quot;DD&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="binary_concat"></a>binary_concat</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>binary_concat(array)</p>
+</li>
+<li>
+
+<p>Concatenates a binary <tt>array</tt> or <tt>multiset</tt> into a single binary.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value  :
+<ul>
+
+<li>the concatenated <tt>binary</tt> value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-binary element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>binary_concat([hex(&#x201c;42&#x201d;), hex(&quot;&quot;), hex(&#x2018;42&#x2019;)]);</p>
+</li>
+<li>
+
+<p>The expected result is</p>
+<p>hex(&#x201c;4242&#x201d;)</p>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Spatial_Functions"></a><a name="SpatialFunctions" id="SpatialFunctions">Spatial Functions</a></h2>
+<div class="section">
+<h3><a name="create_point"></a>create_point</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_point(x, y)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>point</tt> using an <tt>x</tt> and <tt>y</tt> value.</p>
+</li>
+<li>Arguments:</li>
+<li><tt>x</tt> : a <tt>double</tt> that represents the x-coordinate,</li>
+<li><tt>y</tt> : a <tt>double</tt> that represents the y-coordinate.</li>
+<li>Return Value:</li>
+<li>a <tt>point</tt> representing the ordered pair (<tt>x</tt>, <tt>y</tt>),</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-double input value will cause a type error.</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;point&quot;: create_point(30.0,70.0) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;point&quot;: point(&quot;30.0,70.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_line"></a>create_line</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_line(point1, point2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>line</tt> using <tt>point1</tt> and <tt>point2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt> that represents the start point of the line.</li>
+<li><tt>point2</tt> : a <tt>point</tt> that represents the end point of the line.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a spatial <tt>line</tt> created using the points provided in <tt>point1</tt> and <tt>point2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;line&quot;: create_line(create_point(30.0,70.0), create_point(50.0,90.0)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;line&quot;: line(&quot;30.0,70.0 50.0,90.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_rectangle"></a>create_rectangle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_rectangle(point1, point2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>rectangle</tt> using <tt>point1</tt> and <tt>point2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt> that represents the lower_left point of the rectangle.</li>
+<li><tt>point2</tt> : a <tt>point</tt> that represents the upper_right point of the rectangle.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a spatial <tt>rectangle</tt> created using the points provided in <tt>point1</tt> and <tt>point2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;rectangle&quot;: create_rectangle(create_point(30.0,70.0), create_point(50.0,90.0)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;rectangle&quot;: rectangle(&quot;30.0,70.0 50.0,90.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_circle"></a>create_circle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_circle(point, radius)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates the primitive type <tt>circle</tt> using <tt>point</tt> and <tt>radius</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point</tt> : a <tt>point</tt> that represents the center of the circle.</li>
+<li><tt>radius</tt> : a <tt>double</tt> that represents the radius of the circle.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a spatial <tt>circle</tt> created using the center point and the radius provided in <tt>point</tt> and <tt>radius</tt>.</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-point value,</li>
+<li>or, the second argument is any other non-double value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;circle&quot;: create_circle(create_point(30.0,70.0), 5.0) }
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;circle&quot;: circle(&quot;30.0,70.0 5.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="create_polygon"></a>create_polygon</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">create_polygon(array)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array</tt> : an array of doubles representing the points of the polygon.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>polygon</tt>, represents a spatial simple polygon created using the points provided in <tt>array</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li><tt>missing</tt> if any element in the input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-double element in the input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;polygon&quot;: create_polygon([1.0,1.0,2.0,2.0,3.0,3.0,4.0,4.0]) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_x.2Fget_y"></a>get_x/get_y</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_x(point) or get_y(point)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the x or y coordinates of a point <tt>point</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point</tt> : a <tt>point</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> representing the x or y coordinates of the point <tt>point</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;x_coordinate&quot;: 2.3, &quot;y_coordinate&quot;: 5.0 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_points"></a>get_points</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_points(spatial_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an ordered array of the points forming the spatial object <tt>spatial_object</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>spatial_object</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> of the points forming the spatial object <tt>spatial_object</tt>,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-spatial-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_points(create_polygon([1.0,1.0,2.0,2.0,3.0,3.0,4.0,4.0]))
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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;) ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_center.2Fget_radius"></a>get_center/get_radius</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_center(circle_expression) or get_radius(circle_expression)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the center and the radius of a circle <tt>circle_expression</tt>, respectively.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>circle_expression</tt> : a <tt>circle</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>point</tt> or <tt>double</tt>, represent the center or radius of the circle <tt>circle_expression</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-circle input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;circle_radius&quot;: get_radius(create_circle(create_point(6.0,3.0), 1.0)),
+  &quot;circle_center&quot;: get_center(create_circle(create_point(6.0,3.0), 1.0))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;circle_radius&quot;: 1.0, &quot;circle_center&quot;: point(&quot;6.0,3.0&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_distance"></a>spatial_distance</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_distance(point1, point2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the Euclidean distance between <tt>point1</tt> and <tt>point2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt>.</li>
+<li><tt>point2</tt> : a <tt>point</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> as the Euclidean distance between <tt>point1</tt> and <tt>point2</tt>.</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-point input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">spatial_distance(point(&quot;47.44,80.65&quot;), create_point(30.0,70.0));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">20.434678857275934
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_area"></a>spatial_area</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_area(spatial_2d_expression)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the spatial area of <tt>spatial_2d_expression</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>spatial_2d_expression</tt> : a <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> representing the area of <tt>spatial_2d_expression</tt>.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-2d-spatial-object will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">spatial_area(create_circle(create_point(0.0,0.0), 5.0));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">78.53981625
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_intersect"></a>spatial_intersect</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_intersect(spatial_object1, spatial_object2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether <tt>@arg1</tt> and <tt>@arg2</tt> spatially intersect each other.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>spatial_object1</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+<li><tt>spatial_object2</tt> : a <tt>point</tt>, <tt>line</tt>, <tt>rectangle</tt>, <tt>circle</tt>, or <tt>polygon</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> representing whether <tt>spatial_object1</tt> and <tt>spatial_object2</tt> spatially overlap with each other,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-spatial-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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)));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">true
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="spatial_cell"></a>spatial_cell</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">spatial_cell(point1, point2, x_increment, y_increment)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the grid cell that <tt>point1</tt> belongs to.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>point1</tt> : a <tt>point</tt> representing the point of interest that its grid cell will be returned.</li>
+<li><tt>point2</tt> : a <tt>point</tt> representing the origin of the grid.</li>
+<li><tt>x_increment</tt> : a <tt>double</tt>, represents X increments.</li>
+<li><tt>y_increment</tt> : a <tt>double</tt>, represents Y increments.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>rectangle</tt> representing the grid cell that <tt>point1</tt> belongs to,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-point value,</li>
+<li>or, the second or third argument is any other non-double value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">spatial_cell(point(&quot;39.28,70.48&quot;), create_point(20.0,50.0), 5.5, 6.0);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">rectangle(&quot;36.5,68.0 42.0,74.0&quot;);
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Similarity_Functions"></a><a name="SimilarityFunctions" id="SimilarityFunctions">Similarity Functions</a></h2>
+<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>
+<div class="section">
+<h3><a name="edit_distance"></a>edit_distance</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">edit_distance(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the edit distance of <tt>expression1</tt> and <tt>expression2</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
+<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> that represents the edit distance between <tt>expression1</tt> and <tt>expression2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">edit_distance(&quot;SuzannaTillson&quot;, &quot;Suzanna Tilson&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">2
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="edit_distance_check"></a>edit_distance_check</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">edit_distance_check(expression1, expression2, threshold)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the edit distance of <tt>expression1</tt> and <tt>expression2</tt> is within a given threshold.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
+<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
+<li><tt>threshold</tt> : a <tt>bigint</tt> that represents the distance threshold.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> with two items:
+<ul>
+
+<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>
+<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>
+<li>If the first item is false, then the second item is set to 2147483647.</li>
+</ul>
+</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-string value,</li>
+<li>or, the third argument is any other non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">edit_distance_check(&quot;happy&quot;,&quot;hapr&quot;,2);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ true, 2 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="edit_distance_contains"></a>edit_distance_contains</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">edit_distance_contains(expression1, expression2, threshold)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expression1</tt> : a <tt>string</tt> or a homogeneous <tt>array</tt> of a comparable item type.</li>
+<li><tt>expression2</tt> : The same type as <tt>expression1</tt>.</li>
+<li><tt>threshold</tt> : a <tt>bigint</tt> that represents the distance threshold.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> with two items:
+<ul>
+
+<li>The first item contains a <tt>boolean</tt> value representing whether <tt>expression1</tt> can contain <tt>expression2</tt>.</li>
+<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>
+</ul>
+</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-string value,</li>
+<li>or, the third argument is any other non-bigint value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Note: an <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">n_gram index</a> can be utilized for this function.</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">edit_distance_contains(&quot;happy&quot;,&quot;hapr&quot;,2);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ true, 1 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="similarity_jaccard"></a>similarity_jaccard</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">similarity_jaccard(array1, array2)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>array1</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+<li><tt>array2</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>float</tt> that represents the Jaccard similarity of <tt>array1</tt> and <tt>array2</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if any element in any input array is <tt>missing</tt>,</li>
+<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>
+<li>any other non-array input value or non-integer element in any input array will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Note: a <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">keyword index</a> can be utilized for this function.</p>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">similarity_jaccard([1,5,8,9], [1,5,9,10]);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0.6
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="similarity_jaccard_check"></a>similarity_jaccard_check</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">similarity_jaccard_check(array1, array2, threshold)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>array1</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+<li><tt>array2</tt> : an <tt>array</tt> or <tt>multiset</tt>.</li>
+<li><tt>threshold</tt> : a <tt>double</tt> that represents the similarity threshold.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> with two items:
+<ul>
+
+<li>The first item contains a <tt>boolean</tt> value representing whether <tt>array1</tt> and <tt>array2</tt> are similar.</li>
+<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>
+</ul>
+</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li><tt>missing</tt> if any element in any input array is <tt>missing</tt>,</li>
+<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>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first or second argument is any other non-array value,
+<ul>
+
+<li>or, the third argument is any other non-double value.</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Note: a <a href="similarity.html#UsingIndexesToSupportSimilarityQueries">keyword index</a> can be utilized for this function.</p>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">similarity_jaccard_check([1,5,8,9], [1,5,9,10], 0.6);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ false, 0.0 ]
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Tokenizing_Functions"></a><a name="TokenizingFunctions" id="TokenizingFunctions">Tokenizing Functions</a></h2>
+<div class="section">
+<h3><a name="word_tokens"></a>word_tokens</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">word_tokens(string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an array of word tokens of <tt>string</tt> using non_alphanumeric characters as delimiters.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>string</tt> : a <tt>string</tt> that will be tokenized.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>array</tt> of <tt>string</tt> word tokens,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-string input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">word_tokens(&quot;I like the phone, awesome!&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;i&quot;, &quot;like&quot;, &quot;the&quot;, &quot;phone&quot;, &quot;awesome&quot; ]
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Temporal_Functions"></a><a name="TemporalFunctions" id="TemporalFunctions">Temporal Functions</a></h2>
+<div class="section">
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_year/get_month/get_day/get_hour/get_minute/get_second/get_millisecond(temporal_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Accessors for accessing fields in a temporal value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> value representing the field to be extracted,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;year&quot;: get_year(date(&quot;2010-10-30&quot;)),
+  &quot;month&quot;: get_month(datetime(&quot;1987-11-19T23:49:23.938&quot;)),
+  &quot;day&quot;: get_day(date(&quot;2010-10-30&quot;)),
+  &quot;hour&quot;: get_hour(time(&quot;12:23:34.930&quot;)),
+  &quot;min&quot;: get_minute(duration(&quot;P3Y73M632DT49H743M3948.94S&quot;)),
+  &quot;second&quot;: get_second(datetime(&quot;1987-11-19T23:49:23.938&quot;)),
+  &quot;ms&quot;: get_millisecond(duration(&quot;P3Y73M632DT49H743M3948.94S&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;year&quot;: 2010, &quot;month&quot;: 11, &quot;day&quot;: 30, &quot;hour&quot;: 12, &quot;min&quot;: 28, &quot;second&quot;: 23, &quot;ms&quot;: 94 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="adjust_datetime_for_timezone"></a>adjust_datetime_for_timezone</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">adjust_datetime_for_timezone(datetime, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Adjusts the given datetime <tt>datetime</tt> by applying the timezone information <tt>string</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt> : a <tt>datetime</tt> value to be adjusted.</li>
+<li><tt>string</tt> : a <tt>string</tt> representing the timezone information.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> value representing the new datetime after being adjusted by the timezone information,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-datetime value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">adjust_datetime_for_timezone(datetime(&quot;2008-04-26T10:10:00&quot;), &quot;+08:00&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;2008-04-26T18:10:00.000+08:00&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="adjust_time_for_timezone"></a>adjust_time_for_timezone</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">adjust_time_for_timezone(time, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Adjusts the given time <tt>time</tt> by applying the timezone information <tt>string</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>time</tt> : a <tt>time</tt> value to be adjusted.</li>
+<li><tt>string</tt> : a <tt>string</tt> representing the timezone information.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> value representing the new time after being adjusted by the timezone information,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-time value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">adjust_time_for_timezone(get_time_from_datetime(datetime(&quot;2008-04-26T10:10:00&quot;)), &quot;+08:00&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;18:10:00.000+08:00&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="calendar_duration_from_datetime"></a>calendar_duration_from_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">calendar_duration_from_datetime(datetime, duration_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a user_friendly representation of the duration <tt>duration_value</tt> based on the given datetime <tt>datetime</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt> : a <tt>datetime</tt> value to be used as the reference time point.</li>
+<li><tt>duration_value</tt> : a <tt>duration</tt> value to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>duration</tt> value with the duration as <tt>duration_value</tt> but with a user_friendly representation,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-datetime value,</li>
+<li>or, the second argument is any other non-duration input value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">calendar_duration_from_datetime(
+      datetime(&quot;2016-03-26T10:10:00&quot;),
+      datetime(&quot;2016-03-26T10:10:00&quot;) - datetime(&quot;2011-01-01T00:00:00&quot;)
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">duration(&quot;P5Y2M24DT10H10M&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_year_month_duration.2Fget_day_time_duration"></a>get_year_month_duration/get_day_time_duration</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_year_month_duration/get_day_time_duration(duration_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Extracts the correct <tt>duration</tt> subtype from <tt>duration_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>duration_value</tt> : a <tt>duration</tt> value to be converted.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>year_month_duration</tt> value or a <tt>day_time_duration</tt> value,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_year_month_duration(duration(&quot;P12M50DT10H&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">year_month_duration(&quot;P1Y&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">months_from_year_month_duration/ms_from_day_time_duration(duration_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Extracts the number of months or the number of milliseconds from the <tt>duration</tt> subtype.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>duration_value</tt> : a <tt>duration</tt> of the correct subtype.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> representing the number of months/milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;months&quot;: months_from_year_month_duration(get_year_month_duration(duration(&quot;P5Y7MT50M&quot;))),
+    &quot;milliseconds&quot;: ms_from_day_time_duration(get_day_time_duration(duration(&quot;P5Y7MT50M&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{&quot;months&quot;: 67, &quot;milliseconds&quot;: 3000000}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="duration_from_months.2Fduration_from_ms"></a>duration_from_months/duration_from_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">duration_from_months/duration_from_ms(number_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates a <tt>duration</tt> from <tt>number_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>number_value</tt> : a <tt>bigint</tt> representing the number of months/milliseconds</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>duration</tt> containing <tt>number_value</tt> value for months/milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">duration_from_months(8);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">duration(&quot;P8M&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="duration_from_interval"></a>duration_from_interval</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">duration_from_interval(interval_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Creates a <tt>duration</tt> from <tt>interval_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval_value</tt> : an <tt>interval</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>duration</tt> representing the time in the <tt>interval_value</tt></li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-duration input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;dr1&quot; : duration_from_interval(interval(date(&quot;2010-10-30&quot;), date(&quot;2010-12-21&quot;))),
+  &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;))),
+  &quot;dr3&quot; : duration_from_interval(interval(time(&quot;12:32:38&quot;), time(&quot;20:29:20&quot;))),
+  &quot;dr4&quot; : duration_from_interval(null)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;dr1&quot;: day_time_duration(&quot;P52D&quot;),
+  &quot;dr2&quot;: day_time_duration(&quot;P31DT1H1M1.111S&quot;),
+  &quot;dr3&quot;: day_time_duration(&quot;PT7H56M42S&quot;),
+  &quot;dr4&quot;: null
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="current_date"></a>current_date</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">current_date()
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the current date.</p>
+</li>
+<li>Arguments: None</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date</tt> value of the date when the function is called.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="current_time"></a>current_time</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">current_time()
+</pre></div></div>
+</li>
+<li>
+
+<p>Get the current time</p>
+</li>
+<li>Arguments: None</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt> value of the time when the function is called.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="current_datetime"></a>current_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">current_datetime()
+</pre></div></div>
+</li>
+<li>
+
+<p>Get the current datetime</p>
+</li>
+<li>Arguments: None</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value of the datetime when the function is called.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_date_from_datetime"></a>get_date_from_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_date_from_datetime(datetime)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the date value from the given datetime value <tt>datetime</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt>: a <tt>datetime</tt> value to be extracted from.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date</tt> value from the datetime,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>get_date_from_datetime(datetime(&#x201c;2016-03-26T10:10:00&#x201d;));</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>date(&#x201c;2016-03-26&#x201d;)</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_time_from_datetime"></a>get_time_from_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_time_from_datetime(datetime)
+</pre></div></div>
+</li>
+<li>
+
+<p>Get the time value from the given datetime value <tt>datetime</tt></p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime</tt>: a <tt>datetime</tt> value to be extracted from.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt> value from the datetime.</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_time_from_datetime(datetime(&quot;2016-03-26T10:10:00&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time(&quot;10:10:00.000&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="day_of_week"></a>day_of_week</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">day_of_week(date[, week_start_day])
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the day of the week for a given date (1_7)</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+<li><tt>week_start_day</tt>: (Optional) an integer or a string value (case-insensitive) specifying the day of the week to start counting from: 1=Sun[day], 2=Mon[day], &#x2026;, 7=Sat[urday]. If omitted, the default is 1 (Sunday).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the day of the week (1_7),</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;day_1&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;)),
+  &quot;day_2&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), 2),
+  &quot;day_3&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), &quot;Monday&quot;),
+  &quot;day_4&quot;: day_of_week(datetime(&quot;2012-12-30T12:12:12.039&quot;), &quot;MON&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;day_1&quot;: 1, &quot;day_2&quot;: 7, &quot;day_3&quot;: 7, &quot;day_4&quot;: 7 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="day_of_year"></a>day_of_year</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">day_of_year(date)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the day of the year for a given date</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the day of the year,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">day_of_year(date(&quot;2011-12-31&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">365
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="week_of_year"></a>week_of_year</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">week_of_year(date[, week_start_day])
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the week of the year for a given date</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+<li><tt>week_start_day</tt>: (Optional) an integer or a string value (case-insensitive) specifying the day of the week to start counting from: 1=Sun[day], 2=Mon[day], &#x2026;, 7=Sat[urday]. If omitted, the default is 1 (Sunday).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the week of the year,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;week_1&quot;: week_of_year(date(&quot;2012-12-01&quot;)),
+  &quot;week_2&quot;: week_of_year(date(&quot;2012-12-01&quot;), 2),
+  &quot;week_3&quot;: week_of_year(date(&quot;2012-12-01&quot;), &quot;Monday&quot;),
+  &quot;week_4&quot;: week_of_year(date(&quot;2012-12-01&quot;), &quot;MON&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;week_1&quot;: 48, &quot;week_2&quot;: 49, &quot;week_3&quot;: 49, &quot;week_4&quot;: 49 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="quarter_of_year"></a>quarter_of_year</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">quarter_of_year(date)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds the quarter of the year for a given date</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date</tt> or a <tt>datetime</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>bigint</tt> representing the quarter of the year (1_4),</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">quarter_of_year(date(&quot;2011-12-31&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">4
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="datetime_from_date_time"></a>datetime_from_date_time</h3>
+<ul>
+
+<li>Syntax:</li>
+</ul>
+<p>datetime_from_date_time(date,time)</p>
+<ul>
+
+<li>Gets a datetime representing the combination of <tt>date</tt> and <tt>time</tt>
+<ul>
+
+<li>Arguments:</li>
+<li><tt>date</tt>: a <tt>date</tt> value</li>
+<li><tt>time</tt> a <tt>time</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value by combining <tt>date</tt> and <tt>time</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if
+<ul>
+
+<li>the first argument is any other non-date value,</li>
+<li>or, the second argument is any other non-time value.</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="date_from_unix_time_in_days"></a>date_from_unix_time_in_days</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">date_from_unix_time_in_days(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a date representing the time after <tt>numeric_value</tt> days since 1970-01-01.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date</tt> value as the time after <tt>numeric_value</tt> days since 1970-01-01,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">date_from_unix_time_in_days(15800);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>date(&#x201c;2013-04-05&#x201d;)</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="datetime_from_unix_time_in_ms"></a>datetime_from_unix_time_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">datetime_from_unix_time_in_ms(numeric_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a datetime representing the time after <tt>numeric_value</tt> milliseconds since 1970-01-01T00:00:00Z.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<li><tt>string</tt> : (Optional) a string representing the target timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value as the time in the target time zone after <tt>numeric_value</tt> milliseconds since 1970-01-01T00:00:00Z,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+   &quot;datetime_1&quot;: datetime_from_unix_time_in_ms(1365139700000),
+   &quot;datetime_2&quot;: datetime_from_unix_time_in_ms(1365139700000, &quot;America/Los_Angeles&quot;)
+ };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;datetime_1&#x201d;: datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;), &#x201c;datetime_2&#x201d;: datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;) }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="datetime_from_unix_time_in_secs"></a>datetime_from_unix_time_in_secs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">datetime_from_unix_time_in_secs(numeric_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a datetime representing the time after <tt>numeric_value</tt> seconds since 1970-01-01T00:00:00Z.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<li><tt>string</tt> : (Optional) a string representing the target timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value as the time in the target time zone after <tt>numeric_value</tt> seconds since 1970-01-01T00:00:00Z,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;datetime_1&quot;: datetime_from_unix_time_in_secs(1365139700),
+  &quot;datetime_2&quot;: datetime_from_unix_time_in_secs(1365139700, &quot;America/Los_Angeles&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;datetime_1&#x201d;: datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;), &#x201c;datetime_2&#x201d;: datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;) }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="time_from_unix_time_in_ms"></a>time_from_unix_time_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">time_from_unix_time_in_ms(numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets a time representing the time after <tt>numeric_value</tt> milliseconds since 00:00:00.000.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt> value as the time after <tt>numeric_value</tt> milliseconds since 00:00:00.000,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">time_from_unix_time_in_ms(3748);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time(&quot;00:00:03.748&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_date_in_days"></a>unix_time_from_date_in_days</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_date_in_days(date_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the number of days since 1970-01-01 for <tt>date_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date_value</tt>: a <tt>date</tt> value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of days,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-date input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>unix_time_from_date_in_days(date(&#x201c;2013-04-05&#x201d;));</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>15800</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_datetime_in_ms"></a>unix_time_from_datetime_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_datetime_in_ms(datetime_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the time in milliseconds since 1970-01-01T00:00:00Z for <tt>datetime_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime_value</tt> : a <tt>datetime</tt> value.</li>
+<li><tt>string</tt> : (Optional) a string representing the source timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: unix_time_from_datetime_in_ms(datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;)), &#x201c;unix_time_2&#x201d;: unix_time_from_datetime_in_ms(datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;), &#x201c;America/Los_Angeles&#x201d;) };</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: 1365139700000, &#x201c;unix_time_2&#x201d;: 1365139700000 }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_datetime_in_secs"></a>unix_time_from_datetime_in_secs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_datetime_in_secs(datetime_value[, string])
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the time in seconds since 1970-01-01T00:00:00Z for <tt>datetime_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>datetime_value</tt> : a <tt>datetime</tt> value.</li>
+</ul>
+</li>
+<li><tt>string</tt> : (Optional) a string representing the source timezone as defined by IANA Time Zone Database. If omitted, the default is UTC.</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of seconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: unix_time_from_datetime_in_secs(datetime(&#x201c;2013-04-05T05:28:20.000&#x201d;)), &#x201c;unix_time_2&#x201d;: unix_time_from_datetime_in_secs(datetime(&#x201c;2013-04-04T22:28:20.000&#x201d;), &#x201c;America/Los_Angeles&#x201d;) };</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;unix_time_1&#x201d;: 1365139700, &#x201c;unix_time_2&#x201d;: 1365139700 }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="unix_time_from_time_in_ms"></a>unix_time_from_time_in_ms</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_time_in_ms(time_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets an integer value representing the time the milliseconds since 00:00:00.000 for <tt>time_value</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>time_value</tt> : a <tt>time</tt> value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of milliseconds,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-datetime input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">unix_time_from_time_in_ms(time(&quot;00:00:03.748&quot;));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3748
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="parse_date.2Fparse_time.2Fparse_datetime"></a>parse_date/parse_time/parse_datetime</h3>
+<ul>
+
+<li>Syntax:</li>
+</ul>
+<p>parse_date/parse_time/parse_datetime(date,formatting_expression)</p>
+<ul>
+
+<li>Creates a <tt>date/time/date_time</tt> value by treating <tt>date</tt> with formatting <tt>formatting_expression</tt></li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>string</tt> value representing the <tt>date/time/datetime</tt>.</li>
+<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>
+<li><tt>h</tt> hours</li>
+<li><tt>m</tt> minutes</li>
+<li><tt>s</tt> seconds</li>
+<li><tt>n</tt> (or <tt>S</tt>) milliseconds</li>
+<li><tt>a</tt> am/pm</li>
+<li><tt>z</tt> timezone (parsed and ignored)</li>
+<li><tt>Y</tt> year</li>
+<li><tt>Q</tt> quarter of year (1-4)</li>
+<li><tt>QQ</tt> quarter of year (01-04)</li>
+<li><tt>M</tt> month</li>
+<li><tt>D</tt> day</li>
+<li><tt>EEE</tt> weekday (abbreviated name, parsed and ignored)</li>
+<li><tt>EEEE</tt> weekday (full name, parsed and ignored)</li>
+<li><tt>_</tt>, <tt>'</tt>, <tt>/</tt>, <tt>.</tt>, <tt>,</tt>, <tt>T</tt> seperators for both time and date</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>date/time/date_time</tt> value corresponding to <tt>date</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:</li>
+<li>the first argument is any other non-date value,</li>
+<li>the second argument is any other non-string value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">parse_time(&quot;30:30&quot;,&quot;m:s&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time(&quot;00:30:30.000&quot;)
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="print_date.2Fprint_time.2Fprint_datetime"></a>print_date/print_time/print_datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">print_date/print_time/print_datetime(date,formatting_expression)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>date</tt>: a <tt>date/time/datetime</tt> value.</li>
+<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>
+<li><tt>h</tt> hours</li>
+<li><tt>m</tt> minutes</li>
+<li><tt>s</tt> seconds</li>
+<li><tt>n</tt> (or <tt>S</tt>) milliseconds</li>
+<li><tt>a</tt> am/pm</li>
+<li><tt>Y</tt> year</li>
+<li><tt>Q</tt> quarter of year (1-4)</li>
+<li><tt>QQ</tt> quarter of year (01-04)</li>
+<li><tt>M</tt> month</li>
+<li><tt>MMM</tt> month (abbreviated name)</li>
+<li><tt>MMMM</tt> month (full name)</li>
+<li><tt>D</tt> day</li>
+<li><tt>DDD</tt> day of year</li>
+<li><tt>EEE</tt> weekday (abbreviated name)</li>
+<li><tt>EEEE</tt> weekday (full name)</li>
+<li><tt>_</tt>, <tt>'</tt>, <tt>/</tt>, <tt>.</tt>, <tt>,</tt>, <tt>T</tt> seperators for both time and date</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>string</tt> value corresponding to <tt>date</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-date value,</li>
+<li>the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">print_time(time(&quot;00:30:30.000&quot;),&quot;m:s&quot;);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;30:30&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_interval_start.2C_get_interval_end"></a>get_interval_start, get_interval_end</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_interval_start/get_interval_end(interval)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the start/end of the given interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval</tt>: the interval to be accessed.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-interval value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;start&quot;: get_interval_start(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
+  &quot;end&quot;: get_interval_end(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;start&quot;: date(&quot;1984-01-01&quot;), &quot;end&quot;: date(&quot;1985-01-01&quot;) }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<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)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the start/end of the given interval for the specific date/datetime/time type.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval</tt>: the interval to be accessed.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>time</tt>, <tt>date</tt>, or <tt>datetime</tt> (depending on the function) representing the starting or ending time,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-interval value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;start1&quot;: get_interval_start_date(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
+  &quot;end1&quot;: get_interval_end_date(interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;)),
+  &quot;start2&quot;: get_interval_start_datetime(interval_start_from_datetime(&quot;1984-01-01T08:30:00.000&quot;, &quot;P1Y1H&quot;)),
+  &quot;end2&quot;: get_interval_end_datetime(interval_start_from_datetime(&quot;1984-01-01T08:30:00.000&quot;, &quot;P1Y1H&quot;)),
+  &quot;start3&quot;: get_interval_start_time(interval_start_from_time(&quot;08:30:00.000&quot;, &quot;P1H&quot;)),
+  &quot;end3&quot;: get_interval_end_time(interval_start_from_time(&quot;08:30:00.000&quot;, &quot;P1H&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;start1&quot;: date(&quot;1984-01-01&quot;),
+  &quot;end1&quot;: date(&quot;1985-01-01&quot;),
+  &quot;start2&quot;: datetime(&quot;1984-01-01T08:30:00.000&quot;),
+  &quot;end2&quot;: datetime(&quot;1985-01-01T09:30:00.000&quot;),
+  &quot;start3&quot;: time(&quot;08:30:00.000&quot;),
+  &quot;end3&quot;: time(&quot;09:30:00.000&quot;)
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="get_overlapping_interval"></a>get_overlapping_interval</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_overlapping_interval(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the start/end of the given interval for the specific date/datetime/time type.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>: an <tt>interval</tt> value</li>
+<li><tt>interval2</tt>: an <tt>interval</tt> value</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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;))),
+  &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;))),
+  &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;))),
+  &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;))),
+  &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;))),
+  &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;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;overlap1&quot;: interval(time(&quot;12:23:39.000&quot;), time(&quot;18:27:19.000&quot;)),
+  &quot;overlap2&quot;: null,
+  &quot;overlap3&quot;: null,
+  &quot;overlap4&quot;: interval(date(&quot;2013-01-01&quot;), date(&quot;2014-01-01&quot;)),
+  &quot;overlap5&quot;: interval(datetime(&quot;1989-03-04T12:23:39.000&quot;), datetime(&quot;2000-10-30T18:27:19.000&quot;)),
+  &quot;overlap6&quot;: null
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_bin"></a>interval_bin</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_bin(time_to_bin, time_bin_anchor, duration_bin_size)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the <tt>interval</tt> value representing the bin containing the <tt>time_to_bin</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>time_to_bin</tt>: a date/time/datetime value representing the time to be binned.</li>
+<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>
+<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:
+<ul>
+
+<li>datetime +|_ year_month_duration</li>
+<li>datetime +|_ day_time_duration</li>
+<li>date +|_ year_month_duration</li>
+<li>date +|_ day_time_duration</li>
+<li>time +|_ day_time_duration</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:</li>
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument or the second argument is any other non-date/non-time/non-datetime value,</li>
+<li>or, the second argument is any other non-year_month_duration/non-day_time_duration value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>{ &#x201c;bin1&#x201d;: interval_bin(date(&#x201c;2010-10-30&#x201d;), date(&#x201c;1990-01-01&#x201d;), year_month_duration(&#x201c;P1Y&#x201d;)), &#x201c;bin2&#x201d;: interval_bin(datetime(&#x201c;1987-11-19T23:49:23.938&#x201d;), datetime(&#x201c;1990-01-01T00:00:00.000&#x201d;), year_month_duration(&#x201c;P6M&#x201d;)), &#x201c;bin3&#x201d;: interval_bin(time(&#x201c;12:23:34.930+07:00&#x201d;), time(&#x201c;00:00:00&#x201d;), day_time_duration(&#x201c;PT1M&#x201d;)), &#x201c;bin4&#x201d;: interval_bin(datetime(&#x201c;1987-11-19T23:49:23.938&#x201d;), datetime(&#x201c;2013-01-01T00:00:00.000&#x201d;), day_time_duration(&#x201c;PT24H&#x201d;)) };</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;bin1&#x201d;: interval(date(&#x201c;2010-01-01&#x201d;), date(&#x201c;2011-01-01&#x201d;)), &#x201c;bin2&#x201d;: interval(datetime(&#x201c;1987-07-01T00:00:00.000&#x201d;), datetime(&#x201c;1988-01-01T00:00:00.000&#x201d;)), &#x201c;bin3&#x201d;: interval(time(&#x201c;12:23:00.000&#x201d;), time(&#x201c;12:24:00.000&#x201d;)), &#x201c;bin4&#x201d;: interval(datetime(&#x201c;1987-11-19T00:00:00.000&#x201d;), datetime(&#x201c;1987-11-20T00:00:00.000&#x201d;)) }</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_start_from_date.2Ftime.2Fdatetime"></a>interval_start_from_date/time/datetime</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_start_from_date/time/datetime(date/time/datetime, duration)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>interval</tt> value representing the interval starting from the given time point with the length of duration,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument or the second argument is any other non-date/non-time/non-datetime value,</li>
+<li>or, the second argument is any other non-duration value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval1&quot;: interval_start_from_date(&quot;1984-01-01&quot;, &quot;P1Y&quot;),
+  &quot;interval2&quot;: interval_start_from_time(time(&quot;02:23:28.394&quot;), &quot;PT3H24M&quot;),
+  &quot;interval3&quot;: interval_start_from_datetime(&quot;1999-09-09T09:09:09.999&quot;, duration(&quot;P2M30D&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval1&quot;: interval(date(&quot;1984-01-01&quot;), date(&quot;1985-01-01&quot;)),
+  &quot;interval2&quot;: interval(time(&quot;02:23:28.394&quot;), time(&quot;05:47:28.394&quot;)),
+  &quot;interval3&quot;: interval(datetime(&quot;1999-09-09T09:09:09.999&quot;), datetime(&quot;1999-12-09T09:09:09.999&quot;))
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="overlap_bins"></a>overlap_bins</h3>
+<ul>
+
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<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>
+</ul>
+</li>
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source"> overlap_bins(interval, time_bin_anchor, duration_bin_size)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an ordered list of <tt>interval</tt> values representing each bin that is overlapping the <tt>interval</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval</tt>: an <tt>interval</tt> value</li>
+<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>
+<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:
+<ul>
+
+<li>datetime +|_ year_month_duration</li>
+<li>datetime +|_ day_time_duration</li>
+<li>date +|_ year_month_duration</li>
+<li>date +|_ day_time_duration</li>
+<li>time +|_ day_time_duration</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first arugment is any other non-interval value,</li>
+<li>or, the second argument is any other non-date/non-time/non-datetime value,</li>
+<li>or, the second argument is any other non-year_month_duration/non-day_time_duration value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &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;)),
+  &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;)),
+  &quot;datetimebins&quot;: overlap_bins(interval(datetime(&quot;1800-01-01T23:59:48.938&quot;), datetime(&quot;2015-07-26T13:28:30.218&quot;)),
+                              datetime(&quot;1900-01-01T00:00:00.000&quot;), year_month_duration(&quot;P100Y&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ &#x201c;timebins&#x201d;: [ interval(time(&#x201c;17:00:00.000&#x201d;), time(&#x201c;17:30:00.000&#x201d;)), interval(time(&#x201c;17:30:00.000&#x201d;), time(&#x201c;18:00:00.000&#x201d;)), interval(time(&#x201c;18:00:00.000&#x201d;), time(&#x201c;18:30:00.000&#x201d;)), interval(time(&#x201c;18:30:00.000&#x201d;), time(&#x201c;19:00:00.000&#x201d;))                      ], &#x201c;datebins&#x201d;: [ interval(date(&#x201c;1980-01-01&#x201d;), date(&#x201c;1990-01-01&#x201d;)), interval(date(&#x201c;1990-01-01&#x201d;), date(&#x201c;2000-01-01&#x201d;)), interval(date(&#x201c;2000-01-01&#x201d;), date(&#x201c;2010-01-01&#x201d;)), interval(date(&#x201c;2010-01-01&#x201d;), date(&#x201c;2020-01-01&#x201d;))                      ], &#x201c;datetimebins&#x201d;: [ interval(datetime(&#x201c;1800-01-01T00:00:00.000&#x201d;), datetime(&#x201c;1900-01-01T00:00:00.000&#x201d;)), interval(datetime(&#x201c;1900-01-01T00:00:00.000&#x201d;), datetime(&#x201c;2000-01-01T00:00:00.000&#x201d;)), interval(datetime(&#x201c;2000-01-01T00:00:00.000&#x201d;), datetime(&#x201c;2100-01-01T00:00:00.000&#x201d;))                      ] };</p>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="interval_before.2C_interval_after"></a>interval_before, interval_after</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_before(interval1, interval2)
+interval_after(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether an interval happens before/after another interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_before&quot;: interval_before(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                     interval(date(&quot;2005-05-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;interval_after&quot;: interval_after(interval(date(&quot;2005-05-01&quot;), date(&quot;2012-09-09&quot;)),
+                                   interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_before&quot;: true, &quot;interval_after&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_covers.2C_interval_covered_by"></a>interval_covers, interval_covered_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_covers(interval1, interval2)
+interval_covered_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether one interval covers the other interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>
+
+<p>a <tt>boolean</tt> value. Specifically, <tt>interval_covers(interval1, interval2)</tt> is true if and only if</p>
+<p>interval1.start &lt;= interval2.start AND interval1.end &gt;= interval2.end</p>
+<p><tt>interval_covered_by(interval1, interval2)</tt> is true if and only if</p>
+<p>interval2.start &lt;= interval1.start AND interval2.end &gt;= interval1.end</p>
+</li>
+<li>
+
+<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_covers&quot;: interval_covers(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                     interval(date(&quot;2000-03-01&quot;), date(&quot;2004-09-09&quot;))),
+  &quot;interval_covered_by&quot;: interval_covered_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                             interval(date(&quot;2004-09-10&quot;), date(&quot;2012-08-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_covers&quot;: true, &quot;interval_covered_by&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_overlaps.2C_interval_overlapped_by"></a>interval_overlaps, interval_overlapped_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_overlaps(interval1, interval2)
+interval_overlapped_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These functions check whether two intervals overlap with each other.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value. Specifically, <tt>interval_overlaps(interval1, interval2)</tt> is true if and only if
+<p>interval1.start &lt; interval2.start AND interval2.end &gt; interval1.end AND interval1.end &gt; interval2.start</p></li>
+</ul>
+<p><tt>interval_overlapped_by(interval1, interval2)</tt> is true if and only if</p>
+
+<div>
+<div>
+<pre class="source">interval2.start &lt; interval1.start
+AND interval1.end &gt; interval2.end
+AND interval2.end &gt; interval1.start
+</pre></div></div>
+
+<ul>
+
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+<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>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;overlaps&quot;: interval_overlaps(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;overlapped_by&quot;: interval_overlapped_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                          interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;overlaps&quot;: true, &quot;overlapped_by&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_overlapping"></a>interval_overlapping</h3>
+<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>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_overlapping(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>This functions check whether two intervals share any points with each other.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>
+
+<p>a <tt>boolean</tt> value. Specifically, <tt>interval_overlapping(interval1, interval2)</tt> is true if</p>
+<p>interval1.start &lt; interval2.end AND interval1.end &gt; interval2.start</p>
+</li>
+<li>
+
+<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;overlapping1&quot;: interval_overlapping(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                       interval(date(&quot;2004-05-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;overlapping2&quot;: interval_overlapping(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                       interval(date(&quot;2004-09-10&quot;), date(&quot;2006-12-31&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;overlapping1&quot;: true, &quot;overlapping2&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_meets.2C_interval_met_by"></a>interval_meets, interval_met_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_meets(interval1, interval2)
+interval_met_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether an interval meets with another interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;meets&quot;: interval_meets(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                          interval(date(&quot;2005-01-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;metby&quot;: interval_met_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                           interval(date(&quot;2004-09-10&quot;), date(&quot;2006-08-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;meets&quot;: true, &quot;metby&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_starts.2C_interval_started_by"></a>interval_starts, interval_started_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_starts(interval1, interval2)
+interval_started_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether one interval starts with the other interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> value. Specifically, <tt>interval_starts(interval1, interval2)</tt> returns true if and only if
+<p>interval1.start = interval2.start AND interval1.end &lt;= interval2.end</p></li>
+</ul>
+<p><tt>interval_started_by(interval1, interval2)</tt> returns true if and only if</p>
+
+<div>
+<div>
+<pre class="source">interval1.start = interval2.start
+AND interval2.end &lt;= interval1.end
+</pre></div></div>
+
+<ul>
+
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_starts&quot;: interval_starts(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                     interval(date(&quot;2000-01-01&quot;), date(&quot;2012-09-09&quot;))),
+  &quot;interval_started_by&quot;: interval_started_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                             interval(date(&quot;2006-08-01&quot;), date(&quot;2006-08-02&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_starts&quot;: true, &quot;interval_started_by&quot;: true }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="interval_ends.2C_interval_ended_by"></a>interval_ends, interval_ended_by</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">interval_ends(interval1, interval2)
+interval_ended_by(interval1, interval2)
+</pre></div></div>
+</li>
+<li>
+
+<p>These two functions check whether one interval ends with the other interval.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>interval1</tt>, <tt>interval2</tt>: two intervals to be compared</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>
+
+<p>a <tt>boolean</tt> value. Specifically, <tt>interval_ends(interval1, interval2)</tt> returns true if and only if</p>
+<p>interval1.end = interval2.end AND interval1.start &gt;= interval2.start</p>
+<p><tt>interval_ended_by(interval1, interval2)</tt> returns true if and only if</p>
+<p>interval2.end = interval1.end AND interval2.start &gt;= interval1.start</p>
+</li>
+<li>
+
+<p><tt>missing</tt> if the argument is a <tt>missing</tt> value,</p>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-interval input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;interval_ends&quot;: interval_ends(interval(date(&quot;2000-01-01&quot;), date(&quot;2005-01-01&quot;)),
+                                 interval(date(&quot;1998-01-01&quot;), date(&quot;2005-01-01&quot;))),
+  &quot;interval_ended_by&quot;: interval_ended_by(interval(date(&quot;2006-08-01&quot;), date(&quot;2007-03-01&quot;)),
+                                         interval(date(&quot;2006-09-10&quot;), date(&quot;2007-03-01&quot;)))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;interval_ends&quot;: true, &quot;interval_ended_by&quot;: true }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Object_Functions"></a><a name="ObjectFunctions" id="ObjectFunctions">Object Functions</a></h2>
+<div class="section">
+<h3><a name="get_object_fields"></a>get_object_fields</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_object_fields(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Access the object field names, type and open status for a given object.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : a object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value,</li>
+<li>any other non-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_object_fields(
+                  {
+                    &quot;id&quot;: 1,
+                    &quot;project&quot;: &quot;AsterixDB&quot;,
+                    &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+                    &quot;related&quot;: [&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                  }
+                 );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  { &quot;field-name&quot;: &quot;id&quot;, &quot;field-type&quot;: &quot;INT64&quot;, &quot;is-open&quot;: false },
+  { &quot;field-name&quot;: &quot;project&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false },
+  { &quot;field-name&quot;: &quot;address&quot;, &quot;field-type&quot;: &quot;RECORD&quot;, &quot;is-open&quot;: false,
+    &quot;nested&quot;: [
+                { &quot;field-name&quot;: &quot;city&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false },
+                { &quot;field-name&quot;: &quot;state&quot;, &quot;field-type&quot;: &quot;STRING&quot;, &quot;is-open&quot;: false }
+              ]
+  },
+  { &quot;field-name&quot;:
+        &quot;related&quot;,
+        &quot;field-type&quot;: &quot;ORDEREDLIST&quot;,
+        &quot;is-open&quot;: false,
+        &quot;list&quot;: [
+                  { &quot;field-type&quot;: &quot;STRING&quot; },
+                  { &quot;field-type&quot;: &quot;STRING&quot; },
+                  { &quot;field-type&quot;: &quot;STRING&quot; }
+                ]
+  }
+]
+</pre></div></div>
+</li>
+</ul>
+<p>]</p></div>
+<div class="section">
+<h3><a name="get_object_field_value"></a>get_object_field_value</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_object_field_value(input_object, string)
+</pre></div></div>
+</li>
+<li>
+
+<p>Access the field name given in the <tt>string_expression</tt> from the <tt>object_expression</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : a <tt>object</tt> value.</li>
+<li><tt>string</tt> : a <tt>string</tt> representing the top level field name.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>any</tt> value saved in the designated field of the object,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-object value,</li>
+<li>or, the second argument is any other non-string value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">get_object_field_value({
+                         &quot;id&quot;: 1,
+                         &quot;project&quot;: &quot;AsterixDB&quot;,
+                         &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+                         &quot;related&quot;: [&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                        },
+                        &quot;project&quot;
+                       );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">&quot;AsterixDB&quot;
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_remove_fields"></a>object_remove_fields</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_remove_fields(input_object, field_names)
+</pre></div></div>
+</li>
+<li>
+
+<p>Remove indicated fields from a object given a list of field names.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt>:  a object value.</li>
+<li><tt>field_names</tt>: an array of strings and/or array of array of strings.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>a new object value without the fields listed in the second argument,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-object value,</li>
+<li>or, the second argument is any other non-array value or recursively contains non-string items.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_remove_fields(
+                       {
+                         &quot;id&quot;:1,
+                         &quot;project&quot;:&quot;AsterixDB&quot;,
+                         &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+                         &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                       },
+                       [[&quot;address&quot;, &quot;city&quot;], &quot;related&quot;]
+                     );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;:1,
+  &quot;project&quot;:&quot;AsterixDB&quot;,
+  &quot;address&quot;:{ &quot;state&quot;: &quot;CA&quot; }
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_add_fields"></a>object_add_fields</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_add_fields(input_object, fields)
+</pre></div></div>
+</li>
+<li>
+
+<p>Add fields to a object given a list of field names.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : a object value.</li>
+<li><tt>fields</tt>: an array of field descriptor objects where each object has field_name and  field_value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a new object value with the new fields included,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li>the first argument is any other non-object value,</li>
+<li>the second argument is any other non-array value, or contains non-object items.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_add_fields(
+                   {
+                     &quot;id&quot;:1,
+                     &quot;project&quot;:&quot;AsterixDB&quot;,
+                     &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+                     &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+                    },
+                    [{&quot;field-name&quot;:&quot;employment_location&quot;, &quot;field-value&quot;:create_point(30.0,70.0)}]
+                  );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+   &quot;id&quot;:1,
+   &quot;project&quot;:&quot;AsterixDB&quot;,
+   &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+   &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+   &quot;employment_location&quot;: point(&quot;30.0,70.0&quot;)
+ }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_merge"></a>object_merge</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_merge(object1, object2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Merge two different objects into a new object.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>object1</tt> : a object value.</li>
+<li><tt>object2</tt> : a object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>any other non-object input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_merge(
+              {
+                &quot;id&quot;:1,
+                &quot;project&quot;:&quot;AsterixDB&quot;,
+                &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+                &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+              },
+              {
+                &quot;user_id&quot;: 22,
+                &quot;employer&quot;: &quot;UC Irvine&quot;,
+                &quot;employment_type&quot;: &quot;visitor&quot;
+              }
+            );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;employment_type&quot;: &quot;visitor&quot;,
+  &quot;address&quot;: {
+    &quot;city&quot;: &quot;Irvine&quot;,
+    &quot;state&quot;: &quot;CA&quot;
+  },
+  &quot;related&quot;: [
+    &quot;Hivestrix&quot;,
+    &quot;Preglix&quot;,
+    &quot;Apache VXQuery&quot;
+  ],
+  &quot;user_id&quot;: 22,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+  &quot;employer&quot;: &quot;UC Irvine&quot;,
+  &quot;id&quot;: 1
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_length"></a>object_length</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_length(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns number of top-level fields in the given object</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an integer that represents the number of top-level fields in the given object,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value or any other non-object value</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_length(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+               }
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_names"></a>object_names</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_names(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns names of top-level fields in the given object</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an array with top-level field names of the given object,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value or any other non-object value</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_names(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+               }
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ &quot;id&quot;, &quot;project&quot;, &quot;address&quot; ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_remove"></a>object_remove</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_remove(input_object, field_name)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a new object that has the same fields as the input object except the field to be removed</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>field_name</tt> : a string field name.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>A new object that has the same fields as <tt>input_object</tt> except the field <tt>field_name</tt>,</li>
+<li><tt>missing</tt> if the argument <tt>input_object</tt> or <tt>field_name</tt> is missing,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_remove(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;address&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_rename"></a>object_rename</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_rename(input_object, old_field, new_field)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>old_field</tt> : a string representing the old (original) field name inside the object <tt>input_object</tt>.</li>
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_rename(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;address&quot;
+               , &quot;location&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_unwrap"></a>object_unwrap</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_unwrap(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the value of the single name-value pair that appears in <tt>input_object</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value that consists of exactly one name-value pair.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>The value of the single name-value pair that appears in <tt>input_object</tt>,</li>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_unwrap(
+             {
+               &quot;id&quot;: 1
+             }
+           );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  1
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_replace"></a>object_replace</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_replace(input_object, old_value, new_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>old_value</tt> : a primitive type value to be replaced by <tt>new_value</tt>.</li>
+<li><tt>new_value</tt> : a value to replace <tt>old_value</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if <tt>input_object</tt>  or <tt>old_value</tt> is null,</li>
+<li>a type error will be raised if:
+<ul>
+
+<li><tt>old_value</tt> is not a primitive type value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_replace(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;AsterixDB&quot;
+               , &quot;Apache AsterixDB&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;Apache AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_add"></a>object_add</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_add(input_object, field_name, field_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>field_name</tt> : a string representing a field name to be added.</li>
+<li><tt>field_value</tt> : a value to be assigned to the new field <tt>field_name</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>missing</tt>,</li>
+<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>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_add(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;company&quot;
+               , &quot;Apache&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;},
+  &quot;company&quot;: &quot;Apache&quot;
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_put"></a>object_put</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_put(input_object, field_name, field_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Adds, modifies, or removes a field of an object.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+<li><tt>field_name</tt> : a string representing a field name to be added.</li>
+<li><tt>field_value</tt> : a value to be assigned to the new field <tt>field_name</tt>.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if <tt>input_object</tt> or <tt>field_name</tt> is <tt>missing</tt>,</li>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_put(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+               , &quot;project&quot;
+               , &quot;Apache AsterixDB&quot;
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;id&quot;: 1,
+  &quot;project&quot;: &quot;Apache AsterixDB&quot;,
+  &quot;location&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+}
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_values"></a>object_values</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_values(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns an array of the values of the fields in <tt>input_object</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>An array of the values of the fields in <tt>input_object</tt>,</li>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<li><tt>null</tt> if <tt>input_object</tt> is null or any non-object value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_values(
+               {
+                 &quot;id&quot;: 1,
+                 &quot;project&quot;: &quot;AsterixDB&quot;,
+                 &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+               }
+             );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  1,
+  &quot;AsterixDB&quot;,
+  {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="object_pairs"></a>object_pairs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">object_pairs(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>input_object</tt> : an object value.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>An array of the <tt>name</tt>/<tt>value</tt> pairs of the fields in <tt>input_object</tt>,</li>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<li><tt>null</tt> if <tt>input_object</tt> is null or any non-object value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">object_pairs(
+              {
+                &quot;id&quot;: 1,
+                &quot;project&quot;: &quot;AsterixDB&quot;,
+                &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+              }
+            );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  { &quot;name&quot;: &quot;id&quot;, &quot;value&quot;: 1 },
+  { &quot;name&quot;: &quot;project&quot;, &quot;value&quot;: &quot;AsterixDB&quot; },
+  { &quot;name&quot;: &quot;address&quot;, &quot;value&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;} }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="pairs"></a>pairs</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">pairs(input_object)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>input_object</tt> : an object value (or an array or a multiset)</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>missing</tt> if <tt>input_object</tt> is <tt>missing</tt>,</li>
+<li><tt>null</tt> if <tt>input_object</tt> is null or a value of a primitive data type.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">pairs(
+       {
+         &quot;id&quot;: 1,
+         &quot;project&quot;: &quot;AsterixDB&quot;,
+         &quot;address&quot;: {&quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot;}
+       }
+     );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  [ &quot;id&quot;, 1 ],
+  [ &quot;project&quot;, &quot;AsterixDB&quot; ],
+  [ &quot;address&quot;, { &quot;city&quot;: &quot;Irvine&quot;, &quot;state&quot;: &quot;CA&quot; } ],
+  [ &quot;city&quot;, &quot;Irvine&quot; ],
+  [ &quot;state&quot;, &quot;CA&quot; ]
+]
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Aggregate_Functions_.28Array_Functions.29"></a><a name="AggregateFunctions" id="AggregateFunctions">Aggregate Functions (Array Functions) </a></h2>
+<p>This section contains detailed descriptions of the built-in aggregate functions in the query language.</p>
+<p>The query language also supports standard SQL aggregate functions (e.g., <tt>MIN</tt>, <tt>MAX</tt>, <tt>SUM</tt>, <tt>COUNT</tt>, and <tt>AVG</tt>). Note that these are not real functions in the query language, but just syntactic sugars over corresponding builtin aggregate functions (e.g., <tt>ARRAY_MIN</tt>, <tt>ARRAY_MAX</tt>, <tt>ARRAY_SUM</tt>, <tt>ARRAY_COUNT</tt>, and <tt>ARRAY_AVG</tt>). Refer to <a href="manual.html#Aggregation_PseudoFunctions">Aggregation Pseudo-Functions</a> for details.</p>
+<p>The <tt>DISTINCT</tt> keyword may be used with built-in aggregate functions and standard SQL aggregate functions. It may also be used with aggregate functions used as window functions. It determines whether the function aggregates all values in the group, or distinct values only. Refer to <a href="manual.html#Function_call_expressions">Function Calls</a> for details.</p>
+<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>
+<div class="section">
+<h3><a name="array_count"></a>array_count</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_count(collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the number of non-null and non-missing items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> to be counted,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of non-null and non-missing items in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li>any other non-array and non-multiset input value will cause an error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_count( ['hello', 'world', 1, 2, 3, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">5
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_avg"></a>array_avg</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_avg(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the average value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the average of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_avg( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.725
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_sum"></a>array_sum</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_sum(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sum of non-null and non-missing items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_sum( [1.2, 2.3, 3.4, 0, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">6.9
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_min"></a>array_min</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_min(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the min value of non-null and non-missing comparable items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_min( [1.2, 2.3, 3.4, 0, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_max"></a>array_max</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_max(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the max value of the non-null and non-missing comparable items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_max( [1.2, 2.3, 3.4, 0, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3.4
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_stddev_samp"></a>array_stddev_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample standard deviation value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample standard deviation of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_samp( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.4591664287073858
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_stddev_pop"></a>array_stddev_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population standard deviation value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population standard deviation of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_stddev_pop( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.2636751956100112
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_var_samp"></a>array_var_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_var_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample variance value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample variance of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_var_samp( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">2.1291666666666664
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_var_pop"></a>array_var_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_var_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population variance value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population variance of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_var_pop( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">1.5968749999999998
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_skewness"></a>array_skewness</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_skewness(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the skewness value of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the skewness of the non-null and non-missing numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_skewness( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">-0.04808451539164242
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="array_kurtosis"></a>array_kurtosis</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">array_kurtosis(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the kurtosis value from the normal distribution of the non-null and non-missing numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if the given collection does not contain any non-null and non-missing items,</li>
+<li>any other non-array and non-multiset input value will cause a type error,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">array_kurtosis( [1.2, 2.3, 3.4, 0, null] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">-1.342049701096427
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_count"></a>strict_count</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_count(collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the number of items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing the items to be counted,</li>
+<li>or a <tt>null</tt> value,</li>
+<li>or a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>bigint</tt> value representing the number of items in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_count( [1, 2, null, missing] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">4
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_avg"></a>strict_avg</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_avg(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the average value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the average of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_avg( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">200.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_sum"></a>strict_sum</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_sum(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sum of the items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_sum( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">600
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_min"></a>strict_min</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_min(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the min value of comparable items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_min( [10.2, 100, 5] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">5.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_max"></a>strict_max</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_max(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the max value of numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt>,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>multiple incomparable items in the input array or multiset will cause a type error,</li>
+<li>any other non-array and non-multiset input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_max( [10.2, 100, 5] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">100.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_stddev_samp"></a>strict_stddev_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample standard deviation value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample standard deviation of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_samp( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">100.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_stddev_pop"></a>strict_stddev_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population standard deviation value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population standard deviation of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_stddev_pop( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">81.64965809277261
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_var_samp"></a>strict_var_samp</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_samp(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the sample variance value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the sample variance of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_samp( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">10000.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_var_pop"></a>strict_var_pop</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_pop(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the population variance value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the population variance of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_var_pop( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">6666.666666666667
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_skewness"></a>strict_skewness</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_skewness(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the skewness value of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the skewness of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_skewness( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0.0
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="strict_kurtosis"></a>strict_kurtosis</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">strict_kurtosis(num_collection)
+</pre></div></div>
+</li>
+<li>
+
+<p>Gets the kurtosis value from the normal distribution of the numeric items in the given collection.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>num_collection</tt> could be:
+<ul>
+
+<li>an <tt>array</tt> or <tt>multiset</tt> containing numeric values, <tt>null</tt>s or <tt>missing</tt>s,</li>
+<li>or, a <tt>null</tt> value,</li>
+<li>or, a <tt>missing</tt> value.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>double</tt> value representing the kurtosis from a normal distribution of the numbers in the given collection,</li>
+<li><tt>null</tt> is returned if the input is <tt>null</tt> or <tt>missing</tt>,</li>
+<li><tt>null</tt> is returned if there is a <tt>null</tt> or <tt>missing</tt> in the input collection,</li>
+<li>any other non-numeric value in the input collection will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">strict_kurtosis( [100, 200, 300] );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">-1.5
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Comparison_Functions"></a><a name="ComparisonFunctions" id="ComparisonFunctions">Comparison Functions</a></h2>
+<div class="section">
+<h3><a name="greatest"></a>greatest</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">greatest(numeric_value1, numeric_value2, ...)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the greatest value among arguments.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+<li>&#x2026;.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> if any argument is a <tt>missing</tt> value or <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 3, &quot;v2&quot;: 5000.0 }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="least"></a>least</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">least(numeric_value1, numeric_value2, ...)
+</pre></div></div>
+</li>
+<li>
+
+<p>Computes the least value among arguments.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+<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>
+<li>&#x2026;.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li><tt>null</tt> if any argument is a <tt>missing</tt> value or <tt>null</tt> value,</li>
+<li>any other non-numeric input value will cause a type error.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<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) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: 1, &quot;v2&quot;: -0.5 }
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Type_Functions"></a><a name="TypeFunctions" id="TypeFunctions">Type Functions</a></h2>
+<div class="section">
+<h3><a name="is_array"></a>is_array</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_array(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be an <tt>array</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is an <tt>array</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_array(true),
+  &quot;b&quot;: is_array(false),
+  &quot;c&quot;: isarray(null),
+  &quot;d&quot;: isarray(missing),
+  &quot;e&quot;: isarray(&quot;d&quot;),
+  &quot;f&quot;: isarray(4.0),
+  &quot;g&quot;: isarray(5),
+  &quot;h&quot;: isarray([&quot;1&quot;, 2]),
+  &quot;i&quot;: isarray({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isarray</tt>.</p></div>
+<div class="section">
+<h3><a name="is_multiset"></a>is_multiset</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_multiset(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be an <tt>multiset</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is an <tt>multiset</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_multiset(true),
+  &quot;b&quot;: is_multiset(false),
+  &quot;c&quot;: is_multiset(null),
+  &quot;d&quot;: is_multiset(missing),
+  &quot;e&quot;: is_multiset(&quot;d&quot;),
+  &quot;f&quot;: ismultiset(4.0),
+  &quot;g&quot;: ismultiset([&quot;1&quot;, 2]),
+  &quot;h&quot;: ismultiset({&quot;a&quot;:1}),
+  &quot;i&quot;: ismultiset({{&quot;hello&quot;, 9328, &quot;world&quot;, [1, 2, null]}})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ismultiset</tt>.</p></div>
+<div class="section">
+<h3><a name="is_atomic_.28is_atom.29"></a>is_atomic (is_atom)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_atomic(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a value of a <a href="../datamodel.html#PrimitiveTypes">primitive</a> type.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a primitive type or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_atomic(true),
+  &quot;b&quot;: is_atomic(false),
+  &quot;c&quot;: isatomic(null),
+  &quot;d&quot;: isatomic(missing),
+  &quot;e&quot;: isatomic(&quot;d&quot;),
+  &quot;f&quot;: isatom(4.0),
+  &quot;g&quot;: isatom(5),
+  &quot;h&quot;: isatom([&quot;1&quot;, 2]),
+  &quot;i&quot;: isatom({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isatomic</tt>, <tt>is_atom</tt>, and <tt>isatom</tt>.</p></div>
+<div class="section">
+<h3><a name="is_boolean_.28is_bool.29"></a>is_boolean (is_bool)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_boolean(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>boolean</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>boolean</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: isboolean(true),
+  &quot;b&quot;: isboolean(false),
+  &quot;c&quot;: is_boolean(null),
+  &quot;d&quot;: is_boolean(missing),
+  &quot;e&quot;: isbool(&quot;d&quot;),
+  &quot;f&quot;: isbool(4.0),
+  &quot;g&quot;: isbool(5),
+  &quot;h&quot;: isbool([&quot;1&quot;, 2]),
+  &quot;i&quot;: isbool({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isboolean</tt>, <tt>is_bool</tt>, and <tt>isbool</tt>.</p></div>
+<div class="section">
+<h3><a name="is_number_.28is_num.29"></a>is_number (is_num)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_number(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a numeric value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_number(true),
+  &quot;b&quot;: is_number(false),
+  &quot;c&quot;: isnumber(null),
+  &quot;d&quot;: isnumber(missing),
+  &quot;e&quot;: isnumber(&quot;d&quot;),
+  &quot;f&quot;: isnum(4.0),
+  &quot;g&quot;: isnum(5),
+  &quot;h&quot;: isnum([&quot;1&quot;, 2]),
+  &quot;i&quot;: isnum({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isnumber</tt>, <tt>is_num</tt>, and <tt>isnum</tt>.</p></div>
+<div class="section">
+<h3><a name="is_object_.28is_obj.29"></a>is_object (is_obj)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_object(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>object</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>object</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_object(true),
+  &quot;b&quot;: is_object(false),
+  &quot;c&quot;: isobject(null),
+  &quot;d&quot;: isobject(missing),
+  &quot;e&quot;: isobj(&quot;d&quot;),
+  &quot;f&quot;: isobj(4.0),
+  &quot;g&quot;: isobj(5),
+  &quot;h&quot;: isobj([&quot;1&quot;, 2]),
+  &quot;i&quot;: isobj({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<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>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isobject</tt>, <tt>is_obj</tt>, and <tt>isobj</tt>.</p></div>
+<div class="section">
+<h3><a name="is_string_.28is_str.29"></a>is_string (is_str)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_string(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>string</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>string</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_string(true),
+  &quot;b&quot;: isstring(false),
+  &quot;c&quot;: isstring(null),
+  &quot;d&quot;: isstr(missing),
+  &quot;e&quot;: isstr(&quot;d&quot;),
+  &quot;f&quot;: isstr(4.0),
+  &quot;g&quot;: isstr(5),
+  &quot;h&quot;: isstr([&quot;1&quot;, 2]),
+  &quot;i&quot;: isstr({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isstring</tt>, <tt>is_str</tt>, and <tt>isstr</tt>.</p></div>
+<div class="section">
+<h3><a name="is_null"></a>is_null</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_null(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>null</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the variable is a <tt>null</tt> or not,</li>
+<li>a <tt>missing</tt> if the input is <tt>missing</tt>.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: is_null(null), &quot;v2&quot;: is_null(1), &quot;v3&quot;: is_null(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isnull</tt>.</p></div>
+<div class="section">
+<h3><a name="is_missing"></a>is_missing</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_missing(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>missing</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the variable is a <tt>missing</tt> or not.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: is_missing(null), &quot;v2&quot;: is_missing(1), &quot;v3&quot;: is_missing(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: false, &quot;v3&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ismissing</tt>.</p></div>
+<div class="section">
+<h3><a name="is_unknown"></a>is_unknown</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_unknown(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given variable is a <tt>null</tt> value or a <tt>missing</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: is_unknown(null), &quot;v2&quot;: is_unknown(1), &quot;v3&quot;: is_unknown(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: true, &quot;v2&quot;: false, &quot;v3&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isunknown</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="is_binary_.28is_bin.29"></a>is_binary (is_bin)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_binary(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>binary</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>binary</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_binary(true),
+  &quot;b&quot;: is_binary(false),
+  &quot;c&quot;: isbinary(null),
+  &quot;d&quot;: isbinary(missing),
+  &quot;e&quot;: isbin(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isbin(hex(&quot;ABCDEF0123456789&quot;)),
+  &quot;g&quot;: is_bin(sub_binary(hex(&quot;AABBCCDD&quot;), 4)),
+  &quot;h&quot;: is_bin(2),
+  &quot;i&quot;: is_bin({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isbinary</tt>, <tt>is_bin</tt>, and <tt>isbin</tt>.</p></div>
+<div class="section">
+<h3><a name="is_uuid"></a>is_uuid</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_uuid(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>uuid</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>uuid</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_uuid(true),
+  &quot;b&quot;: is_uuid(false),
+  &quot;c&quot;: is_uuid(null),
+  &quot;d&quot;: is_uuid(missing),
+  &quot;e&quot;: isuuid(4.0),
+  &quot;f&quot;: isuuid(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isuuid(uuid(&quot;5c848e5c-6b6a-498f-8452-8847a2957421&quot;))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isuuid</tt>.</p></div>
+<div class="section">
+<h3><a name="is_point"></a>is_point</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_point(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>point</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>point</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_point(true),
+  &quot;b&quot;: is_point(false),
+  &quot;c&quot;: is_point(null),
+  &quot;d&quot;: is_point(missing),
+  &quot;e&quot;: is_point(point(&quot;1,2&quot;)),
+  &quot;f&quot;: ispoint(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: ispoint(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: ispoint(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: ispoint(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: ispoint(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ispoint</tt>.</p></div>
+<div class="section">
+<h3><a name="is_line"></a>is_line</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_line(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>line</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>line</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_line(true),
+  &quot;b&quot;: is_line(false),
+  &quot;c&quot;: is_line(null),
+  &quot;d&quot;: is_line(missing),
+  &quot;e&quot;: is_line(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isline(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: isline(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: isline(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: isline(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: isline(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isline</tt>.</p></div>
+<div class="section">
+<h3><a name="is_rectangle"></a>is_rectangle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_rectangle(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>rectangle</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>rectangle</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_rectangle(true),
+  &quot;b&quot;: is_rectangle(false),
+  &quot;c&quot;: is_rectangle(null),
+  &quot;d&quot;: is_rectangle(missing),
+  &quot;e&quot;: is_rectangle(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isrectangle(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: isrectangle(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: isrectangle(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: isrectangle(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: isrectangle(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isrectangle</tt>.</p></div>
+<div class="section">
+<h3><a name="is_circle"></a>is_circle</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_circle(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>circle</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>circle</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_circle(true),
+  &quot;b&quot;: is_circle(false),
+  &quot;c&quot;: is_circle(null),
+  &quot;d&quot;: is_circle(missing),
+  &quot;e&quot;: is_circle(point(&quot;1,2&quot;)),
+  &quot;f&quot;: iscircle(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: iscircle(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: iscircle(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: iscircle(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: iscircle(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>iscircle</tt>.</p></div>
+<div class="section">
+<h3><a name="is_polygon"></a>is_polygon</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_polygon(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>polygon</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>polygon</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_polygon(true),
+  &quot;b&quot;: is_polygon(false),
+  &quot;c&quot;: is_polygon(null),
+  &quot;d&quot;: is_polygon(missing),
+  &quot;e&quot;: is_polygon(point(&quot;1,2&quot;)),
+  &quot;f&quot;: ispolygon(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: ispolygon(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: ispolygon(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: ispolygon(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: ispolygon(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ispolygon</tt>.</p></div>
+<div class="section">
+<h3><a name="is_spatial"></a>is_spatial</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_spatial(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a spatial value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_spatial(true),
+  &quot;b&quot;: is_spatial(false),
+  &quot;c&quot;: is_spatial(null),
+  &quot;d&quot;: is_spatial(missing),
+  &quot;e&quot;: is_spatial(point(&quot;1,2&quot;)),
+  &quot;f&quot;: isspatial(line(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;g&quot;: isspatial(rectangle(&quot;30.0,70.0 50.0,90.0&quot;)),
+  &quot;h&quot;: isspatial(circle(&quot;30.0,70.0 5.0&quot;)),
+  &quot;i&quot;: isspatial(polygon(&quot;1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0&quot;)),
+  &quot;j&quot;: isspatial(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isspatial</tt>.</p></div>
+<div class="section">
+<h3><a name="is_date"></a>is_date</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_date(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>date</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>date</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_date(true),
+  &quot;b&quot;: is_date(false),
+  &quot;c&quot;: is_date(null),
+  &quot;d&quot;: is_date(missing),
+  &quot;e&quot;: is_date(date(&quot;-19700101&quot;)),
+  &quot;f&quot;: isdate(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isdate(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: isdate(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: isdate(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: isdate(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: isdate(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isdate</tt>.</p></div>
+<div class="section">
+<h3><a name="is_datetime_.28is_timestamp.29"></a>is_datetime (is_timestamp)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_datetime(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>datetime</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>datetime</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: is_datetime(true),
+  &quot;b&quot;: is_datetime(false),
+  &quot;c&quot;: is_datetime(null),
+  &quot;d&quot;: is_datetime(missing),
+  &quot;e&quot;: is_datetime(datetime(&quot;2016-02-02T12:09:22.023Z&quot;)),
+  &quot;f&quot;: isdatetime(datetime(&quot;2011-03-03T12:10:42.011Z&quot;)),
+  &quot;g&quot;: isdatetime(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: is_timestamp(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: is_timestamp(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: istimestamp(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: istimestamp(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>isdatetime</tt>, <tt>is_timestamp</tt>, and <tt>istimestamp</tt>.</p></div>
+<div class="section">
+<h3><a name="is_time"></a>is_time</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_time(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>time</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>time</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_time(true),
+  &quot;b&quot;: is_time(false),
+  &quot;c&quot;: is_time(null),
+  &quot;d&quot;: is_time(missing),
+  &quot;e&quot;: is_time(time(&quot;08:00:00.000Z&quot;)),
+  &quot;f&quot;: istime(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: istime(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: istime(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: istime(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: istime(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: istime(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>istime</tt>.</p></div>
+<div class="section">
+<h3><a name="is_duration"></a>is_duration</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_duration(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a duration value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>duration/year_month_duration/day_time_duration</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_duration(true),
+  &quot;b&quot;: is_duration(false),
+  &quot;c&quot;: is_duration(null),
+  &quot;d&quot;: is_duration(missing),
+  &quot;e&quot;: is_duration(duration(&quot;-PT20.943S&quot;)),
+  &quot;f&quot;: isduration(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isduration(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: isduration(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: isduration(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: isduration(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: isduration(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isduration</tt>.</p></div>
+<div class="section">
+<h3><a name="is_interval"></a>is_interval</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_interval(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a <tt>interval</tt> value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt> on whether the argument is a <tt>interval</tt> value or not,</li>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_interval(true),
+  &quot;b&quot;: is_interval(false),
+  &quot;c&quot;: is_interval(null),
+  &quot;d&quot;: is_interval(missing),
+  &quot;e&quot;: is_interval(interval(datetime(&quot;2013-01-01T00:01:01.000Z&quot;), datetime(&quot;2013-05-05T13:39:01.049Z&quot;))),
+  &quot;f&quot;: isinterval(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: isinterval(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: isinterval(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: isinterval(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: isinterval(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: isinterval(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>isinterval</tt>.</p></div>
+<div class="section">
+<h3><a name="is_temporal"></a>is_temporal</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">is_temporal(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Checks whether the given expression is evaluated to be a temporal value.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<li>a <tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li>a <tt>null</tt> if the argument is a <tt>null</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source"> {
+  &quot;a&quot;: is_temporal(true),
+  &quot;b&quot;: is_temporal(false),
+  &quot;c&quot;: is_temporal(null),
+  &quot;d&quot;: is_temporal(missing),
+  &quot;e&quot;: is_temporal(duration(&quot;-PT20.943S&quot;)),
+  &quot;f&quot;: istemporal(date(&quot;2013-01-01&quot;)),
+  &quot;g&quot;: istemporal(time(&quot;12:12:12.039Z&quot;)),
+  &quot;h&quot;: istemporal(datetime(&quot;2013-01-01T12:12:12.039Z&quot;)),
+  &quot;i&quot;: istemporal(duration(&quot;P100Y12MT12M&quot;)),
+  &quot;j&quot;: istemporal(interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;))),
+  &quot;k&quot;: istemporal(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>istemporal</tt>.</p></div>
+<div class="section">
+<h3><a name="get_type"></a>get_type</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">get_type(expr)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;a&quot;: get_type(true),
+  &quot;b&quot;: get_type(false),
+  &quot;c&quot;: get_type(null),
+  &quot;d&quot;: get_type(missing),
+  &quot;e&quot;: get_type(&quot;d&quot;),
+  &quot;f&quot;: gettype(4.0),
+  &quot;g&quot;: gettype(5),
+  &quot;h&quot;: gettype([&quot;1&quot;, 2]),
+  &quot;i&quot;: gettype({&quot;a&quot;:1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>gettype</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h3><a name="to_array"></a>to_array</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_array(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to an <tt>array</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of <tt>array</tt> type then it is returned as is</li>
+<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>
+<li>otherwise an <tt>array</tt> containing the input expression as its single item is returned</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_array(&quot;asterix&quot;),
+  &quot;v2&quot;: to_array([&quot;asterix&quot;]),
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: [&quot;asterix&quot;], &quot;v2&quot;: [&quot;asterix&quot;] }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>toarray</tt>.</p></div>
+<div class="section">
+<h3><a name="to_atomic_.28to_atom.29"></a>to_atomic (to_atom)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_atomic(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a <a href="../datamodel.html#PrimitiveTypes">primitive</a> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of primitive type then it is returned as is</li>
+<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>
+<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>
+<li>otherwise <tt>null</tt> is returned</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_atomic(&quot;asterix&quot;),
+  &quot;v2&quot;: to_atomic([&quot;asterix&quot;]),
+  &quot;v3&quot;: to_atomic([0, 1]),
+  &quot;v4&quot;: to_atomic({&quot;value&quot;: &quot;asterix&quot;}),
+  &quot;v5&quot;: to_number({&quot;x&quot;: 1, &quot;y&quot;: 2})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>toatomic</tt>, <tt>to_atom</tt>, and <tt>toatom</tt>.</p></div>
+<div class="section">
+<h3><a name="to_boolean_.28to_bool.29"></a>to_boolean (to_bool)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_boolean(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a <tt>boolean</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of <tt>boolean</tt> type then it is returned as is</li>
+<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>
+<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>
+<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>
+<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>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_boolean(0),
+  &quot;v2&quot;: to_boolean(1),
+  &quot;v3&quot;: to_boolean(&quot;&quot;),
+  &quot;v4&quot;: to_boolean(&quot;asterix&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: true, &quot;v3&quot;: false, &quot;v4&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>toboolean</tt>, <tt>to_bool</tt>, and <tt>tobool</tt>.</p></div>
+<div class="section">
+<h3><a name="to_bigint"></a>to_bigint</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_bigint(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to an integer value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<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>
+<li>if the argument is of numeric integer type then it is returned as the same value of <tt>bigint</tt> type</li>
+<li>if the argument is of numeric <tt>float</tt>/<tt>double</tt> type then it is converted to <tt>bigint</tt> type</li>
+<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>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_bigint(false),
+  &quot;v2&quot;: to_bigint(true),
+  &quot;v3&quot;: to_bigint(10),
+  &quot;v4&quot;: to_bigint(float(&quot;1e100&quot;)),
+  &quot;v5&quot;: to_bigint(double(&quot;1e1000&quot;)),
+  &quot;v6&quot;: to_bigint(&quot;20&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>tobigint</tt>.</p></div>
+<div class="section">
+<h3><a name="to_double"></a>to_double</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_double(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a <tt>double</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<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>
+<li>if the argument is of numeric type then it is returned as the value of <tt>double</tt> type</li>
+<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>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_double(false),
+  &quot;v2&quot;: to_double(true),
+  &quot;v3&quot;: to_double(10),
+  &quot;v4&quot;: to_double(11.5),
+  &quot;v5&quot;: to_double(&quot;12.5&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>todouble</tt>.</p></div>
+<div class="section">
+<h3><a name="to_number_.28to_num.29"></a>to_number (to_num)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_number(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a numeric value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of numeric type then it is returned as is</li>
+<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>
+<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>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_number(false),
+  &quot;v2&quot;: to_number(true),
+  &quot;v3&quot;: to_number(10),
+  &quot;v4&quot;: to_number(11.5),
+  &quot;v5&quot;: to_number(&quot;12.5&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>tonumber</tt>, <tt>to_num</tt>, and <tt>tonum</tt>.</p></div>
+<div class="section">
+<h3><a name="to_object_.28to_obj.29"></a>to_object (to_obj)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_object(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to an <tt>object</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<li>if the argument is of <tt>object</tt> type then it is returned as is</li>
+<li>otherwise an empty <tt>object</tt> is returned</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_object({&quot;value&quot;: &quot;asterix&quot;}),
+  &quot;v2&quot;: to_object(&quot;asterix&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: {&quot;value&quot;: &quot;asterix&quot;}, &quot;v2&quot;: {} }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>toobject</tt>, <tt>to_obj</tt>, and <tt>toobj</tt>.</p></div>
+<div class="section">
+<h3><a name="to_string_.28to_str.29"></a>to_string (to_str)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">to_string(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Converts input value to a string value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>if the argument is <tt>missing</tt> then <tt>missing</tt> is returned</li>
+<li>if the argument is <tt>null</tt> then <tt>null</tt> is returned</li>
+<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>
+<li>if the argument is of numeric type then its string representation is returned</li>
+<li>if the argument is of <tt>string</tt> type then it is returned as is</li>
+<li>if the argument is of <tt>array</tt>/<tt>multiset</tt>/<tt>object</tt> type then <tt>null</tt> is returned</li>
+<li>type error is raised for all other input types</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: to_string(false),
+  &quot;v2&quot;: to_string(true),
+  &quot;v3&quot;: to_string(10),
+  &quot;v4&quot;: to_string(11.5),
+  &quot;v5&quot;: to_string(&quot;asterix&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has three aliases: <tt>tostring</tt>, <tt>to_str</tt>, and <tt>tostr</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Conditional_Functions"></a><a name="ConditionalFunctions" id="ConditionalFunctions">Conditional Functions</a></h2>
+<div class="section">
+<h3><a name="if_null_.28ifnull.29"></a>if_null (ifnull)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_null(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which value is not <tt>null</tt> and returns that value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>null</tt> if all arguments evaluate to <tt>null</tt> or no arguments specified</li>
+<li>a value of the first non-<tt>null</tt> argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: if_null(),
+    &quot;b&quot;: if_null(null),
+    &quot;c&quot;: if_null(null, &quot;asterixdb&quot;),
+    &quot;d&quot;: is_missing(if_null(missing))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot;, &quot;d&quot;: true }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifnull</tt>.</p></div>
+<div class="section">
+<h3><a name="if_missing_.28ifmissing.29"></a>if_missing (ifmissing)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_missing(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which value is not <tt>missing</tt> and returns that value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>null</tt> if all arguments evaluate to <tt>missing</tt> or no arguments specified</li>
+<li>a value of the first non-<tt>missing</tt> argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: if_missing(),
+    &quot;b&quot;: if_missing(missing),
+    &quot;c&quot;: if_missing(missing, &quot;asterixdb&quot;),
+    &quot;d&quot;: if_missing(null, &quot;asterixdb&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot;, &quot;d&quot;: null }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifmissing</tt>.</p></div>
+<div class="section">
+<h3><a name="if_missing_or_null_.28ifmissingornull.2C_coalesce.29"></a>if_missing_or_null (ifmissingornull, coalesce)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_missing_or_null(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which value is not <tt>null</tt> or <tt>missing</tt> and returns that value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>null</tt> if all arguments evaluate to either <tt>null</tt> or <tt>missing</tt>, or no arguments specified</li>
+<li>a value of the first non-<tt>null</tt>, non-<tt>missing</tt> argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: if_missing_or_null(),
+    &quot;b&quot;: if_missing_or_null(null, missing),
+    &quot;c&quot;: if_missing_or_null(null, missing, &quot;asterixdb&quot;)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: null, &quot;c&quot;: &quot;asterixdb&quot; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has two aliases: <tt>ifmissingornull</tt> and <tt>coalesce</tt>.</p></div>
+<div class="section">
+<h3><a name="if_inf_.28ifinf.29"></a>if_inf (ifinf)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_inf(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which is a non-infinite (<tt>INF</tt> or<tt>-INF</tt>) number</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>missing</tt> if <tt>missing</tt> argument was encountered before the first non-infinite number argument</li>
+<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>
+<li>the first non-infinite number argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: is_null(if_inf(null)),
+    &quot;b&quot;: is_missing(if_inf(missing)),
+    &quot;c&quot;: is_null(if_inf(double(&quot;INF&quot;))),
+    &quot;d&quot;: if_inf(1, null, missing) ],
+    &quot;e&quot;: is_null(if_inf(null, missing, 1)) ],
+    &quot;f&quot;: is_missing(if_inf(missing, null, 1)) ],
+    &quot;g&quot;: if_inf(float(&quot;INF&quot;), 1) ],
+    &quot;h&quot;: to_string(if_inf(float(&quot;INF&quot;), double(&quot;NaN&quot;), 1)) ]
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifinf</tt>.</p></div>
+<div class="section">
+<h3><a name="if_nan_.28ifnan.29"></a>if_nan (ifnan)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_nan(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which is a non-<tt>NaN</tt> number</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>missing</tt> if <tt>missing</tt> argument was encountered before the first non-<tt>NaN</tt> number argument</li>
+<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>
+<li>the first non-<tt>NaN</tt> number argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: is_null(if_nan(null)),
+    &quot;b&quot;: is_missing(if_nan(missing)),
+    &quot;c&quot;: is_null(if_nan(double(&quot;NaN&quot;))),
+    &quot;d&quot;: if_nan(1, null, missing) ],
+    &quot;e&quot;: is_null(if_nan(null, missing, 1)) ],
+    &quot;f&quot;: is_missing(if_nan(missing, null, 1)) ],
+    &quot;g&quot;: if_nan(float(&quot;NaN&quot;), 1) ],
+    &quot;h&quot;: to_string(if_nan(float(&quot;NaN&quot;), double(&quot;INF&quot;), 1)) ]
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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; }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifnan</tt>.</p></div>
+<div class="section">
+<h3><a name="if_nan_or_inf_.28ifnanorinf.29"></a>if_nan_or_inf (ifnanorinf)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">if_nan_or_inf(expression1, expression2, ... expressionN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Finds first argument which is a non-infinite (<tt>INF</tt> or<tt>-INF</tt>) and non-<tt>NaN</tt> number</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<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>
+<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>
+<li>the first non-infinite and non-<tt>NaN</tt> number argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: is_null(if_nan_or_inf(null)),
+    &quot;b&quot;: is_missing(if_nan_or_inf(missing)),
+    &quot;c&quot;: is_null(if_nan_or_inf(double(&quot;NaN&quot;), double(&quot;INF&quot;))),
+    &quot;d&quot;: if_nan_or_inf(1, null, missing) ],
+    &quot;e&quot;: is_null(if_nan_or_inf(null, missing, 1)) ],
+    &quot;f&quot;: is_missing(if_nan_or_inf(missing, null, 1)) ],
+    &quot;g&quot;: if_nan_or_inf(float(&quot;NaN&quot;), float(&quot;INF&quot;), 1) ],
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<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 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>ifnanorinf</tt>.</p></div>
+<div class="section">
+<h3><a name="null_if_.28nullif.29"></a>null_if (nullif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">null_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>null</tt> if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if
+<ul>
+
+<li>any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value, or</li>
+<li><tt>argument1</tt> = <tt>argument2</tt></li>
+</ul>
+</li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: null_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;),
+    &quot;b&quot;: null_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: null, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>nullif</tt>.</p></div>
+<div class="section">
+<h3><a name="missing_if_.28missingif.29"></a>missing_if (missingif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">missing_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>missing</tt> if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if
+<ul>
+
+<li>any argument is a <tt>missing</tt> value, or</li>
+<li>no argument is a <tt>null</tt> value and <tt>argument1</tt> = <tt>argument2</tt></li>
+</ul>
+</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: missing_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)
+    &quot;b&quot;: missing_if(1, 2),
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>missingif</tt>.</p></div>
+<div class="section">
+<h3><a name="nan_if_.28nanif.29"></a>nan_if (nanif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">nan_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>NaN</tt> value if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li><tt>NaN</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: to_string(nan_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
+    &quot;b&quot;: nan_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: &quot;NaN&quot;, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>nanif</tt>.</p></div>
+<div class="section">
+<h3><a name="posinf_if_.28posinfif.29"></a>posinf_if (posinfif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">posinf_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>+INF</tt> value if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li><tt>+INF</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: to_string(posinf_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
+    &quot;b&quot;: posinf_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: &quot;+INF&quot;, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>posinfif</tt>.</p></div>
+<div class="section">
+<h3><a name="neginf_if_.28neginfif.29"></a>neginf_if (neginfif)</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">neginf_if(expression1, expression2)
+</pre></div></div>
+</li>
+<li>
+
+<p>Compares two arguments and returns <tt>-INF</tt> value if they are equal, otherwise returns the first argument.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expressionI</tt> : an expression (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value</li>
+<li><tt>-INF</tt> value of type <tt>double</tt> if <tt>argument1</tt> = <tt>argument2</tt></li>
+<li>a value of the first argument otherwise</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+    &quot;a&quot;: to_string(neginf_if(&quot;asterixdb&quot;, &quot;asterixdb&quot;)),
+    &quot;b&quot;: neginf_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;a&quot;: &quot;-INF&quot;, &quot;b&quot;: 1 }
+</pre></div></div>
+</li>
+</ul>
+<p>The function has an alias <tt>neginfif</tt>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Miscellaneous_Functions"></a><a name="MiscFunctions" id="MiscFunctions">Miscellaneous Functions</a></h2>
+<div class="section">
+<h3><a name="uuid"></a>uuid</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">uuid()
+</pre></div></div>
+</li>
+<li>
+
+<p>Generates a <tt>uuid</tt>.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li>none</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a generated, random <tt>uuid</tt>.</li>
+</ul>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="len"></a>len</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+<p>len(array)</p>
+</li>
+<li>
+
+<p>Returns the length of the array array.</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>integer</tt> that represents the length of input array or the size of the input multiset,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">len([&quot;Hello&quot;, &quot;World&quot;])
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">2
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="not"></a>not</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">not(expr)
+</pre></div></div>
+</li>
+<li>
+
+<p>Inverts a <tt>boolean</tt> value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr</tt> : an expression</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>boolean</tt>, the inverse of <tt>expr</tt>,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value,</li>
+<li>other non-boolean argument value will cause a type error.</li>
+</ul>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: `not`(true), &quot;v2&quot;: `not`(false), &quot;v3&quot;: `not`(null), &quot;v4&quot;: `not`(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;v1&quot;: false, &quot;v2&quot;: true, &quot;v3&quot;: null }
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="random"></a>random</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">random( [seed_value] )
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a random number, accepting an optional seed value</p>
+</li>
+<li>Arguments:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>A random number of type <tt>double</tt> between 0 and 1,</li>
+<li><tt>missing</tt> if the argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if the argument is a <tt>null</tt> value or a non-numeric value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;v1&quot;: random(),
+  &quot;v2&quot;: random(unix_time_from_datetime_in_ms(current_datetime()))
+};
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="range"></a>range</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">range(start_numeric_value, end_numeric_value)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:</li>
+<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>
+<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>
+<li>Return Value:
+<ul>
+
+<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>
+</ul>
+</li>
+<li>Example:
+
+<div>
+<div>
+<pre class="source">range(0, 3);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ 0, 1, 2, 3 ]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="switch_case"></a>switch_case</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">switch_case(
+    condition,
+    case1, case1_result,
+    case2, case2_result,
+    ...,
+    default, default_result
+)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>condition</tt>: a variable (any type is allowed).</li>
+<li><tt>caseI/default</tt>: a variable (any type is allowed).</li>
+<li><tt>caseI/default_result</tt>: a variable (any type is allowed).</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>caseI_result</tt> if <tt>condition</tt> matches <tt>caseI</tt>, otherwise <tt>default_result</tt>.</li>
+</ul>
+</li>
+<li>Example 1:
+
+<div>
+<div>
+<pre class="source">switch_case(
+    &quot;a&quot;,
+    &quot;a&quot;, 0,
+    &quot;x&quot;, 1,
+    &quot;y&quot;, 2,
+    &quot;z&quot;, 3
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">0
+</pre></div></div>
+</li>
+<li>
+
+<p>Example 2:</p>
+
+<div>
+<div>
+<pre class="source">switch_case(
+    &quot;a&quot;,
+    &quot;x&quot;, 1,
+    &quot;y&quot;, 2,
+    &quot;z&quot;, 3
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">3
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="deep_equal"></a>deep_equal</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">deep_equal(expr1, expr2)
+</pre></div></div>
+</li>
+<li>
+
+<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>
+</li>
+<li>Arguments:
+<ul>
+
+<li><tt>expr1</tt> : an expression,</li>
+<li><tt>expr2</tt> : an expression.</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li><tt>true</tt> or <tt>false</tt> depending on the data equality,</li>
+<li><tt>missing</tt> if any argument is a <tt>missing</tt> value,</li>
+<li><tt>null</tt> if any argument is a <tt>null</tt> value but no argument is a <tt>missing</tt> value.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">deep_equal(
+           {
+             &quot;id&quot;:1,
+             &quot;project&quot;:&quot;AsterixDB&quot;,
+             &quot;address&quot;:{&quot;city&quot;:&quot;Irvine&quot;, &quot;state&quot;:&quot;CA&quot;},
+             &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+           },
+           {
+             &quot;id&quot;:1,
+             &quot;project&quot;:&quot;AsterixDB&quot;,
+             &quot;address&quot;:{&quot;city&quot;:&quot;San Diego&quot;, &quot;state&quot;:&quot;CA&quot;},
+             &quot;related&quot;:[&quot;Hivestrix&quot;, &quot;Preglix&quot;, &quot;Apache VXQuery&quot;]
+           }
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">false
+</pre></div></div>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Bitwise_Functions"></a><a name="BitwiseFunctions" id="BitwiseFunctions">Bitwise Functions</a></h2>
+<p>All Bit/Binary functions can only operate on 64-bit signed integers.</p>
+<p><b>Note:</b> All non-integer numbers and other data types result in null.</p>
+<p><b>Note:</b> The query language uses two&#x2019;s complement representation.</p>
+<p>When looking at the value in binary form, bit 1 is the Least Significant Bit (LSB) and bit 32 is the Most Significant Bit (MSB).</p>
+<p>(MSB) Bit 32 &#x2192; <tt>0000 0000 0000 0000 0000 0000 0000 0000</tt> &#x2190; Bit 1 (LSB)</p>
+<div class="section">
+<h3><a name="bitand"></a>bitand</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITAND(int_value1, int_value2, ... , int_valueN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the result of a bitwise AND operation performed on all input integer values.</p>
+<p>The bitwise AND operation compares each bit of <tt>int_value1</tt> to the corresponding bit of every other <tt>int_value</tt>. If all bits are 1, then the corresponding result bit is set to 1; otherwise it is set to 0 (zero).</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>int_valueI</tt>: Integers, or any valid expressions which evaluate to integers, that are used to compare.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the bitwise AND between all of the input integers.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Compare 3 (0011 in binary) and 6 (0110 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: BITAND(3,6) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: 2 }
+</pre></div></div>
+
+<p>This results in 2 (0010 in binary) because only bit 2 is set in both 3 (00<b>1</b>1) and 6 (01<b>1</b>0).</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>Compare 4.5 and 3 (0011 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: BITAND(4.5,3) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: null }
+</pre></div></div>
+
+<p>The result is null because 4.5 is not an integer.</p>
+</li>
+<li>
+
+<p>Example 3:</p>
+<p>Compare 4.0 (0100 in binary) and 3 (0011 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: BITAND(4.0,3) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: 0 }
+</pre></div></div>
+
+<p>This results in 0 (zero) because 4.0 (0100) and 3 (0011) do not share any bits that are both 1.</p>
+</li>
+<li>
+
+<p>Example 4:</p>
+<p>Compare 3 (0011 in binary) and 6 (0110 in binary) and 15 (1111 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: BITAND(3,6,15) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitAND&quot;: 2 }
+</pre></div></div>
+
+<p>This results in 2 (0010 in binary) because only the 2nd bit from the right is 1 in all three numbers.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="bitclear"></a>bitclear</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITCLEAR(int_value, positions)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the result after clearing the specified bit, or array of bits in <tt>int_value</tt> using the given <tt>positions</tt>.</p>
+<p><b>Note:</b> Specifying a negative or zero bit position makes the function return a null.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>int_value</tt>: An integer, or any valid expression which evaluates to an integer, that contains the target bit or bits to clear.</p>
+</li>
+<li>
+
+<p><tt>positions</tt>: An integer or an array of integers specifying the position or positions to be cleared.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the result after clearing the bit or bits specified.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Clear bit 1 from 6 (0110 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitCLEAR&quot;: BITCLEAR(6,1) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitCLEAR&quot;: 6 }
+</pre></div></div>
+
+<p>This results in 6 (011<b>0</b> in binary) because bit 1 was already zero.</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>Clear bits 1 and 2 from 6 (01<b>10</b> in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitCLEAR&quot;: BITCLEAR(6,[1,2]) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitCLEAR&quot;: 4 }
+</pre></div></div>
+
+<p>This results in 4 (01<b>0</b>0 in binary) because bit 2 changed to zero.</p>
+</li>
+<li>
+
+<p>Example 3:</p>
+<p>Clear bits 1, 2, 4, and 5 from 31 (0<b>11</b>1<b>11</b> in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitCLEAR&quot;: BITCLEAR(31,[1,2,4,5]) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitCLEAR&quot;: 4 }
+</pre></div></div>
+
+<p>This results in 4 (0<b>00</b>1<b>00</b>) because bits 1, 2, 4, and 5 changed to zero.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="bitnot"></a>bitnot</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITNOT(int_value)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the results of a bitwise logical NOT operation performed on an integer value.</p>
+<p>The bitwise logical NOT operation reverses the bits in the value. For each value bit that is 1, the corresponding result bit will be set to 0 (zero); and for each value bit that is 0 (zero), the corresponding result bit will be set to 1.</p>
+<p><b>Note:</b> All bits of the integer will be altered by this operation.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>int_value</tt>: An integer, or any valid expression which evaluates to an integer, that contains the target bits to reverse.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the result after performing the logical NOT operation.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Perform the NOT operation on 3 (0000 0000 0000 0000 0000 0000 0000 0011 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitNOT&quot;: BITNOT(3) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitNOT&quot;: -4 }
+</pre></div></div>
+
+<p>This results in -4 (<b>1111 1111 1111 1111 1111 1111 1111 1100</b> in binary) because all bits changed.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="bitor"></a>bitor</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITOR(int_value1, int_value2, ... , int_valueN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the result of a bitwise inclusive OR operation performed on all input integer values.</p>
+<p>The bitwise inclusive OR operation compares each bit of <tt>int_value1</tt> to the corresponding bit of every other <tt>int_value</tt>. If any bit is 1, the corresponding result bit is set to 1; otherwise, it is set to 0 (zero).</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>int_valueI</tt>: Integers, or any valid expressions which evaluate to integers, that are used to compare.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the bitwise OR between all of the input integers.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Perform OR on 3 (0011 in binary) and 6 (0110 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitOR&quot;: BITOR(3,6) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitOR&quot;: 7 }
+</pre></div></div>
+
+<p>This results in 7 (0<b>111</b> in binary) because at least 1 bit of each (00<b>11</b> and 0<b>11</b>0) is 1 in bits 1, 2, and 3.</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>Perform OR on 3 (0011 in binary) and -4 (1000 0000 0000 &#x2026; 0000 1100 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitOR&quot;: BITOR(3,-4) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitOR&quot;: -1 }
+</pre></div></div>
+
+<p>This results in -1 (<b>1111 1111 1111 &#x2026; 1111 1111</b> in binary) because the two 1 bits in 3 fill in the two 0 bits in -4 to turn on all the bits.</p>
+</li>
+<li>
+
+<p>Example 3:</p>
+<p>Perform OR on 3 (0011 in binary) and 6 (0110 in binary) and 15 (1111 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitOR&quot;: BITOR(3,6,15) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitOR&quot;: 15 }
+</pre></div></div>
+
+<p>This results in 15 (1111 in binary) because there is at least one 1 in each of the four rightmost bits.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="bitset"></a>bitset</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITSET(int_value, positions)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the result after setting the specified bit <tt>position</tt>, or array of bit positions, to 1 in the given <tt>int_value</tt>.</p>
+<p><b>Note:</b> Specifying a negative or zero position makes the function return a null.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>int_value</tt>: An integer, or any valid expression which evaluates to an integer, that contains the target bit or bits to set.</p>
+</li>
+<li>
+
+<p><tt>positions</tt>: An integer or an array of integers specifying the position or positions to be set.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the result after setting the bit or bits specified. If the bit is already set, then it stays set.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Set bit 1 in the value 6 (011<b>0</b> in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSET&quot;: BITSET(6,1) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSET&quot;: 7 }
+</pre></div></div>
+
+<p>This results in 7 (011<b>1</b> in binary) because bit 1 changed to 1.</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>Set bits 1 and 2 in the value 6 (01<b>10</b> in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSET&quot;: BITSET(6,[1,2]) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSET&quot;: 7 }
+</pre></div></div>
+
+<p>This also results in 7 (01<b>11</b> in binary) because bit 1 changed while bit 2 remained the same.</p>
+</li>
+<li>
+
+<p>Example 3:</p>
+<p>Set bits 1 and 4 in the value 6 (<b>0</b>11<b>0</b> in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSET&quot;: BITSET(6,[1,4]) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSET&quot;: 15 }
+</pre></div></div>
+
+<p>This results in 15 (<b>1</b>11<b>1</b> in binary) because bit 1 and 4 changed to ones.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="bitshift"></a>bitshift</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITSHIFT(int_value, shift_amount[, rotate])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the result of a bit shift operation performed on the integer value <tt>int_value</tt>. The <tt>shift_amount</tt> supports left and right shifts. These are logical shifts. The third parameter <tt>rotate</tt> supports circular shift. This is similar to the BitROTATE function in Oracle.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>int_value</tt>: An integer, or any valid expression which evaluates to an integer, that contains the target bit or bits to shift.</p>
+</li>
+<li>
+
+<p><tt>shift_amount</tt>: An integer, or any valid expression which evaluates to an integer, that contains the number of bits to shift.</p>
+<ul>
+
+<li>
+
+<p>A positive (+) number means this is a LEFT shift.</p>
+</li>
+<li>
+
+<p>A negative (-) number means this is a RIGHT shift.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p><tt>rotate</tt>: (Optional) A boolean, or any valid expression which evaluates to a boolean, where:</p>
+<ul>
+
+<li>
+
+<p>FALSE means this is a LOGICAL shift, where bits shifted off the end of a value are considered lost.</p>
+</li>
+<li>
+
+<p>TRUE means this is a CIRCULAR shift (shift-and-rotate operation), where bits shifted off the end of a value are rotated back onto the value at the <i>other</i> end. In other words, the bits rotate in what might be thought of as a circular pattern; therefore, these bits are not lost.</p>
+</li>
+</ul>
+<p>If omitted, the default is FALSE.</p>
+</li>
+</ul>
+<p>For comparison, see the below table.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Input </th>
+<th> Shift </th>
+<th> Result of Logical Shift (Rotate FALSE) </th>
+<th> Result of Circular Shift (Rotate TRUE) </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> 6 (0000 0110)     </td>
+<td> 4     </td>
+<td> 96 (0110 0000)    </td>
+<td> 96 (0110 0000)                                 </td></tr>
+<tr class="a">
+<td> 6 (0000 0110)     </td>
+<td> 3     </td>
+<td> 48 (0011 0000)    </td>
+<td> 48 (0011 0000)                                 </td></tr>
+<tr class="b">
+<td> 6 (0000 0110)     </td>
+<td> 2     </td>
+<td> 24 (0001 1000)    </td>
+<td> 24 (0001 1000)                                 </td></tr>
+<tr class="a">
+<td> 6 (0000 0110)     </td>
+<td> 1     </td>
+<td> 12 (0000 1100)    </td>
+<td> 12 (0000 1100)                                 </td></tr>
+<tr class="b">
+<td> <b>6 (0000 0110)</b> </td>
+<td> <b>0</b> </td>
+<td> <b>6 (0000 0110)</b> </td>
+<td> <b>6 (0000 0110)</b>                              </td></tr>
+<tr class="a">
+<td> 6 (0000 0110)     </td>
+<td> -1    </td>
+<td> 3 (0000 0011)     </td>
+<td> 3 (0000 0011)                                  </td></tr>
+<tr class="b">
+<td> 6 (0000 0110)     </td>
+<td> -2    </td>
+<td> 1 (0000 0001)     </td>
+<td> -9223372036854775807 (1000 0000 &#x2026; 0000 0001) </td></tr>
+<tr class="a">
+<td> 6 (0000 0110)     </td>
+<td> -3    </td>
+<td> 0 (0000 0000)     </td>
+<td> -4611686018427387904 (1100 0000 &#x2026; 0000 0000) </td></tr>
+<tr class="b">
+<td> 6 (0000 0110)     </td>
+<td> -4    </td>
+<td> 0 (0000 0000)     </td>
+<td> 6917529027641081856 (0110 0000 &#x2026; 0000 0000)  </td></tr>
+</tbody>
+</table>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the result of either a logical or circular shift of the given integer.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Logical left shift of the number 6 (0110 in binary) by one bit.</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: BITSHIFT(6,1,FALSE) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: 12 }
+</pre></div></div>
+
+<p>This results in 12 (1100 in binary) because the 1-bits moved from positions 2 and 3 to positions 3 and 4.</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>Logical right shift of the number 6 (0110 in binary) by two bits.</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: BITSHIFT(6,-2) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: 1 }
+</pre></div></div>
+
+<p>This results in 1 (0001 in binary) because the 1-bit in position 3 moved to position 1 and the 1-bit in position 2 was dropped.</p>
+</li>
+<li>
+
+<p>Example 2b:</p>
+<p>Circular right shift of the number 6 (0110 in binary) by two bits.</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: BITSHIFT(6,-2,TRUE) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: -9223372036854775807 }
+</pre></div></div>
+
+<p>This results in -9223372036854775807 (1100 0000 0000 0000 0000 0000 0000 0000 in binary) because the two 1-bits wrapped right, around to the Most Significant Digit position and changed the integer&#x2019;s sign to negative.</p>
+</li>
+<li>
+
+<p>Example 3:</p>
+<p>Circular left shift of the number 524288 (1000 0000 0000 0000 0000 in binary) by 45 bits.</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: BITSHIFT(524288,45,TRUE) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitSHIFT&quot;: 1 }
+</pre></div></div>
+
+<p>This results in 1 because the 1-bit wrapped left, around to the Least Significant Digit position.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="bittest"></a>bittest</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITTEST(int_value, positions [, all_set])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns TRUE if the specified bit, or bits, is a 1; otherwise, returns FALSE if the specified bit, or bits, is a 0 (zero).</p>
+<p><b>Note:</b> Specifying a negative or zero bit position will result in null being returned.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>int_value</tt>: An integer, or any valid expression which evaluates to an integer, that contains the target bit or bits to test.</p>
+</li>
+<li>
+
+<p><tt>positions</tt>: An integer or an array of integers specifying the position or positions to be tested.</p>
+</li>
+<li>
+
+<p><tt>all_set</tt>: (Optional) A boolean, or any valid expression which evaluates to a boolean.</p>
+<ul>
+
+<li>
+
+<p>When <tt>all_set</tt> is FALSE, then it returns TRUE even if one bit in one of the positions is set.</p>
+</li>
+<li>
+
+<p>When <tt>all_set</tt> is TRUE, then it returns TRUE only if all input positions are set.</p>
+</li>
+</ul>
+<p>If omitted, the default is FALSE.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>A boolean, that follows the below table:
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> <tt>int_value</tt>                    </th>
+<th> <tt>all_set</tt> </th>
+<th> Return Value </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> <i>all</i> specified bits are TRUE  </td>
+<td> FALSE     </td>
+<td> TRUE         </td></tr>
+<tr class="a">
+<td> <i>all</i> specified bits are TRUE  </td>
+<td> TRUE      </td>
+<td> TRUE         </td></tr>
+<tr class="b">
+<td> <i>some</i> specified bits are TRUE </td>
+<td> FALSE     </td>
+<td> TRUE         </td></tr>
+<tr class="a">
+<td> <i>some</i> specified bits are TRUE </td>
+<td> TRUE      </td>
+<td> FALSE        </td></tr>
+</tbody>
+</table>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>In the number 6 (0110 in binary), is bit 1 set?</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;IsBitSET&quot;: ISBITSET(6,1) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;IsBitSET&quot;: false }
+</pre></div></div>
+
+<p>This returns FALSE because bit 1 of 6 (011<b>0</b> in binary) is not set to 1.</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>In the number 1, is either bit 1 or bit 2 set?</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitTEST&quot;: BITTEST(1,[1,2],FALSE) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitTEST&quot;: true }
+</pre></div></div>
+
+<p>This returns TRUE because bit 1 of the number 1 (000<b>1</b> in binary) is set to 1.</p>
+</li>
+<li>
+
+<p>Example 3:</p>
+<p>In the number 6 (0110 in binary), are both bits 2 and 3 set?</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;IsBitSET&quot;: ISBITSET(6,[2,3],TRUE) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;IsBitSET&quot;: true }
+</pre></div></div>
+
+<p>This returns TRUE because both bits 2 and 3 in the number 6 (0<b>11</b>0 in binary) are set to 1.</p>
+</li>
+<li>
+
+<p>Example 4:</p>
+<p>In the number 6 (0110 in binary), are all the bits in positions 1 through 3 set?</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitTEST&quot;: BITTEST(6,[1,3],TRUE) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitTEST&quot;: false }
+</pre></div></div>
+
+<p>This returns FALSE because bit 1 in the number 6 (011<b>0</b> in binary) is set to 0 (zero).</p>
+</li>
+</ul>
+<p>The function has an alias <tt>isbitset</tt>.</p></div>
+<div class="section">
+<h3><a name="bitxor"></a>bitxor</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">BITXOR(int_value1, int_value2, ... , int_valueN)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the result of a bitwise Exclusive OR operation performed on two or more integer values.</p>
+<p>The bitwise Exclusive OR operation compares each bit of <tt>int_value1</tt> to the corresponding bit of <tt>int_value2</tt>.</p>
+<p>If there are more than two input values, the first two are compared; then their result is compared to the next input value; and so on.</p>
+<p>When the compared bits do not match, the result bit is 1; otherwise, the compared bits do match, and the result bit is 0 (zero), as summarized:</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Bit 1 </th>
+<th> Bit 2 </th>
+<th> XOR Result Bit </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> 0     </td>
+<td> 0     </td>
+<td> 0              </td></tr>
+<tr class="a">
+<td> 0     </td>
+<td> 1     </td>
+<td> 1              </td></tr>
+<tr class="b">
+<td> 1     </td>
+<td> 0     </td>
+<td> 1              </td></tr>
+<tr class="a">
+<td> 1     </td>
+<td> 1     </td>
+<td> 0              </td></tr>
+</tbody>
+</table>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>int_valueI</tt>: Integers, or any valid expressions which evaluate to integers, that are used to compare.</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, representing the bitwise XOR between the input integers.</li>
+</ul>
+</li>
+<li>
+
+<p>Limitations:</p>
+<ul>
+
+<li>Input values must be integers (such as 1 or 1.0) and cannot contain decimals (such as 1.2).</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>Perform the XOR operation on 3 (0011 in binary) and 6 (0110 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitXOR&quot;: BITXOR(3,6) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitXOR&quot;: 5 }
+</pre></div></div>
+
+<p>This returns 5 (0101 in binary) because the 1st bit pair and 3rd bit pair are different (resulting in 1) while the 2nd bit pair and 4th bit pair are the same (resulting in 0):</p>
+
+<div>
+<div>
+<pre class="source">0011 (3)
+0110 (6)
+====
+0101 (5)
+</pre></div></div>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>Perform the XOR operation on 3 (0011 in binary) and 6 (0110 in binary) and 15 (1111 in binary).</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitXOR&quot;: BITXOR(3,6,15) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;BitXOR&quot;: 10 }
+</pre></div></div>
+
+<p>This returns 10 (1010 in binary) because 3 XOR 6 equals 5 (0101 in binary), and then 5 XOR 15 equals 10 (1010 in binary).</p>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div>
+<div class="section">
+<h2><a name="Window_Functions"></a><a name="WindowFunctions" id="WindowFunctions">Window Functions</a></h2>
+<p>Window functions are used to compute an aggregate or cumulative value, based on a portion of the tuples selected by a query. For each input tuple, a movable window of tuples is defined. The window determines the tuples to be used by the window function.</p>
+<p>The tuples are not grouped into a single output tuple &#x2014; each tuple remains separate in the query output.</p>
+<p>All window functions must be used with an OVER clause. Refer to <a href="manual.html#Over_clauses">Window Queries</a> for details.</p>
+<p>Window functions cannot appear in the FROM clause clause or LIMIT clause.</p>
+<div class="section">
+<h3><a name="cume_dist"></a>cume_dist</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">CUME_DIST() OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the percentile rank of the current tuple as part of the cumulative distribution &#x2013; that is, the number of tuples ranked lower than or equal to the current tuple, including the current tuple, divided by the total number of tuples in the window partition.</p>
+<p>The window order clause determines the sort order of the tuples. If the window order clause is omitted, the function returns the same result (1.0) for each tuple.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>None.</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>A number greater than 0 and less than or equal to 1. The higher the value, the higher the ranking.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each customer, find the cumulative distribution of all orders by order number.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+SELECT o.custid, o.orderno, CUME_DIST() OVER (
+  PARTITION BY o.custid
+  ORDER BY o.orderno
+) AS `rank`
+ORDER BY o.custid, o.orderno;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;rank&quot;: 0.25,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002
+  },
+  {
+    &quot;rank&quot;: 0.5,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007
+  },
+  {
+    &quot;rank&quot;: 0.75,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005
+  },
+  {
+    &quot;rank&quot;: 0.5,
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="dense_rank"></a>dense_rank</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">DENSE_RANK() OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the dense rank of the current tuple &#x2013; that is, the number of distinct tuples preceding this tuple in the current window partition, plus one.</p>
+<p>The tuples are ordered by the window order clause. If any tuples are tied, they will have the same rank. If the window order clause is omitted, the function returns the same result (1) for each tuple.</p>
+<p>For this function, when any tuples have the same rank, the rank of the next tuple will be consecutive, so there will not be a gap in the sequence of returned values. For example, if there are five tuples ranked 3, the next dense rank is 4.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>None.</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, greater than or equal to 1.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>Find the dense rank of all orders by number of items.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+SELECT o.orderno, LEN(o.items) AS items,
+DENSE_RANK() OVER (
+  ORDER BY LEN(o.items)
+) AS `rank`
+ORDER BY `rank`, o.orderno;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;items&quot;: 0,
+    &quot;rank&quot;: 1,
+    &quot;orderno&quot;: 1009
+  },
+  {
+    &quot;items&quot;: 1,
+    &quot;rank&quot;: 2,
+    &quot;orderno&quot;: 1008
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1001
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1002
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1003
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1004
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1007
+  },
+  {
+    &quot;items&quot;: 3,
+    &quot;rank&quot;: 4,
+    &quot;orderno&quot;: 1006
+  },
+  {
+    &quot;items&quot;: 4,
+    &quot;rank&quot;: 5,
+    &quot;orderno&quot;: 1005
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="first_value"></a>first_value</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">FIRST_VALUE(expr) [nulls-modifier] OVER (window-definition)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the requested value from the first tuple in the current window frame, where the window frame is specified by the window definition.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expr</tt>: The value that you want to return from the first tuple in the window frame. <sup>[</sup><a href="#fn_1"><sup>1</sup></a><sup>]</sup></li>
+</ul>
+</li>
+<li>
+
+<p>Modifiers:</p>
+<ul>
+
+<li><a href="manual.html#Window_function_options">NULLS Modifier</a>: (Optional) Determines how NULL or MISSING values are treated when finding the first value in the window frame.
+<ul>
+
+<li>
+
+<p><tt>IGNORE NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are ignored when finding the first tuple. In this case, the function returns the first non-NULL, non-MISSING value.</p>
+</li>
+<li>
+
+<p><tt>RESPECT NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are included when finding the first tuple.</p>
+</li>
+</ul>
+<p>If this modifier is omitted, the default is <tt>RESPECT NULLS</tt>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_frame_clause">Window Frame Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>
+
+<p>The specified value from the first tuple. The order of the tuples is determined by the window order clause.</p>
+</li>
+<li>
+
+<p>NULL, if the frame was empty or if all values were NULL or MISSING and the <tt>IGNORE NULLS</tt> modifier was specified.</p>
+</li>
+<li>
+
+<p>In the following cases, this function may return unpredictable results.</p>
+<ul>
+
+<li>
+
+<p>If the window order clause is omitted.</p>
+</li>
+<li>
+
+<p>If the window frame is defined by <tt>ROWS</tt>, and there are tied tuples in the window frame.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>To make the function return deterministic results, add a window order clause, or add further ordering terms to the window order clause so that no tuples are tied.</p>
+</li>
+<li>
+
+<p>If the window frame is defined by <tt>RANGE</tt> or <tt>GROUPS</tt>, and there are tied tuples in the window frame, the function returns the first value of the input expression.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each order, show the customer and the value, including the value of the smallest order from that customer.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno, revenue,
+FIRST_VALUE(revenue) OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+) AS smallest_order;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null,
+    &quot;smallest_order&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45,
+    &quot;smallest_order&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8,
+    &quot;smallest_order&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55,
+    &quot;smallest_order&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95,
+    &quot;smallest_order&quot;: 477.95
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94,
+    &quot;smallest_order&quot;: 199.94
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92,
+    &quot;smallest_order&quot;: 4639.92
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73,
+    &quot;smallest_order&quot;: 157.73
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58,
+    &quot;smallest_order&quot;: 157.73
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="lag"></a>lag</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">LAG(expr[, offset[, default]]) [nulls-modifier] OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the value from a tuple at a given offset prior to the current tuple position.</p>
+<p>The window order clause determines the sort order of the tuples. If the window order clause is omitted, the return values may be unpredictable.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>expr</tt>: The value that you want to return from the offset tuple. <sup>[</sup><a href="#fn_1"><sup>1</sup></a><sup>]</sup></p>
+</li>
+<li>
+
+<p><tt>offset</tt>: (Optional) A positive integer. If omitted, the default is 1.</p>
+</li>
+<li>
+
+<p><tt>default</tt>: (Optional) The value to return when the offset goes out of partition scope. If omitted, the default is NULL.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Modifiers:</p>
+<ul>
+
+<li><a href="manual.html#Window_function_options">NULLS Modifier</a>: (Optional) Determines how NULL or MISSING values are treated when finding the offset tuple in the window partition.
+<ul>
+
+<li>
+
+<p><tt>IGNORE NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are ignored when finding the offset tuple.</p>
+</li>
+<li>
+
+<p><tt>RESPECT NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are included when finding the offset tuple.</p>
+</li>
+</ul>
+<p>If this modifier is omitted, the default is <tt>RESPECT NULLS</tt>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>
+
+<p>The specified value from the offset tuple.</p>
+</li>
+<li>
+
+<p>If the offset tuple is out of partition scope, it returns the default value, or NULL if no default is specified.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each order, show the customer and the value, including the value of the next-smallest order from that customer.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno, revenue,
+LAG(revenue, 1, &quot;No smaller order&quot;) OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+) AS next_smallest_order;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null,
+    &quot;next_smallest_order&quot;: &quot;No smaller order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45,
+    &quot;next_smallest_order&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8,
+    &quot;next_smallest_order&quot;: 130.45
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55,
+    &quot;next_smallest_order&quot;: 1999.8
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95,
+    &quot;next_smallest_order&quot;: &quot;No smaller order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94,
+    &quot;next_smallest_order&quot;: &quot;No smaller order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92,
+    &quot;next_smallest_order&quot;: &quot;No smaller order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73,
+    &quot;next_smallest_order&quot;: &quot;No smaller order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58,
+    &quot;next_smallest_order&quot;: 157.73
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="last_value"></a>last_value</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">LAST_VALUE(expr) [nulls-modifier] OVER (window-definition)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the requested value from the last tuple in the current window frame, where the window frame is specified by the window definition.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expr</tt>: The value that you want to return from the last tuple in the window frame. <sup>[</sup><a href="#fn_1"><sup>1</sup></a><sup>]</sup></li>
+</ul>
+</li>
+<li>
+
+<p>Modifiers:</p>
+<ul>
+
+<li><a href="manual.html#Window_function_options">NULLS Modifier</a>: (Optional) Determines how NULL or MISSING values are treated when finding the last tuple in the window frame.
+<ul>
+
+<li>
+
+<p><tt>IGNORE NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are ignored when finding the last tuple. In this case, the function returns the last non-NULL, non-MISSING value.</p>
+</li>
+<li>
+
+<p><tt>RESPECT NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are included when finding the last tuple.</p>
+</li>
+</ul>
+<p>If this modifier is omitted, the default is <tt>RESPECT NULLS</tt>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_frame_clause">Window Frame Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>
+
+<p>The specified value from the last tuple. The order of the tuples is determined by the window order clause.</p>
+</li>
+<li>
+
+<p>NULL, if the frame was empty or if all values were NULL or MISSING and the <tt>IGNORE NULLS</tt> modifier was specified.</p>
+</li>
+<li>
+
+<p>In the following cases, this function may return unpredictable results.</p>
+<ul>
+
+<li>
+
+<p>If the window order clause is omitted.</p>
+</li>
+<li>
+
+<p>If the window frame clause is omitted.</p>
+</li>
+<li>
+
+<p>If the window frame is defined by <tt>ROWS</tt>, and there are tied tuples in the window frame.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>To make the function return deterministic results, add a window order clause, or add further ordering terms to the window order clause so that no tuples are tied.</p>
+</li>
+<li>
+
+<p>If the window frame is defined by <tt>RANGE</tt> or <tt>GROUPS</tt>, and there are tied tuples in the window frame, the function returns the last value of the input expression.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each order, show the customer and the value, including the value of the largest order from that customer.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno, revenue,
+LAST_VALUE(revenue) OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+  ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING -- &#x278a;
+) AS largest_order;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null,
+    &quot;largest_order&quot;: 10906.55
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45,
+    &quot;largest_order&quot;: 10906.55
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8,
+    &quot;largest_order&quot;: 10906.55
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55,
+    &quot;largest_order&quot;: 10906.55
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95,
+    &quot;largest_order&quot;: 477.95
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94,
+    &quot;largest_order&quot;: 199.94
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92,
+    &quot;largest_order&quot;: 4639.92
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73,
+    &quot;largest_order&quot;: 18847.58
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58,
+    &quot;largest_order&quot;: 18847.58
+  }
+]
+</pre></div></div>
+
+<p>&#x2780; This clause specifies that the window frame should extend to the end of the window partition. Without this clause, the end point of the window frame would always be the current tuple. This would mean that the largest order would always be the same as the current order.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="lead"></a>lead</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">LEAD(expr[, offset[, default]]) [nulls-modifier] OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the value from a tuple at a given offset ahead of the current tuple position.</p>
+<p>The window order clause determines the sort order of the tuples. If the window order clause is omitted, the return values may be unpredictable.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>expr</tt>: The value that you want to return from the offset tuple. <sup>[</sup><a href="#fn_1"><sup>1</sup></a><sup>]</sup></p>
+</li>
+<li>
+
+<p><tt>offset</tt>: (Optional) A positive integer. If omitted, the default is 1.</p>
+</li>
+<li>
+
+<p><tt>default</tt>: (Optional) The value to return when the offset goes out of window partition scope. If omitted, the default is NULL.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Modifiers:</p>
+<ul>
+
+<li><a href="manual.html#Window_function_options">NULLS Modifier</a>: (Optional) Determines how NULL or MISSING values are treated when finding the offset tuple in the window partition.
+<ul>
+
+<li>
+
+<p><tt>IGNORE NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are ignored when finding the offset tuple.</p>
+</li>
+<li>
+
+<p><tt>RESPECT NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are included when finding the offset tuple.</p>
+</li>
+</ul>
+<p>If this modifier is omitted, the default is <tt>RESPECT NULLS</tt>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>
+
+<p>The specified value from the offset tuple.</p>
+</li>
+<li>
+
+<p>If the offset tuple is out of partition scope, it returns the default value, or NULL if no default is specified.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each order, show the customer and the value, including the value of the next-largest order from that customer.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno, revenue,
+LEAD(revenue, 1, &quot;No larger order&quot;) OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+) AS next_largest_order;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null,
+    &quot;next_largest_order&quot;: 130.45
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45,
+    &quot;next_largest_order&quot;: 1999.8
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8,
+    &quot;next_largest_order&quot;: 10906.55
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55,
+    &quot;next_largest_order&quot;: &quot;No larger order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95,
+    &quot;next_largest_order&quot;: &quot;No larger order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94,
+    &quot;next_largest_order&quot;: &quot;No larger order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92,
+    &quot;next_largest_order&quot;: &quot;No larger order&quot;
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73,
+    &quot;next_largest_order&quot;: 18847.58
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58,
+    &quot;next_largest_order&quot;: &quot;No larger order&quot;
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="nth_value"></a>nth_value</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">NTH_VALUE(expr, offset) [from-modifier] [nulls-modifier] OVER (window-definition)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the requested value from a tuple in the current window frame, where the window frame is specified by the window definition.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>
+
+<p><tt>expr</tt>: The value that you want to return from the offset tuple in the window frame. <sup>[</sup><a href="#fn_1"><sup>1</sup></a><sup>]</sup></p>
+</li>
+<li>
+
+<p><tt>offset</tt>: The number of the offset tuple within the window frame, counting from 1.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Modifiers:</p>
+<ul>
+
+<li>
+
+<p><a href="manual.html#Window_function_options">FROM Modifier</a>: (Optional) Determines where the function starts counting the offset.</p>
+<ul>
+
+<li>
+
+<p><tt>FROM FIRST</tt>: Counting starts at the first tuple in the window frame. In this case, an offset of 1 is the first tuple in the window frame, 2 is the second tuple, and so on.</p>
+</li>
+<li>
+
+<p><tt>FROM LAST</tt>: Counting starts at the last tuple in the window frame. In this case, an offset of 1 is the last tuple in the window frame, 2 is the second-to-last tuple, and so on.</p>
+</li>
+</ul>
+<p>The order of the tuples is determined by the window order clause. If this modifier is omitted, the default is <tt>FROM FIRST</tt>.</p>
+</li>
+<li>
+
+<p><a href="manual.html#Window_function_options">NULLS Modifier</a>: (Optional) Determines how NULL or MISSING values are treated when finding the offset tuple in the window frame.</p>
+<ul>
+
+<li>
+
+<p><tt>IGNORE NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are ignored when finding the offset tuple.</p>
+</li>
+<li>
+
+<p><tt>RESPECT NULLS</tt>: If the values for any tuples evaluate to NULL or MISSING, those tuples are included when finding the offset tuple.</p>
+</li>
+</ul>
+<p>If this modifier is omitted, the default is <tt>RESPECT NULLS</tt>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_frame_clause">Window Frame Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>
+
+<p>The specified value from the offset tuple.</p>
+</li>
+<li>
+
+<p>In the following cases, this function may return unpredictable results.</p>
+<ul>
+
+<li>
+
+<p>If the window order clause is omitted.</p>
+</li>
+<li>
+
+<p>If the window frame is defined by <tt>ROWS</tt>, and there are tied tuples in the window frame.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>To make the function return deterministic results, add a window order clause, or add further ordering terms to the window order clause so that no tuples are tied.</p>
+</li>
+<li>
+
+<p>If the window frame is defined by <tt>RANGE</tt> or <tt>GROUPS</tt>, and there are tied tuples in the window frame, the function returns the first value of the input expression when counting <tt>FROM FIRST</tt>, or the last value of the input expression when counting <tt>FROM LAST</tt>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example 1:</p>
+<p>For each order, show the customer and the value, including the value of the second smallest order from that customer.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno, revenue,
+NTH_VALUE(revenue, 2) FROM FIRST OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+  ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING -- &#x278a;
+) AS smallest_order_but_1;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null,
+    &quot;smallest_order_but_1&quot;: 130.45
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45, // &#x278b;
+    &quot;smallest_order_but_1&quot;: 130.45
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8,
+    &quot;smallest_order_but_1&quot;: 130.45
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55,
+    &quot;smallest_order_but_1&quot;: 130.45
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95,
+    &quot;smallest_order_but_1&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94,
+    &quot;smallest_order_but_1&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92,
+    &quot;smallest_order_but_1&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73,
+    &quot;smallest_order_but_1&quot;: 18847.58
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58, // &#x278b;
+    &quot;smallest_order_but_1&quot;: 18847.58
+  }
+]
+</pre></div></div>
+
+<p>&#x2780; This clause specifies that the window frame should extend to the end of the window partition. Without this clause, the end point of the window frame would always be the current tuple. This would mean that for the smallest order, the function would be unable to find the route with the second smallest order.</p>
+<p>&#x2781; The second smallest order from this customer.</p>
+</li>
+<li>
+
+<p>Example 2:</p>
+<p>For each order, show the customer and the value, including the value of the second largest order from that customer.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno, revenue,
+NTH_VALUE(revenue, 2) FROM LAST OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+  ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING -- &#x278a;
+) AS largest_order_but_1;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55,
+    &quot;largest_order_but_1&quot;: 1999.8
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8, // &#x278b;
+    &quot;largest_order_but_1&quot;: 1999.8
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45,
+    &quot;largest_order_but_1&quot;: 1999.8
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null,
+    &quot;largest_order_but_1&quot;: 1999.8
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95,
+    &quot;largest_order_but_1&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94,
+    &quot;largest_order_but_1&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92,
+    &quot;largest_order_but_1&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58,
+    &quot;largest_order_but_1&quot;: 157.73
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73, // &#x278b;
+    &quot;largest_order_but_1&quot;: 157.73
+  }
+]
+</pre></div></div>
+
+<p>&#x2780; This clause specifies that the window frame should extend to the end of the window partition. Without this clause, the end point of the window frame would always be the current tuple. This would mean the function would be unable to find the second largest order for smaller orders.</p>
+<p>&#x2781; The second largest order from this customer.</p>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ntile"></a>ntile</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">NTILE(num_tiles) OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Divides the window partition into the specified number of tiles, and allocates each tuple in the window partition to a tile, so that as far as possible each tile has an equal number of tuples. When the set of tuples is not equally divisible by the number of tiles, the function puts more tuples into the lower-numbered tiles. For each tuple, the function returns the number of the tile into which that tuple was placed.</p>
+<p>The window order clause determines the sort order of the tuples. If the window order clause is omitted then the tuples are processed in an undefined order.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>num_tiles</tt>: The number of tiles into which you want to divide the window partition. This argument can be an expression and must evaluate to a number. If the number is not an integer, it will be truncated.</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An value greater than or equal to 1 and less than or equal to the number of tiles.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>Allocate each order to one of three tiles by value.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.orderno, revenue,
+NTILE(3) OVER (
+  ORDER BY revenue
+) AS `ntile`;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;ntile&quot;: 1,
+    &quot;orderno&quot;: 1009,
+    &quot;revenue&quot;: null
+  },
+  {
+    &quot;ntile&quot;: 1,
+    &quot;orderno&quot;: 1007,
+    &quot;revenue&quot;: 130.45
+  },
+  {
+    &quot;ntile&quot;: 1,
+    &quot;orderno&quot;: 1001,
+    &quot;revenue&quot;: 157.73
+  },
+  {
+    &quot;ntile&quot;: 2,
+    &quot;orderno&quot;: 1004,
+    &quot;revenue&quot;: 199.94
+  },
+  {
+    &quot;ntile&quot;: 2,
+    &quot;orderno&quot;: 1003,
+    &quot;revenue&quot;: 477.95
+  },
+  {
+    &quot;ntile&quot;: 2,
+    &quot;orderno&quot;: 1008,
+    &quot;revenue&quot;: 1999.8
+  },
+  {
+    &quot;ntile&quot;: 3,
+    &quot;orderno&quot;: 1005,
+    &quot;revenue&quot;: 4639.92
+  },
+  {
+    &quot;ntile&quot;: 3,
+    &quot;orderno&quot;: 1002,
+    &quot;revenue&quot;: 10906.55
+  },
+  {
+    &quot;ntile&quot;: 3,
+    &quot;orderno&quot;: 1006,
+    &quot;revenue&quot;: 18847.58
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="percent_rank"></a>percent_rank</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">PERCENT_RANK() OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the percentile rank of the current tuple &#x2013; that is, the rank of the tuples minus one, divided by the total number of tuples in the window partition minus one.</p>
+<p>The window order clause determines the sort order of the tuples. If the window order clause is omitted, the function returns the same result (0) for each tuple.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>None.</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>A number between 0 and 1. The higher the value, the higher the ranking.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each customer, find the percentile rank of all orders by order number.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+SELECT o.custid, o.orderno, PERCENT_RANK() OVER (
+  PARTITION BY o.custid
+  ORDER BY o.orderno
+) AS `rank`;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;rank&quot;: 0,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002
+  },
+  {
+    &quot;rank&quot;: 0.3333333333333333,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007
+  },
+  {
+    &quot;rank&quot;: 0.6666666666666666,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009
+  },
+  {
+    &quot;rank&quot;: 0,
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003
+  },
+  {
+    &quot;rank&quot;: 0,
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004
+  },
+  {
+    &quot;rank&quot;: 0,
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005
+  },
+  {
+    &quot;rank&quot;: 0,
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001
+  },
+  {
+    &quot;rank&quot;: 1,
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="rank"></a>rank</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">RANK() OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the rank of the current tuple &#x2013; that is, the number of distinct tuples preceding this tuple in the current window partition, plus one.</p>
+<p>The tuples are ordered by the window order clause. If any tuples are tied, they will have the same rank. If the window order clause is omitted, the function returns the same result (1) for each tuple.</p>
+<p>When any tuples have the same rank, the rank of the next tuple will include all preceding tuples, so there may be a gap in the sequence of returned values. For example, if there are five tuples ranked 3, the next rank is 8.</p>
+<p>To avoid gaps in the returned values, use the DENSE_RANK() function instead.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>None.</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, greater than or equal to 1.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>Find the rank of all orders by number of items.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+SELECT o.orderno, LEN(o.items) AS items,
+RANK() OVER (
+  ORDER BY LEN(o.items)
+) AS `rank`;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;items&quot;: 0,
+    &quot;rank&quot;: 1,
+    &quot;orderno&quot;: 1009
+  },
+  {
+    &quot;items&quot;: 1,
+    &quot;rank&quot;: 2,
+    &quot;orderno&quot;: 1008
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1004
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1007
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1002
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1001
+  },
+  {
+    &quot;items&quot;: 2,
+    &quot;rank&quot;: 3,
+    &quot;orderno&quot;: 1003
+  },
+  {
+    &quot;items&quot;: 3,
+    &quot;rank&quot;: 8,
+    &quot;orderno&quot;: 1006
+  },
+  {
+    &quot;items&quot;: 4,
+    &quot;rank&quot;: 9,
+    &quot;orderno&quot;: 1005
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="ratio_to_report"></a>ratio_to_report</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">RATIO_TO_REPORT(expr) OVER (window-definition)
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns the fractional ratio of the specified value for each tuple to the sum of values for all tuples in the window frame.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li><tt>expr</tt>: The value for which you want to calculate the fractional ratio. <sup>[</sup><a href="#fn_1"><sup>1</sup></a><sup>]</sup></li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_frame_clause">Window Frame Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>
+
+<p>A number between 0 and 1, representing the fractional ratio of the value for the current tuple to the sum of values for all tuples in the current window frame. The sum of returned values for all tuples in the current window frame is 1.</p>
+</li>
+<li>
+
+<p>If the input expression does not evaluate to a number, or the sum of values for all tuples is zero, it returns NULL.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each customer, calculate the value of each order as a fraction of the total value of all orders.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno,
+RATIO_TO_REPORT(revenue) OVER (
+  PARTITION BY o.custid
+) AS fractional_ratio;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007,
+    &quot;fractional_ratio&quot;: 0.010006289887088855
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002,
+    &quot;fractional_ratio&quot;: 0.8365971710849288
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009,
+    &quot;fractional_ratio&quot;: null
+  },
+  {
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008,
+    &quot;fractional_ratio&quot;: 0.15339653902798234
+  },
+  {
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003,
+    &quot;fractional_ratio&quot;: 1
+  },
+  {
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004,
+    &quot;fractional_ratio&quot;: 1
+  },
+  {
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005,
+    &quot;fractional_ratio&quot;: 1
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006,
+    &quot;fractional_ratio&quot;: 0.9917007404772666
+  },
+  {
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001,
+    &quot;fractional_ratio&quot;: 0.008299259522733382
+  }
+]
+</pre></div></div>
+</li>
+</ul></div>
+<div class="section">
+<h3><a name="row_number"></a>row_number</h3>
+<ul>
+
+<li>
+
+<p>Syntax:</p>
+
+<div>
+<div>
+<pre class="source">ROW_NUMBER() OVER ([window-partition-clause] [window-order-clause])
+</pre></div></div>
+</li>
+<li>
+
+<p>Returns a unique row number for every tuple in every window partition. In each window partition, the row numbering starts at 1.</p>
+<p>The window order clause determines the sort order of the tuples. If the window order clause is omitted, the return values may be unpredictable.</p>
+</li>
+<li>
+
+<p>Arguments:</p>
+<ul>
+
+<li>None.</li>
+</ul>
+</li>
+<li>
+
+<p>Clauses:</p>
+<ul>
+
+<li>
+
+<p>(Optional) <a href="manual.html#Window_partition_clause">Window Partition Clause</a>.</p>
+</li>
+<li>
+
+<p>(Optional) <a href="manual.html#Window_order_clause">Window Order Clause</a>.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>Return Value:</p>
+<ul>
+
+<li>An integer, greater than or equal to 1.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+<p>For each customer, number all orders by value.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+LET revenue = ROUND((
+  FROM o.items
+  SELECT VALUE SUM(qty * price)
+)[0], 2)
+SELECT o.custid, o.orderno,
+ROW_NUMBER() OVER (
+  PARTITION BY o.custid
+  ORDER BY revenue
+) AS `row`;
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;row&quot;: 1,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1009
+  },
+  {
+    &quot;row&quot;: 2,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1007
+  },
+  {
+    &quot;row&quot;: 3,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1008
+  },
+  {
+    &quot;row&quot;: 4,
+    &quot;custid&quot;: &quot;C13&quot;,
+    &quot;orderno&quot;: 1002
+  },
+  {
+    &quot;row&quot;: 1,
+    &quot;custid&quot;: &quot;C31&quot;,
+    &quot;orderno&quot;: 1003
+  },
+  {
+    &quot;row&quot;: 1,
+    &quot;custid&quot;: &quot;C35&quot;,
+    &quot;orderno&quot;: 1004
+  },
+  {
+    &quot;row&quot;: 1,
+    &quot;custid&quot;: &quot;C37&quot;,
+    &quot;orderno&quot;: 1005
+  },
+  {
+    &quot;row&quot;: 1,
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1001
+  },
+  {
+    &quot;row&quot;: 2,
+    &quot;custid&quot;: &quot;C41&quot;,
+    &quot;orderno&quot;: 1006
+  }
+]
+</pre></div></div>
+</li>
+</ul><hr />
+<p><a name="fn_1" id="fn_1">1</a>. If the query contains the GROUP BY clause or any <a href="#AggregateFunctions">aggregate functions</a>, this expression must only depend on GROUP BY expressions or aggregate functions.</p></div></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/docs/0.9.9/sqlpp/manual.html b/docs/0.9.9/sqlpp/manual.html
new file mode 100644
index 0000000..e002139
--- /dev/null
+++ b/docs/0.9.9/sqlpp/manual.html
@@ -0,0 +1,5342 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/sqlpp/manual.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; The SQL++ Query Language</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+    <script type="text/javascript" src="../js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href=".././" id="bannerLeft"><img src="../images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="../index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="../ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="../ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="../aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="../sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="../datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li class="active"><a href="#"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="../SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="../sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="../api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="../csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="../aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="../feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li><a href="../udf.html" title="User Defined Functions"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="../sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="../sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="../sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="../geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="../geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="../interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="../spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="../sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="../aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="../aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href=".././" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="../images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>The SQL++ Query Language</h1>
+<ul>
+
+<li><a href="#Introduction">1. Introduction</a></li>
+<li><a href="#Expressions">2. Expressions</a>
+<ul>
+
+<li><a href="#Operator_expressions">Operator Expressions</a>
+<ul>
+
+<li><a href="#Arithmetic_operators">Arithmetic Operators</a></li>
+<li><a href="#Collection_operators">Collection Operators</a></li>
+<li><a href="#Comparison_operators">Comparison Operators</a></li>
+<li><a href="#Logical_operators">Logical Operators</a></li>
+</ul>
+</li>
+<li><a href="#Quantified_expressions">Quantified Expressions</a></li>
+<li><a href="#Path_expressions">Path Expressions</a></li>
+<li><a href="#Primary_expressions">Primary Expressions</a>
+<ul>
+
+<li><a href="#Literals">Literals</a></li>
+<li><a href="#Variable_references">Identifiers and Variable References</a></li>
+<li><a href="#Parameter_references">Parameter References</a></li>
+<li><a href="#Parenthesized_expressions">Parenthesized Expressions</a></li>
+<li><a href="#Function_call_expressions">Function Calls</a></li>
+<li><a href="#Case_expressions">Case Expressions</a></li>
+<li><a href="#Constructors">Constructors</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li><a href="#Queries">3. Queries</a>
+<ul>
+
+<li><a href="#Select_clauses">SELECT Clauses</a>
+<ul>
+
+<li><a href="#Select_element">Select Value</a></li>
+<li><a href="#SQL_select">SQL-style Select</a></li>
+<li><a href="#Select_star">Select *</a></li>
+<li><a href="#Select_distinct">Select Distinct</a></li>
+<li><a href="#Unnamed_projections">Unnamed Projections</a></li>
+<li><a href="#Abbreviated_field_access_expressions">Abbreviated Field Access Expressions</a></li>
+</ul>
+</li>
+<li><a href="#From_clauses">FROM clauses</a>
+<ul>
+
+<li><a href="#Joins">Joins</a></li>
+</ul>
+</li>
+<li><a href="#Let_clauses">LET Clauses</a></li>
+<li><a href="#WHERE_Clause">WHERE Clause</a></li>
+<li><a href="#Grouping">Grouping</a>
+<ul>
+
+<li><a href="#GROUP_BY_Clause">GROUP BY Clause</a></li>
+<li><a href="#HAVING_Clause">HAVING Clause</a></li>
+<li><a href="#Aggregation_PseudoFunctions">Aggregation Pseudo-functions</a></li>
+<li><a href="#GROUP_AS_Clause">GROUP AS Clause</a></li>
+</ul>
+</li>
+<li><a href="#Union_all">Selection and UNION ALL</a></li>
+<li><a href="#With_clauses">WITH Clauses</a></li>
+<li><a href="#Order_By_clauses">ORDER BY, LIMIT, and OFFSET Clauses</a></li>
+<li><a href="#Subqueries">Subqueries</a></li>
+</ul>
+</li>
+<li><a href="#Over_clauses">4. Window Functions</a>
+<ul>
+
+<li><a href="#Window_function_call">Window Function Call</a>
+<ul>
+
+<li><a href="#Window_function_arguments">Window Function Arguments</a></li>
+<li><a href="#Window_function_options">Window Function Options</a></li>
+<li><a href="#Window_frame_variable">Window Frame Variable</a></li>
+<li><a href="#Window_definition">Window Definition</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li><a href="#Errors">5. Errors</a>
+<ul>
+
+<li><a href="#Syntax_errors">Syntax Errors</a></li>
+<li><a href="#Identifier_resolution_errors">Identifier Resolution Errors</a></li>
+<li><a href="#Type_errors">Type Errors</a></li>
+<li><a href="#Resource_errors">Resource Errors</a></li>
+</ul>
+</li>
+<li><a href="#Vs_SQL-92">6.Differences from SQL-92</a></li>
+<li><a href="#DDL_and_DML_statements">7. DDL and DML Statements</a>
+<ul>
+
+<li><a href="#Lifecycle_management_statements">Lifecycle Management Statements</a>
+<ul>
+
+<li><a href="#Use">Use Statement</a></li>
+<li><a href="#Sets">Set Statement</a></li>
+<li><a href="#Functions">Function Declaration</a></li>
+<li><a href="#Create">Create Statement</a>
+<ul>
+
+<li><a href="#Dataverses">Create Dataverse</a></li>
+<li><a href="#Types">Create Type</a></li>
+<li><a href="#Datasets">Create Dataset</a></li>
+<li><a href="#Indices">Create Index</a></li>
+<li><a href="#Synonyms">Create Synonym</a></li>
+<li><a href="#Create_function">Create Function</a></li>
+<li><a href="#Create_view">Create View</a></li>
+</ul>
+</li>
+<li><a href="#Removal">Drop Statement</a></li>
+<li><a href="#Load_statement">Load Statement</a></li>
+</ul>
+</li>
+<li><a href="#Modification_statements">Modification Statements</a>
+<ul>
+
+<li><a href="#Inserts">Insert Statement</a></li>
+<li><a href="#Upserts">Upsert Statement</a></li>
+<li><a href="#Deletes">Delete Statement</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li><a href="#Reserved_keywords">Appendix 1. Reserved Keywords</a></li>
+<li><a href="#Performance_tuning">Appendix 2. Performance Tuning</a>
+<ul>
+
+<li><a href="#Parallelism_parameter">Parallelism Parameter</a></li>
+<li><a href="#Memory_parameters">Memory Parameters</a></li>
+<li><a href="#Query_hints">Query Hints</a></li>
+</ul>
+</li>
+<li><a href="#Variable_bindings_and_name_resolution">Appendix 3. Variable Bindings and Name Resolution</a></li>
+<li><a href="#Manual_data">Appendix 4. Example Data</a>
+<ul>
+
+<li><a href="#definition_statements">Data Definitions</a></li>
+<li><a href="#customers_data">Customers Dataset</a></li>
+<li><a href="#orders_data">Orders Dataset</a></li>
+</ul>
+</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Introduction" id="Introduction">1. Introduction</a></h1>
+<p>This document is intended as a reference guide to the full syntax and semantics of AsterixDB&#x2019;s query language, a SQL-based language for working with semistructured data. The language is a derivative of SQL++, a declarative query language for JSON data which is largely backwards compatible with SQL. SQL++ originated from research in the FORWARD project at UC San Diego, and it has much in common with SQL; some differences exist due to the different data models that the two languages were designed to serve. SQL was designed for interacting with the flat, schema-ified world of relational databases, while SQL++ generalizes SQL to also handle nested data formats (like JSON) and the schema-optional (or even schema-less) data models of modern NoSQL and BigData systems.</p>
+<p>In the context of Apache AsterixDB, SQL++ is intended for working with the Asterix Data Model (<a href="../datamodel.html">ADM</a>), a data model based on a superset of JSON with an enriched and flexible type system. New AsterixDB users are encouraged to read and work through the (much friendlier) guide &#x201c;<a href="primer-sqlpp.html">AsterixDB 101: An ADM and SQL++ Primer</a>&#x201d; before attempting to make use of this document. In addition, readers are advised to read through the <a href="../datamodel.html">Asterix Data Model (ADM) reference guide</a> first as well, as an understanding of the data model is a prerequisite to understanding SQL++.</p>
+<p>In what follows, we detail the features of the SQL++ language in a grammar-guided manner. We list and briefly explain each of the productions in the query grammar, offering examples (and results) for clarity. In this manual, we will explain how to use the various features of SQL++ using two datasets named <tt>customers</tt> and <tt>orders</tt>. Each dataset is a collection of objects. The contents of the example datasets can be found at the end of this manual in <a href="#Manual_data">Appendix 4</a>.</p>
+<p>For additional reading on SQL++ and more examples, refer to <a class="externalLink" href="https://asterixdb.apache.org/files/SQL_Book.pdf">SQL++ for SQL Users: A Tutorial</a>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Expressions" id="Expressions">2. Expressions</a></h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>An expression is a language fragment that can be evaluated to return a value. For example, the expression 2 + 3 returns the value 5. Expressions are the building blocks from which queries are constructed. SQL++ supports nearly all of the kinds of expressions in SQL, and adds some new kinds as well.</p>
+<p>SQL++ is an orthogonal language, which means that expressions can serve as operands of higher level expressions. By nesting expressions inside other expressions, complex queries can be built up. Any expression can be enclosed in parentheses to establish operator precedence.</p>
+<p>In this section, we&#x2019;ll discuss the various kinds of SQL++ expressions.</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Expr"></a>Expr</h5>
+<p><img src="../images/diagrams/Expr.png" alt="" /></p></div></div></div></div>
+<div class="section">
+<h2><a name="Operator_Expressions"></a><a name="Operator_expressions" id="Operator_expressions">Operator Expressions</a></h2>
+<p>Operators perform a specific operation on the input values or expressions. The syntax of an operator expression is as follows:</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="OperatorExpr"></a>OperatorExpr</h5>
+<p><img src="../images/diagrams/OperatorExpr.png" alt="" /></p>
+<p>The language provides a full set of operators that you can use within its statements. Here are the categories of operators:</p>
+<ul>
+
+<li><a href="#Arithmetic_operators">Arithmetic Operators</a>, to perform basic mathematical operations;</li>
+<li><a href="#Collection_operators">Collection Operators</a>, to evaluate expressions on collections or objects;</li>
+<li><a href="#Comparison_operators">Comparison Operators</a>, to compare two expressions;</li>
+<li><a href="#Logical_operators">Logical Operators</a>, to combine operators using Boolean logic.</li>
+</ul>
+<p>The following table summarizes the precedence order (from higher to lower) of the major unary and binary operators:</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Operator                                                                    </th>
+<th> Operation </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> EXISTS, NOT EXISTS                                                          </td>
+<td>  Collection emptiness testing </td></tr>
+<tr class="a">
+<td> ^                                                                           </td>
+<td>  Exponentiation  </td></tr>
+<tr class="b">
+<td> *, /, DIV, MOD (%)                                                          </td>
+<td>  Multiplication, division, modulo </td></tr>
+<tr class="a">
+<td> +, -                                                                        </td>
+<td>  Addition, subtraction  </td></tr>
+<tr class="b">
+<td> ||                                                                </td>
+<td>  String concatenation </td></tr>
+<tr class="a">
+<td> IS NULL, IS NOT NULL, IS MISSING, IS NOT MISSING, <br />IS UNKNOWN, IS NOT UNKNOWN, IS VALUED, IS NOT VALUED </td>
+<td> Unknown value comparison </td></tr>
+<tr class="b">
+<td> BETWEEN, NOT BETWEEN                                                        </td>
+<td> Range comparison (inclusive on both sides) </td></tr>
+<tr class="a">
+<td> =, !=, &lt;&gt;, &lt;, &gt;, &lt;=, &gt;=, LIKE, NOT LIKE, IN, NOT IN, IS DISTINCT FROM, IS NOT DISTINCT FROM </td>
+<td> Comparison  </td></tr>
+<tr class="b">
+<td> NOT                                                                         </td>
+<td> Logical negation </td></tr>
+<tr class="a">
+<td> AND                                                                         </td>
+<td> Conjunction </td></tr>
+<tr class="b">
+<td> OR                                                                          </td>
+<td> Disjunction </td></tr>
+</tbody>
+</table>
+<p>In general, if any operand evaluates to a <tt>MISSING</tt> value, the enclosing operator will return <tt>MISSING</tt>; if none of the operands evaluates to a <tt>MISSING</tt> value but there is an operand which evaluates to a <tt>NULL</tt> value, the enclosing operator will return <tt>NULL</tt>. However, there are a few exceptions listed in <a href="#Comparison_operators">comparison operators</a> and <a href="#Logical_operators">logical operators</a>.</p></div></div></div>
+<div class="section">
+<h3><a name="Arithmetic_Operators"></a><a name="Arithmetic_operators" id="Arithmetic_operators">Arithmetic Operators</a></h3>
+<p>Arithmetic operators are used to exponentiate, add, subtract, multiply, and divide numeric values, or concatenate string values.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Operator     </th>
+<th>  Purpose                                                                </th>
+<th> Example    </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> +, -         </td>
+<td>  As unary operators, they denote a <br />positive or negative expression </td>
+<td> SELECT VALUE -1; </td></tr>
+<tr class="a">
+<td> +, -         </td>
+<td>  As binary operators, they add or subtract                              </td>
+<td> SELECT VALUE 1 + 2; </td></tr>
+<tr class="b">
+<td> *            </td>
+<td>  Multiply                                                               </td>
+<td> SELECT VALUE 4 * 2; </td></tr>
+<tr class="a">
+<td> /            </td>
+<td>  Divide (returns a value of type <tt>double</tt> if both operands are integers)</td>
+<td> SELECT VALUE 5 / 2; </td></tr>
+<tr class="b">
+<td> DIV          </td>
+<td>  Divide (returns an integer value if both operands are integers)        </td>
+<td> SELECT VALUE 5 DIV 2; </td></tr>
+<tr class="a">
+<td> MOD (%)      </td>
+<td>  Modulo                                                                 </td>
+<td> SELECT VALUE 5 % 2; </td></tr>
+<tr class="b">
+<td> ^            </td>
+<td>  Exponentiation                                                         </td>
+<td> SELECT VALUE 2^3;       </td></tr>
+<tr class="a">
+<td> || </td>
+<td>  String concatenation                                                   </td>
+<td> SELECT VALUE &#x201c;ab&#x201d;||&#x201c;c&#x201d;||&#x201c;d&#x201d;;       </td></tr>
+</tbody>
+</table></div>
+<div class="section">
+<h3><a name="Collection_Operators"></a><a name="Collection_operators" id="Collection_operators">Collection Operators</a></h3>
+<p>Collection operators are used for membership tests (IN, NOT IN) or empty collection tests (EXISTS, NOT EXISTS).</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Operator   </th>
+<th>  Purpose                                     </th>
+<th> Example    </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> IN         </td>
+<td>  Membership test                             </td>
+<td> FROM customers AS c <br />WHERE c.address.zipcode IN [&#x201c;02340&#x201d;, &#x201c;02115&#x201d;] <br /> SELECT *; </td></tr>
+<tr class="a">
+<td> NOT IN     </td>
+<td>  Non-membership test                         </td>
+<td> FROM customers AS c <br />WHERE c.address.zipcode NOT IN [&#x201c;02340&#x201d;, &#x201c;02115&#x201d;] <br /> SELECT *;</td></tr>
+<tr class="b">
+<td> EXISTS     </td>
+<td>  Check whether a collection is not empty     </td>
+<td> FROM orders AS o <br />WHERE EXISTS  o.items <br /> SELECT *;</td></tr>
+<tr class="a">
+<td> NOT EXISTS </td>
+<td>  Check whether a collection is empty         </td>
+<td> FROM orders AS o <br />WHERE NOT EXISTS  o.items <br /> SELECT *; </td></tr>
+</tbody>
+</table></div>
+<div class="section">
+<h3><a name="Comparison_Operators"></a><a name="Comparison_operators" id="Comparison_operators">Comparison Operators</a></h3>
+<p>Comparison operators are used to compare values.</p>
+<p>The comparison operators fall into one of two sub-categories: missing value comparisons and regular value comparisons. SQL++ (and JSON) has two ways of representing missing information in an object &#x2014; the presence of the field with a NULL for its value (as in SQL), and the absence of the field (which JSON permits). For example, the first of the following objects represents Jack, whose friend is Jill. In the other examples, Jake is friendless &#xe0; la SQL, with a friend field that is NULL, while Joe is friendless in a more natural (for JSON) way, i.e., by not having a friend field.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">{&quot;name&quot;: &quot;Jack&quot;, &quot;friend&quot;: &quot;Jill&quot;}
+
+{&quot;name&quot;: &quot;Jake&quot;, &quot;friend&quot;: NULL}
+
+{&quot;name&quot;: &quot;Joe&quot;}
+</pre></div></div>
+
+<p>The following table enumerates all of the comparison operators available in SQL++.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Operator       </th>
+<th>  Purpose                                       </th>
+<th> Example    </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> IS NULL        </td>
+<td>  Test if a value is NULL                       </td>
+<td>FROM customers AS c <br />WHERE c.name IS NULL <br /> SELECT *; </td></tr>
+<tr class="a">
+<td> IS NOT NULL    </td>
+<td>  Test if a value is not NULL                   </td>
+<td> FROM customers AS c <br />WHERE c.name IS NOT NULL <br /> SELECT *; </td></tr>
+<tr class="b">
+<td> IS MISSING     </td>
+<td>  Test if a value is MISSING                    </td>
+<td> FROM customers AS c <br />WHERE c.name IS MISSING <br /> SELECT *;  </td></tr>
+<tr class="a">
+<td> IS NOT MISSING </td>
+<td>  Test if a value is not MISSING                </td>
+<td> FROM customers AS c <br />WHERE c.name IS NOT MISSING <br /> SELECT *; </td></tr>
+<tr class="b">
+<td> IS UNKNOWN     </td>
+<td>  Test if a value is NULL or MISSING            </td>
+<td> FROM customers AS c <br />WHERE c.name IS UNKNOWN <br /> SELECT *; </td></tr>
+<tr class="a">
+<td> IS NOT UNKNOWN </td>
+<td>  Test if a value is neither NULL nor MISSING   </td>
+<td> FROM customers AS c <br />WHERE c.name IS NOT UNKNOWN <br /> SELECT *; </td></tr>
+<tr class="b">
+<td> IS KNOWN (IS VALUED) </td>
+<td>  Test if a value is neither NULL nor MISSING </td>
+<td> FROM customers AS c <br />WHERE c.name IS KNOWN <br /> SELECT *;  </td></tr>
+<tr class="a">
+<td> IS NOT KNOWN (IS NOT VALUED) </td>
+<td>  Test if a value is NULL or MISSING </td>
+<td> FROM customers AS c <br />WHERE c.name IS NOT KNOWN <br /> SELECT *;  </td></tr>
+<tr class="b">
+<td> BETWEEN        </td>
+<td>  Test if a value is between a start value and a end value. The comparison is inclusive of both the start and end values. </td>
+<td>  FROM customers AS c WHERE c.rating BETWEEN 600 AND 700 SELECT *;</td></tr>
+<tr class="a">
+<td> =              </td>
+<td>  Equality test                                 </td>
+<td> FROM customers AS c <br /> WHERE c.rating = 640 <br /> SELECT *; </td></tr>
+<tr class="b">
+<td> !=             </td>
+<td>  Inequality test                               </td>
+<td> FROM customers AS c <br /> WHERE c.rating != 640 <br /> SELECT *;</td></tr>
+<tr class="a">
+<td> &lt;&gt;             </td>
+<td>  Inequality test                               </td>
+<td> FROM customers AS c <br /> WHERE c.rating &lt;&gt; 640 <br /> SELECT *;</td></tr>
+<tr class="b">
+<td> &lt;              </td>
+<td>  Less than                                     </td>
+<td> FROM customers AS c <br /> WHERE c.rating &lt; 640 <br /> SELECT *; </td></tr>
+<tr class="a">
+<td> &gt;              </td>
+<td>  Greater than                                  </td>
+<td> FROM customers AS c <br /> WHERE c.rating &gt; 640 <br /> SELECT *; </td></tr>
+<tr class="b">
+<td> &lt;=             </td>
+<td>  Less than or equal to                         </td>
+<td> FROM customers AS c <br /> WHERE c.rating &lt;= 640 <br /> SELECT *; </td></tr>
+<tr class="a">
+<td> &gt;=             </td>
+<td>  Greater than or equal to                      </td>
+<td> FROM customers AS c <br /> WHERE c.rating &gt;= 640 <br /> SELECT *; </td></tr>
+<tr class="b">
+<td> LIKE           </td>
+<td>  Test if the left side matches a pattern defined on the right side; in the pattern,  &#x201c;%&#x201d; matches any string while &#x201c;_&#x201d; matches any character. </td>
+<td> FROM customers AS c WHERE c.name LIKE &#x201c;%Dodge%&#x201d; SELECT *;</td></tr>
+<tr class="a">
+<td> NOT LIKE       </td>
+<td>  Test if the left side does not match a pattern defined on the right side; in the pattern, &#x201c;%&#x201d; matches any string while &#x201c;_&#x201d; matches any character. </td>
+<td> FROM customers AS c WHERE c.name NOT LIKE &#x201c;%Dodge%&#x201d; SELECT *;</td></tr>
+<tr class="b">
+<td> IS DISTINCT FROM </td>
+<td> Inequality test that that treats NULL values as equal to each other and MISSING values as equal to each other </td>
+<td> FROM orders AS o <br /> WHERE o.order_date IS DISTINCT FROM o.ship_date <br /> SELECT *; </td>
+<td> </td></tr>
+<tr class="a">
+<td> IS NOT DISTINCT FROM </td>
+<td> Equality test that treats NULL values as equal to each other and MISSING values as equal to each other </td>
+<td> FROM orders AS o <br /> WHERE o.order_date IS NOT DISTINCT FROM o.ship_date <br /> SELECT *;  </td></tr>
+</tbody>
+</table>
+<p>The following table summarizes how the missing value comparison operators work.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Operator </th>
+<th> Non-NULL/Non-MISSING value </th>
+<th> NULL value</th>
+<th> MISSING value</th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> IS NULL  </td>
+<td> FALSE </td>
+<td> TRUE </td>
+<td> MISSING </td></tr>
+<tr class="a">
+<td> IS NOT NULL </td>
+<td> TRUE </td>
+<td> FALSE </td>
+<td> MISSING </td></tr>
+<tr class="b">
+<td> IS MISSING  </td>
+<td> FALSE </td>
+<td> FALSE </td>
+<td> TRUE </td></tr>
+<tr class="a">
+<td> IS NOT MISSING </td>
+<td> TRUE </td>
+<td> TRUE </td>
+<td> FALSE </td></tr>
+<tr class="b">
+<td> IS UNKNOWN </td>
+<td> FALSE </td>
+<td> TRUE </td>
+<td> TRUE </td></tr>
+<tr class="a">
+<td> IS NOT UNKNOWN </td>
+<td> TRUE </td>
+<td> FALSE </td>
+<td> FALSE</td></tr>
+<tr class="b">
+<td> IS KNOWN (IS VALUED) </td>
+<td> TRUE </td>
+<td> FALSE </td>
+<td> FALSE </td></tr>
+<tr class="a">
+<td> IS NOT KNOWN (IS NOT VALUED) </td>
+<td> FALSE </td>
+<td> TRUE </td>
+<td> TRUE </td></tr>
+</tbody>
+</table></div></div></div>
+<div class="section">
+<h3><a name="Logical_Operators"></a><a name="Logical_operators" id="Logical_operators">Logical Operators</a></h3>
+<p>Logical operators perform logical <tt>NOT</tt>, <tt>AND</tt>, and <tt>OR</tt> operations over Boolean values (<tt>TRUE</tt> and <tt>FALSE</tt>) plus <tt>NULL</tt> and <tt>MISSING</tt>.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Operator </th>
+<th>  Purpose                                   </th>
+<th> Example    </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> NOT      </td>
+<td>  Returns true if the following condition is false, otherwise returns false  </td>
+<td> SELECT VALUE NOT 1 = 1; <br /> Returns FALSE  </td></tr>
+<tr class="a">
+<td> AND      </td>
+<td>  Returns true if both branches are true, otherwise returns false            </td>
+<td> SELECT VALUE 1 = 2 AND 1 = 1; <br /> Returns FALSE</td></tr>
+<tr class="b">
+<td> OR       </td>
+<td>  Returns true if one branch is true, otherwise returns false                </td>
+<td> SELECT VALUE 1 = 2 OR 1 = 1; <br /> Returns TRUE </td></tr>
+</tbody>
+</table>
+<p>The following table is the truth table for <tt>AND</tt> and <tt>OR</tt>.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> A  </th>
+<th> B  </th>
+<th> A AND B  </th>
+<th> A OR B </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> TRUE </td>
+<td> TRUE </td>
+<td> TRUE </td>
+<td> TRUE </td></tr>
+<tr class="a">
+<td> TRUE </td>
+<td> FALSE </td>
+<td> FALSE </td>
+<td> TRUE </td></tr>
+<tr class="b">
+<td> TRUE </td>
+<td> NULL </td>
+<td> NULL </td>
+<td> TRUE </td></tr>
+<tr class="a">
+<td> TRUE </td>
+<td> MISSING </td>
+<td> MISSING </td>
+<td> TRUE </td></tr>
+<tr class="b">
+<td> FALSE </td>
+<td> FALSE </td>
+<td> FALSE </td>
+<td> FALSE </td></tr>
+<tr class="a">
+<td> FALSE </td>
+<td> NULL </td>
+<td> FALSE </td>
+<td> NULL </td></tr>
+<tr class="b">
+<td> FALSE </td>
+<td> MISSING </td>
+<td> FALSE </td>
+<td> MISSING </td></tr>
+<tr class="a">
+<td> NULL </td>
+<td> NULL </td>
+<td> NULL </td>
+<td> NULL </td></tr>
+<tr class="b">
+<td> NULL </td>
+<td> MISSING </td>
+<td> MISSING </td>
+<td> NULL </td></tr>
+<tr class="a">
+<td> MISSING </td>
+<td> MISSING </td>
+<td> MISSING </td>
+<td> MISSING </td></tr>
+</tbody>
+</table>
+<p>The following table demonstrates the results of <tt>NOT</tt> on all possible inputs.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> A  </th>
+<th> NOT A </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> TRUE </td>
+<td> FALSE </td></tr>
+<tr class="a">
+<td> FALSE </td>
+<td> TRUE </td></tr>
+<tr class="b">
+<td> NULL </td>
+<td> NULL </td></tr>
+<tr class="a">
+<td> MISSING </td>
+<td> MISSING </td></tr>
+</tbody>
+</table></div></div>
+<div class="section">
+<h2><a name="Quantified_Expressions"></a><a name="Quantified_expressions" id="Quantified_expressions">Quantified Expressions</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="QuantifiedExpr"></a>QuantifiedExpr</h5>
+<p><img src="../images/diagrams/QuantifiedExpr.png" alt="" /></p>
+<p>Synonym for <tt>SOME</tt>: <tt>ANY</tt></p>
+<p>Quantified expressions are used for expressing existential or universal predicates involving the elements of a collection.</p>
+<p>The following pair of examples illustrate the use of a quantified expression to test that every (or some) element in the set [1, 2, 3] of integers is less than three. The first example yields <tt>FALSE</tt> and second example yields <tt>TRUE</tt>.</p>
+<p>It is useful to note that if the set were instead the empty set, the first expression would yield <tt>TRUE</tt> (&#x201c;every&#x201d; value in an empty set satisfies the condition) while the second expression would yield <tt>FALSE</tt> (since there isn&#x2019;t &#x201c;some&#x201d; value, as there are no values in the set, that satisfies the condition). To express a universal predicate that yields <tt>FALSE</tt> with the empty set, we would use the quantifier <tt>SOME AND EVERY</tt> in lieu of <tt>EVERY</tt>.</p>
+<p>A quantified expression will return a <tt>NULL</tt> (or <tt>MISSING</tt>) if the first expression in it evaluates to <tt>NULL</tt> (or <tt>MISSING</tt>). Otherwise, a type error will be raised if the first expression in a quantified expression does not return a collection.</p></div>
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">EVERY x IN [ 1, 2, 3 ] SATISFIES x &lt; 3 -- &#x278a;
+SOME x IN [ 1, 2, 3 ] SATISFIES x &lt; 3  -- &#x278b;
+</pre></div></div>
+
+<p>&#x2780; Returns <tt>FALSE</tt><br />
+&#x2781; Returns <tt>TRUE</tt></p></div></div></div></div>
+<div class="section">
+<h2><a name="Path_Expressions"></a><a name="Path_expressions" id="Path_expressions">Path Expressions</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="PathExpr"></a>PathExpr</h5>
+<p><img src="../images/diagrams/PathExpr.png" alt="" /></p>
+<p>Components of complex types in the data model are accessed via path expressions. Path access can be applied to the result of a query expression that yields an instance of a complex type, for example, an object or an array instance.</p>
+<p>For objects, path access is based on field names, and it accesses the field whose name was specified.</p>
+<p>For arrays, path access is based on (zero-based) array-style indexing. Array indices can be used to retrieve either a single element from an array, or a whole subset of an array. Accessing a single element is achieved by providing a single index argument (zero-based element position), while obtaining a subset of an array is achieved by providing the <tt>start</tt> and <tt>end</tt> (zero-based) index positions; the returned subset is from position <tt>start</tt> to position <tt>end - 1</tt>; the <tt>end</tt> position argument is optional. If a position argument is negative then the element position is counted from the end of the array (<tt>-1</tt> addresses the last element, <tt>-2</tt> next to last, and so on).</p>
+<p>Multisets have similar behavior to arrays, except for retrieving arbitrary items as the order of items is not fixed in multisets.</p>
+<p>Attempts to access non-existent fields or out-of-bound array elements produce the special value <tt>MISSING</tt>. Type errors will be raised for inappropriate use of a path expression, such as applying a field accessor to a numeric value.</p>
+<p>The following examples illustrate field access for an object, index-based element access or subset retrieval of an array, and also a composition thereof.</p></div>
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">({&quot;name&quot;: &quot;MyABCs&quot;, &quot;array&quot;: [ &quot;a&quot;, &quot;b&quot;, &quot;c&quot;]}).array    -- &#x278a;
+([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;])[2]                                     -- &#x278b;
+([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;])[-1]                                    -- &#x278c;
+({&quot;name&quot;: &quot;MyABCs&quot;, &quot;array&quot;: [ &quot;a&quot;, &quot;b&quot;, &quot;c&quot;]}).array[2] -- &#x278d;
+([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;])[0:2]                                   -- &#x278e;
+([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;])[0:]                                    -- &#x278f;
+([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;])[-2:-1]                                 -- &#x2790;
+</pre></div></div>
+
+<p>&#x2780; Returns <tt>[[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]]</tt><br />
+&#x2781; Returns <tt>[&quot;c&quot;]</tt><br />
+&#x2782; Returns <tt>[&quot;c&quot;]</tt><br />
+&#x2783; Returns <tt>[&quot;c&quot;]</tt><br />
+&#x2784; Returns <tt>[[&quot;a&quot;, &quot;b&quot;]]</tt><br />
+&#x2785; Returns <tt>[[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]]</tt><br />
+&#x2786; Returns <tt>[[&quot;b&quot;]]</tt></p></div></div></div></div>
+<div class="section">
+<h2><a name="Primary_Expressions"></a><a name="Primary_expressions" id="Primary_expressions">Primary Expressions</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="PrimaryExpr"></a>PrimaryExpr</h5>
+<p><img src="../images/diagrams/PrimaryExpr.png" alt="" /></p>
+<p>The most basic building block for any expression in SQL++ is Primary Expression. This can be a simple literal (constant) value, a reference to a query variable that is in scope, a parenthesized expression, a function call, or a newly constructed instance of the data model (such as a newly constructed object, array, or multiset of data model instances).</p></div></div></div>
+<div class="section">
+<h3><a name="Literals" id="Literals">Literals</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="Literal"></a>Literal</h5>
+<p><img src="../images/diagrams/Literal.png" alt="" /></p>
+<p>The simplest kind of expression is a literal that directly represents a value in JSON format. Here are some examples:</p>
+
+<div>
+<div>
+<pre class="source">-42
+&quot;Hello&quot;
+true
+false
+null
+</pre></div></div>
+
+<p>Numeric literals may include a sign and an optional decimal point. They may also be written in exponential notation, like this:</p>
+
+<div>
+<div>
+<pre class="source">5e2
+-4.73E-2
+</pre></div></div>
+
+<p>String literals may be enclosed in either single quotes or double quotes. Inside a string literal, the delimiter character for that string must be &#x201c;escaped&#x201d; by a backward slash, as in these examples:</p>
+
+<div>
+<div>
+<pre class="source">&quot;I read \&quot;War and Peace\&quot; today.&quot;
+'I don\'t believe everything I read.'
+</pre></div></div>
+
+<p>The table below shows how to escape characters in SQL++.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th>Character Name </th>
+<th>Escape Method</th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td>Single Quote</td>
+<td> <tt>\'</tt></td></tr>
+<tr class="a">
+<td>Double Quote</td>
+<td><tt>\&quot;</tt></td></tr>
+<tr class="b">
+<td>Backslash</td>
+<td><tt>\\</tt></td></tr>
+<tr class="a">
+<td>Slash</td>
+<td><tt>\/</tt></td></tr>
+<tr class="b">
+<td>Backspace</td>
+<td><tt>\b</tt></td></tr>
+<tr class="a">
+<td>Formfeed</td>
+<td><tt>\f</tt></td></tr>
+<tr class="b">
+<td>Newline</td>
+<td><tt>\n</tt></td></tr>
+<tr class="a">
+<td>CarriageReturn</td>
+<td><tt>\r</tt></td></tr>
+<tr class="b">
+<td>EscapeTab</td>
+<td><tt>\t</tt></td></tr>
+</tbody>
+</table></div></div></div>
+<div class="section">
+<h3><a name="Identifiers_and_Variable_References"></a><a name="Variable_references" id="Variable_references">Identifiers and Variable References</a></h3>
+<p>Like SQL, SQL++ makes use of a language construct called an <i>identifier</i>. An identifier starts with an alphabetic character or the underscore character _ , and contains only case-sensitive alphabetic characters, numeric digits, or the special characters _ and $. It is also possible for an identifier to include other special characters, or to be the same as a reserved word, by enclosing the identifier in back-ticks (it&#x2019;s then called a <i>delimited identifier</i>). Identifiers are used in variable names and in certain other places in SQL++ syntax, such as in path expressions, which we&#x2019;ll discuss soon. Here are some examples of identifiers:</p>
+
+<div>
+<div>
+<pre class="source">X
+customer_name
+`SELECT`
+`spaces in here`
+`@&amp;#`
+</pre></div></div>
+
+<p>A very simple kind of SQL++ expression is a variable, which is simply an identifier. As in SQL, a variable can be bound to a value, which may be an input dataset, some intermediate result during processing of a query, or the final result of a query. We&#x2019;ll learn more about variables when we discuss queries.</p>
+<p>Note that the SQL++ rules for delimiting strings and identifiers are different from the SQL rules. In SQL, strings are always enclosed in single quotes, and double quotes are used for delimited identifiers.</p></div>
+<div class="section">
+<h3><a name="Parameter_References"></a><a name="Parameter_references" id="Parameter_references">Parameter References</a></h3>
+<p>A parameter reference is an external variable. Its value is provided using the <a href="../api.html#queryservice">statement execution API</a>.</p>
+<p>Parameter references come in two forms, <i>Named Parameter References</i> and <i>Positional Parameter References</i>.</p>
+<p>Named parameter references consist of the &#x201c;$&#x201d; symbol followed by an identifier or delimited identifier.</p>
+<p>Positional parameter references can be either a &#x201c;$&#x201d; symbol followed by one or more digits or a &#x201c;?&#x201d; symbol. If numbered, positional parameters start at 1. &#x201c;?&#x201d; parameters are interpreted as $1 to $N based on the order in which they appear in the statement.</p>
+<p>Parameter references may appear as shown in the below examples:</p>
+<div class="section">
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">$id
+$1
+?
+</pre></div></div>
+
+<p>An error will be raised in the parameter is not bound at query execution time.</p></div></div></div>
+<div class="section">
+<h3><a name="Parenthesized_Expressions"></a><a name="Parenthesized_expressions" id="Parenthesized_expressions">Parenthesized Expressions</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="ParenthesizedExpr"></a>ParenthesizedExpr</h5>
+<p><img src="../images/diagrams/ParenthesizedExpr.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Subquery"></a>Subquery</h5>
+<p><img src="../images/diagrams/Subquery.png" alt="" /></p>
+<p>An expression can be parenthesized to control the precedence order or otherwise clarify a query. A <a href="#Subqueries">subquery</a> (nested <a href="#Union_all">selection</a>) may also be enclosed in parentheses. For more on these topics please see their respective sections.</p>
+<p>The following expression evaluates to the value 2.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">( 1 + 1 )
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Function_Calls"></a><a name="Function_call_expressions" id="Function_call_expressions">Function Calls</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="FunctionCall"></a>FunctionCall</h5>
+<p><img src="../images/diagrams/FunctionCall.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="OrdinaryFunctionCall"></a>OrdinaryFunctionCall</h5>
+<p><img src="../images/diagrams/OrdinaryFunctionCall.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="AggregateFunctionCall"></a>AggregateFunctionCall</h5>
+<p><img src="../images/diagrams/AggregateFunctionCall.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DataverseName"></a>DataverseName</h5>
+<p><img src="../images/diagrams/DataverseName.png" alt="" /></p>
+<p>Functions are included in SQL++, like most languages, as a way to package useful functionality or to componentize complicated or reusable computations. A function call is a legal query expression that represents the value resulting from the evaluation of its body expression with the given parameter bindings; the parameter value bindings can themselves be any expressions in SQL++.</p>
+<p>Note that Window functions, and aggregate functions used as window functions, have a more complex syntax. Window function calls are described in the section on <a href="#Over_clauses">Window Queries</a>.</p>
+<p>Also note that FILTER expressions can only be specified when calling <a href="#Aggregation_PseudoFunctions">Aggregation Pseudo-Functions</a>.</p>
+<p>The following example is a function call expression whose value is 8.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">length('a string')
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Case_Expressions"></a><a name="Case_expressions" id="Case_expressions">Case Expressions</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="CaseExpr"></a>CaseExpr</h5>
+<p><img src="../images/diagrams/CaseExpr.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="SimpleCaseExpr"></a>SimpleCaseExpr</h5>
+<p><img src="../images/diagrams/SimpleCaseExpr.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="SearchedCaseExpr"></a>SearchedCaseExpr</h5>
+<p><img src="../images/diagrams/SearchedCaseExpr.png" alt="" /></p>
+<p>In a simple <tt>CASE</tt> expression, the query evaluator searches for the first <tt>WHEN</tt> &#x2026; <tt>THEN</tt> pair in which the <tt>WHEN</tt> expression is equal to the expression following <tt>CASE</tt> and returns the expression following <tt>THEN</tt>. If none of the <tt>WHEN</tt> &#x2026; <tt>THEN</tt> pairs meet this condition, and an <tt>ELSE</tt> branch exists, it returns the <tt>ELSE</tt> expression. Otherwise, <tt>NULL</tt> is returned.</p>
+<p>In a searched CASE expression, the query evaluator searches from left to right until it finds a <tt>WHEN</tt> expression that is evaluated to <tt>TRUE</tt>, and then returns its corresponding <tt>THEN</tt> expression. If no condition is found to be <tt>TRUE</tt>, and an <tt>ELSE</tt> branch exists, it returns the <tt>ELSE</tt> expression. Otherwise, it returns <tt>NULL</tt>.</p>
+<p>The following example illustrates the form of a case expression.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CASE (2 &lt; 3) WHEN true THEN &quot;yes&quot; ELSE &quot;no&quot; END
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Constructors" id="Constructors">Constructors</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="Constructor"></a>Constructor</h5>
+<p><img src="../images/diagrams/Constructor.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ObjectConstructor"></a>ObjectConstructor</h5>
+<p><img src="../images/diagrams/ObjectConstructor.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ArrayConstructor"></a>ArrayConstructor</h5>
+<p><img src="../images/diagrams/ArrayConstructor.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ParenthesizedArrayConstructor"></a>ParenthesizedArrayConstructor</h5>
+<p><img src="../images/diagrams/ParenthesizedArrayConstructor.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="MultisetConstructor"></a>MultisetConstructor</h5>
+<p><img src="../images/diagrams/MultisetConstructor.png" alt="" /></p>
+<p>Structured JSON values can be represented by constructors, as in these examples:</p>
+
+<div>
+<div>
+<pre class="source">{ &quot;name&quot;: &quot;Bill&quot;, &quot;age&quot;: 42 } -- &#x278a;
+[ 1, 2, &quot;Hello&quot;, null ]       -- &#x278b;
+</pre></div></div>
+
+<p>&#x2780; An object<br />
+&#x2781; An array</p>
+<p>In a constructed object, the names of the fields must be strings (either literal strings or computed strings), and an object may not contain any duplicate names. Of course, structured literals can be nested, as in this example:</p>
+
+<div>
+<div>
+<pre class="source">[ {&quot;name&quot;: &quot;Bill&quot;,
+   &quot;address&quot;:
+      {&quot;street&quot;: &quot;25 Main St.&quot;,
+       &quot;city&quot;: &quot;Cincinnati, OH&quot;
+      }
+  },
+  {&quot;name&quot;: &quot;Mary&quot;,
+   &quot;address&quot;:
+      {&quot;street&quot;: &quot;107 Market St.&quot;,
+       &quot;city&quot;: &quot;St. Louis, MO&quot;
+      }
+   }
+]
+</pre></div></div>
+
+<p>The array items in an array constructor, and the field-names and field-values in an object constructor, may be represented by expressions. For example, suppose that the variables firstname, lastname, salary, and bonus are bound to appropriate values. Then structured values might be constructed by the following expressions:</p>
+<p>An object:</p>
+
+<div>
+<div>
+<pre class="source">{
+  &quot;name&quot;: firstname || &quot; &quot; || lastname,
+  &quot;income&quot;: salary + bonus
+}
+</pre></div></div>
+
+<p>An array:</p>
+
+<div>
+<div>
+<pre class="source">[&quot;1984&quot;, lastname, salary + bonus, null]
+</pre></div></div>
+
+<p>If only one expression is specified instead of the field-name/field-value pair in an object constructor then this expression is supposed to provide the field value. The field name is then automatically generated based on the kind of the value expression as in Q2.1:</p>
+<ul>
+
+<li>If it is a variable reference expression then the generated field name is the name of that variable.</li>
+<li>If it is a field access expression then the generated field name is the last identifier in that expression.</li>
+<li>For all other cases, a compilation error will be raised.</li>
+</ul></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q2.1)</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+WHERE c.custid = &quot;C47&quot;
+SELECT VALUE {c.name, c.rating}
+</pre></div></div>
+
+<p>This query outputs:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;name&quot;: &quot;S. Logan&quot;,
+        &quot;rating&quot;: 625
+    }
+]
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Queries" id="Queries">3. Queries</a></h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>A <i>query</i> can be an expression, or it can be constructed from blocks of code called <i>query blocks</i>. A query block may contain several clauses, including <tt>SELECT</tt>, <tt>FROM</tt>, <tt>LET</tt>, <tt>WHERE</tt>, <tt>GROUP BY</tt>, and <tt>HAVING</tt>.</p></div>
+<div class="section">
+<h5><a name="Query"></a>Query</h5>
+<p><img src="../images/diagrams/Query.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Selection"></a>Selection</h5>
+<p><img src="../images/diagrams/Selection.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="QueryBlock"></a>QueryBlock</h5>
+<p><img src="../images/diagrams/QueryBlock.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="StreamGenerator"></a>StreamGenerator</h5>
+<p><img src="../images/diagrams/StreamGenerator.png" alt="" /></p>
+<p>Note that, unlike SQL, SQL++ allows the <tt>SELECT</tt> clause to appear either at the beginning or at the end of a query block. For some queries, placing the <tt>SELECT</tt> clause at the end may make a query block easier to understand, because the <tt>SELECT</tt> clause refers to variables defined in the other clauses.</p></div></div></div></div>
+<div class="section">
+<h2><a name="SELECT_Clause"></a><a name="Select_clauses" id="Select_clauses">SELECT Clause</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="SelectClause"></a>SelectClause</h5>
+<p><img src="../images/diagrams/SelectClause.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Projection"></a>Projection</h5>
+<p><img src="../images/diagrams/Projection.png" alt="" /></p>
+<p>Synonyms for <tt>VALUE</tt>: <tt>ELEMENT</tt>, <tt>RAW</tt></p>
+<p>In a query block, the <tt>FROM</tt>, <tt>WHERE</tt>, <tt>GROUP BY</tt>, and <tt>HAVING</tt> clauses (if present) are collectively called the Stream Generator. All these clauses, taken together, generate a stream of tuples of bound variables. The <tt>SELECT</tt> clause then uses these bound variables to generate the output of the query block.</p>
+<p>For example, the clause <tt>FROM customers AS c</tt> scans over the <tt>customers</tt> collection, binding the variable <tt>c</tt> to each <tt>customer</tt> object in turn, producing a stream of bindings.</p>
+<p>Here&#x2019;s a slightly more complex example of a stream generator:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c, orders AS o
+WHERE c.custid = o.custid
+</pre></div></div>
+
+<p>In this example, the <tt>FROM</tt> clause scans over the customers and orders collections, producing a stream of variable pairs (<tt>c</tt>, <tt>o</tt>) in which <tt>c</tt> is bound to a <tt>customer</tt> object and <tt>o</tt> is bound to an <tt>order</tt> object. The <tt>WHERE</tt> clause then retains only those pairs in which the custid values of the two objects match.</p>
+<p>The output of the query block is a collection containing one output item for each tuple produced by the stream generator. If the stream generator produces no tuples, the output of the query block is an empty collection. Depending on the <tt>SELECT</tt> clause, each output item may be an object or some other kind of value.</p>
+<p>In addition to using the variables bound by previous clauses, the <tt>SELECT</tt> clause may create and bind some additional variables. For example, the clause <tt>SELECT salary + bonus AS pay</tt> creates the variable <tt>pay</tt> and binds it to the value of <tt>salary + bonus</tt>. This variable may then be used in a later <tt>ORDER BY</tt> clause.</p>
+<p>In SQL++, the <tt>SELECT</tt> clause may appear either at the beginning or at the end of a query block. Since the <tt>SELECT</tt> clause depends on variables that are bound in the other clauses, the examples in this section place <tt>SELECT</tt> at the end of the query blocks.</p></div></div></div>
+<div class="section">
+<h3><a name="SELECT_VALUE"></a><a name="Select_element" id="Select_element">SELECT VALUE</a></h3>
+<p>The <tt>SELECT VALUE</tt> clause returns an array or multiset that contains the results of evaluating the <tt>VALUE</tt> expression, with one evaluation being performed per &#x201c;binding tuple&#x201d; (i.e., per <tt>FROM</tt> clause item) satisfying the statement&#x2019;s selection criteria. If there is no <tt>FROM</tt> clause, the expression after <tt>VALUE</tt> is evaluated once with no binding tuples (except those inherited from an outer environment).</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.1)</p>
+
+<div>
+<div>
+<pre class="source">SELECT VALUE 1;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+   1
+]
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.2) The following query returns the names of all customers whose rating is above 650.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+WHERE c.rating &gt; 650
+SELECT VALUE name;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    &quot;T. Cody&quot;,
+    &quot;M. Sinclair&quot;,
+    &quot;T. Henry&quot;
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="SQL-style_SELECT"></a><a name="SQL_select" id="SQL_select">SQL-style SELECT</a></h3>
+<p>Traditional SQL-style <tt>SELECT</tt> syntax is also supported in SQL++, however the result of a query is not guaranteed to preserve the order of expressions in the <tt>SELECT</tt> clause.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.3) The following query returns the names and customers ids of any customers whose rating is 750.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+WHERE c.rating = 750
+SELECT c.name AS customer_name, c.custid AS customer_id;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;customer_id&quot;: &quot;C13&quot;,
+        &quot;customer_name&quot;: &quot;T. Cody&quot;
+    },
+    {
+        &quot;customer_id&quot;: &quot;C37&quot;,
+        &quot;customer_name&quot;: &quot;T. Henry&quot;
+    }
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="SELECT_.2A"></a><a name="Select_star" id="Select_star">SELECT *</a></h3>
+<p>As in SQL, the phrase <tt>SELECT *</tt> suggests, &#x201c;select everything.&#x201d;</p>
+<p>For each binding tuple in the stream, <tt>SELECT *</tt> produces an output object. For each variable in the binding tuple, the output object contains a field: the name of the field is the name of the variable, and the value of the field is the value of the variable. Essentially, <tt>SELECT *</tt> means, &#x201c;return all the bound variables, with their names and values.&#x201d;</p>
+<p>The effect of <tt>SELECT *</tt> can be illustrated by an example based on two small collections named <tt>ages</tt> and <tt>eyes</tt>. The contents of the two collections are as follows:</p>
+<p><tt>ages</tt>:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;name&quot;: &quot;Bill&quot;, &quot;age&quot;: 21 },
+    { &quot;name&quot;: &quot;Sue&quot;, &quot;age&quot;: 32 }
+]
+</pre></div></div>
+
+<p><tt>eyes</tt>:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;name&quot;: &quot;Bill&quot;, &quot;eyecolor&quot;: &quot;brown&quot; },
+    { &quot;name&quot;: &quot;Sue&quot;, &quot;eyecolor&quot;: &quot;blue&quot; }
+]
+</pre></div></div>
+
+<p>The following example applies <tt>SELECT *</tt> to a single collection.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.4a) Return all the information in the <tt>ages</tt> collection.</p>
+
+<div>
+<div>
+<pre class="source">FROM ages AS a
+SELECT * ;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;a&quot;: { &quot;name&quot;: &quot;Bill&quot;, &quot;age&quot;: 21 },
+    },
+    { &quot;a&quot;: { &quot;name&quot;: &quot;Sue&quot;, &quot;age&quot;: 32}
+    }
+]
+</pre></div></div>
+
+<p>Note that the variable-name <tt>a</tt> appears in the query result. If the <tt>FROM</tt> clause had been simply <tt>FROM ages</tt> (omitting <tt>AS a</tt>), the variable-name in the query result would have been <tt>ages</tt>.</p>
+<p>The next example applies <tt>SELECT *</tt> to a join of two collections.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.4b) Return all the information in a join of <tt>ages</tt> and <tt>eyes</tt> on matching name fields.</p>
+
+<div>
+<div>
+<pre class="source">FROM ages AS a, eyes AS e
+WHERE a.name = e.name
+SELECT * ;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;a&quot;: { &quot;name&quot;: &quot;Bill&quot;, &quot;age&quot;: 21 },
+      &quot;e&quot;: { &quot;name&quot;: &quot;Bill&quot;, &quot;eyecolor&quot;: &quot;Brown&quot; }
+    },
+    { &quot;a&quot;: { &quot;name&quot;: &quot;Sue&quot;, &quot;age&quot;: 32 },
+      &quot;e&quot;: { &quot;name&quot;: &quot;Sue&quot;, &quot;eyecolor&quot;: &quot;Blue&quot; }
+    }
+]
+</pre></div></div>
+
+<p>Note that the result of <tt>SELECT *</tt> in SQL++ is more complex than the result of <tt>SELECT *</tt> in SQL.</p></div></div></div>
+<div class="section">
+<h3><a name="SELECT_variable..2A"></a><a name="Select_variable_star" id="Select_variable_star">SELECT <i>variable</i>.*</a></h3>
+<p>SQL++ has an alternative version of <tt>SELECT *</tt> in which the star is preceded by a variable.</p>
+<p>Whereas the version without a named variable means, &#x201c;return all the bound variables, with their names and values,&#x201d; <tt>SELECT</tt> <i>variable</i> <tt>.*</tt> means &#x201c;return only the named variable, and return only its value, not its name.&#x201d;</p>
+<p>The following example can be compared with (Q3.4a) to see the difference between the two versions of <tt>SELECT *</tt>:</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.4c) Return all information in the <tt>ages</tt> collection.</p>
+
+<div>
+<div>
+<pre class="source">FROM ages AS a
+SELECT a.*
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;name&quot;: &quot;Bill&quot;, &quot;age&quot;: 21 },
+    { &quot;name&quot;: &quot;Sue&quot;, &quot;age&quot;: 32 }
+]
+</pre></div></div>
+
+<p>Note that, for queries over a single collection, <tt>SELECT</tt> <i>variable</i> <tt>.*</tt> returns a simpler result and therefore may be preferable to <tt>SELECT *</tt>.</p>
+<p>In fact, <tt>SELECT</tt> <i>variable</i> <tt>.*</tt>, like <tt>SELECT *</tt> in SQL, is equivalent to a <tt>SELECT</tt> clause that enumerates all the fields of the collection, as in (Q3.4d):</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.4d) Return all the information in the <tt>ages</tt> collection.</p>
+
+<div>
+<div>
+<pre class="source">FROM ages AS a
+SELECT a.name, a.age
+</pre></div></div>
+
+<p>(same result as (Q3.4c))</p>
+<p><tt>SELECT</tt> <i>variable</i> <tt>.*</tt> has an additional application. It can be used to return all the fields of a nested object. To illustrate this use, we will use the <tt>customers</tt> dataset in the example database &#x2014; see <a href="#Manual_data">Appendix 4</a>.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.4e) In the <tt>customers</tt> dataset, return all the fields of the <tt>address</tt> objects that have zipcode &#x201c;02340&#x201d;.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+WHERE c.address.zipcode = &quot;02340&quot;
+SELECT address.*  ;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;street&quot;: &quot;690 River St.&quot;,
+        &quot;city&quot;: &quot;Hanover, MA&quot;,
+        &quot;zipcode&quot;: &quot;02340&quot;
+    }
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="SELECT_DISTINCT"></a><a name="Select_distinct" id="Select_distinct">SELECT DISTINCT</a></h3>
+<p>The <tt>DISTINCT</tt> keyword is used to eliminate duplicate items from the results of a query block.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.5a) Returns all of the different cities in the <tt>customers</tt> dataset.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+SELECT DISTINCT c.address.city;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;city&quot;: &quot;Boston, MA&quot;
+    },
+    {
+        &quot;city&quot;: &quot;Hanover, MA&quot;
+    },
+    {
+        &quot;city&quot;: &quot;St. Louis, MO&quot;
+    },
+    {
+        &quot;city&quot;: &quot;Rome, Italy&quot;
+    }
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="SELECT_EXCLUDE"></a><a name="Select_exclude" id="Select_exclude">SELECT EXCLUDE</a></h3>
+<p>The <tt>EXCLUDE</tt> keyword is used to remove one or more fields that would otherwise be returned from the <tt>SELECT</tt> clause. Conceptually, the scope of the <tt>EXCLUDE</tt> clause is the output of the <tt>SELECT</tt> clause itself. In a Stream Generator with both <tt>DISTINCT</tt> and <tt>EXCLUDE</tt> clauses, the <tt>DISTINCT</tt> clause is applied after the <tt>EXCLUDE</tt> clause.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.5b) For the customer with <tt>custid = C13</tt>, return their information <i>excluding</i> the <tt>zipcode</tt> field inside the <tt>address</tt> object and the top-level <tt>name</tt> field.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+WHERE c.custid = &quot;C13&quot;
+SELECT c.* EXCLUDE address.zipcode, name;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;201 Main St.&quot;,
+            &quot;city&quot;: &quot;St. Louis, MO&quot;
+        },
+        &quot;rating&quot;: 750
+    }
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Unnamed_Projections"></a><a name="Unnamed_projections" id="Unnamed_projections">Unnamed Projections</a></h3>
+<p>Similar to standard SQL, the query language supports unnamed projections (a.k.a, unnamed <tt>SELECT</tt> clause items), for which names are generated rather than user-provided. Name generation has three cases:</p>
+<ul>
+
+<li>If a projection expression is a variable reference expression, its generated name is the name of the variable.</li>
+<li>If a projection expression is a field access expression, its generated name is the last identifier in the expression.</li>
+<li>For all other cases, the query processor will generate a unique name.</li>
+</ul>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.6) Returns the last digit and the order date of all orders for the customer whose ID is &#x201c;C41&#x201d;.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+WHERE o.custid = &quot;C41&quot;
+SELECT o.orderno % 1000,  o.order_date;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;$1&quot;: 1,
+        &quot;order_date&quot;: &quot;2020-04-29&quot;
+    },
+    {
+        &quot;$1&quot;: 6,
+        &quot;order_date&quot;: &quot;2020-09-02&quot;
+    }
+]
+</pre></div></div>
+
+<p>In the result, <tt>$1</tt> is the generated name for <tt>o.orderno % 1000</tt>, while <tt>order_date</tt> is the generated name for <tt>o.order_date</tt>. It is good practice, however, to not rely on the randomly generated names which can be confusing and irrelevant. Instead, practice good naming conventions by providing a meaningful and concise name which properly describes the selected item.</p></div></div></div>
+<div class="section">
+<h3><a name="Abbreviated_Field_Access_Expressions"></a><a name="Abbreviated_field_access_expressions" id="Abbreviated_field_access_expressions">Abbreviated Field Access Expressions</a></h3>
+<p>As in standard SQL, field access expressions can be abbreviated when there is no ambiguity. In the next example, the variable <tt>o</tt> is the only possible variable reference for fields <tt>orderno</tt> and <tt>order_date</tt> and thus could be omitted in the query. This practice is not recommended, however, as queries may have fields (such as <tt>custid</tt>) which can be present in multiple datasets. More information on abbreviated field access can be found in the appendix section on Variable Resolution.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.7) Same as Q3.6, omitting the variable reference for the order number and date and providing custom names for <tt>SELECT</tt> clause items.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+WHERE o.custid = &quot;C41&quot;
+SELECT orderno % 1000 AS last_digit, order_date;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;last_digit&quot;: 1,
+        &quot;order_date&quot;: &quot;2020-04-29&quot;
+    },
+    {
+        &quot;last_digit&quot;: 6,
+        &quot;order_date&quot;: &quot;2020-09-02&quot;
+    }
+]
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="FROM_Clause"></a><a name="From_clauses" id="From_clauses">FROM Clause</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="FromClause"></a>FromClause</h5>
+<p><img src="../images/diagrams/FromClause.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="FromTerm"></a>FromTerm</h5>
+<p><img src="../images/diagrams/FromTerm.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="NamedExpr"></a>NamedExpr</h5>
+<p><img src="../images/diagrams/NamedExpr.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="JoinStep"></a>JoinStep</h5>
+<p><img src="../images/diagrams/JoinStep.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="UnnestStep"></a>UnnestStep</h5>
+<p><img src="../images/diagrams/UnnestStep.png" alt="" /></p>
+<p>Synonyms for <tt>UNNEST</tt>: <tt>CORRELATE</tt>, <tt>FLATTEN</tt></p>
+<p>The purpose of a <tt>FROM</tt> clause is to iterate over a collection, binding a variable to each item in turn. Here&#x2019;s a query that iterates over the <tt>customers</tt> dataset, choosing certain customers and returning some of their attributes.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.8) List the customer ids and names of the customers in zipcode 63101, in order by their customer IDs.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers
+WHERE address.zipcode = &quot;63101&quot;
+SELECT custid AS customer_id, name
+ORDER BY customer_id;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;customer_id&quot;: &quot;C13&quot;,
+        &quot;name&quot;: &quot;T. Cody&quot;
+    },
+    {
+        &quot;customer_id&quot;: &quot;C31&quot;,
+        &quot;name&quot;: &quot;B. Pruitt&quot;
+    },
+    {
+        &quot;customer_id&quot;: &quot;C41&quot;,
+        &quot;name&quot;: &quot;R. Dodge&quot;
+    }
+]
+</pre></div></div>
+
+<p>Let&#x2019;s take a closer look at what this <tt>FROM</tt> clause is doing. A <tt>FROM</tt> clause always produces a stream of bindings, in which an iteration variable is bound in turn to each item in a collection. In Q3.8, since no explicit iteration variable is provided, the <tt>FROM</tt> clause defines an implicit variable named <tt>customers</tt>, the same name as the dataset that is being iterated over. The implicit iteration variable serves as the object-name for all field-names in the query block that do not have explicit object-names. Thus, <tt>address.zipcode</tt> really means <tt>customers.address.zipcode</tt>, <tt>custid</tt> really means <tt>customers.custid</tt>, and <tt>name</tt> really means <tt>customers.name</tt>.</p>
+<p>You may also provide an explicit iteration variable, as in this version of the same query:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.9) Alternative version of Q3.8 (same result).</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+WHERE c.address.zipcode = &quot;63101&quot;
+SELECT c.custid AS customer_id, c.name
+ORDER BY customer_id;
+</pre></div></div>
+
+<p>In Q3.9, the variable <tt>c</tt> is bound to each <tt>customer</tt> object in turn as the query iterates over the <tt>customers</tt> dataset. An explicit iteration variable can be used to identify the fields of the referenced object, as in <tt>c.name</tt> in the <tt>SELECT</tt> clause of Q3.9. When referencing a field of an object, the iteration variable can be omitted when there is no ambiguity. For example, <tt>c.name</tt> could be replaced by <tt>name</tt> in the <tt>SELECT</tt> clause of Q3.9. That&#x2019;s why field-names like <tt>name</tt> and <tt>custid</tt> could stand by themselves in the Q3.8 version of this query.</p>
+<p>In the examples above, the <tt>FROM</tt> clause iterates over the objects in a dataset. But in general, a <tt>FROM</tt> clause can iterate over any collection. For example, the objects in the <tt>orders</tt> dataset each contain a field called <tt>items</tt>, which is an array of nested objects. In some cases, you will write a <tt>FROM</tt> clause that iterates over a nested array like <tt>items</tt>.</p>
+<p>The stream of objects (more accurately, variable bindings) that is produced by the <tt>FROM</tt> clause does not have any particular order. The system will choose the most efficient order for the iteration. If you want your query result to have a specific order, you must use an <tt>ORDER BY</tt> clause.</p>
+<p>It&#x2019;s good practice to specify an explicit iteration variable for each collection in the <tt>FROM</tt> clause, and to use these variables to qualify the field-names in other clauses. Here are some reasons for this convention:</p>
+<ul>
+
+<li>
+
+<p>It&#x2019;s nice to have different names for the collection as a whole and an object in the collection. For example, in the clause <tt>FROM customers AS c</tt>, the name <tt>customers</tt> represents the dataset and the name <tt>c</tt> represents one object in the dataset.</p>
+</li>
+<li>
+
+<p>In some cases, iteration variables are required. For example, when joining a dataset to itself, distinct iteration variables are required to distinguish the left side of the join from the right side.</p>
+</li>
+<li>
+
+<p>In a subquery it&#x2019;s sometimes necessary to refer to an object in an outer query block (this is called a <i>correlated subquery</i>). To avoid confusion in correlated subqueries, it&#x2019;s best to use explicit variables.</p>
+</li>
+</ul></div></div></div>
+<div class="section">
+<h3><a name="Joins"></a><a name="Join_clauses" id="Join_clauses">Joins</a></h3>
+<p>A <tt>FROM</tt> clause gets more interesting when there is more than one collection involved. The following query iterates over two collections: <tt>customers</tt> and <tt>orders</tt>. The <tt>FROM</tt> clause produces a stream of binding tuples, each containing two variables, <tt>c</tt> and <tt>o</tt>. In each binding tuple, <tt>c</tt> is bound to an object from <tt>customers</tt>, and <tt>o</tt> is bound to an object from <tt>orders</tt>. Conceptually, at this point, the binding tuple stream contains all possible pairs of a customer and an order (this is called the <i>Cartesian product</i> of <tt>customers</tt> and <tt>orders</tt>). Of course, we are interested only in pairs where the <tt>custid</tt> fields match, and that condition is expressed in the <tt>WHERE</tt> clause, along with the restriction that the order number must be 1001.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.10) Create a packing list for order number 1001, showing the customer name and address and all the items in the order.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c, orders AS o
+WHERE c.custid = o.custid
+AND o.orderno = 1001
+SELECT o.orderno,
+    c.name AS customer_name,
+    c.address,
+    o.items AS items_ordered;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1001,
+        &quot;customer_name&quot;: &quot;R. Dodge&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;150 Market St.&quot;,
+            &quot;city&quot;: &quot;St. Louis, MO&quot;,
+            &quot;zipcode&quot;: &quot;63101&quot;
+        },
+        &quot;items_ordered&quot;: [
+            {
+                &quot;itemno&quot;: 347,
+                &quot;qty&quot;: 5,
+                &quot;price&quot;: 19.99
+            },
+            {
+                &quot;itemno&quot;: 193,
+                &quot;qty&quot;: 2,
+                &quot;price&quot;: 28.89
+            }
+        ]
+    }
+]
+</pre></div></div>
+
+<p>Q3.10 is called a <i>join query</i> because it joins the <tt>customers</tt> collection and the <tt>orders</tt> collection, using the join condition <tt>c.custid = o.custid</tt>. In SQL++, as in SQL, you can express this query more explicitly by a <tt>JOIN</tt> clause that includes the join condition, as follows:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.11) Alternative statement of Q3.10 (same result).</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c JOIN orders AS o
+    ON c.custid = o.custid
+WHERE o.orderno = 1001
+SELECT o.orderno,
+    c.name AS customer_name,
+    c.address,
+    o.items AS items_ordered;
+</pre></div></div>
+
+<p>Whether you express the join condition in a <tt>JOIN</tt> clause or in a <tt>WHERE</tt> clause is a matter of taste; the result is the same. This manual will generally use a comma-separated list of collection-names in the <tt>FROM</tt> clause, leaving the join condition to be expressed elsewhere. As we&#x2019;ll soon see, in some query blocks the join condition can be omitted entirely.</p>
+<p>There is, however, one case in which an explicit <tt>JOIN</tt> clause is necessary. That is when you need to join collection A to collection B, and you want to make sure that every item in collection A is present in the query result, even if it doesn&#x2019;t match any item in collection B. This kind of query is called a <i>left outer join</i>, and it is illustrated by the following example.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.12) List the customer ID and name, together with the order numbers and dates of their orders (if any) of customers T. Cody and M. Sinclair.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c LEFT OUTER JOIN orders AS o ON c.custid = o.custid
+WHERE c.name = &quot;T. Cody&quot;
+   OR c.name = &quot;M. Sinclair&quot;
+SELECT c.custid, c.name, o.orderno, o.order_date
+ORDER BY c.custid, o.order_date;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;orderno&quot;: 1002,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;order_date&quot;: &quot;2020-05-01&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;orderno&quot;: 1007,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;order_date&quot;: &quot;2020-09-13&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;orderno&quot;: 1008,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;order_date&quot;: &quot;2020-10-13&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;orderno&quot;: 1009,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;order_date&quot;: &quot;2020-10-13&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C25&quot;,
+        &quot;name&quot;: &quot;M. Sinclair&quot;
+    }
+]
+</pre></div></div>
+
+<p>As you can see from the result of this left outer join, our data includes four orders from customer T. Cody, but no orders from customer M. Sinclair. The behavior of left outer join in SQL++ is different from that of SQL. SQL would have provided M. Sinclair with an order in which all the fields were <tt>null</tt>. SQL++, on the other hand, deals with schemaless data, which permits it to simply omit the order fields from the outer join.</p>
+<p>Now we&#x2019;re ready to look at a new kind of join that was not provided (or needed) in original SQL. Consider this query:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.13) For every case in which an item is ordered in a quantity greater than 100, show the order number, date, item number, and quantity.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items AS i
+WHERE i.qty &gt; 100
+SELECT o.orderno, o.order_date, i.itemno AS item_number,
+    i.qty AS quantity
+ORDER BY o.orderno, item_number;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1002,
+        &quot;order_date&quot;: &quot;2020-05-01&quot;,
+        &quot;item_number&quot;: 680,
+        &quot;quantity&quot;: 150
+    },
+    {
+        &quot;orderno&quot;: 1005,
+        &quot;order_date&quot;: &quot;2020-08-30&quot;,
+        &quot;item_number&quot;: 347,
+        &quot;quantity&quot;: 120
+    },
+    {
+        &quot;orderno&quot;: 1006,
+        &quot;order_date&quot;: &quot;2020-09-02&quot;,
+        &quot;item_number&quot;: 460,
+        &quot;quantity&quot;: 120
+    }
+]
+</pre></div></div>
+
+<p>Q3.13 illustrates a feature called <i>left-correlation</i> in the <tt>FROM</tt> clause. Notice that we are joining <tt>orders</tt>, which is a dataset, to <tt>items</tt>, which is an array nested inside each order. In effect, for each order, we are unnesting the <tt>items</tt> array and joining it to the <tt>order</tt> as though it were a separate collection. For this reason, this kind of query is sometimes called an <i>unnesting query</i>. The keyword <tt>UNNEST</tt> may be used whenever left-correlation is used in a <tt>FROM</tt> clause, as shown in this example:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.14) Alternative statement of Q3.13 (same result).</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o UNNEST o.items AS i
+WHERE i.qty &gt; 100
+SELECT o.orderno, o.order_date, i.itemno AS item_number,
+        i.qty AS quantity
+ORDER BY o.orderno, item_number;
+</pre></div></div>
+
+<p>The results of Q3.13 and Q3.14 are exactly the same. <tt>UNNEST</tt> serves as a reminder that left-correlation is being used to join an object with its nested items. The join condition in Q3.14 is expressed by the left-correlation: each order <tt>o</tt> is joined to its own items, referenced as <tt>o.items</tt>. The result of the <tt>FROM</tt> clause is a stream of binding tuples, each containing two variables, <tt>o</tt> and <tt>i</tt>. The variable <tt>o</tt> is bound to an order and the variable <tt>i</tt> is bound to one item inside that order.</p>
+<p>Like <tt>JOIN</tt>, <tt>UNNEST</tt> has a <tt>LEFT OUTER</tt> option. Q3.14 could have specified:</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o LEFT OUTER UNNEST o.items AS i
+</pre></div></div>
+
+<p>In this case, orders that have no nested items would appear in the query result.</p></div></div></div></div>
+<div class="section">
+<h2><a name="LET_Clause"></a><a name="Let_clauses" id="Let_clauses">LET Clause</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="LetClause"></a>LetClause</h5>
+<p><img src="../images/diagrams/LetClause.png" alt="" /></p>
+<p>Synonyms for <tt>LET</tt>: <tt>LETTING</tt></p>
+<p><tt>LET</tt> clauses can be useful when a (complex) expression is used several times within a query, allowing it to be written once to make the query more concise. The word <tt>LETTING</tt> can also be used, although this is not as common. The next query shows an example.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.15) For each item in an order, the revenue is defined as the quantity times the price of that item. Find individual items for which the revenue is greater than 5000. For each of these, list the order number, item number, and revenue, in descending order by revenue.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items AS i
+LET revenue = i.qty * i.price
+WHERE revenue &gt; 5000
+SELECT o.orderno, i.itemno, revenue
+ORDER by revenue desc;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1006,
+        &quot;itemno&quot;: 460,
+        &quot;revenue&quot;: 11997.6
+    },
+    {
+        &quot;orderno&quot;: 1002,
+        &quot;itemno&quot;: 460,
+        &quot;revenue&quot;: 9594.05
+    },
+    {
+        &quot;orderno&quot;: 1006,
+        &quot;itemno&quot;: 120,
+        &quot;revenue&quot;: 5525
+    }
+]
+</pre></div></div>
+
+<p>The expression for computing revenue is defined once in the <tt>LET</tt> clause and then used three times in the remainder of the query. Avoiding repetition of the revenue expression makes the query shorter and less prone to errors.</p></div></div></div></div>
+<div class="section">
+<h2><a name="WHERE_Clause"></a><a name="Where_having_clauses" id="Where_having_clauses">WHERE Clause</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="WhereClause"></a>WhereClause</h5>
+<p><img src="../images/diagrams/WhereClause.png" alt="" /></p>
+<p>The purpose of a <tt>WHERE</tt> clause is to operate on the stream of binding tuples generated by the <tt>FROM</tt> clause, filtering out the tuples that do not satisfy a certain condition. The condition is specified by an expression based on the variable names in the binding tuples. If the expression evaluates to true, the tuple remains in the stream; if it evaluates to anything else, including <tt>null</tt> or <tt>missing</tt>, it is filtered out. The surviving tuples are then passed along to the next clause to be processed (usually either <tt>GROUP BY</tt> or <tt>SELECT</tt>).</p>
+<p>Often, the expression in a <tt>WHERE</tt> clause is some kind of comparison like <tt>quantity &gt; 100</tt>. However, any kind of expression is allowed in a <tt>WHERE</tt> clause. The only thing that matters is whether the expression returns <tt>true</tt> or not.</p></div></div></div></div>
+<div class="section">
+<h2><a name="Grouping" id="Grouping">Grouping</a></h2>
+<p>Grouping is especially important when manipulating hierarchies like the ones that are often found in JSON data. Often you will want to generate output data that includes both summary data and line items within the summaries. For this purpose, SQL++ supports several important extensions to the traditional grouping features of SQL. The familiar <tt>GROUP BY</tt> and <tt>HAVING</tt> clauses are still there, and they are joined by a new clause called <tt>GROUP AS</tt>. We&#x2019;ll illustrate these clauses by a series of examples.</p>
+<div class="section">
+<h3><a name="GROUP_BY_Clause"></a><a name="Group_By_clauses" id="Group_By_clauses">GROUP BY Clause</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="GroupByClause"></a>GroupByClause</h5>
+<p><img src="../images/diagrams/GroupByClause.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="GroupingElement"></a>GroupingElement</h5>
+<p><img src="../images/diagrams/GroupingElement.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="OrdinaryGroupingSet"></a>OrdinaryGroupingSet</h5>
+<p><img src="../images/diagrams/OrdinaryGroupingSet.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="NamedExpr"></a>NamedExpr</h5>
+<p><img src="../images/diagrams/NamedExpr.png" alt="" /></p>
+<p>We&#x2019;ll begin our discussion of grouping with an example from ordinary SQL.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.16) List the number of orders placed by each customer who has placed an order.</p>
+
+<div>
+<div>
+<pre class="source">SELECT o.custid, COUNT(o.orderno) AS `order count`
+FROM orders AS o
+GROUP BY o.custid
+ORDER BY o.custid;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;order count&quot;: 4,
+        &quot;custid&quot;: &quot;C13&quot;
+    },
+    {
+        &quot;order count&quot;: 1,
+        &quot;custid&quot;: &quot;C31&quot;
+    },
+    {
+        &quot;order count&quot;: 1,
+        &quot;custid&quot;: &quot;C35&quot;
+    },
+    {
+        &quot;order count&quot;: 1,
+        &quot;custid&quot;: &quot;C37&quot;
+    },
+    {
+        &quot;order count&quot;: 2,
+        &quot;custid&quot;: &quot;C41&quot;
+    }
+]
+</pre></div></div>
+
+<p>The input to a <tt>GROUP BY</tt> clause is the stream of binding tuples generated by the <tt>FROM</tt> and <tt>WHERE</tt>clauses. In this query, before grouping, the variable <tt>o</tt> is bound to each object in the <tt>orders</tt> collection in turn.</p>
+<p>SQL++ evaluates the expression in the <tt>GROUP BY</tt> clause, called the grouping expression, once for each of the binding tuples. It then organizes the results into groups in which the grouping expression has a common value (as defined by the <tt>=</tt> operator). In this example, the grouping expression is <tt>o.custid</tt>, and each of the resulting groups is a set of <tt>orders</tt> that have the same <tt>custid</tt>. If necessary, a group is formed for <tt>orders</tt> in which <tt>custid</tt> is <tt>null</tt>, and another group is formed for <tt>orders</tt> that have no <tt>custid</tt>. This query uses the aggregating function <tt>COUNT(o.orderno)</tt>, which counts how many order numbers are in each group. If we are sure that each order object has a distinct <tt>orderno</tt>, we could also simply count the order objects in each group by using <tt>COUNT(*)</tt> in place of <tt>COUNT(o.orderno)</tt>.</p>
+<p>In the <tt>GROUP BY</tt>clause, you may optionally define an alias for the grouping expression. For example, in Q3.16, you could have written <tt>GROUP BY o.custid AS cid</tt>. The alias <tt>cid</tt> could then be used in place of the grouping expression in later clauses. In cases where the grouping expression contains an operator, it is especially helpful to define an alias (for example, <tt>GROUP BY salary + bonus AS pay)</tt>.</p>
+<p>Q3.16 had a single grouping expression, <tt>o.custid</tt>. If a query has multiple grouping expressions, the combination of grouping expressions is evaluated for every binding tuple, and the stream of binding tuples is partitioned into groups that have values in common for all of the grouping expressions. We&#x2019;ll see an example of such a query in Q3.18.</p>
+<p>After grouping, the number of binding tuples is reduced: instead of a binding tuple for each of the input objects, there is a binding tuple for each group. The grouping expressions (identified by their aliases, if any) are bound to the results of their evaluations. However, all the non-grouping fields (that is, fields that were not named in the grouping expressions), are accessible only in a special way: as an argument of one of the special aggregation pseudo-functions such as: <tt>SUM</tt>, <tt>AVG</tt>, <tt>MAX</tt>, <tt>MIN</tt>, <tt>STDEV</tt> and <tt>COUNT</tt>. The clauses that come after grouping can access only properties of groups, including the grouping expressions and aggregate properties of the groups such as <tt>COUNT(o.orderno)</tt> or <tt>COUNT(*)</tt>. (We&#x2019;ll see an exception when we discuss the new <tt>GROUP AS</tt> clause.)</p>
+<p>You may notice that the results of Q3.16 do not include customers who have no <tt>orders</tt>. If we want to include these <tt>customers</tt>, we need to use an outer join between the <tt>customers</tt> and <tt>orders</tt> collections. This is illustrated by the following example, which also includes the name of each customer.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.17) List the number of orders placed by each customer including those customers who have placed no orders.</p>
+
+<div>
+<div>
+<pre class="source">SELECT c.custid, c.name, COUNT(o.orderno) AS `order count`
+FROM customers AS c LEFT OUTER JOIN orders AS o ON c.custid = o.custid
+GROUP BY c.custid, c.name
+ORDER BY c.custid;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;order count&quot;: 4,
+        &quot;name&quot;: &quot;T. Cody&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C25&quot;,
+        &quot;order count&quot;: 0,
+        &quot;name&quot;: &quot;M. Sinclair&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C31&quot;,
+        &quot;order count&quot;: 1,
+        &quot;name&quot;: &quot;B. Pruitt&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C35&quot;,
+        &quot;order count&quot;: 1,
+        &quot;name&quot;: &quot;J. Roberts&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C37&quot;,
+        &quot;order count&quot;: 1,
+        &quot;name&quot;: &quot;T. Henry&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C41&quot;,
+        &quot;order count&quot;: 2,
+        &quot;name&quot;: &quot;R. Dodge&quot;
+    },
+    {
+        &quot;custid&quot;: &quot;C47&quot;,
+        &quot;order count&quot;: 0,
+        &quot;name&quot;: &quot;S. Logan&quot;
+    }
+]
+</pre></div></div>
+
+<p>Notice in Q3.17 what happens when the special aggregation function <tt>COUNT</tt> is applied to a collection that does not exist, such as the orders of M. Sinclair: it returns zero. This behavior is unlike that of the other special aggregation functions <tt>SUM</tt>, <tt>AVG</tt>, <tt>MAX</tt>, and <tt>MIN</tt>, which return <tt>null</tt> if their operand does not exist. This should make you cautious about the <tt>COUNT</tt> function: If it returns zero, that may mean that the collection you are counting has zero members, or that it does not exist, or that you have misspelled the collection&#x2019;s name.</p>
+<p>Q3.17 also shows how a query block can have more than one grouping expression. In general, the <tt>GROUP BY</tt>clause produces a binding tuple for each different combination of values for the grouping expressions. In Q3.17, the <tt>c.custid</tt> field uniquely identifies a customer, so adding <tt>c.name</tt> as a grouping expression does not result in any more groups. Nevertheless, <tt>c.name</tt> must be included as a grouping expression if it is to be referenced outside (after) the <tt>GROUP BY</tt> clause. If <tt>c.name</tt> were not included in the <tt>GROUP BY</tt> clause, it would not be a group property and could not be used in the <tt>SELECT</tt> clause.</p>
+<p>Of course, a grouping expression need not be a simple field-name. In Q3.18, orders are grouped by month, using a temporal function to extract the month component of the order dates. In cases like this, it is helpful to define an alias for the grouping expression so that it can be referenced elsewhere in the query e.g. in the <tt>SELECT</tt> clause.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.18) Find the months in 2020 that had the largest numbers of orders; list the months and their numbers of orders. (Return the top three.)</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o
+WHERE get_year(date(o.order_date)) = 2020
+GROUP BY get_month(date(o.order_date)) AS month
+SELECT month, COUNT(*) AS order_count
+ORDER BY order_count DESC, month DESC
+LIMIT 3;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;month&quot;: 10,
+        &quot;order_count&quot;: 2
+    },
+    {
+        &quot;month&quot;: 9,
+        &quot;order_count&quot;: 2
+    },
+    {
+        &quot;month&quot;: 8,
+        &quot;order_count&quot;: 1
+    }
+]
+</pre></div></div>
+
+<p>Groups are commonly formed from named collections like <tt>customers</tt> and <tt>orders</tt>. But in some queries you need to form groups from a collection that is nested inside another collection, such as <tt>items</tt> inside <tt>orders</tt>. In SQL++ you can do this by using left-correlation in the <tt>FROM</tt> clause to unnest the inner collection, joining the inner collection with the outer collection, and then performing the grouping on the join, as illustrated in Q3.19.</p>
+<p>Q3.19 also shows how a <tt>LET</tt> clause can be used after a <tt>GROUP BY</tt> clause to define an expression that is referenced multiple times in later clauses.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.19) For each order, define the total revenue of the order as the sum of quantity times price for all the items in that order. List the total revenue for all the orders placed by the customer with id &#x201c;C13&#x201d;, in descending order by total revenue.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders as o, o.items as i
+WHERE o.custid = &quot;C13&quot;
+GROUP BY o.orderno
+LET total_revenue = sum(i.qty * i.price)
+SELECT o.orderno, total_revenue
+ORDER BY total_revenue desc;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1002,
+        &quot;total_revenue&quot;: 10906.55
+    },
+    {
+        &quot;orderno&quot;: 1008,
+        &quot;total_revenue&quot;: 1999.8
+    },
+    {
+        &quot;orderno&quot;: 1007,
+        &quot;total_revenue&quot;: 130.45
+    }
+]
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="ROLLUP"></a><a name="Rollup" id="Rollup">ROLLUP</a></h4>
+<p>The <tt>ROLLUP</tt> subclause is an aggregation feature that extends the functionality of the <tt>GROUP BY</tt> clause. It returns extra <i>super-aggregate</i> items in the query results, giving subtotals and a grand total for the aggregate functions in the query. To illustrate, first consider the following query.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.R1) List the number of orders, grouped by customer region and city.</p>
+
+<div>
+<div>
+<pre class="source">SELECT customer_region AS Region,
+       customer_city AS City,
+       COUNT(o.orderno) AS `Order Count`
+FROM customers AS c LEFT OUTER JOIN orders AS o ON c.custid = o.custid
+LET address_line = SPLIT(c.address.city, &quot;,&quot;),
+    customer_city = TRIM(address_line[0]),
+    customer_region = TRIM(address_line[1])
+GROUP BY customer_region, customer_city
+ORDER BY customer_region ASC, customer_city ASC, `Order Count` DESC;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;Region&quot;: &quot;Italy&quot;,
+    &quot;City&quot;: &quot;Rome&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;Boston&quot;,
+    &quot;Order Count&quot;: 2
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;Hanover&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;City&quot;: &quot;St. Louis&quot;,
+    &quot;Order Count&quot;: 7
+  }
+]
+</pre></div></div>
+
+<p>This query uses string functions to split each customer&#x2019;s address into city and region. The query then counts the total number of orders placed by each customer, and groups the results first by customer region, then by customer city. The aggregate results (labeled <tt>Order Count</tt>) are only shown by city, and there are no subtotals or grand total. We can add these using the <tt>ROLLUP</tt> subclause, as in the following example.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.R2) List the number of orders by customer region and city, including subtotals and a grand total.</p>
+
+<div>
+<div>
+<pre class="source">SELECT customer_region AS Region,
+       customer_city AS City,
+       COUNT(o.orderno) AS `Order Count`
+FROM customers AS c LEFT OUTER JOIN orders AS o ON c.custid = o.custid
+LET address_line = SPLIT(c.address.city, &quot;,&quot;),
+    customer_city = TRIM(address_line[0]),
+    customer_region = TRIM(address_line[1])
+GROUP BY ROLLUP(customer_region, customer_city)
+ORDER BY customer_region ASC, customer_city ASC, `Order Count` DESC;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;Region&quot;: null,
+    &quot;City&quot;: null,
+    &quot;Order Count&quot;: 9
+  },
+  {
+    &quot;Region&quot;: &quot;Italy&quot;,
+    &quot;City&quot;: null,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;Italy&quot;,
+    &quot;City&quot;: &quot;Rome&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: null,
+    &quot;Order Count&quot;: 2
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;Boston&quot;,
+    &quot;Order Count&quot;: 2
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;Hanover&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;City&quot;: null,
+    &quot;Order Count&quot;: 7
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;City&quot;: &quot;St. Louis&quot;,
+    &quot;Order Count&quot;: 7
+  }
+]
+</pre></div></div>
+
+<p>With the addition of the <tt>ROLLUP</tt> subclause, the results now include an extra item at the start of each region, giving the subtotal for that region. There is also another extra item at the very start of the results, giving the grand total for all regions.</p>
+<p>The order of the fields specified by the <tt>ROLLUP</tt> subclause determines the hierarchy of the super-aggregate items. The customer region is specified first, followed by the customer city; so the results are aggregated by region first, and then by city within each region.</p>
+<p>The grand total returns <tt>null</tt> as a value for the city and the region, and the subtotals return <tt>null</tt> as the value for the city, which may make the results hard to understand at first glance. A workaround for this is given in the next example.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.R3) List the number of orders by customer region and city, with meaningful subtotals and grand total.</p>
+
+<div>
+<div>
+<pre class="source">SELECT IFNULL(customer_region, &quot;All regions&quot;) AS Region,
+       IFNULL(customer_city, &quot;All cities&quot;) AS City,
+       COUNT(o.orderno) AS `Order Count`
+FROM customers AS c LEFT OUTER JOIN orders AS o ON c.custid = o.custid
+LET address_line = SPLIT(c.address.city, &quot;,&quot;),
+    customer_city = TRIM(address_line[0]),
+    customer_region = TRIM(address_line[1])
+GROUP BY ROLLUP(customer_region, customer_city)
+ORDER BY customer_region ASC, customer_city ASC, `Order Count` DESC;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;City&quot;: &quot;All cities&quot;,
+    &quot;Order Count&quot;: 9
+  },
+  {
+    &quot;Region&quot;: &quot;Italy&quot;,
+    &quot;City&quot;: &quot;All cities&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;Italy&quot;,
+    &quot;City&quot;: &quot;Rome&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;All cities&quot;,
+    &quot;Order Count&quot;: 2
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;Boston&quot;,
+    &quot;Order Count&quot;: 2
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;City&quot;: &quot;Hanover&quot;,
+    &quot;Order Count&quot;: 0
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;City&quot;: &quot;All cities&quot;,
+    &quot;Order Count&quot;: 7
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;City&quot;: &quot;St. Louis&quot;,
+    &quot;Order Count&quot;: 7
+  }
+]
+</pre></div></div>
+
+<p>This query uses the <tt>IFNULL</tt> function to populate the region and city fields with meaningful values for the super-aggregate items. This makes the results clearer and more readable.</p></div></div>
+<div class="section">
+<h4><a name="CUBE"></a><a name="Cube" id="Cube">CUBE</a></h4>
+<p>The <tt>CUBE</tt> subclause is similar to the <tt>ROLLUP</tt> subclause, in that it returns extra super-aggregate items in the query results, giving subtotals and a grand total for the aggregate functions. Whereas <tt>ROLLUP</tt> returns a grand total and a hierarchy of subtotals based on the specified fields, the <tt>CUBE</tt> subclause returns a grand total and subtotals for every possible combination of the specified fields.</p>
+<p>The following example is a modification of Q3.R3 which illustrates the <tt>CUBE</tt> subclause.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.C) List the number of orders by customer region and order date, with all possible subtotals and a grand total.</p>
+
+<div>
+<div>
+<pre class="source">SELECT IFNULL(customer_region, &quot;All regions&quot;) AS Region,
+       IFNULL(order_month, &quot;All months&quot;) AS Month,
+       COUNT(o.orderno) AS `Order Count`
+FROM customers AS c INNER JOIN orders AS o ON c.custid = o.custid
+LET address_line = SPLIT(c.address.city, &quot;,&quot;),
+    customer_region = TRIM(address_line[1]),
+    order_month = get_month(date(o.order_date))
+GROUP BY CUBE(customer_region, order_month)
+ORDER BY customer_region ASC, order_month ASC;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 9,
+    &quot;Month&quot;: &quot;All months&quot;
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 4
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 5
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 6
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 7
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 8
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 2,
+    &quot;Month&quot;: 9
+  },
+  {
+    &quot;Region&quot;: &quot;All regions&quot;,
+    &quot;Order Count&quot;: 2,
+    &quot;Month&quot;: 10
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;Order Count&quot;: 2,
+    &quot;Month&quot;: &quot;All months&quot;
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 7
+  },
+  {
+    &quot;Region&quot;: &quot;MA&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 8
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;Order Count&quot;: 7,
+    &quot;Month&quot;: &quot;All months&quot;
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 4
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 5
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;Order Count&quot;: 1,
+    &quot;Month&quot;: 6
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;Order Count&quot;: 2,
+    &quot;Month&quot;: 9
+  },
+  {
+    &quot;Region&quot;: &quot;MO&quot;,
+    &quot;Order Count&quot;: 2,
+    &quot;Month&quot;: 10
+  }
+]
+</pre></div></div>
+
+<p>To simplify the results, this query uses an inner join, so that customers who have not placed an order are not included in the totals. The query uses string functions to extract the region from each customer&#x2019;s address, and a temporal function to extract the year from the order date.</p>
+<p>The query uses the <tt>CUBE</tt> subclause with customer region and order month. This means that there are four possible aggregates to calculate:</p>
+<ul>
+
+<li>All regions, all months</li>
+<li>All regions, each month</li>
+<li>Each region, all months</li>
+<li>Each region, each month</li>
+</ul>
+<p>The results start with the grand total, showing the total number of orders across all regions for all months. This is followed by date subtotals, showing the number of orders across all regions for each month. Following that are the regional subtotals, showing the total number of orders for all months in each region; and the result items, giving the number of orders for each month in each region.</p>
+<p>The query also uses the <tt>IFNULL</tt> function to populate the region and date fields with meaningful values for the super-aggregate items. This makes the results clearer and more readable.</p></div></div></div>
+<div class="section">
+<h3><a name="HAVING_Clause"></a><a name="Having_clauses" id="Having_clauses">HAVING Clause</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="HavingClause"></a>HavingClause</h5>
+<p><img src="../images/diagrams/HavingClause.png" alt="" /></p>
+<p>The <tt>HAVING</tt> clause is very similar to the <tt>WHERE</tt> clause, except that it comes after <tt>GROUP BY</tt> and applies a filter to groups rather than to individual objects. Here&#x2019;s an example of a <tt>HAVING</tt> clause that filters orders by applying a condition to their nested arrays of <tt>items</tt>.</p>
+<p>By adding a <tt>HAVING</tt> clause to Q3.19, we can filter the results to include only those orders whose total revenue is greater than 1000, as shown in Q3.22.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.20) Modify Q3.19 to include only orders whose total revenue is greater than 5000.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items as i
+WHERE o.custid = &quot;C13&quot;
+GROUP BY o.orderno
+LET total_revenue = sum(i.qty * i.price)
+HAVING total_revenue &gt; 5000
+SELECT o.orderno, total_revenue
+ORDER BY total_revenue desc;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1002,
+        &quot;total_revenue&quot;: 10906.55
+    }
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Aggregation_Pseudo-Functions"></a><a name="Aggregation_PseudoFunctions" id="Aggregation_PseudoFunctions">Aggregation Pseudo-Functions</a></h3>
+<p>SQL provides several special functions for performing aggregations on groups including: <tt>SUM</tt>, <tt>AVG</tt>, <tt>MAX</tt>, <tt>MIN</tt>, and <tt>COUNT</tt> (some implementations provide more). These same functions are supported in SQL++. However, it&#x2019;s worth spending some time on these special functions because they don&#x2019;t behave like ordinary functions. They are called &#x201c;pseudo-functions&#x201d; here because they don&#x2019;t evaluate their operands in the same way as ordinary functions. To see the difference, consider these two examples, which are syntactically similar:</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example_1"></a>Example 1</h5>
+
+<div>
+<div>
+<pre class="source">SELECT LENGTH(name) FROM customers
+</pre></div></div>
+
+<p>In Example 1, <tt>LENGTH</tt> is an ordinary function. It simply evaluates its operand (name) and then returns a result computed from the operand.</p></div>
+<div class="section">
+<h5><a name="Example_2"></a>Example 2</h5>
+
+<div>
+<div>
+<pre class="source">SELECT AVG(rating) FROM customers
+</pre></div></div>
+
+<p>The effect of <tt>AVG</tt> in Example 2 is quite different. Rather than performing a computation on an individual rating value, <tt>AVG</tt> has a global effect: it effectively restructures the query. As a pseudo-function, <tt>AVG</tt> requires its operand to be a group; therefore, it automatically collects all the rating values from the query block and forms them into a group.</p>
+<p>The aggregation pseudo-functions always require their operand to be a group. In some queries, the group is explicitly generated by a <tt>GROUP BY</tt> clause, as in Q3.21:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.21) List the average credit rating of customers by zipcode.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+GROUP BY c.address.zipcode AS zip
+SELECT zip, AVG(c.rating) AS `avg credit rating`
+ORDER BY zip;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;avg credit rating&quot;: 625
+    },
+    {
+        &quot;avg credit rating&quot;: 657.5,
+        &quot;zip&quot;: &quot;02115&quot;
+    },
+    {
+        &quot;avg credit rating&quot;: 690,
+        &quot;zip&quot;: &quot;02340&quot;
+    },
+    {
+        &quot;avg credit rating&quot;: 695,
+        &quot;zip&quot;: &quot;63101&quot;
+    }
+]
+</pre></div></div>
+
+<p>Note in the result of Q3.21 that one or more customers had no zipcode. These customers were formed into a group for which the value of the grouping key is missing. When the query results were returned in JSON format, the <tt>missing</tt> key simply does not appear. Also note that the group whose key is <tt>missing</tt> appears first because <tt>missing</tt> is considered to be smaller than any other value. If some customers had had <tt>null</tt> as a zipcode, they would have been included in another group, appearing after the <tt>missing</tt> group but before the other groups.</p>
+<p>When an aggregation pseudo-function is used without an explicit <tt>GROUP BY</tt> clause, it implicitly forms the entire query block into a single group, as in Q3.22:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.22) Find the average credit rating among all customers.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+SELECT AVG(c.rating) AS `avg credit rating`;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;avg credit rating&quot;: 670
+    }
+]
+</pre></div></div>
+
+<p>The aggregation pseudo-function <tt>COUNT</tt> has a special form in which its operand is <tt>*</tt> instead of an expression.</p>
+<p>For example, <tt>SELECT COUNT(*) FROM customers</tt> simply returns the total number of customers, whereas <tt>SELECT COUNT(rating) FROM customers</tt> returns the number of customers who have known ratings (that is, their ratings are not <tt>null</tt> or <tt>missing</tt>).</p>
+<p>Because the aggregation pseudo-functions sometimes restructure their operands, they can be used only in query blocks where (explicit or implicit) grouping is being done. Therefore the pseudo-functions cannot operate directly on arrays or multisets. For operating directly on JSON collections, SQL++ provides a set of ordinary functions for computing aggregations. Each ordinary aggregation function (except the ones corresponding to <tt>COUNT</tt> and <tt>ARRAY_AGG</tt>) has two versions: one that ignores <tt>null</tt> and <tt>missing</tt> values and one that returns <tt>null</tt> if a <tt>null</tt> or <tt>missing</tt> value is encountered anywhere in the collection. The names of the aggregation functions are as follows:</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Aggregation pseudo-function; operates on groups only </th>
+<th> Ordinary function: Ignores NULL or MISSING values </th>
+<th> Ordinary function: Returns NULL if NULL or MISSING are encountered</th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td>SUM</td>
+<td> ARRAY_SUM</td>
+<td> STRICT_SUM </td></tr>
+<tr class="a">
+<td> AVG </td>
+<td>ARRAY_MAX</td>
+<td> STRICT_MAX </td></tr>
+<tr class="b">
+<td> MAX </td>
+<td> ARRAY_MIN</td>
+<td> STRICT_MIN </td></tr>
+<tr class="a">
+<td> MIN </td>
+<td> ARRAY_AVG</td>
+<td> STRICT_AVG </td></tr>
+<tr class="b">
+<td> COUNT </td>
+<td>ARRAY_COUNT</td>
+<td>STRICT_COUNT (see exception below) </td></tr>
+<tr class="a">
+<td>STDDEV_SAMP</td>
+<td>ARRAY_STDDEV_SAMP</td>
+<td> STRICT_STDDEV_SAMP </td></tr>
+<tr class="b">
+<td>STDDEV_POP</td>
+<td>ARRAY_STDDEV_POP</td>
+<td> STRICT_STDDEV_POP </td></tr>
+<tr class="a">
+<td>VAR_SAMP</td>
+<td>ARRAY_VAR_SAMP</td>
+<td> STRICT_VAR_SAMP </td></tr>
+<tr class="b">
+<td>VAR_POP</td>
+<td>ARRAY_VAR_POP</td>
+<td> STRICT_VAR_POP </td></tr>
+<tr class="a">
+<td>SKEWENESS</td>
+<td>ARRAY_SKEWNESS</td>
+<td> STRICT_SKEWNESS </td></tr>
+<tr class="b">
+<td>KURTOSIS</td>
+<td>ARRAY_KURTOSIS</td>
+<td> STRICT_KURTOSIS </td></tr>
+<tr class="a">
+<td> </td>
+<td>ARRAY_AGG</td>
+<td> </td></tr>
+</tbody>
+</table>
+<p>Exception: the ordinary aggregation function STRICT_COUNT operates on any collection, and returns a count of its items, including null values in the count. In this respect, STRICT_COUNT is more similar to COUNT(*) than to COUNT(expression).</p>
+<p>Note that the ordinary aggregation functions that ignore <tt>null</tt> have names beginning with &#x201c;ARRAY&#x201d;. This naming convention has historical roots. Despite their names, the functions operate on both arrays and multisets.</p>
+<p>Because of the special properties of the aggregation pseudo-functions, SQL (and therefore SQL++) is not a pure functional language. But every query that uses a pseudo-function can be expressed as an equivalent query that uses an ordinary function. Q3.23 is an example of how queries can be expressed without pseudo-functions. A more detailed explanation of all of the functions is also available in the section on <a href="builtins.html#AggregateFunctions">Aggregate Functions</a>.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.23) Alternative form of Q3.22, using the ordinary function <tt>ARRAY_AVG</tt> rather than the aggregating pseudo-function <tt>AVG</tt>.</p>
+
+<div>
+<div>
+<pre class="source">SELECT ARRAY_AVG(
+    (SELECT VALUE c.rating
+    FROM customers AS c) ) AS `avg credit rating`;
+</pre></div></div>
+
+<p>Result (same as Q3.22):</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;avg credit rating&quot;: 670
+    }
+]
+</pre></div></div>
+
+<p>If the function <tt>STRICT_AVG</tt> had been used in Q3.23 in place of <tt>ARRAY_AVG</tt>, the average credit rating returned by the query would have been <tt>null</tt>, because at least one customer has no credit rating.</p></div></div></div>
+<div class="section">
+<h3><a name="GROUP_AS_Clause"></a><a name="Group_As_clauses" id="Group_As_clauses">GROUP AS Clause</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="GroupAsClause"></a>GroupAsClause</h5>
+<p><img src="../images/diagrams/GroupAsClause.png" alt="" /></p>
+<p>JSON is a hierarchical format, and a fully featured JSON query language needs to be able to produce hierarchies of its own, with computed data at every level of the hierarchy. The key feature of SQL++ that makes this possible is the <tt>GROUP AS</tt> clause.</p>
+<p>A query may have a <tt>GROUP AS</tt> clause only if it has a <tt>GROUP BY</tt> clause. The <tt>GROUP BY</tt> clause &#x201c;hides&#x201d; the original objects in each group, exposing only the grouping expressions and special aggregation functions on the non-grouping fields. The purpose of the <tt>GROUP AS</tt> clause is to make the original objects in the group visible to subsequent clauses. Thus the query can generate output data both for the group as a whole and for the individual objects inside the group.</p>
+<p>For each group, the <tt>GROUP AS</tt> clause preserves all the objects in the group, just as they were before grouping, and gives a name to this preserved group. The group name can then be used in the <tt>FROM</tt> clause of a subquery to process and return the individual objects in the group.</p>
+<p>To see how this works, we&#x2019;ll write some queries that investigate the customers in each zipcode and their credit ratings. This would be a good time to review the sample database in <a href="#Manual_data">Appendix 4</a>. A part of the data is summarized below.</p>
+
+<div>
+<div>
+<pre class="source">Customers in zipcode 02115:
+    C35, J. Roberts, rating 565
+    C37, T. Henry, rating 750
+
+Customers in zipcode 02340:
+    C25, M. Sinclair, rating 690
+
+Customers in zipcode 63101:
+    C13, T. Cody, rating 750
+    C31, B. Pruitt, (no rating)
+    C41, R. Dodge, rating 640
+
+Customers with no zipcode:
+    C47, S. Logan, rating 625
+</pre></div></div>
+
+<p>Now let&#x2019;s consider the effect of the following clauses:</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+GROUP BY c.address.zipcode
+GROUP AS g
+</pre></div></div>
+
+<p>This query fragment iterates over the <tt>customers</tt> objects, using the iteration variable <tt>c</tt>. The <tt>GROUP BY</tt> clause forms the objects into groups, each with a common zipcode (including one group for customers with no zipcode). After the <tt>GROUP BY</tt> clause, we can see the grouping expression, <tt>c.address.zipcode</tt>, but other fields such as <tt>c.custid</tt> and <tt>c.name</tt> are visible only to special aggregation functions.</p>
+<p>The clause <tt>GROUP AS g</tt> now makes the original objects visible again. For each group in turn, the variable <tt>g</tt> is bound to a multiset of objects, each of which has a field named <tt>c</tt>, which in turn contains one of the original objects. Thus after <tt>GROUP AS g</tt>, for the group with zipcode 02115, <tt>g</tt> is bound to the following multiset:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;c&quot;:
+        { &quot;custid&quot;: &quot;C35&quot;,
+          &quot;name&quot;: &quot;J. Roberts&quot;,
+          &quot;address&quot;:
+            { &quot;street&quot;: &quot;420 Green St.&quot;,
+              &quot;city&quot;: &quot;Boston, MA&quot;,
+              &quot;zipcode&quot;: &quot;02115&quot;
+            },
+          &quot;rating&quot;: 565
+        }
+    },
+    { &quot;c&quot;:
+        { &quot;custid&quot;: &quot;C37&quot;,
+          &quot;name&quot;: &quot;T. Henry&quot;,
+          &quot;address&quot;:
+            { &quot;street&quot;: &quot;120 Harbor Blvd.&quot;,
+              &quot;city&quot;: &quot;St. Louis, MO&quot;,
+              &quot;zipcode&quot;: &quot;02115&quot;
+            },
+          &quot;rating&quot;: 750
+        }
+    }
+]
+</pre></div></div>
+
+<p>Thus, the clauses following <tt>GROUP AS</tt> can see the original objects by writing subqueries that iterate over the multiset <tt>g</tt>.</p>
+<p>The extra level named <tt>c</tt> was introduced into this multiset because the groups might have been formed from a join of two or more collections. Suppose that the <tt>FROM</tt> clause looked like <tt>FROM customers AS c, orders AS o</tt>. Then each item in the group would contain both a <tt>customers</tt> object and an <tt>orders</tt> object, and these two objects might both have a field with the same name. To avoid ambiguity, each of the original objects is wrapped in an &#x201c;outer&#x201d; object that gives it the name of its iteration variable in the <tt>FROM</tt> clause. Consider this fragment:</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c, orders AS o
+WHERE c.custid = o.custid
+GROUP BY c.address.zipcode
+GROUP AS g
+</pre></div></div>
+
+<p>In this case, following <tt>GROUP AS g</tt>, the variable <tt>g</tt> would be bound to the following collection:</p>
+
+<div>
+<div>
+<pre class="source">[
+    { &quot;c&quot;: { an original customers object },
+      &quot;o&quot;: { an original orders object }
+    },
+    { &quot;c&quot;: { another customers object },
+      &quot;o&quot;: { another orders object }
+    },
+    ...
+]
+</pre></div></div>
+
+<p>After using <tt>GROUP AS</tt> to make the content of a group accessible, you will probably want to write a subquery to access that content. A subquery for this purpose is written in exactly the same way as any other subquery. The name specified in the <tt>GROUP AS</tt> clause (<tt>g</tt> in the above example) is the name of a collection of objects. You can write a <tt>FROM</tt> clause to iterate over the objects in the collection, and you can specify an iteration variable to represent each object in turn. For <tt>GROUP AS</tt> queries in this manual, we&#x2019;ll use <tt>g</tt>as the name of the reconstituted group, and <tt>gi</tt> as an iteration variable representing one object inside the group. Of course, you can use any names you like for these purposes.</p>
+<p>Now we are ready to take a look at how <tt>GROUP AS</tt> might be used in a query. Suppose that we want to group customers by zipcode, and for each group we want to see the average credit rating and a list of the individual customers in the group. Here&#x2019;s a query that does that:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.24) For each zipcode, list the average credit rating in that zipcode, followed by the customer numbers and names in numeric order.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+GROUP BY c.address.zipcode AS zip
+GROUP AS g
+SELECT zip, AVG(c.rating) AS `avg credit rating`,
+    (FROM g AS gi
+     SELECT gi.c.custid, gi.c.name
+     ORDER BY gi.c.custid) AS `local customers`
+ORDER BY zip;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;avg credit rating&quot;: 625,
+        &quot;local customers&quot;: [
+            {
+                &quot;custid&quot;: &quot;C47&quot;,
+                &quot;name&quot;: &quot;S. Logan&quot;
+            }
+        ]
+    },
+    {
+        &quot;avg credit rating&quot;: 657.5,
+        &quot;local customers&quot;: [
+            {
+                &quot;custid&quot;: &quot;C35&quot;,
+                &quot;name&quot;: &quot;J. Roberts&quot;
+            },
+            {
+                &quot;custid&quot;: &quot;C37&quot;,
+                &quot;name&quot;: &quot;T. Henry&quot;
+            }
+        ],
+        &quot;zip&quot;: &quot;02115&quot;
+    },
+    {
+        &quot;avg credit rating&quot;: 690,
+        &quot;local customers&quot;: [
+            {
+                &quot;custid&quot;: &quot;C25&quot;,
+                &quot;name&quot;: &quot;M. Sinclair&quot;
+            }
+        ],
+        &quot;zip&quot;: &quot;02340&quot;
+    },
+    {
+        &quot;avg credit rating&quot;: 695,
+        &quot;local customers&quot;: [
+            {
+                &quot;custid&quot;: &quot;C13&quot;,
+                &quot;name&quot;: &quot;T. Cody&quot;
+            },
+            {
+                &quot;custid&quot;: &quot;C31&quot;,
+                &quot;name&quot;: &quot;B. Pruitt&quot;
+            },
+            {
+                &quot;custid&quot;: &quot;C41&quot;,
+                &quot;name&quot;: &quot;R. Dodge&quot;
+            }
+        ],
+        &quot;zip&quot;: &quot;63101&quot;
+    }
+]
+</pre></div></div>
+
+<p>Note that this query contains two <tt>ORDER BY</tt> clauses: one in the outer query and one in the subquery. These two clauses govern the ordering of the outer-level list of zipcodes and the inner-level lists of customers, respectively. Also note that the group of customers with no zipcode comes first in the output list.</p></div></div></div></div>
+<div class="section">
+<h2><a name="Selection_and_UNION_ALL"></a><a name="Union_all" id="Union_all">Selection and UNION ALL</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Selection"></a>Selection</h5>
+<p><img src="../images/diagrams/Selection.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="UnionOption"></a>UnionOption</h5>
+<p><img src="../images/diagrams/UnionOption.png" alt="" /></p>
+<p>In a SQL++ query, two or more query blocks can be connected by the operator <tt>UNION ALL</tt>. The result of a <tt>UNION ALL</tt> between two query blocks contains all the items returned by the first query block, and all the items returned by the second query block. Duplicate items are not eliminated from the query result.</p>
+<p>As in SQL, there is no ordering guarantee on the contents of the output stream. However, unlike SQL, the query language does not constrain what the data looks like on the input streams; in particular, it allows heterogeneity on the input and output streams. A type error will be raised if one of the inputs is not a collection.</p>
+<p>When two or more query blocks are connected by <tt>UNION ALL</tt>, they can be followed by <tt>ORDER BY</tt>, <tt>LIMIT</tt>, and <tt>OFFSET</tt> clauses that apply to the <tt>UNION</tt> query as a whole. For these clauses to be meaningful, the field-names returned by the two query blocks should match. The following example shows a <tt>UNION ALL</tt> of two query blocks, with an ordering specified for the result.</p>
+<p>In this example, a customer might be selected because he has ordered more than two different items (first query block) or because he has a high credit rating (second query block). By adding an explanatory string to each query block, the query writer can cause the output objects to be labeled to distinguish these two cases.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.25a) Find customer ids for customers who have placed orders for more than two different items or who have a credit rating greater than 700, with labels to distinguish these cases.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items AS i
+GROUP BY o.orderno, o.custid
+HAVING COUNT(*) &gt; 2
+SELECT DISTINCT o.custid AS customer_id, &quot;Big order&quot; AS reason
+
+UNION ALL
+
+FROM customers AS c
+WHERE rating &gt; 700
+SELECT c.custid AS customer_id, &quot;High rating&quot; AS reason
+ORDER BY customer_id;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;reason&quot;: &quot;High rating&quot;,
+        &quot;customer_id&quot;: &quot;C13&quot;
+    },
+    {
+        &quot;reason&quot;: &quot;Big order&quot;,
+        &quot;customer_id&quot;: &quot;C37&quot;
+    },
+    {
+        &quot;reason&quot;: &quot;High rating&quot;,
+        &quot;customer_id&quot;: &quot;C37&quot;
+    },
+    {
+        &quot;reason&quot;: &quot;Big order&quot;,
+        &quot;customer_id&quot;: &quot;C41&quot;
+    }
+]
+</pre></div></div>
+
+<p>If, on the other hand, you simply want a list of the customer ids and you don&#x2019;t care to preserve the reasons, you can simplify your output by using <tt>SELECT VALUE</tt>, as follows:</p>
+<p>(Q3.25b) Simplify Q3.25a to return a simple list of unlabeled customer ids.</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items AS i
+GROUP BY o.orderno, o.custid
+HAVING COUNT(*) &gt; 2
+SELECT VALUE o.custid
+
+UNION ALL
+
+FROM customers AS c
+WHERE rating &gt; 700
+SELECT VALUE c.custid;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    &quot;C37&quot;,
+    &quot;C41&quot;,
+    &quot;C13&quot;,
+    &quot;C37&quot;
+]
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="WITH_Clause"></a><a name="With_clauses" id="With_clauses">WITH Clause</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="WithClause"></a>WithClause</h5>
+<p><img src="../images/diagrams/WithClause.png" alt="" /></p>
+<p>As in standard SQL, a <tt>WITH</tt> clause can be used to improve the modularity of a query. A <tt>WITH</tt> clause often contains a subquery that is needed to compute some result that is used later in the main query. In cases like this, you can think of the <tt>WITH</tt> clause as computing a &#x201c;temporary view&quot; of the input data. The next example uses a <tt>WITH</tt> clause to compute the total revenue of each order in 2020; then the main part of the query finds the minimum, maximum, and average revenue for orders in that year.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.26) Find the minimum, maximum, and average revenue among all orders in 2020, rounded to the nearest integer.</p>
+
+<div>
+<div>
+<pre class="source">WITH order_revenue AS
+    (FROM orders AS o, o.items AS i
+    WHERE get_year(date(o.order_date)) = 2020
+    GROUP BY o.orderno
+    SELECT o.orderno, SUM(i.qty * i.price) AS revenue
+  )
+FROM order_revenue
+SELECT AVG(revenue) AS average,
+       MIN(revenue) AS minimum,
+       MAX(revenue) AS maximum;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;average&quot;: 4669.99,
+        &quot;minimum&quot;: 130.45,
+        &quot;maximum&quot;: 18847.58
+    }
+]
+</pre></div></div>
+
+<p><tt>WITH</tt> can be particularly useful when a value needs to be used several times in a query.</p></div></div></div></div>
+<div class="section">
+<h2><a name="ORDER_BY.2C_LIMIT.2C_and_OFFSET_Clauses"></a><a name="Order_By_clauses" id="Order_By_clauses">ORDER BY, LIMIT, and OFFSET Clauses</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="OrderbyClause"></a>OrderbyClause</h5>
+<p><img src="../images/diagrams/OrderbyClause.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="LimitClause"></a>LimitClause</h5>
+<p><img src="../images/diagrams/LimitClause.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="OffsetClause"></a>OffsetClause</h5>
+<p><img src="../images/diagrams/OffsetClause.png" alt="" /></p>
+<p>The last three (optional) clauses to be processed in a query are <tt>ORDER BY</tt>, <tt>LIMIT</tt>, and <tt>OFFSET</tt>.</p>
+<p>The <tt>ORDER BY</tt> clause is used to globally sort data in either ascending order (i.e., <tt>ASC</tt>) or descending order (i.e., <tt>DESC</tt>). During ordering (if the <tt>NULLS</tt> modifier is not specified), <tt>MISSING</tt> and <tt>NULL</tt> are treated as being smaller than any other value if they are encountered in the ordering key(s). <tt>MISSING</tt> is treated as smaller than <tt>NULL</tt> if both occur in the data being sorted. The <tt>NULLS</tt> modifier determines how <tt>MISSING</tt> and <tt>NULL</tt> are ordered relative to all other values: first (<tt>NULLS</tt> <tt>FIRST</tt>) or last (<tt>NULLS</tt> <tt>LAST</tt>). The relative order between <tt>MISSING</tt> and <tt>NULL</tt> is not affected by the <tt>NULLS</tt> modifier (i.e. <tt>MISSING</tt> is still treated as smaller than <tt>NULL</tt>). The ordering of values of a given type is consistent with its type&#x2019;s <tt>&lt;=</tt> ordering; the ordering of values across types is implementation-defined but stable.</p>
+<p>The <tt>LIMIT</tt> clause is used to limit the result set to a specified maximum size. The optional <tt>OFFSET</tt> clause is used to specify a number of items in the output stream to be discarded before the query result begins. The <tt>OFFSET</tt> can also be used as a standalone clause, without the <tt>LIMIT</tt>.</p>
+<p>The following example illustrates use of the <tt>ORDER BY</tt> and <tt>LIMIT</tt> clauses.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.27) Return the top three customers by rating.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+SELECT c.custid, c.name, c.rating
+ORDER BY c.rating DESC
+LIMIT 3;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;rating&quot;: 750
+    },
+    {
+        &quot;custid&quot;: &quot;C37&quot;,
+        &quot;name&quot;: &quot;T. Henry&quot;,
+        &quot;rating&quot;: 750
+    },
+    {
+        &quot;custid&quot;: &quot;C25&quot;,
+        &quot;name&quot;: &quot;M. Sinclair&quot;,
+        &quot;rating&quot;: 690
+    }
+]
+</pre></div></div>
+
+<p>The following example illustrates the use of <tt>OFFSET</tt>:</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.38) Find the customer with the third-highest credit rating.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c
+SELECT c.custid, c.name, c.rating
+ORDER BY c.rating DESC
+LIMIT 1 OFFSET 2;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C25&quot;,
+        &quot;name&quot;: &quot;M. Sinclair&quot;,
+        &quot;rating&quot;: 690
+    }
+]
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="Subqueries" id="Subqueries">Subqueries</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Subquery"></a>Subquery</h5>
+<p><img src="../images/diagrams/Subquery.png" alt="" /></p>
+<p>A subquery is simply a query surrounded by parentheses. In SQL++, a subquery can appear anywhere that an expression can appear. Like any query, a subquery always returns a collection, even if the collection contains only a single value or is empty. If the subquery has a SELECT clause, it returns a collection of objects. If the subquery has a SELECT VALUE clause, it returns a collection of scalar values. If a single scalar value is expected, the indexing operator [0] can be used to extract the single scalar value from the collection.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.29) (Subquery in SELECT clause) For every order that includes item no. 120, find the order number, customer id, and customer name.</p>
+<p>Here, the subquery is used to find a customer name, given a customer id. Since the outer query expects a scalar result, the subquery uses SELECT VALUE and is followed by the indexing operator [0].</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items AS i
+WHERE i.itemno = 120
+SELECT o.orderno, o.custid,
+    (FROM customers AS c
+     WHERE c.custid = o.custid
+     SELECT VALUE c.name)[0] AS name;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1003,
+        &quot;custid&quot;: &quot;C31&quot;,
+        &quot;name&quot;: &quot;B. Pruitt&quot;
+    },
+    {
+        &quot;orderno&quot;: 1006,
+        &quot;custid&quot;: &quot;C41&quot;,
+        &quot;name&quot;: &quot;R. Dodge&quot;
+    }
+]
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.30) (Subquery in WHERE clause) Find the customer number, name, and rating of all customers whose rating is greater than the average rating.</p>
+<p>Here, the subquery is used to find the average rating among all customers. Once again, SELECT VALUE and indexing [0] have been used to get a single scalar value.</p>
+
+<div>
+<div>
+<pre class="source">FROM customers AS c1
+WHERE c1.rating &gt;
+   (FROM customers AS c2
+    SELECT VALUE AVG(c2.rating))[0]
+SELECT c1.custid, c1.name, c1.rating;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;rating&quot;: 750
+    },
+    {
+        &quot;custid&quot;: &quot;C25&quot;,
+        &quot;name&quot;: &quot;M. Sinclair&quot;,
+        &quot;rating&quot;: 690
+    },
+    {
+        &quot;custid&quot;: &quot;C37&quot;,
+        &quot;name&quot;: &quot;T. Henry&quot;,
+        &quot;rating&quot;: 750
+    }
+]
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q3.31) (Subquery in FROM clause) Compute the total revenue (sum over items of quantity time price) for each order, then find the average, maximum, and minimum total revenue over all orders.</p>
+<p>Here, the FROM clause expects to iterate over a collection of objects, so the subquery uses an ordinary SELECT and does not need to be indexed. You might think of a FROM clause as a &#x201c;natural home&#x201d; for a subquery.</p>
+
+<div>
+<div>
+<pre class="source">FROM
+   (FROM orders AS o, o.items AS i
+    GROUP BY o.orderno
+    SELECT o.orderno, SUM(i.qty * i.price) AS revenue
+   ) AS r
+SELECT AVG(r.revenue) AS average,
+       MIN(r.revenue) AS minimum,
+       MAX(r.revenue) AS maximum;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;average&quot;: 4669.99,
+        &quot;minimum&quot;: 130.45,
+        &quot;maximum&quot;: 18847.58
+    }
+]
+</pre></div></div>
+
+<p>Note the similarity between Q3.26 and Q3.31. This illustrates how a subquery can often be moved into a <tt>WITH</tt> clause to improve the modularity and readability of a query.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Over_clauses" id="Over_clauses">4. Window Functions</a></h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>Window functions are special functions that compute aggregate values over a &#x201c;window&#x201d; of input data. Like an ordinary function, a window function returns a value for every item in the input dataset. But in the case of a window function, the value returned by the function can depend not only on the argument of the function, but also on other items in the same collection. For example, a window function applied to a set of employees might return the rank of each employee in the set, as measured by salary. As another example, a window function applied to a set of items, ordered by purchase date, might return the running total of the cost of the items.</p>
+<p>A window function call is identified by an <tt>OVER</tt> clause, which can specify three things: partitioning, ordering, and framing. The partitioning specification is like a <tt>GROUP BY</tt>: it splits the input data into partitions. For example, a set of employees might be partitioned by department. The window function, when applied to a given object, is influenced only by other objects in the same partition. The ordering specification is like an <tt>ORDER BY</tt>: it determines the ordering of the objects in each partition. The framing specification defines a &#x201c;frame&#x201d; that moves through the partition, defining how the result for each object depends on nearby objects. For example, the frame for a current object might consist of the two objects before and after the current one; or it might consist of all the objects before the current one in the same partition. A window function call may also specify some options that control (for example) how nulls are handled by the function.</p>
+<p>Here is an example of a window function call:</p>
+
+<div>
+<div>
+<pre class="source">SELECT deptno, purchase_date, item, cost,
+    SUM(cost) OVER (
+        PARTITION BY deptno
+        ORDER BY purchase_date
+        ROWS UNBOUNDED PRECEDING) AS running_total_cost
+FROM purchases
+ORDER BY deptno, purchase_date
+</pre></div></div>
+
+<p>This example partitions the <tt>purchases</tt> dataset by department number. Within each department, it orders the <tt>purchases</tt> by date and computes a running total cost for each item, using the frame specification <tt>ROWS UNBOUNDED PRECEDING</tt>. Note that the <tt>ORDER BY</tt> clause in the window function is separate and independent from the <tt>ORDER BY</tt> clause of the query as a whole.</p>
+<p>The general syntax of a window function call is specified in this section. SQL++ has a set of builtin window functions, which are listed and explained in the <a href="builtins.html#WindowFunctions">Window Functions</a> section of the builtin functions page. In addition, standard SQL aggregate functions such as <tt>SUM</tt> and <tt>AVG</tt> can be used as window functions if they are used with an <tt>OVER</tt> clause.</p></div></div></div></div>
+<div class="section">
+<h2><a name="Window_Function_Call"></a><a name="Window_function_call" id="Window_function_call">Window Function Call</a></h2>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="WindowFunctionCall"></a>WindowFunctionCall</h5>
+<p><img src="../images/diagrams/WindowFunctionCall.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="WindowFunctionType"></a>WindowFunctionType</h5>
+<p><img src="../images/diagrams/WindowFunctionType.png" alt="" /></p>
+<p>Refer to the <a href="builtins.html#AggregateFunctions">Aggregate Functions</a> section for a list of aggregate functions.</p>
+<p>Refer to the <a href="builtins.html#WindowFunctions">Window Functions</a> section for a list of window functions.</p></div></div></div>
+<div class="section">
+<h3><a name="Window_Function_Arguments"></a><a name="Window_function_arguments" id="Window_function_arguments">Window Function Arguments</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="WindowFunctionArguments"></a>WindowFunctionArguments</h5>
+<p><img src="../images/diagrams/WindowFunctionArguments.png" alt="" /></p>
+<p>Refer to the <a href="builtins.html#AggregateFunctions">Aggregate Functions</a> section or the <a href="builtins.html#WindowFunctions">Window Functions</a> section for details of the arguments for individual functions.</p></div></div></div>
+<div class="section">
+<h3><a name="Window_Function_Options"></a><a name="Window_function_options" id="Window_function_options">Window Function Options</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="WindowFunctionOptions"></a>WindowFunctionOptions</h5>
+<p><img src="../images/diagrams/WindowFunctionOptions.png" alt="" /></p>
+<p>Window function options cannot be used with <a href="builtins.html#AggregateFunctions">aggregate functions</a>.</p>
+<p>Window function options can only be used with some <a href="builtins.html#WindowFunctions">window functions</a>, as described below.</p>
+<p>The <i>FROM modifier</i> determines whether the computation begins at the first or last tuple in the window. It is optional and can only be used with the <tt>nth_value()</tt> function. If it is omitted, the default setting is <tt>FROM FIRST</tt>.</p>
+<p>The <i>NULLS modifier</i> determines whether NULL values are included in the computation, or ignored. MISSING values are treated the same way as NULL values. It is also optional and can only be used with the <tt>first_value()</tt>, <tt>last_value()</tt>, <tt>nth_value()</tt>, <tt>lag()</tt>, and <tt>lead()</tt> functions. If omitted, the default setting is <tt>RESPECT NULLS</tt>.</p></div></div></div>
+<div class="section">
+<h3><a name="Window_Frame_Variable"></a><a name="Window_frame_variable" id="Window_frame_variable">Window Frame Variable</a></h3>
+<p>The <tt>AS</tt> keyword enables you to specify an alias for the window frame contents. It introduces a variable which will be bound to the contents of the frame. When using a built-in <a href="builtins.html#AggregateFunctions">aggregate function</a> as a window function, the function&#x2019;s argument must be a subquery which refers to this alias, for example:</p>
+
+<div>
+<div>
+<pre class="source">SELECT ARRAY_COUNT(DISTINCT (FROM alias SELECT VALUE alias.src.field))
+OVER alias AS (PARTITION BY &#x2026; ORDER BY &#x2026;)
+FROM source AS src
+</pre></div></div>
+
+<p>The alias is not necessary when using a <a href="builtins.html#WindowFunctions">window function</a>, or when using a standard SQL aggregate function with the <tt>OVER</tt> clause.</p></div>
+<div class="section">
+<h3><a name="Window_Definition"></a><a name="Window_definition" id="Window_definition">Window Definition</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="WindowDefinition"></a>WindowDefinition</h5>
+<p><img src="../images/diagrams/WindowDefinition.png" alt="" /></p>
+<p>The <i>window definition</i> specifies the partitioning, ordering, and framing for window functions.</p></div></div>
+<div class="section">
+<h4><a name="Window_Partition_Clause"></a><a name="Window_partition_clause" id="Window_partition_clause">Window Partition Clause</a></h4>
+<div class="section">
+<h5><a name="WindowPartitionClause"></a>WindowPartitionClause</h5>
+<p><img src="../images/diagrams/WindowPartitionClause.png" alt="" /></p>
+<p>The <i>window partition clause</i> divides the tuples into logical partitions using one or more expressions.</p>
+<p>This clause may be used with any <a href="builtins.html#WindowFunctions">window function</a>, or any <a href="builtins.html#AggregateFunctions">aggregate function</a> used as a window function.</p>
+<p>This clause is optional. If omitted, all tuples are united in a single partition.</p></div></div>
+<div class="section">
+<h4><a name="Window_Order_Clause"></a><a name="Window_order_clause" id="Window_order_clause">Window Order Clause</a></h4>
+<div class="section">
+<h5><a name="WindowOrderClause"></a>WindowOrderClause</h5>
+<p><img src="../images/diagrams/WindowOrderClause.png" alt="" /></p>
+<p>The <i>window order clause</i> determines how tuples are ordered within each partition. The window function works on tuples in the order specified by this clause.</p>
+<p>This clause may be used with any <a href="builtins.html#WindowFunctions">window function</a>, or any <a href="builtins.html#AggregateFunctions">aggregate function</a> used as a window function.</p>
+<p>This clause is optional. If omitted, all tuples are considered peers, i.e. their order is tied. When tuples in the window partition are tied, each window function behaves differently.</p>
+<ul>
+
+<li>
+
+<p>The <tt>row_number()</tt> function returns a distinct number for each tuple. If tuples are tied, the results may be unpredictable.</p>
+</li>
+<li>
+
+<p>The <tt>rank()</tt>, <tt>dense_rank()</tt>, <tt>percent_rank()</tt>, and <tt>cume_dist()</tt> functions return the same result for each tuple.</p>
+</li>
+<li>
+
+<p>For other functions, if the <a href="#Window_frame_clause">window frame</a> is defined by <tt>ROWS</tt>, the results may be unpredictable. If the window frame is defined by <tt>RANGE</tt> or <tt>GROUPS</tt>, the results are same for each tuple.</p>
+</li>
+</ul>
+<p><b>Note:</b> This clause does not guarantee the overall order of the query results. To guarantee the order of the final results, use the query <tt>ORDER BY</tt> clause.</p></div></div>
+<div class="section">
+<h4><a name="Window_Frame_Clause"></a><a name="Window_frame_clause" id="Window_frame_clause">Window Frame Clause</a></h4>
+<div class="section">
+<h5><a name="WindowFrameClause"></a>WindowFrameClause</h5>
+<p><img src="../images/diagrams/WindowFrameClause.png" alt="" /></p>
+<p>The <i>window frame clause</i> defines the window frame. It can be used with all <a href="builtins.html#AggregateFunctions">aggregate functions</a> and some <a href="builtins.html#WindowFunctions">window functions</a> &#x2014; refer to the descriptions of individual functions for more details.  It is optional and allowed only when the <a href="#Window_order_clause">window order clause</a> is present.</p>
+<ul>
+
+<li>
+
+<p>If this clause is omitted and there is no <a href="#Window_order_clause">window order clause</a>, the window frame is the entire partition.</p>
+</li>
+<li>
+
+<p>If this clause is omitted but there is a <a href="#Window_order_clause">window order clause</a>, the window frame becomes all tuples in the partition preceding the current tuple and its peers &#x2014; the same as <tt>RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW</tt>.</p>
+</li>
+</ul>
+<p>The window frame can be defined in the following ways:</p>
+<ul>
+
+<li>
+
+<p><tt>ROWS</tt>: Counts the exact number of tuples within the frame. If window ordering doesn&#x2019;t result in unique ordering, the function may produce unpredictable results. You can add a unique expression or more window ordering expressions to produce unique ordering.</p>
+</li>
+<li>
+
+<p><tt>RANGE</tt>: Looks for a value offset within the frame. The function produces deterministic results.</p>
+</li>
+<li>
+
+<p><tt>GROUPS</tt>: Counts all groups of tied rows within the frame. The function produces deterministic results.</p>
+</li>
+</ul>
+<p><b>Note:</b> If this clause uses <tt>RANGE</tt> with either <i>Expr</i> <tt>PRECEDING</tt> or <i>Expr</i> <tt>FOLLOWING</tt>, the <a href="#Window_order_clause">window order clause</a> must have only a single ordering term. The ordering term expression must evaluate to a number. If these conditions are not met, the window frame will be empty, which means the window function will return its default value: in most cases this is <tt>null</tt>, except for <tt>strict_count()</tt> or <tt>array_count()</tt>, whose default value is 0. This restriction does not apply when the window frame uses <tt>ROWS</tt> or <tt>GROUPS</tt>.</p>
+<p><b>Tip:</b> The <tt>RANGE</tt> window frame is commonly used to define window frames based on date or time. If you want to use <tt>RANGE</tt> with either <i>Expr</i> <tt>PRECEDING</tt> or <i>Expr</i> <tt>FOLLOWING</tt>, and you want to use an ordering expression based on date or time, the expression in <i>Expr</i> <tt>PRECEDING</tt> or <i>Expr</i> <tt>FOLLOWING</tt> must use a data type that can be added to the ordering expression.</p></div></div>
+<div class="section">
+<h4><a name="Window_Frame_Extent"></a><a name="Window_frame_extent" id="Window_frame_extent">Window Frame Extent</a></h4>
+<div class="section">
+<h5><a name="WindowFrameExtent"></a>WindowFrameExtent</h5>
+<p><img src="../images/diagrams/WindowFrameExtent.png" alt="" /></p>
+<p>The <i>window frame extent clause</i> specifies the start point and end point of the window frame. The expression before <tt>AND</tt> is the start point and the expression after <tt>AND</tt> is the end point. If <tt>BETWEEN</tt> is omitted, you can only specify the start point; the end point becomes <tt>CURRENT ROW</tt>.</p>
+<p>The window frame end point can&#x2019;t be before the start point. If this clause violates this restriction explicitly, an error will result. If it violates this restriction implicitly, the window frame will be empty, which means the window function will return its default value: in most cases this is <tt>null</tt>, except for <tt>strict_count()</tt> or <tt>array_count()</tt>, whose default value is 0.</p>
+<p>Window frame extents that result in an explicit violation are:</p>
+<ul>
+
+<li>
+
+<p><tt>BETWEEN CURRENT ROW AND</tt> <i>Expr</i> <tt>PRECEDING</tt></p>
+</li>
+<li>
+
+<p><tt>BETWEEN</tt> <i>Expr</i> <tt>FOLLOWING AND</tt> <i>Expr</i> <tt>PRECEDING</tt></p>
+</li>
+<li>
+
+<p><tt>BETWEEN</tt> <i>Expr</i> <tt>FOLLOWING AND CURRENT ROW</tt></p>
+</li>
+</ul>
+<p>Window frame extents that result in an implicit violation are:</p>
+<ul>
+
+<li>
+
+<p><tt>BETWEEN UNBOUNDED PRECEDING AND</tt> <i>Expr</i> <tt>PRECEDING</tt> &#x2014; if <i>Expr</i> is too high, some tuples may generate an empty window frame.</p>
+</li>
+<li>
+
+<p><tt>BETWEEN</tt> <i>Expr</i> <tt>PRECEDING AND</tt> <i>Expr</i> <tt>PRECEDING</tt> &#x2014; if the second  <i>Expr</i> is greater than or equal to the first <i>Expr</i>, all result sets will generate an empty window frame.</p>
+</li>
+<li>
+
+<p><tt>BETWEEN</tt> <i>Expr</i> <tt>FOLLOWING AND</tt> <i>Expr</i> <tt>FOLLOWING</tt> &#x2014; if the first <i>Expr</i> is greater than or equal to the second <i>Expr</i>, all result sets will generate an empty window frame.</p>
+</li>
+<li>
+
+<p><tt>BETWEEN</tt> <i>Expr</i> <tt>FOLLOWING AND UNBOUNDED FOLLOWING</tt> &#x2014; if <i>Expr</i> is too high, some tuples may generate an empty window frame.</p>
+</li>
+<li>
+
+<p>If the <a href="#Window_frame_exclusion">window frame exclusion clause</a> is present, any window frame specification may result in empty window frame.</p>
+</li>
+</ul>
+<p>The <i>Expr</i> must be a positive constant or an expression that evaluates as a positive number. For <tt>ROWS</tt> or <tt>GROUPS</tt>, the <i>Expr</i> must be an integer.</p></div></div>
+<div class="section">
+<h4><a name="Window_Frame_Exclusion"></a><a name="Window_frame_exclusion" id="Window_frame_exclusion">Window Frame Exclusion</a></h4>
+<div class="section">
+<h5><a name="WindowFrameExclusion"></a>WindowFrameExclusion</h5>
+<p><img src="../images/diagrams/WindowFrameExclusion.png" alt="" /></p>
+<p>The <i>window frame exclusion clause</i> enables you to exclude specified tuples from the window frame.</p>
+<p>This clause can be used with all <a href="builtins.html#AggregateFunctions">aggregate functions</a> and some <a href="builtins.html#WindowFunctions">window functions</a> &#x2014; refer to the descriptions of individual functions for more details.</p>
+<p>This clause is allowed only when the <a href="#Window_frame_clause">window frame clause</a> is present.</p>
+<p>This clause is optional. If this clause is omitted, the default is no exclusion &#x2014; the same as <tt>EXCLUDE NO OTHERS</tt>.</p>
+<ul>
+
+<li>
+
+<p><tt>EXCLUDE CURRENT ROW</tt>: If the current tuple is still part of the window frame, it is removed from the window frame.</p>
+</li>
+<li>
+
+<p><tt>EXCLUDE GROUP</tt>: The current tuple and any peers of the current tuple are removed from the window frame.</p>
+</li>
+<li>
+
+<p><tt>EXCLUDE TIES</tt>: Any peers of the current tuple, but not the current tuple itself, are removed from the window frame.</p>
+</li>
+<li>
+
+<p><tt>EXCLUDE NO OTHERS</tt>: No additional tuples are removed from the window frame.</p>
+</li>
+</ul>
+<p>If the current tuple is already removed from the window frame, then it remains removed from the window frame.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Errors" id="Errors">5. Errors</a></h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>A query can potentially result in one of the following errors:</p>
+<ul>
+
+<li>syntax error,</li>
+<li>identifier resolution error,</li>
+<li>type error,</li>
+<li>resource error.</li>
+</ul>
+<p>If the query processor runs into any error, it will terminate the ongoing processing of the query and immediately return an error message to the client.</p></div></div></div></div>
+<div class="section">
+<h2><a name="Syntax_Errors"></a><a name="Syntax_errors" id="Syntax_errors">Syntax Errors</a></h2>
+<p>A valid query must satisfy the grammar rules of the query language. Otherwise, a syntax error will be raised.</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q4.1)</p>
+
+<div>
+<div>
+<pre class="source">customers AS c
+SELECT *
+</pre></div></div>
+
+<p>Since the queryhas no <tt>FROM</tt> keyword before the dataset <tt>customers</tt>, we will get a syntax error as follows:</p>
+
+<div>
+<div>
+<pre class="source">ERROR: Code: 1 &quot;ASX1001: Syntax error: In line 2 &gt;&gt;customers AS c&lt;&lt; Encountered \&quot;AS\&quot; at column 11. &quot;
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q4.2)</p>
+
+<div>
+<div>
+<pre class="source"> FROM customers AS c
+ WHERE type=&quot;advertiser&quot;
+ SELECT *;
+</pre></div></div>
+
+<p>Since &#x201c;type&#x201d; is a reserved keyword in the query parser, we will get a syntax error as follows:</p>
+
+<div>
+<div>
+<pre class="source">ERROR: Code: 1 &quot;ASX1001: Syntax error: In line 3 &gt;&gt; WHERE type=\&quot;advertiser\&quot;&lt;&lt; Encountered \&quot;type\&quot; at column 8. &quot;;
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="Identifier_Resolution_Errors"></a><a name="Identifier_resolution_errors" id="Identifier_resolution_errors">Identifier Resolution Errors</a></h2>
+<p>Referring to an undefined identifier can cause an error if the identifier cannot be successfully resolved as a valid field access.</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q4.3)</p>
+
+<div>
+<div>
+<pre class="source"> FROM customer AS c
+ SELECT *
+</pre></div></div>
+
+<p>If we have a typo as above in &#x201c;customers&#x201d; that misses the dataset name&#x2019;s ending &#x201c;s&#x201d;, we will get an identifier resolution error as follows:</p>
+
+<div>
+<div>
+<pre class="source">ERROR: Code: 1 &quot;ASX1077: Cannot find dataset customer in dataverse Commerce nor an alias with name customer (in line 2, at column 7)&quot;
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q4.4)</p>
+
+<div>
+<div>
+<pre class="source"> FROM customers AS c JOIN orders AS o ON c.custid = o.custid
+ SELECT name, orderno;
+</pre></div></div>
+
+<p>If the compiler cannot figure out how to resolve an unqualified field name, which will occur if there is more than one variable in scope (e.g., <tt>customers AS c</tt> and <tt>orders AS o</tt> as above), we will get an identifier resolution error as follows:</p>
+
+<div>
+<div>
+<pre class="source">ERROR: Code: 1 &quot;ASX1074: Cannot resolve ambiguous alias reference for identifier name (in line 3, at column 9)&quot;
+</pre></div></div>
+
+<p>The same can happen when failing to properly identify the <tt>GROUP BY</tt> expression.</p>
+<p>(Q4.5)</p>
+
+<div>
+<div>
+<pre class="source">SELECT o.custid, COUNT(o.orderno) AS `order count`
+FROM orders AS o
+GROUP BY custid;
+</pre></div></div>
+
+<p>Result:</p>
+
+<div>
+<div>
+<pre class="source">ERROR: Code: 1 &quot;ASX1073: Cannot resolve alias reference for undefined identifier o (in line 2, at column 8)&quot;
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="Type_Errors"></a><a name="Type_errors" id="Type_errors">Type Errors</a></h2>
+<p>The query compiler does type checks based on its available type information. In addition, the query runtime also reports type errors if a data model instance it processes does not satisfy the type requirement.</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+<p>(Q4.6)</p>
+
+<div>
+<div>
+<pre class="source">get_day(10/11/2020);
+</pre></div></div>
+
+<p>Since function <tt>get_day</tt> can only process duration, daytimeduration, date, or datetime input values, we will get a type error as follows:</p>
+
+<div>
+<div>
+<pre class="source">ERROR: Code: 1 &quot;ASX0002: Type mismatch: function get-day expects its 1st input parameter to be of type duration, daytimeduration, date or datetime, but the actual input type is double (in line 2, at column 1)&quot;
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="Resource_Errors"></a><a name="Resource_errors" id="Resource_errors">Resource Errors</a></h2>
+<p>A query can potentially exhaust system resources, such as the number of open files and disk spaces. For instance, the following two resource errors could be potentially be seen when running the system:</p>
+
+<div>
+<div>
+<pre class="source">Error: no space left on device
+Error: too many open files
+</pre></div></div>
+
+<p>The &#x201c;no space left on device&#x201d; issue usually can be fixed by cleaning up disk space and reserving more disk space for the system. The &#x201c;too many open files&#x201d; issue usually can be fixed by a system administrator, following the instructions <a class="externalLink" href="https://easyengine.io/tutorials/linux/increase-open-files-limit/">here</a>.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Vs_SQL-92" id="Vs_SQL-92">6. Differences from SQL-92</a></h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>SQL++ offers the following additional features beyond SQL-92:</p>
+<ul>
+
+<li>Fully composable and functional: A subquery can iterate over any intermediate collection and can appear anywhere in a query.</li>
+<li>Schema-free: The query language does not assume the existence of a static schema for any data that it processes.</li>
+<li>Correlated <tt>FROM</tt> terms: A right-side <tt>FROM</tt> term expression can refer to variables defined by <tt>FROM</tt> terms on its left.</li>
+<li>Powerful <tt>GROUP BY</tt>: In addition to a set of aggregate functions as in standard SQL, the groups created by the <tt>GROUP BY</tt> clause are directly usable in nested queries and/or to obtain nested results.</li>
+<li>Generalized <tt>SELECT</tt> clause: A <tt>SELECT</tt> clause can return any type of collection, while in SQL-92, a <tt>SELECT</tt> clause has to return a (homogeneous) collection of objects.</li>
+</ul>
+<p>The following matrix is a quick &#x201c;SQL-92 compatibility cheat sheet&#x201d; for SQL++.</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th> Feature </th>
+<th>  SQL++ </th>
+<th> SQL-92 </th>
+<th>  Why different?  </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> SELECT * </td>
+<td> Returns nested objects </td>
+<td> Returns flattened concatenated objects </td>
+<td> Nested collections are 1st class citizens </td></tr>
+<tr class="a">
+<td> SELECT list </td>
+<td> order not preserved </td>
+<td> order preserved </td>
+<td> Fields in a JSON object are not ordered </td></tr>
+<tr class="b">
+<td> Subquery </td>
+<td> Returns a collection  </td>
+<td> The returned collection is cast into a scalar value if the subquery appears in a SELECT list or on one side of a comparison or as input to a function </td>
+<td> Nested collections are 1st class citizens </td></tr>
+<tr class="a">
+<td> LEFT OUTER JOIN </td>
+<td>  Fills in <tt>MISSING</tt>(s) for non-matches  </td>
+<td>   Fills in <tt>NULL</tt>(s) for non-matches    </td>
+<td> &#x201c;Absence&#x201d; is more appropriate than &#x201c;unknown&#x201d; here  </td></tr>
+<tr class="b">
+<td> UNION ALL       </td>
+<td> Allows heterogeneous inputs and output </td>
+<td> Input streams must be UNION-compatible and output field names are drawn from the first input stream </td>
+<td> Heterogenity and nested collections are common </td></tr>
+<tr class="a">
+<td> IN constant_expr </td>
+<td> The constant expression has to be an array or multiset, i.e., [..,..,&#x2026;] </td>
+<td> The constant collection can be represented as comma-separated items in a paren pair </td>
+<td> Nested collections are 1st class citizens </td></tr>
+<tr class="b">
+<td> String literal </td>
+<td> Double quotes or single quotes </td>
+<td> Single quotes only </td>
+<td> Double quoted strings are pervasive in JSON</td></tr>
+<tr class="a">
+<td> Delimited identifiers </td>
+<td> Backticks </td>
+<td> Double quotes </td>
+<td> Double quoted strings are pervasive in JSON </td></tr>
+</tbody>
+</table>
+<p>The following SQL-92 features are not implemented yet. However, SQL++ does not conflict with these features:</p>
+<ul>
+
+<li>CROSS JOIN, NATURAL JOIN, UNION JOIN</li>
+<li>FULL OUTER JOIN</li>
+<li>INTERSECT, EXCEPT, UNION with set semantics</li>
+<li>CAST expression</li>
+<li>ALL and SOME predicates for linking to subqueries</li>
+<li>UNIQUE predicate (tests a collection for duplicates)</li>
+<li>MATCH predicate (tests for referential integrity)</li>
+<li>Row and Table constructors</li>
+<li>Preserved order for expressions in a SELECT list</li>
+</ul><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="DDL_and_DML_statements" id="DDL_and_DML_statements">7. DDL and DML statements</a></h1>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Stmnt"></a>Stmnt</h5>
+<p><img src="../images/diagrams/Stmnt.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="SingleStmnt"></a>SingleStmnt</h5>
+<p><img src="../images/diagrams/SingleStmnt.png" alt="" /></p>
+<p>In addition to queries, an implementation of SQL++ needs to support statements for data definition and manipulation purposes as well as controlling the context to be used in evaluating query expressions. This section details the DDL and DML statements supported in SQL++ as realized today in Apache AsterixDB.</p><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div></div>
+<div class="section">
+<h2><a name="Lifecycle_Management_Statements"></a><a name="Lifecycle_management_statements" id="Lifecycle_management_statements">Lifecycle Management Statements</a></h2>
+<div class="section">
+<h3><a name="Use_Statement"></a><a name="Use" id="Use">Use Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="UseStmnt"></a>UseStmnt</h5>
+<p><img src="../images/diagrams/UseStmnt.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DataverseName"></a>DataverseName</h5>
+<p><img src="../images/diagrams/DataverseName.png" alt="" /></p>
+<p>At the uppermost level, the world of data is organized into data namespaces called <b>dataverses</b>. To set the default dataverse for statements, the <tt>USE</tt> statement is provided.</p>
+<p>As an example, the following statement sets the default dataverse to be <tt>Commerce</tt>.</p>
+
+<div>
+<div>
+<pre class="source">USE Commerce;
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Set_Statement"></a><a name="Sets" id="Sets"> Set Statement</a></h3>
+<p>The <tt>SET</tt> statement can be used to override certain configuration parameters. More information about <tt>SET</tt> can be found in <a href="#Performance_tuning">Appendix 2</a>.</p></div>
+<div class="section">
+<h3><a name="Function_Declaration"></a><a name="Functions" id="Functions"> Function Declaration</a></h3>
+<p>When writing a complex query, it can sometimes be helpful to define one or more auxiliary functions that each address a sub-piece of the overall query.</p>
+<p>The <tt>DECLARE FUNCTION</tt> statement supports the creation of such helper functions. In general, the function body (expression) can be any legal query expression.</p>
+<p>The function named in the <tt>DECLARE FUNCTION</tt> statement is accessible only in the current query. To create a persistent function for use in multiple queries, use the <tt>CREATE FUNCTION</tt> statement.</p>
+<div class="section">
+<div class="section">
+<h5><a name="FunctionDeclaration"></a>FunctionDeclaration</h5>
+<p><img src="../images/diagrams/FunctionDeclaration.png" alt="" /></p>
+<p>The following is a simple example of a temporary function definition and its use.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">DECLARE FUNCTION nameSearch(customerId){
+    (SELECT c.custid, c.name
+    FROM customers AS c
+    WHERE c.custid = customerId)[0]
+ };
+
+
+SELECT VALUE nameSearch(&quot;C25&quot;);
+</pre></div></div>
+
+<p>For our sample data set, this returns:</p>
+
+<div>
+<div>
+<pre class="source">[
+  { &quot;custid&quot;: &quot;C25&quot;, &quot;name&quot;: &quot;M. Sinclair&quot; }
+]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Create_Statement"></a><a name="Create" id="Create"> Create Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="CreateStmnt"></a>CreateStmnt</h5>
+<p><img src="../images/diagrams/CreateStmnt.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DataverseName"></a>DataverseName</h5>
+<p><img src="../images/diagrams/DataverseName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="QualifiedName"></a>QualifiedName</h5>
+<p><img src="../images/diagrams/QualifiedName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DoubleQualifiedName"></a>DoubleQualifiedName</h5>
+<p><img src="../images/diagrams/DoubleQualifiedName.png" alt="" /></p>
+<p>The <tt>CREATE</tt> statement is used for creating dataverses as well as other persistent artifacts in a dataverse. It can be used to create new dataverses, datatypes, datasets, indexes, and user-defined query functions.</p></div></div>
+<div class="section">
+<h4><a name="Create_Dataverse"></a><a name="Dataverses" id="Dataverses"> Create Dataverse</a></h4>
+<div class="section">
+<h5><a name="CreateDataverse"></a>CreateDataverse</h5>
+<p><img src="../images/diagrams/CreateDataverse.png" alt="" /></p>
+<p>The <tt>CREATE DATAVERSE</tt> statement is used to create new dataverses. To ease the authoring of reusable query scripts, an optional <tt>IF NOT EXISTS</tt> clause is included to allow creation to be requested either unconditionally or only if the dataverse does not already exist. If this clause is absent, an error is returned if a dataverse with the indicated name already exists.</p>
+<p>The following example creates a new dataverse named <tt>Commerce</tt> if one does not already exist.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE DATAVERSE Commerce IF NOT EXISTS;
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Create_Type"></a><a name="Types" id="Types"> Create Type </a></h4>
+<div class="section">
+<h5><a name="CreateType"></a>CreateType</h5>
+<p><img src="../images/diagrams/CreateType.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ObjectTypeDef"></a>ObjectTypeDef</h5>
+<p><img src="../images/diagrams/ObjectTypeDef.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ObjectField"></a>ObjectField</h5>
+<p><img src="../images/diagrams/ObjectField.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="TypeExpr"></a>TypeExpr</h5>
+<p><img src="../images/diagrams/TypeExpr.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ArrayTypeDef"></a>ArrayTypeDef</h5>
+<p><img src="../images/diagrams/ArrayTypeDef.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="MultisetTypeDef"></a>MultisetTypeDef</h5>
+<p><img src="../images/diagrams/MultisetTypeDef.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="TypeReference"></a>TypeReference</h5>
+<p><img src="../images/diagrams/TypeReference.png" alt="" /></p>
+<p>The <tt>CREATE TYPE</tt> statement is used to create a new named datatype. This type can then be used to create stored collections or utilized when defining one or more other datatypes. Much more information about the data model is available in the <a href="../datamodel.html">data model reference guide</a>. A new type can be a object type, a renaming of another type, an array type, or a multiset type. A object type can be defined as being either open or closed. Instances of a closed object type are not permitted to contain fields other than those specified in the create type statement. Instances of an open object type may carry additional fields, and open is the default for new types if neither option is specified.</p>
+<p>The following example creates three new object types called <tt>addressType</tt>, <tt>customerType</tt>, and <tt>itemType</tt>. Their fields are essentially traditional typed name/value pairs (much like SQL fields). Since it is defined as (defaulting to) being an open type, instances will be permitted to contain more than what is specified in the type definition. Indeed many of the customer objects contain a rating as well, however this is not necessary for the customer object to be created. As can be seen in the sample data, customers can exist without ratings or with part (or all) of the address missing.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE TYPE addressType AS {
+    street:                     string,
+    city:                       string,
+    zipcode:                    string?
+};
+
+CREATE TYPE customerType AS {
+    custid:                     string,
+    name:                       string,
+    address:                    addressType?
+};
+
+CREATE TYPE itemType AS {
+    itemno:                     int,
+    qty:                        int,
+    price:                      int
+};
+</pre></div></div>
+
+<p>Optionally, you may wish to create a type that has an automatically generated primary key field. The example below shows an alternate form of <tt>itemType</tt> which achieves this by setting its primary key, <tt>itemno</tt>, to UUID. (Refer to the Datasets section later for more details on such fields.)</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE TYPE itemType AS {
+    itemno:                     uuid,
+    qty:                        int,
+    price:                      int
+};
+</pre></div></div>
+
+<p>Note that the type of the <tt>itemno</tt> in this example is UUID. This field type can be used if you want to have an autogenerated-PK field. (Refer to the Datasets section later for more details on such fields.)</p>
+<p>The next example creates a new object type, closed this time, called <tt>orderType</tt>. Instances of this closed type will not be permitted to have extra fields, although the <tt>ship_date</tt> field is marked as optional and may thus be <tt>NULL</tt> or <tt>MISSING</tt> in legal instances of the type. The items field is an array of instances of another object type, <tt>itemType</tt>.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE TYPE orderType AS CLOSED {
+    orderno:                    int,
+    custid:                     string,
+    order_date:                 string,
+    ship_date:                  string?,
+    items:                      [ itemType ]
+};
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Create_Dataset"></a><a name="Datasets" id="Datasets"> Create Dataset</a></h4>
+<div class="section">
+<h5><a name="CreateDataset"></a>CreateDataset</h5>
+<p><img src="../images/diagrams/CreateDataset.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="CreateInternalDataset"></a>CreateInternalDataset</h5>
+<p><img src="../images/diagrams/CreateInternalDataset.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="CreateExternalDataset"></a>CreateExternalDataset</h5>
+<p><img src="../images/diagrams/CreateExternalDataset.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DatasetTypeDef"></a>DatasetTypeDef</h5>
+<p><img src="../images/diagrams/DatasetTypeDef.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DatasetFieldDef"></a>DatasetFieldDef</h5>
+<p><img src="../images/diagrams/DatasetFieldDef.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="TypeReference"></a>TypeReference</h5>
+<p><img src="../images/diagrams/TypeReference.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="PrimaryKey"></a>PrimaryKey</h5>
+<p><img src="../images/diagrams/PrimaryKey.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="NestedField"></a>NestedField</h5>
+<p><img src="../images/diagrams/NestedField.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="AdapterName"></a>AdapterName</h5>
+<p><img src="../images/diagrams/AdapterName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Configuration"></a>Configuration</h5>
+<p><img src="../images/diagrams/Configuration.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="KeyValuePair"></a>KeyValuePair</h5>
+<p><img src="../images/diagrams/KeyValuePair.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Properties"></a>Properties</h5>
+<p><img src="../images/diagrams/Properties.png" alt="" /></p>
+<p>The <tt>CREATE DATASET</tt> statement is used to create a new dataset. Datasets are named, multisets of object type instances; they are where data lives persistently and are the usual targets for queries. Datasets are typed, and the system ensures that their contents conform to their type definitions. An Internal dataset (the default kind) is a dataset whose content lives within and is managed by the system. It is required to have a specified unique primary key field which uniquely identifies the contained objects. (The primary key is also used in secondary indexes to identify the indexed primary data objects.)</p>
+<p>Internal datasets contain several advanced options that can be specified when appropriate. One such option is that random primary key (UUID) values can be auto-generated by declaring the field to be UUID and putting <tt>AUTOGENERATED</tt> after the <tt>PRIMARY KEY</tt> identifier. In this case, unlike other non-optional fields, a value for the auto-generated PK field should not be provided at insertion time by the user since each object&#x2019;s primary key field value will be auto-generated by the system.</p>
+<p>Another advanced option, when creating an Internal dataset, is to specify the merge policy to control which of the underlying LSM storage components to be merged. (The system supports Log-Structured Merge tree based physical storage for Internal datasets.) Currently the system supports four different component merging policies that can be chosen per dataset: no-merge, constant, prefix, and correlated-prefix. The no-merge policy simply never merges disk components. The constant policy merges disk components when the number of components reaches a constant number k that can be configured by the user. The prefix policy relies on both component sizes and the number of components to decide which components to merge. It works by first trying to identify the smallest ordered (oldest to newest) sequence of components such that the sequence does not contain a single component that exceeds some threshold size M and that either the sum of the component&#x2019;s sizes exceeds M or the number of components in the sequence exceeds another threshold C. If such a sequence exists, the components in the sequence are merged together to form a single component. Finally, the correlated-prefix policy is similar to the prefix policy, but it delegates the decision of merging the disk components of all the indexes in a dataset to the primary index. When the correlated-prefix policy decides that the primary index needs to be merged (using the same decision criteria as for the prefix policy), then it will issue successive merge requests on behalf of all other indexes associated with the same dataset. The system&#x2019;s default policy is the prefix policy except when there is a filter on a dataset, where the preferred policy for filters is the correlated-prefix.</p>
+<p>Another advanced option shown in the syntax above, related to performance and mentioned above, is that a <b>filter</b> can optionally be created on a field to further optimize range queries with predicates on the filter&#x2019;s field. Filters allow some range queries to avoid searching all LSM components when the query conditions match the filter. (Refer to <a href="../sqlpp/filters.html">Filter-Based LSM Index Acceleration</a> for more information about filters.)</p>
+<p>An External dataset, in contrast to an Internal dataset, has data stored outside of the system&#x2019;s control. Files living in HDFS or in the local filesystem(s) of a cluster&#x2019;s nodes are currently supported. External dataset support allows queries to treat foreign data as though it were stored in the system, making it possible to query &#x201c;legacy&#x201d; file data (for example, Hive data) without having to physically import it. When defining an External dataset, an appropriate adapter type must be selected for the desired external data. (See the <a href="../aql/externaldata.html">Guide to External Data</a> for more information on the available adapters.)</p>
+<p>The following example creates an Internal dataset for storing <tt>customerType</tt> objects. It specifies that their <tt>custid</tt> field is their primary key.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INTERNAL DATASET customers(customerType) PRIMARY KEY custid;
+</pre></div></div>
+
+<p>The next example creates an Internal dataset (the default kind when no dataset kind is specified) for storing <tt>itemType</tt> objects might look like. It specifies that the <tt>itemno</tt> field should be used as the primary key for the dataset. It also specifies that the <tt>itemno</tt> field is an auto-generated field, meaning that a randomly generated UUID value should be assigned to each incoming object by the system. (A user should therefore not attempt to provide a value for this field.)</p>
+<p>Note that the <tt>itemno</tt> field&#x2019;s declared type must be UUID in this case.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE DATASET MyItems(itemType) PRIMARY KEY itemno AUTOGENERATED;
+</pre></div></div>
+
+<p>Alternatively the dataset object type can be specified using inline type definition syntax.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE DATASET MyItems(itemno INT NOT UNKNOWN, qty INT NOT UNKNOWN, price INT NOT UNKNOWN) PRIMARY KEY itemno AUTOGENERATED;
+</pre></div></div>
+
+<p>The next example creates an External dataset for querying LineItemType objects. The choice of the <tt>hdfs</tt> adapter means that this dataset&#x2019;s data actually resides in HDFS. The example <tt>CREATE</tt> statement also provides parameters used by the hdfs adapter: the URL and path needed to locate the data in HDFS and a description of the data format.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE EXTERNAL DATASET LineItem(LineItemType) USING hdfs (
+  (&quot;hdfs&quot;=&quot;hdfs://HOST:PORT&quot;),
+  (&quot;path&quot;=&quot;HDFS_PATH&quot;),
+  (&quot;input-format&quot;=&quot;text-input-format&quot;),
+  (&quot;format&quot;=&quot;delimited-text&quot;),
+  (&quot;delimiter&quot;=&quot;|&quot;));
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Create_Index"></a><a name="Indices" id="Indices">Create Index</a></h4>
+<div class="section">
+<h5><a name="CreateIndex"></a>CreateIndex</h5>
+<p><img src="../images/diagrams/CreateIndex.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="CreateSecondaryIndex"></a>CreateSecondaryIndex</h5>
+<p><img src="../images/diagrams/CreateSecondaryIndex.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="CreatePrimaryKeyIndex"></a>CreatePrimaryKeyIndex</h5>
+<p><img src="../images/diagrams/CreatePrimaryKeyIndex.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="IndexedElement"></a>IndexedElement</h5>
+<p><b><img src="../images/diagrams/IndexedElement.png" alt="" /></b></p></div>
+<div class="section">
+<h5><a name="ArrayIndexElement"></a>ArrayIndexElement</h5>
+<p><b><img src="../images/diagrams/ArrayIndexElement.png" alt="" /></b></p></div>
+<div class="section">
+<h5><a name="IndexField"></a>IndexField</h5>
+<p><b><img src="../images/diagrams/IndexField.png" alt="" /></b></p></div>
+<div class="section">
+<h5><a name="NestedField"></a>NestedField</h5>
+<p><img src="../images/diagrams/NestedField.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="IndexType"></a>IndexType</h5>
+<p><img src="../images/diagrams/IndexType.png" alt="" /></p>
+<p>The <tt>CREATE INDEX</tt> statement creates a secondary index on one or more fields of a specified dataset. Supported index types include <tt>BTREE</tt> for totally ordered datatypes, <tt>RTREE</tt> for spatial data, and <tt>KEYWORD</tt> and <tt>NGRAM</tt> for textual (string) data. An index can be created on a nested field (or fields) by providing a valid path expression as an index field identifier. An array index can be created on an array or multiset datatype by providing a sequence of <tt>UNNEST</tt> and <tt>SELECT</tt>s to identify the field(s) to be indexed.</p>
+<p>An indexed field is not required to be part of the datatype associated with a dataset if the dataset&#x2019;s datatype is declared as open <b>and</b> if the field&#x2019;s type is provided along with its name and if the <tt>ENFORCED</tt> keyword is specified at the end of the index definition. <tt>ENFORCING</tt> an open field introduces a check that makes sure that the actual type of the indexed field (if the optional field exists in the object) always matches this specified (open) field type.</p>
+<p>The following example creates a btree index called <tt>cCustIdx</tt> on the <tt>custid</tt> field of the orders dataset. This index can be useful for accelerating exact-match queries, range search queries, and joins involving the <tt>custid</tt> field.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX cCustIdx ON orders(custid) TYPE BTREE;
+</pre></div></div>
+
+<p>The following example creates a btree index called <tt>oCNameIdx</tt> on the <tt>cname</tt> field of the orders dataset, but does not insert <tt>NULL</tt> and <tt>MISSING</tt> values into the index. By default, if <tt>INCLUDE/EXCLUDE UNKNOWN KEY</tt> is not specified, unknown values will be inserted into btree indexes.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX oCNametIdx ON orders(cname) EXCLUDE UNKNOWN KEY;
+</pre></div></div>
+
+<p>The following example creates an open btree index called <tt>oCreatedTimeIdx</tt> on the (non-declared) <tt>createdTime</tt> field of the <tt>orders</tt> dataset having <tt>datetime</tt> type. This index can be useful for accelerating exact-match queries, range search queries, and joins involving the <tt>createdTime</tt> field. The index is enforced so that records that do not have the <tt>createdTime</tt> field or have a mismatched type on the field cannot be inserted into the dataset.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX oCreatedTimeIdx ON orders(createdTime: datetime?) TYPE BTREE ENFORCED;
+</pre></div></div>
+
+<p>The following example creates an open btree index called <tt>cAddedTimeIdx</tt> on the (non-declared) <tt>addedTime</tt> field of the <tt>customers</tt> dataset having datetime type. This index can be useful for accelerating exact-match queries, range search queries, and joins involving the <tt>addedTime</tt> field. The index is not enforced so that records that do not have the <tt>addedTime</tt> field or have a mismatched type on the field can still be inserted into the dataset.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX cAddedTimeIdx ON customers(addedTime: datetime?);
+</pre></div></div>
+
+<p>The following example creates a btree index called <tt>oOrderUserNameIdx</tt> on <tt>orderUserName</tt>, a nested field residing within a object-valued user field in the <tt>orders</tt> dataset. This index can be useful for accelerating exact-match queries, range search queries, and joins involving the nested <tt>orderUserName</tt> field.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX oOrderUserNameIdx ON orders(order.orderUserName) TYPE BTREE;
+</pre></div></div>
+
+<p>The following example creates an array index called <tt>oItemsPriceIdx</tt> on the <tt>price</tt> field inside the <tt>items</tt> array of the <tt>orders</tt> dataset. This index can be useful for accelerating membership queries, existential or universal quantification queries, or joins involving the <tt>price</tt> field inside this array. Unknown values cannot currently be stored inside array indexes, so <tt>EXCLUDE UNKNOWN KEY</tt> must be specified.</p></div></div>
+<div class="section">
+<h4><a name="Example"></a>Example</h4>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX oItemsPriceIdx ON orders(UNNEST items SELECT price) EXCLUDE UNKNOWN KEY;
+</pre></div></div>
+
+<p>The following example creates an open rtree index called <tt>oOrderLocIdx</tt> on the order-location field of the <tt>orders</tt> dataset. This index can be useful for accelerating queries that use the <a href="builtins.html#spatial_intersect"><tt>spatial-intersect</tt> function</a> in a predicate involving the sender-location field.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX oOrderLocIDx ON orders(`order-location` : point?) TYPE RTREE ENFORCED;
+</pre></div></div>
+
+<p>The following example creates a 3-gram index called <tt>cUserIdx</tt> on the name field of the <tt>customers</tt> dataset. This index can be used to accelerate some similarity or substring maching queries on the name field. For details refer to the document on <a href="similarity.html#NGram_Index">similarity queries</a>.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX cUserIdx ON customers(name) TYPE NGRAM(3);
+</pre></div></div>
+
+<p>The following example creates a keyword index called <tt>oCityIdx</tt> on the <tt>city</tt> within the <tt>address</tt> field of the <tt>customers</tt> dataset. This keyword index can be used to optimize queries with token-based similarity predicates on the <tt>address</tt> field. For details refer to the document on <a href="similarity.html#Keyword_Index">similarity queries</a>.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE INDEX oCityIdx ON customers(address.city) TYPE KEYWORD;
+</pre></div></div>
+
+<p>The following example creates a special secondary index which holds only the primary keys. This index is useful for speeding up aggregation queries which involve only primary keys. The name of the index is optional. If the name is not specified, the system will generate one. When the user would like to drop this index, the metadata can be queried to find the system-generated name.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE PRIMARY INDEX cus_pk_idx ON customers;
+</pre></div></div>
+
+<p>An example query that can be accelerated using the primary-key index:</p>
+
+<div>
+<div>
+<pre class="source">SELECT COUNT(*) FROM customers;
+</pre></div></div>
+
+<p>To look up the the above primary-key index, issue the following query:</p>
+
+<div>
+<div>
+<pre class="source">SELECT VALUE i
+FROM Metadata.`Index` i
+WHERE i.DataverseName = &quot;Commerce&quot; AND i.DatasetName = &quot;customers&quot;;
+</pre></div></div>
+
+<p>The query returns:</p>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;DataverseName&quot;: &quot;Commerce&quot;,
+        &quot;DatasetName&quot;: &quot;customers&quot;,
+        &quot;IndexName&quot;: &quot;cus_pk_idx&quot;,
+        &quot;IndexStructure&quot;: &quot;BTREE&quot;,
+        &quot;SearchKey&quot;: [],
+        &quot;IsPrimary&quot;: false,
+        &quot;Timestamp&quot;: &quot;Fri Sep 18 14:15:51 PDT 2020&quot;,
+        &quot;PendingOp&quot;: 0
+    },
+    {
+        &quot;DataverseName&quot;: &quot;Commerce&quot;,
+        &quot;DatasetName&quot;: &quot;customers&quot;,
+        &quot;IndexName&quot;: &quot;customers&quot;,
+        &quot;IndexStructure&quot;: &quot;BTREE&quot;,
+        &quot;SearchKey&quot;: [
+            [
+                &quot;custid&quot;
+            ]
+        ],
+        &quot;IsPrimary&quot;: true,
+        &quot;Timestamp&quot;: &quot;Thu Jul 16 13:07:37 PDT 2020&quot;,
+        &quot;PendingOp&quot;: 0
+    }
+]
+</pre></div></div>
+
+<p>Remember that <tt>CREATE PRIMARY INDEX</tt> creates a secondary index. That is the reason the <tt>IsPrimary</tt> field is false. The primary-key index can be identified by the fact that the <tt>SearchKey</tt> field is empty since it only contains primary key fields.</p></div></div>
+<div class="section">
+<h4><a name="Create_Synonym"></a><a name="Synonyms" id="Synonyms"> Create Synonym</a></h4>
+<div class="section">
+<h5><a name="CreateSynonym"></a>CreateSynonym</h5>
+<p><img src="../images/diagrams/CreateSynonym.png" alt="" /></p>
+<p>The <tt>CREATE SYNONYM</tt> statement creates a synonym for a given dataset or a view. This synonym may be used instead of the dataset name in <tt>SELECT</tt>, <tt>INSERT</tt>, <tt>UPSERT</tt>, <tt>DELETE</tt>, and <tt>LOAD</tt> statements, or instead of the view name in <tt>SELECT</tt> statements. The target dataset or view does not need to exist when the synonym is created. A synonym may be created for another synonym.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE DATASET customers(customersType) PRIMARY KEY custid;
+
+CREATE SYNONYM customersSynonym FOR customers;
+
+SELECT * FROM customersSynonym;
+</pre></div></div>
+
+<p>More information on how synonyms are resolved can be found in <a href="#Variable_bindings_and_name_resolution">Appendix 3. Variable Bindings and Name Resolution</a>.</p></div></div>
+<div class="section">
+<h4><a name="Create_Function"></a><a name="Create_function" id="Create_function">Create Function</a></h4>
+<p>The <tt>CREATE FUNCTION</tt> statement creates a <b>named</b> function that can then be used and reused in queries. The body of a function can be any query expression involving the function&#x2019;s parameters.</p>
+<div class="section">
+<h5><a name="CreateFunction"></a>CreateFunction</h5>
+<p><img src="../images/diagrams/CreateFunction.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="FunctionParameters"></a>FunctionParameters</h5>
+<p><img src="../images/diagrams/FunctionParameters.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="ExternalFunctionDef"></a>ExternalFunctionDef</h5>
+<p><img src="../images/diagrams/ExternalFunctionDef.png" alt="" /></p>
+<p>The following is an example of a <tt>CREATE FUNCTION</tt> statement which is similar to our earlier <tt>DECLARE FUNCTION</tt> example.</p>
+<p>It differs from that example in that it results in a function that is persistently registered by name in the specified dataverse (the current dataverse being used, if not otherwise specified).</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE FUNCTION nameSearch(customerId) {
+    (SELECT c.custid, c.name
+     FROM customers AS c
+     WHERE u.custid = customerId)[0]
+ };
+</pre></div></div>
+
+<p>The following is an example of CREATE FUNCTION statement that replaces an existing function.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE OR REPLACE FUNCTION friendInfo(userId) {
+    (SELECT u.id, u.name
+     FROM GleambookUsers u
+     WHERE u.id = userId)[0]
+ };
+</pre></div></div>
+
+<p>The following is an example of CREATE FUNCTION statement that introduces a function with a variable number of arguments. The arguments are accessible in the function body via <tt>args</tt> array parameter.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE FUNCTION strJoin(...) {
+    string_join(args, &quot;,&quot;)
+};
+</pre></div></div>
+
+<p>External functions can also be loaded into Libraries via the <a href="../udf.html">UDF API</a>. Given an already loaded library <tt>pylib</tt>, a function <tt>sentiment</tt> mapping to a Python method <tt>sent_model.sentiment</tt> in <tt>sentiment_mod</tt> would be as follows</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE FUNCTION sentiment(a) AS &quot;sentiment_mod&quot;, &quot;sent_model.sentiment&quot; AT pylib;
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Create_View"></a><a name="Create_view" id="Create_view">Create View</a></h4>
+<p>The <tt>CREATE VIEW</tt> statement creates a <b>named</b> view that can then be used in queries. The body of a view can be any <tt>SELECT</tt> statement.</p>
+<div class="section">
+<h5><a name="CreateView"></a>CreateView</h5>
+<p><img src="../images/diagrams/CreateView.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">CREATE DATASET customers(customersType) PRIMARY KEY custid;
+
+CREATE VIEW customersView AS 
+    SELECT c.custid, c.name
+    FROM customers AS c 
+    WHERE c.address.city = &quot;Boston, MA&quot;;
+
+SELECT * FROM customersView;
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Drop_Statement"></a><a name="Removal" id="Removal">Drop Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="DropStmnt"></a>DropStmnt</h5>
+<p><img src="../images/diagrams/DropStmnt.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DataverseName"></a>DataverseName</h5>
+<p><img src="../images/diagrams/DataverseName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="QualifiedName"></a>QualifiedName</h5>
+<p><img src="../images/diagrams/QualifiedName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="DoubleQualifiedName"></a>DoubleQualifiedName</h5>
+<p><img src="../images/diagrams/DoubleQualifiedName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="FunctionSignature"></a>FunctionSignature</h5>
+<p><img src="../images/diagrams/FunctionSignature.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="FunctionParameters"></a>FunctionParameters</h5>
+<p><img src="../images/diagrams/FunctionParameters.png" alt="" /></p>
+<p>The <tt>DROP</tt> statement is the inverse of the <tt>CREATE</tt> statement. It can be used to drop dataverses, datatypes, datasets, indexes, functions, and synonyms.</p>
+<p>The following examples illustrate some uses of the <tt>DROP</tt> statement.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">DROP DATASET customers IF EXISTS;
+
+DROP INDEX orders.orderidIndex;
+
+DROP TYPE customers2.customersType;
+
+DROP FUNCTION nameSearch@1;
+
+DROP SYNONYM customersSynonym;
+
+DROP VIEW customersView;
+
+DROP DATAVERSE CommerceData;
+</pre></div></div>
+
+<p>When an artifact is dropped, it will be droppped from the current dataverse if none is specified (see the <tt>DROP DATASET</tt> example above) or from the specified dataverse (see the <tt>DROP TYPE</tt> example above) if one is specified by fully qualifying the artifact name in the <tt>DROP</tt> statement. When specifying an index to drop, the index name must be qualified by the dataset that it indexes. When specifying a function to drop, since the query language allows functions to be overloaded by their number of arguments, the identifying name of the function to be dropped must explicitly include that information. (<tt>nameSearch@1</tt> above denotes the 1-argument function named <tt>nameSearch</tt> in the current dataverse.)</p></div></div></div>
+<div class="section">
+<h3><a name="Load_Statement"></a><a name="Load_statement" id="Load_statement">Load Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="LoadStmnt"></a>LoadStmnt</h5>
+<p><img src="../images/diagrams/LoadStmnt.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="AdapterName"></a>AdapterName</h5>
+<p><img src="../images/diagrams/AdapterName.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="Configuration"></a>Configuration</h5>
+<p><img src="../images/diagrams/Configuration.png" alt="" /></p></div>
+<div class="section">
+<h5><a name="KeyValuePair"></a>KeyValuePair</h5>
+<p><img src="../images/diagrams/KeyValuePair.png" alt="" /></p>
+<p>The <tt>LOAD</tt> statement is used to initially populate a dataset via bulk loading of data from an external file. An appropriate adapter must be selected to handle the nature of the desired external data. The <tt>LOAD</tt> statement accepts the same adapters and the same parameters as discussed earlier for External datasets. (See the <a href="../aql/externaldata.html">guide to external data</a> for more information on the available adapters.) If a dataset has an auto-generated primary key field, the file to be imported should not include that field in it.</p>
+<p>The target dataset name may be a synonym introduced by <tt>CREATE SYNONYM</tt> statement.</p>
+<p>The following example shows how to bulk load the <tt>customers</tt> dataset from an external file containing data that has been prepared in ADM (Asterix Data Model) format.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source"> LOAD DATASET customers USING localfs
+    ((&quot;path&quot;=&quot;127.0.0.1:///Users/bignosqlfan/commercenew/gbu.adm&quot;),(&quot;format&quot;=&quot;adm&quot;));
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="Modification_statements" id="Modification_statements">Modification statements</a></h2>
+<div class="section">
+<h3><a name="Insert_Statement"></a><a name="Inserts" id="Inserts">Insert Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="InsertStmnt"></a>InsertStmnt</h5>
+<p><img src="../images/diagrams/InsertStmnt.png" alt="" /></p>
+<p>The <tt>INSERT</tt> statement is used to insert new data into a dataset. The data to be inserted comes from a query expression. This expression can be as simple as a constant expression, or in general it can be any legal query. In case the dataset has an auto-generated primary key, when performing an <tt>INSERT</tt> operation, the system allows the user to manually add the auto-generated key field in the <tt>INSERT</tt> statement, or skip that field and the system will automatically generate it and add it. However, it is important to note that if the a record already exists in the dataset with the auto-generated key provided by the user, then that operation is going to fail. As a general rule, insertion will fail if the dataset already has data with the primary key value(s) being inserted.</p>
+<p>Inserts are processed transactionally by the system. The transactional scope of each insert transaction is the insertion of a single object plus its affiliated secondary index entries (if any). If the query part of an insert returns a single object, then the <tt>INSERT</tt> statement will be a single, atomic transaction. If the query part returns multiple objects, each object being inserted will be treated as a separate tranaction.</p>
+<p>The target dataset name may be a synonym introduced by <tt>CREATE SYNONYM</tt> statement.</p>
+<p>The following example illustrates a query-based insertion.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">INSERT INTO custCopy (SELECT VALUE c FROM customers c)
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Upsert_Statement"></a><a name="Upserts" id="Upserts">Upsert Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="UpsertStmnt"></a>UpsertStmnt</h5>
+<p><img src="../images/diagrams/UpsertStmnt.png" alt="" /></p>
+<p>The <tt>UPSERT</tt> statement syntactically mirrors the <tt>INSERT</tt>statement discussed above. The difference lies in its semantics, which for <tt>UPSERT</tt> are &#x201c;add or replace&#x201d; instead of the <tt>INSERT</tt> &#x201c;add if not present, else error&#x201d; semantics. Whereas an <tt>INSERT</tt> can fail if another object already exists with the specified key, the analogous <tt>UPSERT</tt> will replace the previous object&#x2019;s value with that of the new object in such cases. Like the <tt>INSERT</tt> statement, the system allows the user to manually provide the auto-generated key for datasets with an auto-generated key as its primary key. This operation will insert the record if no record with that key already exists, but if a record with the key already exists, then the operation will be converted to a replace/update operation.</p>
+<p>The target dataset name may be a synonym introduced by <tt>CREATE SYNONYM</tt> statement.</p>
+<p>The following example illustrates a query-based upsert operation.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">UPSERT INTO custCopy (SELECT VALUE c FROM customers c)
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Delete_Statement"></a><a name="Deletes" id="Deletes">Delete Statement</a></h3>
+<div class="section">
+<div class="section">
+<h5><a name="DeleteStmnt"></a>DeleteStmnt</h5>
+<p><img src="../images/diagrams/DeleteStmnt.png" alt="" /></p>
+<p>The <tt>DELETE</tt> statement is used to delete data from a target dataset. The data to be deleted is identified by a boolean expression involving the variable bound to the target dataset in the <tt>DELETE</tt> statement.</p>
+<p>Deletes are processed transactionally by the system. The transactional scope of each delete transaction is the deletion of a single object plus its affiliated secondary index entries (if any). If the boolean expression for a delete identifies a single object, then the <tt>DELETE</tt> statement itself will be a single, atomic transaction. If the expression identifies multiple objects, then each object deleted will be handled as a separate transaction.</p>
+<p>The target dataset name may be a synonym introduced by <tt>CREATE SYNONYM</tt> statement.</p>
+<p>The following examples illustrate single-object deletions.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">DELETE FROM customers c WHERE c.custid = &quot;C41&quot;;
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">DELETE FROM customers WHERE custid = &quot;C47&quot;;
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<h1><a name="Reserved_keywords" id="Reserved_keywords">Appendix 1. Reserved keywords</a></h1><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>All reserved keywords are listed in the following table:</p>
+<table border="0" class="table table-striped">
+<thead>
+
+<tr class="a">
+<th>     </th>
+<th>     </th>
+<th>       </th>
+<th>    </th>
+<th>     </th>
+<th>    </th></tr>
+</thead><tbody>
+
+<tr class="b">
+<td> ADAPTER </td>
+<td> ALL </td>
+<td> AND </td>
+<td> ANY </td>
+<td> APPLY </td>
+<td> AS </td></tr>
+<tr class="a">
+<td> ASC </td>
+<td> AT </td>
+<td> AUTOGENERATED </td>
+<td> BETWEEN </td>
+<td> BTREE </td>
+<td> BY </td></tr>
+<tr class="b">
+<td> CASE </td>
+<td> CLOSED </td>
+<td> COLLECTION </td>
+<td> CREATE </td>
+<td> COMPACTION </td>
+<td> COMPACT </td></tr>
+<tr class="a">
+<td> CONNECT </td>
+<td> CORRELATE </td>
+<td> DATASET </td>
+<td> DATAVERSE </td>
+<td> DECLARE </td>
+<td> DEFINITION </td></tr>
+<tr class="b">
+<td> DELETE </td>
+<td> DESC </td>
+<td> DISCONNECT </td>
+<td> DISTINCT </td>
+<td> DIV </td>
+<td> DROP </td></tr>
+<tr class="a">
+<td> ELEMENT </td>
+<td> EXPLAIN </td>
+<td> ELSE </td>
+<td> ENFORCED </td>
+<td> END </td>
+<td> EVERY </td></tr>
+<tr class="b">
+<td> EXCEPT </td>
+<td> EXIST </td>
+<td> EXTERNAL </td>
+<td> FEED </td>
+<td> FILTER </td>
+<td> FLATTEN </td></tr>
+<tr class="a">
+<td> FOR </td>
+<td> FROM </td>
+<td> FULL </td>
+<td> FULLTEXT </td>
+<td> FUNCTION </td>
+<td> GROUP </td></tr>
+<tr class="b">
+<td> HAVING </td>
+<td> HINTS </td>
+<td> IF </td>
+<td> INTO </td>
+<td> IN </td>
+<td> INDEX </td></tr>
+<tr class="a">
+<td> INGESTION </td>
+<td> INNER </td>
+<td> INSERT </td>
+<td> INTERNAL </td>
+<td> INTERSECT </td>
+<td> IS </td></tr>
+<tr class="b">
+<td> JOIN </td>
+<td> KEYWORD </td>
+<td> LEFT </td>
+<td> LETTING </td>
+<td> LET </td>
+<td> LIKE </td></tr>
+<tr class="a">
+<td> LIMIT </td>
+<td> LOAD </td>
+<td> MISSING </td>
+<td> NODEGROUP </td>
+<td> NGRAM </td>
+<td> NOT </td></tr>
+<tr class="b">
+<td> NULL </td>
+<td> OFFSET </td>
+<td> ON </td>
+<td> OPEN </td>
+<td> OR </td>
+<td> ORDER </td></tr>
+<tr class="a">
+<td> OUTER </td>
+<td> OUTPUT </td>
+<td> OVER </td>
+<td> PATH </td>
+<td> POLICY </td>
+<td> PRE-SORTED </td></tr>
+<tr class="b">
+<td> PRIMARY </td>
+<td> RAW </td>
+<td> REFRESH </td>
+<td> RETURN </td>
+<td> RETURNING </td>
+<td> RIGHT </td></tr>
+<tr class="a">
+<td> RTREE </td>
+<td> RUN </td>
+<td> SATISFIES </td>
+<td> SECONDARY </td>
+<td> SELECT </td>
+<td> SET </td></tr>
+<tr class="b">
+<td> SOME </td>
+<td> START </td>
+<td> STOP </td>
+<td> SYNONYM </td>
+<td> TEMPORARY </td>
+<td> THEN </td></tr>
+<tr class="a">
+<td> TO </td>
+<td> TRUE </td>
+<td> TYPE </td>
+<td> UNION </td>
+<td> UNKNOWN </td>
+<td> UNNEST </td></tr>
+<tr class="b">
+<td> UPDATE </td>
+<td> UPSERT </td>
+<td> USE </td>
+<td> USING </td>
+<td> VALUE </td>
+<td> VALUED </td></tr>
+<tr class="a">
+<td> WHEN </td>
+<td> WHERE </td>
+<td> WITH </td>
+<td> WRITE </td>
+<td>     </td>
+<td>     </td></tr>
+</tbody>
+</table><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div></div>
+<div class="section">
+<h2><a name="Appendix_2._Performance_Tuning"></a><a name="Performance_tuning" id="Performance_tuning">Appendix 2. Performance Tuning</a></h2><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>The <tt>SET</tt> statement can be used to override some cluster-wide configuration parameters for a specific request:</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="SetStmnt"></a>SetStmnt</h5>
+<p><img src="../images/diagrams/SetStmnt.png" alt="" /></p>
+<p>As parameter identifiers are qualified names (containing a &#x2018;.&#x2019;) they have to be escaped using backticks (``). Note that changing query parameters will not affect query correctness but only impact performance characteristics, such as response time and throughput.</p></div></div></div></div>
+<div class="section">
+<h2><a name="Parallelism_Parameter"></a><a name="Parallelism_parameter" id="Parallelism_parameter">Parallelism Parameter</a></h2>
+<p>The system can execute each request using multiple cores on multiple machines (a.k.a., partitioned parallelism) in a cluster. A user can manually specify the maximum execution parallelism for a request to scale it up and down using the following parameter:</p>
+<ul>
+
+<li><b>compiler.parallelism</b>: the maximum number of CPU cores can be used to process a query. There are three cases of the value <i>p</i> for compiler.parallelism:
+<ul>
+
+<li>
+
+<p><i>p</i> &lt; 0 or <i>p</i> &gt; the total number of cores in a cluster:  the system will use all available cores in the cluster;</p>
+</li>
+<li>
+
+<p><i>p</i> = 0 (the default):  the system will use the storage parallelism (the number of partitions of stored datasets) as the maximum parallelism for query processing;</p>
+</li>
+<li>
+
+<p>all other cases:  the system will use the user-specified number as the maximum number of CPU cores to use for executing the query.</p>
+</li>
+</ul>
+</li>
+</ul>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">SET `compiler.parallelism` &quot;16&quot;;
+
+SELECT c.name AS cname, o.orderno AS orderno
+FROM customers c JOIN orders o ON c.custid = o.custid;
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="Memory_Parameters"></a><a name="Memory_parameters" id="Memory_parameters">Memory Parameters</a></h2>
+<p>In the system, each blocking runtime operator such as join, group-by and order-by works within a fixed memory budget, and can gracefully spill to disks if the memory budget is smaller than the amount of data they have to hold. A user can manually configure the memory budget of those operators within a query. The supported configurable memory parameters are:</p>
+<ul>
+
+<li>
+
+<p><b>compiler.groupmemory</b>: the memory budget that each parallel group-by operator instance can use; 32MB is the default budget.</p>
+</li>
+<li>
+
+<p><b>compiler.sortmemory</b>: the memory budget that each parallel sort operator instance can use; 32MB is the default budget.</p>
+</li>
+<li>
+
+<p><b>compiler.joinmemory</b>: the memory budget that each parallel hash join operator instance can use; 32MB is the default budget.</p>
+</li>
+<li>
+
+<p><b>compiler.windowmemory</b>: the memory budget that each parallel window aggregate operator instance can use; 32MB is the default budget.</p>
+</li>
+</ul>
+<p>For each memory budget value, you can use a 64-bit integer value with a 1024-based binary unit suffix (for example, B, KB, MB, GB). If there is no user-provided suffix, &#x201c;B&#x201d; is the default suffix. See the following examples.</p>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">SET `compiler.groupmemory` &quot;64MB&quot;;
+
+SELECT c.custid, COUNT(*)
+FROM customers c
+GROUP BY c.custid;
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">SET `compiler.sortmemory` &quot;67108864&quot;;
+
+SELECT VALUE o
+FROM orders AS o
+ORDER BY ARRAY_LENGTH(o.items) DESC;
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">SET `compiler.joinmemory` &quot;132000KB&quot;;
+
+SELECT c.name AS cname, o.ordeno AS orderno
+FROM customers c JOIN orders o ON c.custid = o.custid;
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div></div>
+<div class="section">
+<h2><a name="Parallel_Sort_Parameter"></a><a name="Parallel_sort_parameter" id="Parallel_sort_parameter">Parallel Sort Parameter</a></h2>
+<p>The following parameter enables you to activate or deactivate full parallel sort for order-by operations.</p>
+<p>When full parallel sort is inactive (<tt>false</tt>), each existing data partition is sorted (in parallel), and then all data partitions are merged into a single node.</p>
+<p>When full parallel sort is active (<tt>true</tt>), the data is first sampled, and then repartitioned so that each partition contains data that is greater than the previous partition. The data in each partition is then sorted (in parallel), but the sorted partitions are not merged into a single node.</p>
+<ul>
+
+<li><b>compiler.sort.parallel</b>: A boolean specifying whether full parallel sort is active (<tt>true</tt>) or inactive (<tt>false</tt>). The default value is <tt>true</tt>.</li>
+</ul>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">SET `compiler.sort.parallel` &quot;true&quot;;
+
+SELECT VALUE o
+FROM orders AS o
+ORDER BY ARRAY_LENGTH(o.items) DESC;
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div></div>
+<div class="section">
+<h2><a name="Controlling_Index-Only-Plan_Parameter"></a><a name="Index_Only" id="Index_Only">Controlling Index-Only-Plan Parameter</a></h2>
+<p>By default, the system tries to build an index-only plan whenever utilizing a secondary index is possible. For example, if a <tt>SELECT</tt> or <tt>JOIN</tt> query can utilize an enforced B+Tree or R-Tree index on a field, the optimizer checks whether a secondary-index search alone can generate the result that the query asks for. It mainly checks two conditions: (1) predicates used in <tt>WHERE</tt> only uses the primary key field and/or secondary key field and (2) the result does not return any other fields. If these two conditions hold, it builds an index-only plan. Since an index-only plan only searches a secondary-index to answer a query, it is faster than a non-index-only plan that needs to search the primary index. However, this index-only plan can be turned off per query by setting the following parameter.</p>
+<ul>
+
+<li><b>compiler.indexonly</b>: if this is set to false, the index-only-plan will not be applied; the default value is true.</li>
+</ul>
+<div class="section">
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">set `compiler.indexonly` &quot;false&quot;;
+
+SELECT o.order_date AS orderdate
+FROM orders o where o.order_date = &quot;2020-05-01&quot;;
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div></div>
+<div class="section">
+<h2><a name="Controlling_Array-Index_Access_Method_Plan_Parameter"></a><a name="ArrayIndexFlag" id="ArrayIndexFlag">Controlling Array-Index Access Method Plan Parameter</a></h2>
+<p>By default, the system attempts to utilize array indexes as an access method if an array index is present and is applicable. If you believe that your query will not benefit from an array index, toggle the parameter below.</p>
+<ul>
+
+<li><b>compiler.arrayindex</b>: if this is set to true, array indexes will be considered as an access method for applicable queries; the default value is true.</li>
+</ul>
+<div class="section">
+<div class="section">
+<h4><a name="Example"></a>Example</h4>
+
+<div>
+<div>
+<pre class="source">set `compiler.arrayindex` &quot;false&quot;;
+
+SELECT o.orderno
+FROM orders o
+WHERE SOME i IN o.items
+SATISFIES i.price = 19.91;
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div>
+<div class="section">
+<h2><a name="Query_Hints"></a><a name="Query_hints" id="Query_hints">Query Hints</a></h2>
+<div class="section">
+<div class="section">
+<h4><a name="a.E2.80.9Chash.E2.80.9D_GROUP_BY_hint"></a><a name="hash_groupby" id="hash_groupby">&#x201c;hash&#x201d; GROUP BY hint</a></h4>
+<p>The system supports two algorithms for GROUP BY clause evaluation: pre-sorted and hash-based. By default it uses the pre-sorted approach: The input data is first sorted on the grouping fields and then aggregation is performed on that sorted data. The alternative is a hash-based strategy which can be enabled via a <tt>/*+ hash */</tt> GROUP BY hint: The data is aggregated using an in-memory hash-table (that can spill to disk if necessary). This approach is recommended for low-cardinality grouping fields.</p>
+<div class="section">
+<h5><a name="Example:"></a>Example:</h5>
+
+<div>
+<div>
+<pre class="source">SELECT c.address.state, count(*)
+FROM Customers AS c
+/*+ hash */ GROUP BY c.address.state
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="a.E2.80.9Chash-bcast.E2.80.9D_JOIN_hint"></a><a name="hash_bcast_join" id="hash_bcast_join">&#x201c;hash-bcast&#x201d; JOIN hint</a></h4>
+<p>By default the system uses a partitioned-parallel hash join strategy to parallelize the execution of an equi-join. In this approach both sides of the join are repartitioned (if necessary) on a hash of the join key; potentially matching data items thus arrive at the same partition to be joined locally. This strategy is robust, but not always the fastest when one of the join sides is low cardinality and the other is high cardinality (since it scans and potentially moves the data from both sides). This special case can be better handled by broadcasting (replicating) the smaller side to all data partitions of the larger side and not moving the data from the other (larger) side. The system provides a join hint to enable this strategy: <tt>/*+ hash-bcast */</tt>. This hint forces the right side of the join to be replicated while the left side retains its original partitioning.</p>
+<div class="section">
+<h5><a name="Example:"></a>Example:</h5>
+
+<div>
+<div>
+<pre class="source">SELECT *
+FROM Orders AS o JOIN Customers AS c
+ON o.customer_id /*+ hash-bcast */ = c.customer_id
+</pre></div></div>
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div></div></div></div>
+<div class="section">
+<h2><a name="Appendix_3._Variable_Bindings_and_Name_Resolution"></a><a name="Variable_bindings_and_name_resolution" id="Variable_bindings_and_name_resolution">Appendix 3. Variable Bindings and Name Resolution</a></h2><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>In this Appendix, we&#x2019;ll look at how variables are bound and how names are resolved. Names can appear in every clause of a query. Sometimes a name consists of just a single identifier, e.g., <tt>region</tt> or <tt>revenue</tt>. More often a name will consist of two identifiers separated by a dot, e.g., <tt>customer.address</tt>. Occasionally a name may have more than two identifiers, e.g., <tt>policy.owner.address.zipcode</tt>. <i>Resolving</i> a name means determining exactly what the (possibly multi-part) name refers to. It is necessary to have well-defined rules for how to resolve a name in cases of ambiguity. (In the absence of schemas, such cases arise more commonly, and also differently, than they do in SQL.)</p>
+<p>The basic job of each clause in a query block is to bind variables. Each clause sees the variables bound by previous clauses and may bind additional variables. Names are always resolved with respect to the variables that are bound (&#x201c;in scope&#x201d;) at the place where the name use in question occurs. It is possible that the name resolution process will fail, which may lead to an empty result or an error message.</p>
+<p>One important bit of background: When the system is reading a query and resolving its names, it has a list of all the available dataverses and datasets. As a result, it knows whether <tt>a.b</tt> is a valid name for dataset <tt>b</tt> in dataverse <tt>a</tt>. However, the system does not in general have knowledge of the schemas of the data inside the datasets; remember that this is a much more open world. As a result, in general the system cannot know whether any object in a particular dataset will have a field named <tt>c</tt>. These assumptions affect how errors are handled. If you try to access dataset <tt>a.b</tt> and no dataset by that name exists, you will get an error and your query will not run. However, if you try to access a field <tt>c</tt> in a collection of objects, your query will run and return <tt>missing</tt> for each object that doesn&#x2019;t have a field named <tt>c</tt> - this is because it&#x2019;s possible that some object (someday) could have such a field.</p></div>
+<div class="section">
+<h2><a name="Binding_Variables"></a><a name="Binding_variables" id="Binding_variables">Binding Variables</a></h2>
+<p>Variables can be bound in the following ways:</p>
+<ol style="list-style-type: decimal">
+
+<li>
+
+<p><tt>WITH</tt> and <tt>LET</tt> clauses bind a variable to the result of an expression in a straightforward way</p>
+<p>Examples:</p>
+<p><tt>WITH cheap_parts AS (SELECT partno FROM parts WHERE price &lt; 100)</tt> binds the variable <tt>cheap_parts</tt> to the result of the subquery.</p>
+<p><tt>LET pay = salary + bonus</tt> binds the variable <tt>pay</tt> to the result of evaluating the expression <tt>salary + bonus</tt>.</p>
+</li>
+<li>
+
+<p><tt>FROM</tt>, <tt>GROUP BY</tt>, and <tt>SELECT</tt> clauses have optional <tt>AS</tt> subclauses that contain an expression and a name (called an <i>iteration variable</i> in a <tt>FROM</tt> clause, or an alias in <tt>GROUP BY</tt> or <tt>SELECT</tt>).</p>
+<p>Examples:</p>
+<p><tt>FROM customer AS c, order AS o</tt></p>
+<p><tt>GROUP BY salary + bonus AS total_pay</tt></p>
+<p><tt>SELECT MAX(price) AS highest_price</tt></p>
+<p>An <tt>AS</tt> subclause always binds the name (as a variable) to the result of the expression (or, in the case of a <tt>FROM</tt> clause, to the <i>individual members</i> of the collection identified by the expression).</p>
+<p>It&#x2019;s always a good practice to use the keyword <tt>AS</tt> when defining an alias or iteration variable. However, as in SQL, the syntax allows the keyword <tt>AS</tt> to be omitted. For example, the <tt>FROM</tt> clause above could have been written like this:</p>
+<p><tt>FROM customer c, order o</tt></p>
+<p>Omitting the keyword <tt>AS</tt> does not affect the binding of variables. The FROM clause in this example binds variables c and o whether the keyword AS is used or not.</p>
+<p>In certain cases, a variable is automatically bound even if no alias or variable-name is specified. Whenever an expression could have been followed by an AS subclause, if the expression consists of a simple name or a path expression, that expression binds a variable whose name is the same as the simple name or the last step in the path expression. Here are some examples:</p>
+<p><tt>FROM customer, order</tt> binds iteration variables named <tt>customer</tt> and <tt>order</tt></p>
+<p><tt>GROUP BY address.zipcode</tt> binds a variable named <tt>zipcode</tt></p>
+<p><tt>SELECT item[0].price</tt> binds a variable named <tt>price</tt></p>
+<p>Note that a <tt>FROM</tt> clause iterates over a collection (usually a dataset), binding a variable to each member of the collection in turn. The name of the collection remains in scope, but it is not a variable. For example, consider this <tt>FROM</tt> clause used in a self-join:</p>
+<p><tt>FROM customer AS c1, customer AS c2</tt></p>
+<p>This <tt>FROM</tt> clause joins the customer dataset to itself, binding the iteration variables <tt>c1</tt> and <tt>c2</tt> to objects in the left-hand-side and right-hand-side of the join, respectively. After the <tt>FROM</tt> clause, <tt>c1</tt> and <tt>c2</tt> are in scope as variables, and customer remains accessible as a dataset name but not as a variable.</p>
+</li>
+<li>
+
+<p>Special rules for <tt>GROUP BY</tt>:</p>
+<ul>
+
+<li>
+
+<p>(3A): If a <tt>GROUP BY</tt> clause specifies an expression that has no explicit alias, it binds a pseudo-variable that is lexicographically identical to the expression itself. For example:</p>
+<p><tt>GROUP BY salary + bonus</tt> binds a pseudo-variable named <tt>salary + bonus</tt>.</p>
+<p>This rule allows subsequent clauses to refer to the grouping expression (salary + bonus) even though its constituent variables (salary and bonus) are no longer in scope. For example, the following query is valid:</p>
+
+<div>
+<div>
+<pre class="source">FROM employee
+GROUP BY salary + bonus
+HAVING salary + bonus &gt; 1000
+SELECT salary + bonus, COUNT(*) AS how_many
+</pre></div></div>
+
+<p>While it might have been more elegant to explicitly require an alias in cases like this, the pseudo-variable rule is retained for SQL compatibility. Note that the expression <tt>salary + bonus</tt> is not <i>actually</i> evaluated in the <tt>HAVING</tt> and <tt>SELECT</tt> clauses (and could not be since <tt>salary</tt> and <tt>bonus</tt> are no longer individually in scope). Instead, the expression <tt>salary + bonus</tt> is treated as a reference to the pseudo-variable defined in the <tt>GROUP BY</tt> clause.</p>
+</li>
+<li>
+
+<p>(3B): The <tt>GROUP BY</tt> clause may be followed by a <tt>GROUP AS</tt> clause that binds a variable to the group. The purpose of this variable is to make the individual objects inside the group visible to subqueries that may need to iterate over them.</p>
+<p>The <tt>GROUP AS</tt> variable is bound to a multiset of objects. Each object represents one of the members of the group. Since the group may have been formed from a join, each of the member-objects contains a nested object for each variable bound by the nearest <tt>FROM</tt> clause (and its <tt>LET</tt> subclause, if any). These nested objects, in turn, contain the actual fields of the group-member. To understand this process, consider the following query fragment:</p>
+
+<div>
+<div>
+<pre class="source">FROM parts AS p, suppliers AS s
+WHERE p.suppno = s.suppno
+GROUP BY p.color GROUP AS g
+</pre></div></div>
+
+<p>Suppose that the objects in <tt>parts</tt> have fields <tt>partno</tt>, <tt>color</tt>, and <tt>suppno</tt>. Suppose that the objects in suppliers have fields <tt>suppno</tt> and <tt>location</tt>.</p>
+<p>Then, for each group formed by the <tt>GROUP BY</tt>, the variable g will be bound to a multiset with the following structure:</p>
+
+<div>
+<div>
+<pre class="source">[ { &quot;p&quot;: { &quot;partno&quot;: &quot;p1&quot;, &quot;color&quot;: &quot;red&quot;, &quot;suppno&quot;: &quot;s1&quot; },
+    &quot;s&quot;: { &quot;suppno&quot;: &quot;s1&quot;, &quot;location&quot;: &quot;Denver&quot; } },
+  { &quot;p&quot;: { &quot;partno&quot;: &quot;p2&quot;, &quot;color&quot;: &quot;red&quot;, &quot;suppno&quot;: &quot;s2&quot; },
+    &quot;s&quot;: { &quot;suppno&quot;: &quot;s2&quot;, &quot;location&quot;: &quot;Atlanta&quot; } },
+  ...
+]
+</pre></div></div>
+</li>
+</ul>
+</li>
+</ol></div>
+<div class="section">
+<h2><a name="Scoping" id="Scoping">Scoping</a></h2>
+<p>In general, the variables that are in scope at a particular position are those variables that were bound earlier in the current query block, in outer (enclosing) query blocks, or in a <tt>WITH</tt> clause at the beginning of the query. More specific rules follow.</p>
+<p>The clauses in a query block are conceptually processed in the following order:</p>
+<ul>
+
+<li><tt>FROM</tt> (followed by LET subclause, if any)</li>
+<li><tt>WHERE</tt></li>
+<li><tt>GROUP BY</tt> (followed by LET subclause, if any)</li>
+<li><tt>HAVING</tt></li>
+<li><tt>SELECT</tt> or <tt>SELECT VALUE</tt></li>
+<li><tt>ORDER BY</tt></li>
+<li><tt>OFFSET</tt></li>
+<li><tt>LIMIT</tt></li>
+</ul>
+<p>During processing of each clause, the variables that are in scope are those variables that are bound in the following places:</p>
+<ol style="list-style-type: decimal">
+
+<li>
+
+<p>In earlier clauses of the same query block (as defined by the ordering given above).</p>
+<p>Example: <tt>FROM orders AS o SELECT o.date</tt> The variable <tt>o</tt> in the <tt>SELECT</tt> clause is bound, in turn, to each object in the dataset <tt>orders</tt>.</p>
+</li>
+<li>
+
+<p>In outer query blocks in which the current query block is nested. In case of duplication, the innermost binding wins.</p>
+</li>
+<li>
+
+<p>In the <tt>WITH</tt> clause (if any) at the beginning of the query.</p>
+</li>
+</ol>
+<p>However, in a query block where a <tt>GROUP BY</tt> clause is present:</p>
+<ol style="list-style-type: decimal">
+
+<li>
+
+<p>In clauses processed before <tt>GROUP BY</tt>, scoping rules are the same as though no GROUP BY were present.</p>
+</li>
+<li>
+
+<p>In clauses processed after <tt>GROUP BY</tt>, the variables bound in the nearest <tt>FROM</tt>-clause (and its <tt>LET</tt> subclause, if any) are removed from scope and replaced by the variables bound in the <tt>GROUP BY</tt> clause (and its <tt>LET</tt> subclause, if any). However, this replacement does not apply inside the arguments of the five SQL special aggregating functions (<tt>MIN</tt>, <tt>MAX</tt>, <tt>AVG</tt>, <tt>SUM</tt>, and <tt>COUNT</tt>). These functions still need to see the individual data items over which they are computing an aggregation. For example, after <tt>FROM employee AS e GROUP BY deptno</tt>, it would not be valid to reference <tt>e.salary</tt>, but <tt>AVG(e.salary)</tt> would be valid.</p>
+</li>
+</ol>
+<p>Special case: In an expression inside a <tt>FROM</tt> clause, a variable is in scope if it was bound in an earlier expression in the same <tt>FROM</tt> clause. Example:</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o, o.items AS i
+</pre></div></div>
+
+<p>The reason for this special case is to support iteration over nested collections.</p>
+<p>Note that, since the <tt>SELECT</tt> clause comes <i>after</i> the <tt>WHERE</tt> and <tt>GROUP BY</tt> clauses in conceptual processing order, any variables defined in <tt>SELECT</tt> are not visible in <tt>WHERE</tt> or <tt>GROUP BY</tt>. Therefore the following query will not return what might be the expected result (since in the WHERE clause, <tt>pay</tt> will be interpreted as a field in the <tt>emp</tt> object rather than as the computed value <tt>salary + bonus</tt>):</p>
+
+<div>
+<div>
+<pre class="source">SELECT name, salary + bonus AS pay
+FROM emp
+WHERE pay &gt; 1000
+ORDER BY pay
+</pre></div></div>
+
+<p>The likely intent of the query above can be accomplished as follows:</p>
+
+<div>
+<div>
+<pre class="source">FROM emp AS e
+LET pay = e.salary + e.bonus
+WHERE pay &gt; 1000
+SELECT e.name, pay
+ORDER BY pay
+</pre></div></div>
+
+<p>Note that in the phrase <i>expr1</i> <tt>JOIN</tt> <i>expr2</i> <tt>ON</tt> <i>expr3</i>, variables defined in <i>expr1</i> are visible in <i>expr3</i> but not in <i>expr2</i>. Here&#x2019;s an example that will not work:</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o JOIN o.items AS i ON 1 = 1
+</pre></div></div>
+
+<p>The variable <tt>o</tt>, defined in the phrase before <tt>JOIN</tt>, cannot be used in the phrase immediately following <tt>JOIN</tt>. The probable intent of this example could be accomplished in either of the following ways:</p>
+
+<div>
+<div>
+<pre class="source">FROM orders AS o UNNEST o.items AS i
+
+FROM orders AS o, o.items AS i
+</pre></div></div>
+
+<p>To summarize this rule: You may not use left-correlation in an explicit <tt>JOIN</tt> clause.</p></div>
+<div class="section">
+<h2><a name="Resolving_Names"></a><a name="Resolving_names" id="Resolving_names">Resolving Names</a></h2>
+<p>The process of name resolution begins with the leftmost identifier in the name. The rules for resolving the leftmost identifier are:</p>
+<ol style="list-style-type: decimal">
+
+<li>
+
+<p><i>In a <tt>FROM</tt> clause</i>: Names in a <tt>FROM</tt> clause identify the collections over which the query block will iterate. These collections may be stored datasets, views, synonyms, or may be the results of nested query blocks. A stored dataset may be in a named dataverse or in the default dataverse. Thus, if the two-part name <tt>a.b</tt> is in a <tt>FROM</tt> clause, a might represent a dataverse and <tt>b</tt> might represent a dataset in that dataverse. Another example of a two-part name in a <tt>FROM</tt> clause is <tt>FROM orders AS o, o.items AS i</tt>. In <tt>o.items</tt>, <tt>o</tt> represents an order object bound earlier in the <tt>FROM</tt> clause, and items represents the items object inside that order.</p>
+<p>The rules for resolving the leftmost identifier in a <tt>FROM</tt> clause (including a <tt>JOIN</tt> subclause), or in the expression following <tt>IN</tt> in a quantified predicate, are as follows:</p>
+<ul>
+
+<li>
+
+<p>(1A):  If the identifier matches a variable-name that is in scope, it resolves to the binding of that variable. (Note that in the case of a subquery, an in-scope variable might have been bound in an outer query block; this is called a correlated subquery).</p>
+</li>
+<li>
+
+<p>(1B):  Otherwise, if the identifier is the first part of a two-part name like <tt>a.b</tt>, the name is treated as <tt>dataverse.dataset</tt>. If the identifier stands alone as a one-part name, it is treated as the name of a dataset in the default dataverse. If the designated dataset exists then the identifier is resolved to that dataset, othwerise if a view with given name exists then the identifier is resolved to that view, otherwise if a synonym with given name exists then the identifier is resolved to the target dataset or the target view of that synonym (potentially recursively if this synonym points to another synonym). An error will result if the designated dataset, view, or a synonym with this name does not exist.</p>
+<p>Datasets and views take precedence over synonyms, so if both a dataset (or a view) and a synonym have the same name then the resolution is to the dataset. Note that there cannot be a dataset and a view with the same name.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p><i>Elsewhere in a query block</i>: In clauses other than <tt>FROM</tt>, a name typically identifies a field of some object. For example, if the expression <tt>a.b</tt> is in a <tt>SELECT</tt> or <tt>WHERE</tt> clause, it&#x2019;s likely that <tt>a</tt> represents an object and <tt>b</tt> represents a field in that object.</p>
+<p>The rules for resolving the leftmost identifier in clauses other than the ones listed in Rule 1 are:</p>
+<ul>
+
+<li>
+
+<p>(2A):  If the identifier matches a variable-name that is in scope, it resolves to the binding of that variable. (In the case of a correlated subquery, the in-scope variable might have been bound in an outer query block).</p>
+</li>
+<li>
+
+<p>(2B):  (The &#x201c;Single Variable Rule&#x201d;): Otherwise, if the <tt>FROM</tt> clause in the current query block binds exactly one variable, the identifier is treated as a field access on the object bound to that variable. For example, in the query <tt>FROM customer SELECT address</tt>, the identifier address is treated as a field in the object bound to the variable <tt>customer</tt>. At runtime, if the object bound to <tt>customer</tt> has no <tt>address</tt> field, the <tt>address</tt> expression will return <tt>missing</tt>. If the <tt>FROM</tt> clause in the current query block binds multiple variables, name resolution fails with an &#x201c;ambiguous name&#x201d; error. If there&#x2019;s no <tt>FROM</tt> clause in the current query block, name resolution fails with an &#x201c;undefined identifier&#x201d; error. Note that the Single Variable Rule searches for bound variables only in the current query block, not in outer (containing) blocks. The purpose of this rule is to permit the compiler to resolve field-references unambiguously without relying on any schema information. Also note that variables defined by <tt>LET</tt> clauses do not participate in the resolution process performed by this rule.</p>
+<p>Exception: In a query that has a <tt>GROUP BY</tt> clause, the Single Variable Rule does not apply in any clauses that occur after the <tt>GROUP BY</tt> because, in these clauses, the variables bound by the <tt>FROM</tt> clause are no longer in scope. In clauses after <tt>GROUP BY</tt>, only Rule (2A) applies.</p>
+</li>
+</ul>
+</li>
+<li>
+
+<p>In an <tt>ORDER BY</tt> clause following a <tt>UNION ALL</tt> expression:</p>
+<p>The leftmost identifier is treated as a field-access on the objects that are generated by the <tt>UNION ALL</tt>. For example:</p>
+
+<div>
+<div>
+<pre class="source">query-block-1
+UNION ALL
+query-block-2
+ORDER BY salary
+</pre></div></div>
+
+<p>In the result of this query, objects that have a foo field will be ordered by the value of this field; objects that have no foo field will appear at at the beginning of the query result (in ascending order) or at the end (in descending order.)</p>
+</li>
+<li>
+
+<p><i>In a standalone expression</i>: If a query consists of a standalone expression then identifiers inside that expression are resolved according to Rule 1. For example, if the whole query is <tt>ARRAY_COUNT(a.b)</tt> then <tt>a.b</tt> will be treated as dataset <tt>b</tt> contained in dataverse <tt>a</tt>. Note that this rule only applies to identifiers which are located directly inside a standalone expression. Identifiers inside <tt>SELECT</tt> statements in a standalone expression are still resolved according to Rules 1-3. For example, if the whole query is <tt>ARRAY_SUM( (FROM employee AS e SELECT VALUE salary) )</tt> then <tt>salary</tt> is resolved as <tt>e.salary</tt> following the &#x201c;Single Variable Rule&#x201d; (Rule (2B)).</p>
+</li>
+<li>
+
+<p>Once the leftmost identifier has been resolved, the following dots and identifiers in the name (if any) are treated as a path expression that navigates to a field nested inside that object. The name resolves to the field at the end of the path. If this field does not exist, the value <tt>missing</tt> is returned.</p>
+</li>
+</ol><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+</div>
+<div class="section">
+<h2><a name="Appendix_4._Example_Data"></a><a name="Manual_data" id="Manual_data">Appendix 4. Example Data</a></h2><!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+
+<p>This appendix lists the data definitions and the datasets used for the examples provided throughout this manual.</p>
+<div class="section">
+<h3><a name="Data_Definitions"></a><a name="definition_statements" id="definition_statements">Data Definitions</a></h3>
+
+<div>
+<div>
+<pre class="source">CREATE DATAVERSE Commerce IF NOT EXISTS;
+
+USE Commerce;
+
+CREATE TYPE addressType AS {
+    street:			string,
+    city:			string,
+    zipcode:			string?
+};
+
+CREATE TYPE customerType AS {
+    custid:			string,
+    name:			string,
+    address:			addressType?
+};
+
+CREATE DATASET customers(customerType)
+    PRIMARY KEY custid;
+
+CREATE TYPE itemType AS {
+    itemno:			int,
+    qty:			int,
+    price:			int
+};
+
+CREATE TYPE orderType AS {
+    orderno:			int,
+    custid:			string,
+    order_date:			string,
+    ship_date:			string?,
+    items:			[ itemType ]
+};
+
+CREATE DATASET orders(orderType)
+    PRIMARY KEY orderno;
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Customers_Data"></a><a name="customers_data" id="customers_data">Customers Data</a></h3>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;name&quot;: &quot;T. Cody&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;201 Main St.&quot;,
+            &quot;city&quot;: &quot;St. Louis, MO&quot;,
+            &quot;zipcode&quot;: &quot;63101&quot;
+        },
+        &quot;rating&quot;: 750
+    },
+    {
+        &quot;custid&quot;: &quot;C25&quot;,
+        &quot;name&quot;: &quot;M. Sinclair&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;690 River St.&quot;,
+            &quot;city&quot;: &quot;Hanover, MA&quot;,
+            &quot;zipcode&quot;: &quot;02340&quot;
+        },
+        &quot;rating&quot;: 690
+    },
+    {
+        &quot;custid&quot;: &quot;C31&quot;,
+        &quot;name&quot;: &quot;B. Pruitt&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;360 Mountain Ave.&quot;,
+            &quot;city&quot;: &quot;St. Louis, MO&quot;,
+            &quot;zipcode&quot;: &quot;63101&quot;
+        }
+    },
+    {
+        &quot;custid&quot;: &quot;C35&quot;,
+        &quot;name&quot;: &quot;J. Roberts&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;420 Green St.&quot;,
+            &quot;city&quot;: &quot;Boston, MA&quot;,
+            &quot;zipcode&quot;: &quot;02115&quot;
+        },
+        &quot;rating&quot;: 565
+    },
+    {
+        &quot;custid&quot;: &quot;C37&quot;,
+        &quot;name&quot;: &quot;T. Henry&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;120 Harbor Blvd.&quot;,
+            &quot;city&quot;: &quot;Boston, MA&quot;,
+            &quot;zipcode&quot;: &quot;02115&quot;
+        },
+        &quot;rating&quot;: 750
+    },
+    {
+        &quot;custid&quot;: &quot;C41&quot;,
+        &quot;name&quot;: &quot;R. Dodge&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;150 Market St.&quot;,
+            &quot;city&quot;: &quot;St. Louis, MO&quot;,
+            &quot;zipcode&quot;: &quot;63101&quot;
+        },
+        &quot;rating&quot;: 640
+    },
+    {
+        &quot;custid&quot;: &quot;C47&quot;,
+        &quot;name&quot;: &quot;S. Logan&quot;,
+        &quot;address&quot;: {
+            &quot;street&quot;: &quot;Via del Corso&quot;,
+            &quot;city&quot;: &quot;Rome, Italy&quot;
+        },
+        &quot;rating&quot;: 625
+    }
+]
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Orders_Data"></a><a name="orders_data" id="orders_data">Orders Data</a></h3>
+
+<div>
+<div>
+<pre class="source">[
+    {
+        &quot;orderno&quot;: 1001,
+        &quot;custid&quot;: &quot;C41&quot;,
+        &quot;order_date&quot;: &quot;2020-04-29&quot;,
+        &quot;ship_date&quot;: &quot;2020-05-03&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 347,
+                &quot;qty&quot;: 5,
+                &quot;price&quot;: 19.99
+            },
+            {
+                &quot;itemno&quot;: 193,
+                &quot;qty&quot;: 2,
+                &quot;price&quot;: 28.89
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1002,
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;order_date&quot;: &quot;2020-05-01&quot;,
+        &quot;ship_date&quot;: &quot;2020-05-03&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 460,
+                &quot;qty&quot;: 95,
+                &quot;price&quot;: 100.99
+            },
+            {
+                &quot;itemno&quot;: 680,
+                &quot;qty&quot;: 150,
+                &quot;price&quot;: 8.75
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1003,
+        &quot;custid&quot;: &quot;C31&quot;,
+        &quot;order_date&quot;: &quot;2020-06-15&quot;,
+        &quot;ship_date&quot;: &quot;2020-06-16&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 120,
+                &quot;qty&quot;: 2,
+                &quot;price&quot;: 88.99
+            },
+            {
+                &quot;itemno&quot;: 460,
+                &quot;qty&quot;: 3,
+                &quot;price&quot;: 99.99
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1004,
+        &quot;custid&quot;: &quot;C35&quot;,
+        &quot;order_date&quot;: &quot;2020-07-10&quot;,
+        &quot;ship_date&quot;: &quot;2020-07-15&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 680,
+                &quot;qty&quot;: 6,
+                &quot;price&quot;: 9.99
+            },
+            {
+                &quot;itemno&quot;: 195,
+                &quot;qty&quot;: 4,
+                &quot;price&quot;: 35
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1005,
+        &quot;custid&quot;: &quot;C37&quot;,
+        &quot;order_date&quot;: &quot;2020-08-30&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 460,
+                &quot;qty&quot;: 2,
+                &quot;price&quot;: 99.98
+            },
+            {
+                &quot;itemno&quot;: 347,
+                &quot;qty&quot;: 120,
+                &quot;price&quot;: 22
+            },
+            {
+                &quot;itemno&quot;: 780,
+                &quot;qty&quot;: 1,
+                &quot;price&quot;: 1500
+            },
+            {
+                &quot;itemno&quot;: 375,
+                &quot;qty&quot;: 2,
+                &quot;price&quot;: 149.98
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1006,
+        &quot;custid&quot;: &quot;C41&quot;,
+        &quot;order_date&quot;: &quot;2020-09-02&quot;,
+        &quot;ship_date&quot;: &quot;2020-09-04&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 680,
+                &quot;qty&quot;: 51,
+                &quot;price&quot;: 25.98
+            },
+            {
+                &quot;itemno&quot;: 120,
+                &quot;qty&quot;: 65,
+                &quot;price&quot;: 85
+            },
+            {
+                &quot;itemno&quot;: 460,
+                &quot;qty&quot;: 120,
+                &quot;price&quot;: 99.98
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1007,
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;order_date&quot;: &quot;2020-09-13&quot;,
+        &quot;ship_date&quot;: &quot;2020-09-20&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 185,
+                &quot;qty&quot;: 5,
+                &quot;price&quot;: 21.99
+            },
+            {
+                &quot;itemno&quot;: 680,
+                &quot;qty&quot;: 1,
+                &quot;price&quot;: 20.5
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1008,
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;order_date&quot;: &quot;2020-10-13&quot;,
+        &quot;items&quot;: [
+            {
+                &quot;itemno&quot;: 460,
+                &quot;qty&quot;: 20,
+                &quot;price&quot;: 99.99
+            }
+        ]
+    },
+    {
+        &quot;orderno&quot;: 1009,
+        &quot;custid&quot;: &quot;C13&quot;,
+        &quot;order_date&quot;: &quot;2020-10-13&quot;,
+        &quot;items&quot;: []
+    }
+]
+</pre></div></div></div></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>
diff --git a/docs/0.9.9/udf.html b/docs/0.9.9/udf.html
new file mode 100644
index 0000000..b9be9ec
--- /dev/null
+++ b/docs/0.9.9/udf.html
@@ -0,0 +1,411 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/udf.md at 2024-04-01
+ | Rendered using Apache Maven Fluido Skin 1.7
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20240401" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; User-defined Functions</title>
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
+    <link rel="stylesheet" href="./css/site.css" />
+    <link rel="stylesheet" href="./css/print.css" media="print" />
+    <script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
+
+  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <div id="banner">
+        <div class="pull-left"><a href="./" id="bannerLeft"><img src="images/asterixlogo.png"  alt="AsterixDB"/></a></div>
+        <div class="pull-right"></div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2024-04-01</li>
+      <li id="projectVersion" class="pull-right">Version: 0.9.9</li>
+      <li class="pull-right"><a href="index.html" title="Documentation Home">Documentation Home</a></li>
+        </ul>
+      </div>
+      <div class="row-fluid">
+        <div id="leftColumn" class="span2">
+          <div class="well sidebar-nav">
+    <ul class="nav nav-list">
+      <li class="nav-header">Get Started - Installation</li>
+    <li><a href="ncservice.html" title="Option 1: using NCService"><span class="none"></span>Option 1: using NCService</a></li>
+    <li><a href="ansible.html" title="Option 2: using Ansible"><span class="none"></span>Option 2: using Ansible</a></li>
+    <li><a href="aws.html" title="Option 3: using Amazon Web Services"><span class="none"></span>Option 3: using Amazon Web Services</a></li>
+      <li class="nav-header">AsterixDB Primer</li>
+    <li><a href="sqlpp/primer-sqlpp.html" title="Using SQL++"><span class="none"></span>Using SQL++</a></li>
+      <li class="nav-header">Data Model</li>
+    <li><a href="datamodel.html" title="The Asterix Data Model"><span class="none"></span>The Asterix Data Model</a></li>
+      <li class="nav-header">Queries</li>
+    <li><a href="sqlpp/manual.html" title="The SQL++ Query Language"><span class="none"></span>The SQL++ Query Language</a></li>
+    <li><a href="SQLPP.html" title="Raw SQL++ Grammar"><span class="none"></span>Raw SQL++ Grammar</a></li>
+    <li><a href="sqlpp/builtins.html" title="Builtin Functions"><span class="none"></span>Builtin Functions</a></li>
+      <li class="nav-header">API/SDK</li>
+    <li><a href="api.html" title="HTTP API"><span class="none"></span>HTTP API</a></li>
+    <li><a href="csv.html" title="CSV Output"><span class="none"></span>CSV Output</a></li>
+      <li class="nav-header">Advanced Features</li>
+    <li><a href="aql/externaldata.html" title="Accessing External Data"><span class="none"></span>Accessing External Data</a></li>
+    <li><a href="feeds.html" title="Data Ingestion with Feeds"><span class="none"></span>Data Ingestion with Feeds</a></li>
+    <li class="active"><a href="#"><span class="none"></span>User Defined Functions</a></li>
+    <li><a href="sqlpp/filters.html" title="Filter-Based LSM Index Acceleration"><span class="none"></span>Filter-Based LSM Index Acceleration</a></li>
+    <li><a href="sqlpp/fulltext.html" title="Support of Full-text Queries"><span class="none"></span>Support of Full-text Queries</a></li>
+    <li><a href="sqlpp/similarity.html" title="Support of Similarity Queries"><span class="none"></span>Support of Similarity Queries</a></li>
+    <li><a href="geo/quickstart.html" title="GIS Support Overview"><span class="none"></span>GIS Support Overview</a></li>
+    <li><a href="geo/functions.html" title="GIS Functions"><span class="none"></span>GIS Functions</a></li>
+    <li><a href="interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval Joins</a></li>
+    <li><a href="spatial_join.html" title="Support of Spatial Joins"><span class="none"></span>Support of Spatial Joins</a></li>
+    <li><a href="sqlpp/arrayindex.html" title="Support of Array Indexes"><span class="none"></span>Support of Array Indexes</a></li>
+      <li class="nav-header">Deprecated</li>
+    <li><a href="aql/primer.html" title="AsterixDB Primer: Using AQL"><span class="none"></span>AsterixDB Primer: Using AQL</a></li>
+    <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>
+    <li><a href="aql/builtins.html" title="Queries: Builtin Functions (AQL)"><span class="none"></span>Queries: Builtin Functions (AQL)</a></li>
+</ul>
+          <hr />
+          <div id="poweredBy">
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+            <div class="clear"></div>
+<a href="./" title="AsterixDB" class="builtBy"><img class="builtBy"  alt="AsterixDB" src="images/asterixlogo.png"    /></a>
+            </div>
+          </div>
+        </div>
+        <div id="bodyColumn"  class="span10" >
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ !-->
+<h1>User-defined Functions</h1>
+<div class="section">
+<h2><a name="Table_of_Contents"></a><a name="atoc" id="#toc">Table of Contents</a></h2>
+<ul>
+
+<li><a href="#introduction">Introduction</a></li>
+<li><a href="#installingUDF">Installing an UDF Library</a></li>
+<li><a href="#UDFOnFeeds">Attaching an UDF on Data Feeds</a></li>
+<li><a href="#udfConfiguration">A quick look of the UDF configuration</a></li>
+<li><a href="#adapter">User defined Feed Adapters</a></li>
+<li><a href="#uninstall">Unstalling an UDF Library</a><!--
+! Licensed to the Apache Software Foundation (ASF) under one
+! or more contributor license agreements.  See the NOTICE file
+! distributed with this work for additional information
+! regarding copyright ownership.  The ASF licenses this file
+! to you under the Apache License, Version 2.0 (the
+! "License"); you may not use this file except in compliance
+! with the License.  You may obtain a copy of the License at
+!
+!   http://www.apache.org/licenses/LICENSE-2.0
+!
+! Unless required by applicable law or agreed to in writing,
+! software distributed under the License is distributed on an
+! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+! KIND, either express or implied.  See the License for the
+! specific language governing permissions and limitations
+! under the License.
+!--></li>
+</ul></div>
+<div class="section">
+<h2><a name="Introduction"></a><a name="introduction">Introduction</a></h2>
+<p>Apache AsterixDB supports three languages for writing user-defined functions (UDFs): SQL++, Java, and Python A user can encapsulate data processing logic into a UDF and invoke it later repeatedly. For SQL++ functions, a user can refer to <a href="sqlpp/manual.html#Functions">SQL++ Functions</a> for their usages. This document will focus on UDFs in languages other than SQL++</p></div>
+<div class="section">
+<h2><a name="Endpoints_and_Authentication"></a><a name="authentication">Endpoints and Authentication</a></h2>
+<p>The UDF API endpoint used to deploy functions is not enabled by default until authentication has been configured properly. Even if the endpoint is enabled, it is only accessible on the loopback interface on each NC to restrict access.</p>
+<p>To enable it, we need to set the path to the credential file and populate it with our username and password.</p>
+<p>The credential file is a simple <tt>/etc/passwd</tt> style text file with usernames and corresponding <tt>bcrypt</tt> hashed and salted passwords. You can populate this on your own if you would like, but the <tt>asterixhelper</tt> utility can write the entries as well. We can invoke <tt>asterixhelper</tt> like so:</p>
+
+<div>
+<div>
+<pre class="source">$ bin/asterixhelper -u admin -p admin -cp opt/local/conf add_credential
+</pre></div></div>
+
+<p>Then, in your <tt>cc.conf</tt>, in the <tt>[cc]</tt> section, add the correct <tt>credential.file</tt> path</p>
+
+<div>
+<div>
+<pre class="source">[nc]
+address = 127.0.0.1
+...
+...
+credential.file = conf/passwd
+</pre></div></div>
+
+<p>Now,restart the cluster if it was already started to allow the Cluster Controller to find the new credentials.</p></div>
+<div class="section">
+<h2><a name="Installing_a_Java_UDF_Library"></a><a name="installingUDF">Installing a Java UDF Library</a></h2>
+<p>To install a UDF package to the cluster, we need to send a Multipart Form-data HTTP request to the <tt>/admin/udf</tt> endpoint of the CC at the normal API port (<tt>19004</tt> by default). Any suitable tool will do, but for the example here I will use <tt>curl</tt> which is widely available.</p>
+<p>For example, to install a library with the following criteria:</p>
+<ul>
+
+<li><tt>udfs</tt> dataverse name</li>
+<li>with a new Library name of <tt>testlib</tt></li>
+<li>from <tt>lib.zip</tt> in the present working directory</li>
+<li>to the cluster at <tt>localhost</tt> with API port <tt>19004</tt> of the Asterix CC</li>
+<li>with credentials being a username and password of <tt>admin:admin</tt></li>
+</ul>
+<p>we would execute</p>
+
+<div>
+<div>
+<pre class="source">curl -v -u admin:admin -X POST -F 'data=@./lib.zip' -F 'type=java' localhost:19004/admin/udf/udfs/testlib
+</pre></div></div>
+
+<p>Any response other than <tt>200</tt> indicates an error in deployment.</p>
+<p>In the AsterixDB source release, we provide several sample UDFs that you can try out. You need to build the AsterixDB source to get the compiled UDF package. It can be found under the <tt>asterix-external-data</tt> sub-project under the path <tt>asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/library</tt>. After compilation, the UDFs will be packed in a zip file at <tt>asterixdb/asterix-external-data/target/asterix-external-data-$VERSION-testlib.zip</tt> which you can use to upload to the AsterixDB cluster.</p>
+<p>Assuming that these UDFs have been installed into the <tt>testlib</tt> library in<tt>udfs</tt> dataverse, here is an example that uses the sample UDF <tt>mysum</tt> to compute the sum of two input integers.</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CREATE FUNCTION mysum(a: int32, b: int32)
+RETURNS int32
+  AS &quot;org.apache.asterix.external.library.MySumFactory&quot; AT testlib;
+</pre></div></div>
+</div>
+<div class="section">
+<h2><a name="Creating_a_Python_UDF"></a><a name="PythonUDF" id="PythonUDF">Creating a Python UDF</a></h2>
+<p>Python UDFs need to be rolled into a <a class="externalLink" href="https://github.com/linkedin/shiv">shiv</a> package with all their dependencies. By default AsterixDB will use the Python interpreter located at <tt>/usr/bin/python3</tt>. This can be changed in the cluster config <tt>[common]</tt> section using the <tt>python.path</tt> configuration variable.</p>
+<p>First, let&#x2019;s devise a function that we would like to use in AsterixDB, <tt>sentiment_mod.py</tt></p>
+
+<div>
+<div>
+<pre class="source">import os
+from typing import Tuple
+class sent_model:
+
+    def __init__(self):
+        good_words = os.path.join(os.path.dirname(__file__), 'good.txt')
+        with open(good_words) as f:
+            self.whitelist = f.read().splitlines()
+
+    def sentiment(self, arg: Tuple[str])-&gt; str:
+        words = arg[0].split()
+        for word in words:
+            if word in self.whitelist:
+                return 'great'
+
+        return 'eh'
+</pre></div></div>
+
+<p>Furthermore, let&#x2019;s assume &#x2018;good.txt&#x2019; contains the following entries</p>
+
+<div>
+<div>
+<pre class="source">spam
+eggs
+ham
+</pre></div></div>
+
+<p>Now, in the module directory, execute <tt>shiv</tt> with all the dependencies of the module listed. We don&#x2019;t actually use scikit-learn here (our method is obviously better!), but it&#x2019;s just included as an example of a real dependency.</p>
+
+<div>
+<div>
+<pre class="source">shiv -o lib.pyz --site-packages . scikit-learn
+</pre></div></div>
+
+<p>Then, deploy it the same as the Java UDF was, with the library name <tt>pylib</tt> in <tt>udfs</tt> dataverse</p>
+
+<div>
+<div>
+<pre class="source">curl -v -u admin:admin -X POST -F 'data=@./lib.pyz' -F 'type=python' localhost:19002/admin/udf/udfs/pylib
+</pre></div></div>
+
+<p>With the library deployed, we can define a function within it for use. For example, to expose the Python function <tt>sentiment</tt> in the module <tt>sentiment_mod</tt> in the class <tt>sent_model</tt>, the <tt>CREATE FUNCTION</tt> would be as follows</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CREATE FUNCTION sentiment(a)
+RETURNS TweetType
+  AS &quot;sentiment_mod&quot;, &quot;sent_model.sentiment&quot; AT pylib;
+</pre></div></div>
+
+<p>By default, AsterixDB will treat all external functions as deterministic. It means the function must return the same result for the same input, irrespective of when or how many times the function is called on that input. This particular function behaves the same on each input, so it satisfies the deterministic property. This enables better optimization of queries including this function. If a function is not deterministic then it should be declared as such by using a <tt>WITH</tt> sub-clause:</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CREATE FUNCTION sentiment(text)
+  AS &quot;sentiment_mod&quot;, &quot;sent_model.sentiment&quot; AT pylib
+  WITH { &quot;deterministic&quot;: false }
+</pre></div></div>
+
+<p>With the function now defined, it can then be used as any other scalar SQL++ function would be. For example:</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+INSERT INTO Tweets([
+  {&quot;id&quot;:1, &quot;msg&quot;:&quot;spam is great&quot;},
+  {&quot;id&quot;:2, &quot;msg&quot;:&quot;i will not eat green eggs and ham&quot;},
+  {&quot;id&quot;:3, &quot;msg&quot;:&quot;bacon is better&quot;}
+]);
+
+SELECT t.msg as msg, sentiment(t.msg) as sentiment
+FROM Tweets t;
+</pre></div></div>
+</div>
+<div class="section">
+<h2><a name="Python_Type_Mappings"></a><a name="pytpes">Python Type Mappings</a></h2>
+<p>Currently only a subset of AsterixDB types are supported in Python UDFs. The supported types are as follows:</p>
+<ul>
+
+<li>Integer types (int8,16,32,64)</li>
+<li>Floating point types (float, double)</li>
+<li>String</li>
+<li>Boolean</li>
+<li>Arrays, Sets (cast to lists)</li>
+<li>Objects (cast to dict)</li>
+</ul>
+<p>Unsupported types can be cast to these in SQL++ first in order to be passed to a Python UDF</p></div>
+<div class="section">
+<h2><a name="Execution_Model_For_UDFs"></a><a name="execution">Execution Model For UDFs</a></h2>
+<p>AsterixDB queries are deployed across the cluster as Hyracks jobs. A Hyracks job has a lifecycle that can be simplified for the purposes of UDFs to - A pre-run phase which allocates resources, <tt>open</tt> - The time during which the job has data flowing through it, <tt>nextFrame</tt> - Cleanup and shutdown in <tt>close</tt>.</p>
+<p>If a SQL++ function is defined as a member of a class in the library, the class will be instantiated during <tt>open</tt>. The class will exist in memory for the lifetime of the query. Therefore if your function needs to reference files or other data that would be costly to load per-call, making it a member variable that is initialized in the constructor of the object will greatly increase the performance of the SQL++ function.</p>
+<p>For each function invoked during a query, there will be an independent instance of the function per data partition. This means that the function must not assume there is any global state or that it can assume things about the layout of the data. The execution of the function will be parallel to the same degree as the level of data parallelism in the cluster.</p>
+<p>After initialization, the function bound in the SQL++ function definition is called once per tuple during the query execution (i.e. <tt>nextFrame</tt>). Unless the function specifies <tt>null-call</tt> in the <tt>WITH</tt> clause, <tt>NULL</tt> values will be skipped.</p>
+<p>At the close of the query, the function is torn down and not re-used in any way. All functions should assume that nothing will persist in-memory outside of the lifetime of a query, and any behavior contrary to this is undefined.</p></div>
+<div class="section">
+<h2><a name="Attaching_a_UDF_on_Data_Feeds"></a><a name="UDFOnFeeds" id="UDFOnFeeds">Attaching a UDF on Data Feeds</a></h2>
+<p>In <a href="feeds.html">Data Ingestion using feeds</a>, we introduced an efficient way for users to get data into AsterixDB. In some use cases, users may want to pre-process the incoming data before storing it into the dataset. To meet this need, AsterixDB allows the user to attach a UDF onto the ingestion pipeline. Following the example in <a href="feeds.html">Data Ingestion</a>, here we show an example of how to attach a UDF that extracts the user names mentioned from the incoming Tweet text, storing the processed Tweets into a dataset.</p>
+<p>We start by creating the datatype and dataset that will be used for the feed and UDF. One thing to keep in mind is that data flows from the feed to the UDF and then to the dataset. This means that the feed&#x2019;s datatype should be the same as the input type of the UDF, and the output datatype of the UDF should be the same as the dataset&#x2019;s datatype. Thus, users should make sure that their datatypes are consistent in the UDF configuration. Users can also take advantage of open datatypes in AsterixDB by creating a minimum description of the data for simplicity. Here we use open datatypes:</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CREATE TYPE TweetType IF NOT EXISTS AS OPEN {
+    id: int64
+};
+
+CREATE DATASET ProcessedTweets(TweetType) PRIMARY KEY id;
+</pre></div></div>
+
+<p>As the <tt>TweetType</tt> is an open datatype, processed Tweets can be stored into the dataset after they are annotated with an extra attribute. Given the datatype and dataset above, we can create a Twitter Feed with the same datatype. Please refer to section <a href="feeds.html">Data Ingestion</a> if you have any trouble in creating feeds.</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CREATE FEED TwitterFeed WITH {
+  &quot;adapter-name&quot;: &quot;push_twitter&quot;,
+  &quot;type-name&quot;: &quot;TweetType&quot;,
+  &quot;format&quot;: &quot;twitter-status&quot;,
+  &quot;consumer.key&quot;: &quot;************&quot;,
+  &quot;consumer.secret&quot;: &quot;************&quot;,
+  &quot;access.token&quot;: &quot;**********&quot;,
+  &quot;access.token.secret&quot;: &quot;*************&quot;
+};
+</pre></div></div>
+
+<p>Then we define the function we want to apply to the feed</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CREATE FUNCTION addMentionedUsers(t: TweetType)
+  AS &quot;org.apache.asterix.external.library.AddMentionedUsersFactory&quot; AT testlib
+  WITH { &quot;resources&quot;: { &quot;textFieldName&quot;: &quot;text&quot; } };
+</pre></div></div>
+
+<p>After creating the feed, we attach the UDF onto the feed pipeline and start the feed with following statements:</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+
+CONNECT FEED TwitterFeed TO DATASET ProcessedTweets APPLY FUNCTION addMentionedUsers;
+
+START FEED TwitterFeed;
+</pre></div></div>
+
+<p>You can check the annotated Tweets by querying the <tt>ProcessedTweets</tt> dataset:</p>
+
+<div>
+<div>
+<pre class="source">SELECT * FROM ProcessedTweets LIMIT 10;
+</pre></div></div>
+</div>
+<div class="section">
+<h2><a name="Installing_a_user-defined_Feed_Adapter"></a><a name="adapter">Installing a user-defined Feed Adapter</a></h2>
+<p>First, upload a zip file packaged the same way as a Java UDF, but also containing the adapter you would like to use. Next, issue a <tt>CREATE ADAPTER</tt> statement referencing the class name. For example:</p>
+
+<div>
+<div>
+<pre class="source">CREATE ADAPTER TweetAdapter
+  AS &quot;org.apache.asterix.external.library.adapter.TestTypedAdapterFactory&quot; AT testlib;
+</pre></div></div>
+
+<p>Then, the adapter can be used like any other adapter in a feed.</p>
+
+<div>
+<div>
+<pre class="source">CREATE FEED TweetFeed WITH {
+  &quot;adapter-name&quot;: &quot;TweetAdapter&quot;,
+  &quot;type-name&quot; : &quot;TweetType&quot;,
+  &quot;num_output_records&quot;: 4
+};
+</pre></div></div>
+</div>
+<div class="section">
+<h2><a name="Unstalling_an_UDF_Library"></a><a name="uninstall">Unstalling an UDF Library</a></h2>
+<p>If you want to uninstall the UDF library, simply issue a <tt>DELETE</tt> against the endpoint you <tt>POST</tt>ed against once all functions declared with the library are removed. First we&#x2019;ll drop the function we declared earlier:</p>
+
+<div>
+<div>
+<pre class="source">USE udfs;
+DROP FUNCTION mysum(a,b);
+</pre></div></div>
+
+<p>Then issue the proper <tt>DELETE</tt> request</p>
+
+<div>
+<div>
+<pre class="source">curl -u admin:admin -X DELETE localhost:19002/admin/udf/udfs/testlib
+</pre></div></div>
+
+<p>The library will also be dropped if you drop the dataverse entirely.</p></div>
+        </div>
+      </div>
+    </div>
+    <hr/>
+    <footer>
+      <div class="container-fluid">
+        <div class="row-fluid">
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.
+      </div>
+        </div>
+      </div>
+    </footer>
+  </body>
+</html>