Update site for release
Change-Id:If17ec8dad1de435c9a0c15ef4d7a7e615bb3ecd2
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/incubator-asterixdb-site/+/14524
Reviewed-by: Ian Maxon <imaxon@uci.edu>
diff --git a/content/docs/0.9.7.1/aql/builtins.html b/content/docs/0.9.7.1/aql/builtins.html
new file mode 100644
index 0000000..a17f962
--- /dev/null
+++ b/content/docs/0.9.7.1/aql/builtins.html
@@ -0,0 +1,12189 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/markdown/aql/builtins.md at 2021-12-13
+ | 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="20211213" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>AsterixDB – 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: 2021-12-13</li>
+ <li id="projectVersion" class="pull-right">Version: 0.9.7.1</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="../interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval 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">{ "v1": abs(2013), "v2": abs(-4036), "v3": abs(0), "v4": abs(float("-2013.5")), "v5": abs(double("-2013.593823748327284")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 2013, "v2": 4036, "v3": 0, "v4": 2013.5, "v5": 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>“NaN” for other legitimate numeric values.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": acos(1), "v2": acos(2), "v3": acos(0), "v4": acos(float("0.5")), "v5": acos(double("-0.5")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 0.0, "v2": "NaN", "v3": 1.5707963267948966, "v4": 1.0471975511965979, "v5": 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>“NaN” for other legitimate numeric values.</li>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": asin(1), "v2": asin(2), "v3": asin(0), "v4": asin(float("0.5")), "v5": asin(double("-0.5")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 1.5707963267948966, "v2": "NaN", "v3": 0.0, "v4": 0.5235987755982989, "v5": -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">{ "v1": atan(1), "v2": atan(2), "v3": atan(0), "v4": atan(float("0.5")), "v5": atan(double("1000")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 0.7853981633974483, "v2": 1.1071487177940904, "v3": 0.0, "v4": 0.4636476090008061, "v5": 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">{ "v1": atan2(1, 2), "v2": atan2(0, 4), "v3": atan2(float("0.5"), double("-0.5")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 0.4636476090008061, "v2": 0.0, "v3": 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">{
+ "v1": ceil(2013),
+ "v2": ceil(-4036),
+ "v3": ceil(0.3),
+ "v4": ceil(float("-2013.2")),
+ "v5": ceil(double("-2013.893823748327284"))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 2013, "v2": -4036, "v3": 1.0, "v4": -2013.0, "v5": -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">{ "v1": cos(1), "v2": cos(2), "v3": cos(0), "v4": cos(float("0.5")), "v5": cos(double("1000")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 0.5403023058681398, "v2": -0.4161468365471424, "v3": 1.0, "v4": 0.8775825618903728, "v5": 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">{ "v1": cosh(1), "v2": cosh(2), "v3": cosh(0), "v4": cosh(float("0.5")), "v5": cosh(double("8")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 1.5430806348152437, "v2": 3.7621956910836314, "v3": 1.0, "v4": 1.1276259652063807, "v5": 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">{ "v1": degrees(pi()) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 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">{ "v1": e() };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 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">{ "v1": exp(1), "v2": exp(2), "v3": exp(0), "v4": exp(float("0.5")), "v5": exp(double("1000")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 2.718281828459045, "v2": 7.38905609893065, "v3": 1.0, "v4": 1.6487212707001282, "v5": "Infinity" }
+</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">{
+ "v1": floor(2013),
+ "v2": floor(-4036),
+ "v3": floor(0.8),
+ "v4": floor(float("-2013.2")),
+ "v5": floor(double("-2013.893823748327284"))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 2013, "v2": -4036, "v3": 0.0, "v4": -2014.0, "v5": -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">{ "v1": ln(1), "v2": ln(2), "v3": ln(0), "v4": ln(float("0.5")), "v5": ln(double("1000")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 0.0, "v2": 0.6931471805599453, "v3": "-Infinity", "v4": -0.6931471805599453, "v5": 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">{ "v1": log(1), "v2": log(2), "v3": log(0), "v4": log(float("0.5")), "v5": log(double("1000")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 0.0, "v2": 0.3010299956639812, "v3": "-Infinity", "v4": -0.3010299956639812, "v5": 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">{ "v1": pi() };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 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">{ "v1": power(1, 2), "v3": power(0, 4), "v4": power(float("0.5"), double("-0.5")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 1, "v3": 0, "v4": 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">{ "v1": radians(180) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 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">{
+ "v1": round(2013),
+ "v2": round(-4036),
+ "v3": round(0.8),
+ "v4": round(float("-2013.256")),
+ "v5": round(double("-2013.893823748327284"))
+ "v6": round(123456, -1),
+ "v7": round(456.456, 2),
+ "v8": round(456.456, -1),
+ "v9": round(-456.456, -2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 2013, "v2": -4036, "v3": 1.0, "v4": -2013.0, "v5": -2014.0, "v6": 123460, "v7": 456.46, "v8": 460, "v9": -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">{ "v1": sign(1), "v2": sign(2), "v3": sign(0), "v4": sign(float("0.5")), "v5": sign(double("-1000")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 1, "v2": 1, "v3": 0, "v4": 1, "v5": -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">{ "v1": sin(1), "v2": sin(2), "v3": sin(0), "v4": sin(float("0.5")), "v5": sin(double("1000")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 0.8414709848078965, "v2": 0.9092974268256817, "v3": 0.0, "v4": 0.479425538604203, "v5": 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">{ "v1": sinh(1), "v2": sinh(2), "v3": sinh(0), "v4": sinh(float("0.5")), "v5": sinh(double("8")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 1.1752011936438014, "v2": 3.626860407847019, "v3": 0.0, "v4": 0.5210953054937474, "v5": 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">{ "v1": sqrt(1), "v2": sqrt(2), "v3": sqrt(0), "v4": sqrt(float("0.5")), "v5": sqrt(double("1000")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 1.0, "v2": 1.4142135623730951, "v3": 0.0, "v4": 0.7071067811865476, "v5": 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">{ "v1": tan(1), "v2": tan(2), "v3": tan(0), "v4": tan(float("0.5")), "v5": tan(double("1000")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 1.5574077246549023, "v2": -2.185039863261519, "v3": 0.0, "v4": 0.5463024898437905, "v5": 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">{ "v1": tanh(1), "v2": tanh(2), "v3": tanh(0), "v4": tanh(float("0.5")), "v5": tanh(double("8")) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 0.7615941559557649, "v2": 0.964027580075817, "v3": 0.0, "v4": 0.4621171572600098, "v5": 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">{ "v1": trunc(1, 1), "v2": trunc(2, -2), "v3": trunc(0.122, 2), "v4": trunc(float("11.52"), -1), "v5": trunc(double("1000.5252"), 3) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 1, "v2": 2, "v3": 0.12, "v4": 10.0, "v5": 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">{
+ "v1": round_half_to_even(2013),
+ "v2": round_half_to_even(-4036),
+ "v3": round_half_to_even(0.8),
+ "v4": round_half_to_even(float("-2013.256")),
+ "v5": round_half_to_even(double("-2013.893823748327284")),
+ "v6": round_half_to_even(double("-2013.893823748327284"), 2),
+ "v7": round_half_to_even(2013, 4),
+ "v8": round_half_to_even(float("-2013.256"), 5)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 2013, "v2": -4036, "v3": 1.0, "v4": -2013.0, "v5": -2014.0, "v6": -2013.89, "v7": 2013, "v8": -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>….</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("test ", "driven ", "development");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">"test driven development"
+</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">{ "v1": contains("I like x-phone", "phone"), "v2": contains("one", "phone") };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": true, "v2": 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">{
+ "v1": ends_with(" love product-b its shortcut_menu is awesome:)", ":)"),
+ "v2": ends_with(" awsome:)", ":-)")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": true, "v2": 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 “title”.</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">{ "v1": initcap("ASTERIXDB is here!"), "v2": title("ASTERIXDB is here!") };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": "Asterixdb Is Here!", "v2": "Asterixdb Is Here!" }
+</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("test string");
+</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("👩‍👩‍👧‍👦");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is (the emoji character 👩‍👩‍👧‍👦 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("ASTERIXDB");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">"asterixdb"
+</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 “👩‍👩‍👧‍👦” contains 7 code points, and it is possible to trim a few code points (such as a 2-people-family “👨‍👦”) 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("me like x-phone", "eml");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">" like x-phone"
+</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("👨‍👩‍👧‍👦", "👨‍👦")
+</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">"👩‍👧‍👦"
+</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">{
+ "v1": position("ppphonepp", "phone"),
+ "v2": position("hone", "phone"),
+ "v3": position1("ppphonepp", "phone"),
+ "v4": position1("hone", "phone")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 2, "v2": -1, v3": 3, "v4": -1 }
+</pre></div></div>
+</li>
+<li>
+
+<p>Example of multi-code-point character:</p>
+
+<div>
+<div>
+<pre class="source">position("👩‍👩‍👧‍👦🏀", "🏀");
+</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">{
+ "v1": regexp_contains("pphonepp", "p*hone"),
+ "v2": regexp_contains("hone", "p+hone")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": true, "v2": 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">{
+ "v1": regexp_like(" can't stand acast the network is horrible:(", ".*acast.*"),
+ "v2": regexp_like("acast", ".*acst.*")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": true, "v2": 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">{
+ "v1": regexp_position("pphonepp", "p*hone"),
+ "v2": regexp_position("hone", "p+hone"),
+ "v3": regexp_position1("pphonepp", "p*hone"),
+ "v4": regexp_position1("hone", "p+hone")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 0, "v2": -1, "v3": 1, "v4": -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(" like x-phone the voicemail_service is awesome", " like x-phone", "like product-a");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">"like product-a the voicemail_service is awesome"
+</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("test", 3);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">"testtesttest"
+</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">{
+ "v1": replace(" like x-phone the voicemail_service is awesome", " like x-phone", "like product-a"),
+ "v2": replace("x-phone and x-phone", "x-phone", "product-a", 1)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "v1": "like product-a the voicemail_service is awesome",
+ "v2": "product-a and x-phone"
+}
+</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("hello");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">"olleh"
+</pre></div></div>
+</li>
+<li>
+
+<p>Example of multi-code-point character (Korean):</p>
+
+<div>
+<div>
+<pre class="source">reverse("한글");
+</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">"ᆯᅳᄀᆫᅡᄒ"
+</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 “👩‍👩‍👧‍👦” contains 7 code points, and it is possible to trim a few code points (such as a 2-people-family “👨‍👦”) 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">{
+ "v1": rtrim("i like x-phone", "x-phone"),
+ "v2": rtrim("i like x-phone", "onexph")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": "i like ", "v2": "i like x-" }
+</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("👨‍👩‍👧‍👦", "👨‍👦")
+</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">"👨‍👩‍👧"
+</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>""</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("test driven development", " ");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ "test", "driven", "development" ]
+</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("123//456", "/");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ "123", "", "456" ]
+</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">{
+ "v1" : starts_with(" like the plan, amazing", " like"),
+ "v2" : starts_with("I like the plan, amazing", " like")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": true, "v2": 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 👨‍👩‍👧‍👦 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">{ "v1": substr("test string", 6, 3), "v2": substr1("test string", 6, 3) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": "tri", "v2": "str" }
+</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 “👩‍👩‍👧‍👦” contains 7 code points, and it is possible to trim a few code points (such as a 2-people-family “👨‍👦”) 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("i like x-phone", "xphoen");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">" like "
+</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(“👨‍👩‍👧‍👦”, “👨‍👦”)</p>
+</li>
+<li>
+
+<p>The expected result is (only woman and girl are left in the family):</p>
+
+<div>
+<div>
+<pre class="source"> "👩‍👧"
+</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("hello")
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">"HELLO"
+</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(["ASTERIX", " ", "ROCKS!"]);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">"ASTERIX ROCKS!"
+</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(["ASTERIX", "ROCKS~"], "!! ");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">"ASTERIX!! ROCKS~"
+</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("Hello ASTERIX!");
+</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">"Hello ASTERIX!"
+</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(" like x-phone", "x-phone");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">" like "
+</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(" like x-phone", "xph");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">"one"
+</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(“ABCDEF0123456789”,“hex”), parse_binary(“abcdef0123456789”,“HEX”), parse_binary(‘QXN0ZXJpeAE=’,“base64”) ];</p>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>[ hex(“ABCDEF0123456789”), hex(“ABCDEF0123456789”), hex(“4173746572697801”) ]</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("ABCDEF0123456789"), "base64"), print_binary(base64("q83vASNFZ4k="), "hex") ]
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result are:</p>
+
+<div>
+<div>
+<pre class="source">[ "q83vASNFZ4k=", "ABCDEF0123456789" ]
+</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("00AA"))
+</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("AABBCCDD"), 4);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is</p>
+
+<div>
+<div>
+<pre class="source">hex("DD")
+</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(“42”), hex(""), hex(‘42’)]);</p>
+</li>
+<li>
+
+<p>The expected result is</p>
+<p>hex(“4242”)</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">{ "point": create_point(30.0,70.0) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "point": point("30.0,70.0") }
+</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">{ "line": 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">{ "line": line("30.0,70.0 50.0,90.0") }
+</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">{ "rectangle": 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">{ "rectangle": rectangle("30.0,70.0 50.0,90.0") }
+</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">{ "circle": 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">{ "circle": circle("30.0,70.0 5.0") }
+</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">{ "polygon": 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">{ "polygon": polygon("1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0") }
+</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">{ "x_coordinate": get_x(create_point(2.3,5.0)), "y_coordinate": get_y(create_point(2.3,5.0)) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "x_coordinate": 2.3, "y_coordinate": 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("1.0,1.0"), point("2.0,2.0"), point("3.0,3.0"), point("4.0,4.0") ]
+</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">{
+ "circle_radius": get_radius(create_circle(create_point(6.0,3.0), 1.0)),
+ "circle_center": 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">{ "circle_radius": 1.0, "circle_center": point("6.0,3.0") }
+</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("47.44,80.65"), 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("39.28,70.48"), 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("39.28,70.48"), 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("36.5,68.0 42.0,74.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="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("SuzannaTillson", "Suzanna Tilson");
+</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("happy","hapr",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("happy","hapr",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 “check” version of Jaccard is faster than the “non_check” 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("I like the phone, awesome!");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ "i", "like", "the", "phone", "awesome" ]
+</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">{
+ "year": get_year(date("2010-10-30")),
+ "month": get_month(datetime("1987-11-19T23:49:23.938")),
+ "day": get_day(date("2010-10-30")),
+ "hour": get_hour(time("12:23:34.930+07:00")),
+ "min": get_minute(duration("P3Y73M632DT49H743M3948.94S")),
+ "second": get_second(datetime("1987-11-19T23:49:23.938")),
+ "ms": get_millisecond(duration("P3Y73M632DT49H743M3948.94S"))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "year": 2010, "month": 11, "day": 30, "hour": 5, "min": 28, "second": 23, "ms": 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("2008-04-26T10:10:00"), "+08:00");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">"2008-04-26T18:10:00.000+08:00"
+</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("2008-04-26T10:10:00")), "+08:00");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">"18:10:00.000+08:00"
+</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("2016-03-26T10:10:00"),
+ datetime("2016-03-26T10:10:00") - datetime("2011-01-01T00:00:00")
+);
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">duration("P5Y2M24DT10H10M")
+</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("P12M50DT10H"));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">year_month_duration("P1Y")
+</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">{
+ "months": months_from_year_month_duration(get_year_month_duration(duration("P5Y7MT50M"))),
+ "milliseconds": ms_from_day_time_duration(get_day_time_duration(duration("P5Y7MT50M")))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{"months": 67, "milliseconds": 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("P8M")
+</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">{
+ "dr1" : duration_from_interval(interval(date("2010-10-30"), date("2010-12-21"))),
+ "dr2" : duration_from_interval(interval(datetime("2012-06-26T01:01:01.111"), datetime("2012-07-27T02:02:02.222"))),
+ "dr3" : duration_from_interval(interval(time("12:32:38"), time("20:29:20"))),
+ "dr4" : duration_from_interval(null)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "dr1": day_time_duration("P52D"),
+ "dr2": day_time_duration("P31DT1H1M1.111S"),
+ "dr3": day_time_duration("PT7H56M42S"),
+ "dr4": 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>
+</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("2016-03-26T10:10:00"));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time("10:10:00.000Z")
+</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)
+</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> value (Can also be a <tt>datetime</tt>)</li>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>an <tt>tinyint</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">day_of_week(datetime("2012-12-30T12:12:12.039Z"));
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">7
+</pre></div></div>
+</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>
+</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)
+</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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value as the time 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>
+</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)
+</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>
+</ul>
+</li>
+<li>Return Value:
+<ul>
+
+<li>a <tt>datetime</tt> value as the time 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>
+</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="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.000Z.</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.000Z,</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": date_from_unix_time_in_days(15800),
+ "datetime": datetime_from_unix_time_in_ms(1365139700000),
+ "time": time_from_unix_time_in_ms(3748)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "date": date("2013-04-05"), "datetime": datetime("2013-04-05T05:28:20.000Z"), "time": time("00:00:03.748Z") }
+</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>
+</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)
+</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>
+</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>
+</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)
+</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>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>
+</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.000Z 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">{
+ "date": date_from_unix_time_in_days(15800),
+ "datetime": datetime_from_unix_time_in_ms(1365139700000),
+ "time": time_from_unix_time_in_ms(3748)
+}
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "date": date("2013-04-05"), "datetime": datetime("2013-04-05T05:28:20.000Z"), "time": time("00:00:03.748Z") }
+</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> milliseconds</li>
+<li><tt>a</tt> am/pm</li>
+<li><tt>z</tt> timezone</li>
+<li><tt>Y</tt> year</li>
+<li><tt>M</tt> month</li>
+<li><tt>D</tt> day</li>
+<li><tt>W</tt> weekday</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("30:30","m:s");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">time("00:30:30.000Z")
+</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> milliseconds</li>
+<li><tt>a</tt> am/pm</li>
+<li><tt>z</tt> timezone</li>
+<li><tt>Y</tt> year</li>
+<li><tt>M</tt> month</li>
+<li><tt>D</tt> day</li>
+<li><tt>W</tt> weekday</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("00:30:30.000Z"),"m:s");
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">"30:30"
+</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">{
+ "start": get_interval_start(interval_start_from_date("1984-01-01", "P1Y")),
+ "end": get_interval_end(interval_start_from_date("1984-01-01", "P1Y"))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "start": date("1984_01_01"), "end": date("1985_01_01") }
+</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">{
+ "start1": get_interval_start_date(interval_start_from_date("1984-01-01", "P1Y")),
+ "end1": get_interval_end_date(interval_start_from_date("1984-01-01", "P1Y")),
+ "start2": get_interval_start_datetime(interval_start_from_datetime("1984-01-01T08:30:00.000", "P1Y1H")),
+ "end2": get_interval_end_datetime(interval_start_from_datetime("1984-01-01T08:30:00.000", "P1Y1H")),
+ "start3": get_interval_start_time(interval_start_from_time("08:30:00.000", "P1H")),
+ "end3": get_interval_end_time(interval_start_from_time("08:30:00.000", "P1H"))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "start1": date("1984-01-01"),
+ "end1": date("1985-01-01"),
+ "start2": datetime("1984-01-01T08:30:00.000Z"),
+ "end2": datetime("1985-01-01T09:30:00.000Z"),
+ "start3": time("08:30:00.000Z"),
+ "end3": time("09:30:00.000Z")
+}
+</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">{ "overlap1": get_overlapping_interval(interval(time("11:23:39"), time("18:27:19")), interval(time("12:23:39"), time("23:18:00"))),
+ "overlap2": get_overlapping_interval(interval(time("12:23:39"), time("18:27:19")), interval(time("07:19:39"), time("09:18:00"))),
+ "overlap3": get_overlapping_interval(interval(date("1980-11-30"), date("1999-09-09")), interval(date("2013-01-01"), date("2014-01-01"))),
+ "overlap4": get_overlapping_interval(interval(date("1980-11-30"), date("2099-09-09")), interval(date("2013-01-01"), date("2014-01-01"))),
+ "overlap5": get_overlapping_interval(interval(datetime("1844-03-03T11:19:39"), datetime("2000-10-30T18:27:19")), interval(datetime("1989-03-04T12:23:39"), datetime("2009-10-10T23:18:00"))),
+ "overlap6": get_overlapping_interval(interval(datetime("1989-03-04T12:23:39"), datetime("2000-10-30T18:27:19")), interval(datetime("1844-03-03T11:19:39"), datetime("1888-10-10T23:18:00")))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "overlap1": interval(time("12:23:39.000Z"), time("18:27:19.000Z")),
+ "overlap2": null,
+ "overlap3": null,
+ "overlap4": interval(date("2013-01-01"), date("2014_01_01")),
+ "overlap5": interval(datetime("1989-03-04T12:23:39.000Z"), datetime("2000-10-30T18:27:19.000Z")),
+ "overlap6": 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:
+<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>
+<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>
+</ul>
+</li>
+<li>
+
+<p>Example:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "bin1": interval_bin(date("2010-10-30"), date("1990-01-01"), year_month_duration("P1Y")),
+ "bin2": interval_bin(datetime("1987-11-19T23:49:23.938"), datetime("1990-01-01T00:00:00.000Z"), year_month_duration("P6M")),
+ "bin3": interval_bin(time("12:23:34.930+07:00"), time("00:00:00"), day_time_duration("PT1M")),
+ "bin4": interval_bin(datetime("1987-11-19T23:49:23.938"), datetime("2013-01-01T00:00:00.000"), day_time_duration("PT24H"))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "bin1": interval(date("2010-01-01"),date("2011-01-01")),
+ "bin2": interval(datetime("1987-07-01T00:00:00.000Z"), datetime("1988-01-01T00:00:00.000Z")),
+ "bin3": interval(time("05:23:00.000Z"), time("05:24:00.000Z")),
+ "bin4": interval(datetime("1987-11-19T00:00:00.000Z"), datetime("1987-11-20T00:00:00.000Z"))
+}
+</pre></div></div>
+</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">{
+ "interval1": interval_start_from_date("1984-01-01", "P1Y"),
+ "interval2": interval_start_from_time(time("02:23:28.394"), "PT3H24M"),
+ "interval3": interval_start_from_datetime("1999-09-09T09:09:09.999", duration("P2M30D"))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expectecd result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "interval1": interval(date("1984-01-01"), date("1985-01-01")),
+ "interval2": interval(time("02:23:28.394Z"), time("05:47:28.394Z")),
+ "interval3": interval(datetime("1999-09-09T09:09:09.999Z"), datetime("1999-12-09T09:09:09.999Z"))
+}
+</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">{
+ "timebins": overlap_bins(interval(time("17:23:37"), time("18:30:21")), time("00:00:00"), day_time_duration("PT30M")),
+ "datebins": overlap_bins(interval(date("1984-03-17"), date("2013-08-22")), date("1990-01-01"), year_month_duration("P10Y")),
+ "datetimebins": overlap_bins(interval(datetime("1800-01-01T23:59:48.938"), datetime("2015-07-26T13:28:30.218")),
+ datetime("1900-01-01T00:00:00.000"), year_month_duration("P100Y"))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "timebins": [
+ interval(time("17:00:00.000Z"), time("17:30:00.000Z")),
+ interval(time("17:30:00.000Z"), time("18:00:00.000Z")),
+ interval(time("18:00:00.000Z"), time("18:30:00.000Z")),
+ interval(time("18:30:00.000Z"), time("19:00:00.000Z"))
+ ],
+ "datebins": [
+ interval(date("1980-01-01"), date("1990-01-01")),
+ interval(date("1990-01-01"), date("2000-01-01")),
+ interval(date("2000-01-01"), date("2010-01-01")),
+ interval(date("2010-01-01"), date("2020-01-01"))
+ ],
+ "datetimebins": [
+ interval(datetime("1800-01-01T00:00:00.000Z"), datetime("1900-01-01T00:00:00.000Z")),
+ interval(datetime("1900-01-01T00:00:00.000Z"), datetime("2000-01-01T00:00:00.000Z")),
+ interval(datetime("2000-01-01T00:00:00.000Z"), datetime("2100-01-01T00:00:00.000Z"))
+ ]
+};
+</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="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 < interval2.start</tt>, and <tt>interval_after(interval1, interval2)</tt> is true if and only if <tt>interval1.start > 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">{
+ "interval_before": interval_before(interval(date("2000-01-01"), date("2005-01-01")),
+ interval(date("2005-05-01"), date("2012-09-09"))),
+ "interval_after": interval_after(interval(date("2005-05-01"), date("2012-09-09")),
+ interval(date("2000-01-01"), date("2005-01-01")))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "interval_before": true, "interval_after": 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 <= interval2.start AND interval1.end >= interval2.end</p>
+<p><tt>interval_covered_by(interval1, interval2)</tt> is true if and only if</p>
+<p>interval2.start <= interval1.start AND interval2.end >= 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">{
+ "interval_covers": interval_covers(interval(date("2000-01-01"), date("2005-01-01")),
+ interval(date("2000-03-01"), date("2004-09-09"))),
+ "interval_covered_by": interval_covered_by(interval(date("2006-08-01"), date("2007-03-01")),
+ interval(date("2004-09-10"), date("2012-08-01")))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "interval_covers": true, "interval_covered_by": 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 < interval2.start AND interval2.end > interval1.end AND interval1.end > 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 < interval1.start
+AND interval1.end > interval2.end
+AND interval2.end > 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’s relations on the definition of overlap.</p>
+</li>
+<li>
+
+<p>Examples:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "overlaps": interval_overlaps(interval(date("2000-01-01"), date("2005-01-01")),
+ interval(date("2004-05-01"), date("2012-09-09"))),
+ "overlapped_by": interval_overlapped_by(interval(date("2006-08-01"), date("2007-03-01")),
+ interval(date("2004-05-01"), date("2012-09-09"))))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "overlaps": true, "overlapped_by": 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’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 < interval2.end AND interval1.end > 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">{
+ "overlapping1": interval_overlapping(interval(date("2000-01-01"), date("2005-01-01")),
+ interval(date("2004-05-01"), date("2012-09-09"))),
+ "overlapping2": interval_overlapping(interval(date("2006-08-01"), date("2007-03-01")),
+ interval(date("2004-09-10"), date("2006-12-31")))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "overlapping1": true, "overlapping2": 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">{
+ "meets": interval_meets(interval(date("2000-01-01"), date("2005-01-01")),
+ interval(date("2005-01-01"), date("2012-09-09"))),
+ "metby": interval_met_by(interval(date("2006-08-01"), date("2007-03-01")),
+ interval(date("2004-09-10"), date("2006-08-01")))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "meets": true, "metby": 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 <= 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 <= 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">{
+ "interval_starts": interval_starts(interval(date("2000-01-01"), date("2005-01-01")),
+ interval(date("2000-01-01"), date("2012-09-09"))),
+ "interval_started_by": interval_started_by(interval(date("2006-08-01"), date("2007-03-01")),
+ interval(date("2006-08-01"), date("2006-08-02")))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "interval_starts": true, "interval_started_by": 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 >= 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 >= 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">{
+ "interval_ends": interval_ends(interval(date("2000-01-01"), date("2005-01-01")),
+ interval(date("1998-01-01"), date("2005-01-01"))),
+ "interval_ended_by": interval_ended_by(interval(date("2006-08-01"), date("2007-03-01")),
+ interval(date("2006-09-10"), date("2007-03-01")))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "interval_ends": true, "interval_ended_by": 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(
+ {
+ "id": 1,
+ "project": "AsterixDB",
+ "address": {"city": "Irvine", "state": "CA"},
+ "related": ["Hivestrix", "Preglix", "Apache VXQuery"]
+ }
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+ { "field-name": "id", "field-type": "INT64", "is-open": false },
+ { "field-name": "project", "field-type": "STRING", "is-open": false },
+ { "field-name": "address", "field-type": "RECORD", "is-open": false,
+ "nested": [
+ { "field-name": "city", "field-type": "STRING", "is-open": false },
+ { "field-name": "state", "field-type": "STRING", "is-open": false }
+ ]
+ },
+ { "field-name":
+ "related",
+ "field-type": "ORDEREDLIST",
+ "is-open": false,
+ "list": [
+ { "field-type": "STRING" },
+ { "field-type": "STRING" },
+ { "field-type": "STRING" }
+ ]
+ }
+]
+</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({
+ "id": 1,
+ "project": "AsterixDB",
+ "address": {"city": "Irvine", "state": "CA"},
+ "related": ["Hivestrix", "Preglix", "Apache VXQuery"]
+ },
+ "project"
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">"AsterixDB"
+</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(
+ {
+ "id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"]
+ },
+ [["address", "city"], "related"]
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "id":1,
+ "project":"AsterixDB",
+ "address":{ "state": "CA" }
+}
+</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(
+ {
+ "id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"]
+ },
+ [{"field-name":"employment_location", "field-value":create_point(30.0,70.0)}]
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"]
+ "employment_location": point("30.0,70.0")
+ }
+</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’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(
+ {
+ "id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"]
+ },
+ {
+ "user_id": 22,
+ "employer": "UC Irvine",
+ "employment_type": "visitor"
+ }
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "employment_type": "visitor",
+ "address": {
+ "city": "Irvine",
+ "state": "CA"
+ },
+ "related": [
+ "Hivestrix",
+ "Preglix",
+ "Apache VXQuery"
+ ],
+ "user_id": 22,
+ "project": "AsterixDB",
+ "employer": "UC Irvine",
+ "id": 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(
+ {
+ "id": 1,
+ "project": "AsterixDB",
+ "address": {"city": "Irvine", "state": "CA"},
+ }
+ );
+</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(
+ {
+ "id": 1,
+ "project": "AsterixDB",
+ "address": {"city": "Irvine", "state": "CA"},
+ }
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[ "id", "project", "address" ]
+</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(
+ {
+ "id": 1,
+ "project": "AsterixDB",
+ "address": {"city": "Irvine", "state": "CA"}
+ }
+ , "address"
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "id": 1,
+ "project": "AsterixDB",
+}
+</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(
+ {
+ "id": 1,
+ "project": "AsterixDB",
+ "address": {"city": "Irvine", "state": "CA"}
+ }
+ , "address"
+ , "location"
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "id": 1,
+ "project": "AsterixDB",
+ "location": {"city": "Irvine", "state": "CA"}
+}
+</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(
+ {
+ "id": 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(
+ {
+ "id": 1,
+ "project": "AsterixDB",
+ "address": {"city": "Irvine", "state": "CA"}
+ }
+ , "AsterixDB"
+ , "Apache AsterixDB"
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "id": 1,
+ "project": "Apache AsterixDB",
+ "location": {"city": "Irvine", "state": "CA"}
+}
+</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(
+ {
+ "id": 1,
+ "project": "AsterixDB",
+ "address": {"city": "Irvine", "state": "CA"}
+ }
+ , "company"
+ , "Apache"
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "id": 1,
+ "project": "AsterixDB",
+ "location": {"city": "Irvine", "state": "CA"},
+ "company": "Apache"
+}
+</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(
+ {
+ "id": 1,
+ "project": "AsterixDB",
+ "address": {"city": "Irvine", "state": "CA"}
+ }
+ , "project"
+ , "Apache AsterixDB"
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{
+ "id": 1,
+ "project": "Apache AsterixDB",
+ "location": {"city": "Irvine", "state": "CA"}
+}
+</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(
+ {
+ "id": 1,
+ "project": "AsterixDB",
+ "address": {"city": "Irvine", "state": "CA"}
+ }
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+ 1,
+ "AsterixDB",
+ {"city": "Irvine", "state": "CA"}
+]
+</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>’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(
+ {
+ "id": 1,
+ "project": "AsterixDB",
+ "address": {"city": "Irvine", "state": "CA"}
+ }
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+ { "name": "id", "value": 1 },
+ { "name": "project", "value": "AsterixDB" },
+ { "name": "address", "value": {"city": "Irvine", "state": "CA"} }
+]
+</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>’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>’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(
+ {
+ "id": 1,
+ "project": "AsterixDB",
+ "address": {"city": "Irvine", "state": "CA"}
+ }
+ );
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">[
+ [ "id", 1 ],
+ [ "project", "AsterixDB" ],
+ [ "address", { "city": "Irvine", "state": "CA" } ],
+ [ "city", "Irvine" ],
+ [ "state", "CA" ]
+]
+</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>-> <tt>smallint</tt>-><tt>integer</tt>-><tt>bigint</tt>-><tt>float</tt>-><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>-> <tt>smallint</tt>-><tt>integer</tt>-><tt>bigint</tt>-><tt>float</tt>-><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>-> <tt>smallint</tt>-><tt>integer</tt>-><tt>bigint</tt>-><tt>float</tt>-><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>-> <tt>smallint</tt>-><tt>integer</tt>-><tt>bigint</tt>-><tt>float</tt>-><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>-> <tt>smallint</tt>-><tt>integer</tt>-><tt>bigint</tt>-><tt>float</tt>-><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>-> <tt>smallint</tt>-><tt>integer</tt>-><tt>bigint</tt>-><tt>float</tt>-><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>….</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>-> <tt>smallint</tt>-><tt>integer</tt>-><tt>bigint</tt>-><tt>float</tt>-><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">{ "v1": greatest(1, 2, 3), "v2": greatest(float("0.5"), double("-0.5"), 5000) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 3, "v2": 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>….</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>-> <tt>smallint</tt>-><tt>integer</tt>-><tt>bigint</tt>-><tt>float</tt>-><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">{ "v1": least(1, 2, 3), "v2": least(float("0.5"), double("-0.5"), 5000) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 1, "v2": -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">{
+ "a": is_array(true),
+ "b": is_array(false),
+ "c": isarray(null),
+ "d": isarray(missing),
+ "e": isarray("d"),
+ "f": isarray(4.0),
+ "g": isarray(5),
+ "h": isarray(["1", 2]),
+ "i": isarray({"a":1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": false, "f": false, "g": false, "h": true, "i": 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">{
+ "a": is_multiset(true),
+ "b": is_multiset(false),
+ "c": is_multiset(null),
+ "d": is_multiset(missing),
+ "e": is_multiset("d"),
+ "f": ismultiset(4.0),
+ "g": ismultiset(["1", 2]),
+ "h": ismultiset({"a":1}),
+ "i": ismultiset({{"hello", 9328, "world", [1, 2, null]}})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": false, "f": false, "g": false, "h": false, "i": 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">{
+ "a": is_atomic(true),
+ "b": is_atomic(false),
+ "c": isatomic(null),
+ "d": isatomic(missing),
+ "e": isatomic("d"),
+ "f": isatom(4.0),
+ "g": isatom(5),
+ "h": isatom(["1", 2]),
+ "i": isatom({"a":1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": true, "b": true, "c": null, "e": true, "f": true, "g": true, "h": false, "i": 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">{
+ "a": isboolean(true),
+ "b": isboolean(false),
+ "c": is_boolean(null),
+ "d": is_boolean(missing),
+ "e": isbool("d"),
+ "f": isbool(4.0),
+ "g": isbool(5),
+ "h": isbool(["1", 2]),
+ "i": isbool({"a":1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": true, "b": true, "c": null, "e": false, "f": false, "g": false, "h": false, "i": 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">{
+ "a": is_number(true),
+ "b": is_number(false),
+ "c": isnumber(null),
+ "d": isnumber(missing),
+ "e": isnumber("d"),
+ "f": isnum(4.0),
+ "g": isnum(5),
+ "h": isnum(["1", 2]),
+ "i": isnum({"a":1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": false, "f": true, "g": true, "h": false, "i": 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">{
+ "a": is_object(true),
+ "b": is_object(false),
+ "c": isobject(null),
+ "d": isobject(missing),
+ "e": isobj("d"),
+ "f": isobj(4.0),
+ "g": isobj(5),
+ "h": isobj(["1", 2]),
+ "i": isobj({"a":1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+<p>{ “a”: false, “b”: false, “c”: null, “e”: false, “f”: false, “g”: false, “h”: false, “i”: 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">{
+ "a": is_string(true),
+ "b": isstring(false),
+ "c": isstring(null),
+ "d": isstr(missing),
+ "e": isstr("d"),
+ "f": isstr(4.0),
+ "g": isstr(5),
+ "h": isstr(["1", 2]),
+ "i": isstr({"a":1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": true, "f": false, "g": false, "h": false, "i": 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">{ "v1": is_null(null), "v2": is_null(1), "v3": is_null(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": true, "v2": 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">{ "v1": is_missing(null), "v2": is_missing(1), "v3": is_missing(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": false, "v2": false, "v3": 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">{ "v1": is_unknown(null), "v2": is_unknown(1), "v3": is_unknown(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": true, "v2": false, "v3": 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">{
+ "a": is_binary(true),
+ "b": is_binary(false),
+ "c": isbinary(null),
+ "d": isbinary(missing),
+ "e": isbin(point("1,2")),
+ "f": isbin(hex("ABCDEF0123456789")),
+ "g": is_bin(sub_binary(hex("AABBCCDD"), 4)),
+ "h": is_bin(2),
+ "i": is_bin({"a":1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": false, "f": true, "g": true, "h": false, "i": 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"> {
+ "a": is_uuid(true),
+ "b": is_uuid(false),
+ "c": is_uuid(null),
+ "d": is_uuid(missing),
+ "e": isuuid(4.0),
+ "f": isuuid(date("2013-01-01")),
+ "g": isuuid(uuid("5c848e5c-6b6a-498f-8452-8847a2957421"))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": false, "f": false, "g": 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">{
+ "a": is_point(true),
+ "b": is_point(false),
+ "c": is_point(null),
+ "d": is_point(missing),
+ "e": is_point(point("1,2")),
+ "f": ispoint(line("30.0,70.0 50.0,90.0")),
+ "g": ispoint(rectangle("30.0,70.0 50.0,90.0")),
+ "h": ispoint(circle("30.0,70.0 5.0")),
+ "i": ispoint(polygon("1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0")),
+ "j": ispoint(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": true, "f": false, "g": false, "h": false, "i": false, "j": 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">{
+ "a": is_line(true),
+ "b": is_line(false),
+ "c": is_line(null),
+ "d": is_line(missing),
+ "e": is_line(point("1,2")),
+ "f": isline(line("30.0,70.0 50.0,90.0")),
+ "g": isline(rectangle("30.0,70.0 50.0,90.0")),
+ "h": isline(circle("30.0,70.0 5.0")),
+ "i": isline(polygon("1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0")),
+ "j": isline(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": false, "f": true, "g": false, "h": false, "i": false, "j": 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">{
+ "a": is_rectangle(true),
+ "b": is_rectangle(false),
+ "c": is_rectangle(null),
+ "d": is_rectangle(missing),
+ "e": is_rectangle(point("1,2")),
+ "f": isrectangle(line("30.0,70.0 50.0,90.0")),
+ "g": isrectangle(rectangle("30.0,70.0 50.0,90.0")),
+ "h": isrectangle(circle("30.0,70.0 5.0")),
+ "i": isrectangle(polygon("1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0")),
+ "j": isrectangle(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": false, "f": false, "g": true, "h": false, "i": false, "j": 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">{
+ "a": is_circle(true),
+ "b": is_circle(false),
+ "c": is_circle(null),
+ "d": is_circle(missing),
+ "e": is_circle(point("1,2")),
+ "f": iscircle(line("30.0,70.0 50.0,90.0")),
+ "g": iscircle(rectangle("30.0,70.0 50.0,90.0")),
+ "h": iscircle(circle("30.0,70.0 5.0")),
+ "i": iscircle(polygon("1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0")),
+ "j": iscircle(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": false, "f": false, "g": false, "h": true, "i": false, "j": 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">{
+ "a": is_polygon(true),
+ "b": is_polygon(false),
+ "c": is_polygon(null),
+ "d": is_polygon(missing),
+ "e": is_polygon(point("1,2")),
+ "f": ispolygon(line("30.0,70.0 50.0,90.0")),
+ "g": ispolygon(rectangle("30.0,70.0 50.0,90.0")),
+ "h": ispolygon(circle("30.0,70.0 5.0")),
+ "i": ispolygon(polygon("1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0")),
+ "j": ispolygon(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": false, "f": false, "g": false, "h": false, "i": true, "j": 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">{
+ "a": is_spatial(true),
+ "b": is_spatial(false),
+ "c": is_spatial(null),
+ "d": is_spatial(missing),
+ "e": is_spatial(point("1,2")),
+ "f": isspatial(line("30.0,70.0 50.0,90.0")),
+ "g": isspatial(rectangle("30.0,70.0 50.0,90.0")),
+ "h": isspatial(circle("30.0,70.0 5.0")),
+ "i": isspatial(polygon("1.0,1.0 2.0,2.0 3.0,3.0 4.0,4.0")),
+ "j": isspatial(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": true, "f": true, "g": true, "h": true, "i": true, "j": 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">{
+ "a": is_date(true),
+ "b": is_date(false),
+ "c": is_date(null),
+ "d": is_date(missing),
+ "e": is_date(date("-19700101")),
+ "f": isdate(date("2013-01-01")),
+ "g": isdate(time("12:12:12.039Z")),
+ "h": isdate(datetime("2013-01-01T12:12:12.039Z")),
+ "i": isdate(duration("P100Y12MT12M")),
+ "j": isdate(interval(date("2013-01-01"), date("20130505"))),
+ "k": isdate(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": true, "f": true, "g": false, "h": false, "i": false, "j": false, "k": 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">{
+ "a": is_datetime(true),
+ "b": is_datetime(false),
+ "c": is_datetime(null),
+ "d": is_datetime(missing),
+ "e": is_datetime(datetime("2016-02-02T12:09:22.023Z")),
+ "f": isdatetime(datetime("2011-03-03T12:10:42.011Z")),
+ "g": isdatetime(time("12:12:12.039Z")),
+ "h": is_timestamp(datetime("2013-01-01T12:12:12.039Z")),
+ "i": is_timestamp(duration("P100Y12MT12M")),
+ "j": istimestamp(interval(date("2013-01-01"), date("20130505"))),
+ "k": istimestamp(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": true, "f": true, "g": false, "h": true, "i": false, "j": false, "k": 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"> {
+ "a": is_time(true),
+ "b": is_time(false),
+ "c": is_time(null),
+ "d": is_time(missing),
+ "e": is_time(time("08:00:00.000Z")),
+ "f": istime(date("2013-01-01")),
+ "g": istime(time("12:12:12.039Z")),
+ "h": istime(datetime("2013-01-01T12:12:12.039Z")),
+ "i": istime(duration("P100Y12MT12M")),
+ "j": istime(interval(date("2013-01-01"), date("20130505"))),
+ "k": istime(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": true, "f": false, "g": true, "h": false, "i": false, "j": false, "k": 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"> {
+ "a": is_duration(true),
+ "b": is_duration(false),
+ "c": is_duration(null),
+ "d": is_duration(missing),
+ "e": is_duration(duration("-PT20.943S")),
+ "f": isduration(date("2013-01-01")),
+ "g": isduration(time("12:12:12.039Z")),
+ "h": isduration(datetime("2013-01-01T12:12:12.039Z")),
+ "i": isduration(duration("P100Y12MT12M")),
+ "j": isduration(interval(date("2013-01-01"), date("20130505"))),
+ "k": isduration(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": true, "f": false, "g": false, "h": false, "i": true, "j": false, "k": 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"> {
+ "a": is_interval(true),
+ "b": is_interval(false),
+ "c": is_interval(null),
+ "d": is_interval(missing),
+ "e": is_interval(interval(datetime("2013-01-01T00:01:01.000Z"), datetime("2013-05-05T13:39:01.049Z"))),
+ "f": isinterval(date("2013-01-01")),
+ "g": isinterval(time("12:12:12.039Z")),
+ "h": isinterval(datetime("2013-01-01T12:12:12.039Z")),
+ "i": isinterval(duration("P100Y12MT12M")),
+ "j": isinterval(interval(date("2013-01-01"), date("20130505"))),
+ "k": isinterval(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": true, "f": false, "g": false, "h": false, "i": false, "j": true, "k": 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"> {
+ "a": is_temporal(true),
+ "b": is_temporal(false),
+ "c": is_temporal(null),
+ "d": is_temporal(missing),
+ "e": is_temporal(duration("-PT20.943S")),
+ "f": istemporal(date("2013-01-01")),
+ "g": istemporal(time("12:12:12.039Z")),
+ "h": istemporal(datetime("2013-01-01T12:12:12.039Z")),
+ "i": istemporal(duration("P100Y12MT12M")),
+ "j": istemporal(interval(date("2013-01-01"), date("20130505"))),
+ "k": istemporal(3)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": false, "b": false, "c": null, "e": true, "f": true, "g": true, "h": true, "i": true, "j": true, "k": 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">{
+ "a": get_type(true),
+ "b": get_type(false),
+ "c": get_type(null),
+ "d": get_type(missing),
+ "e": get_type("d"),
+ "f": gettype(4.0),
+ "g": gettype(5),
+ "h": gettype(["1", 2]),
+ "i": gettype({"a":1})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": "boolean", "b": "boolean", "c": "null", "d": "missing", "e": "string", "f": "double", "g": "bigint", "h": "array", "i": "object" }
+</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">{
+ "v1": to_array("asterix"),
+ "v2": to_array(["asterix"]),
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": ["asterix"], "v2": ["asterix"] }
+</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">{
+ "v1": to_atomic("asterix"),
+ "v2": to_atomic(["asterix"]),
+ "v3": to_atomic([0, 1]),
+ "v4": to_atomic({"value": "asterix"}),
+ "v5": to_number({"x": 1, "y": 2})
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": "asterix", "v2": "asterix", "v3": null, "v4": "asterix", "v5": 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’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’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">{
+ "v1": to_boolean(0),
+ "v2": to_boolean(1),
+ "v3": to_boolean(""),
+ "v4": to_boolean("asterix")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": false, "v2": true, "v3": false, "v4": 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">{
+ "v1": to_bigint(false),
+ "v2": to_bigint(true),
+ "v3": to_bigint(10),
+ "v4": to_bigint(float("1e100")),
+ "v5": to_bigint(double("1e1000")),
+ "v6": to_bigint("20")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 0, "v2": 1, "v3": 10, "v4": 9223372036854775807, "v5": 9223372036854775807, "v6": 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">{
+ "v1": to_double(false),
+ "v2": to_double(true),
+ "v3": to_double(10),
+ "v4": to_double(11.5),
+ "v5": to_double("12.5")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 0.0, "v2": 1.0, "v3": 10.0, "v4": 11.5, "v5": 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">{
+ "v1": to_number(false),
+ "v2": to_number(true),
+ "v3": to_number(10),
+ "v4": to_number(11.5),
+ "v5": to_number("12.5")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": 0, "v2": 1, "v3": 10, "v4": 11.5, "v5": 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">{
+ "v1": to_object({"value": "asterix"}),
+ "v2": to_object("asterix")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": {"value": "asterix"}, "v2": {} }
+</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>"true"</tt> is returned if it is <tt>true</tt>, <tt>"false"</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">{
+ "v1": to_string(false),
+ "v2": to_string(true),
+ "v3": to_string(10),
+ "v4": to_string(11.5),
+ "v5": to_string("asterix")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": "false", "v2": "true", "v3": "10", "v4": "11.5", "v5": "asterix" }
+</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">{
+ "a": if_null(),
+ "b": if_null(null),
+ "c": if_null(null, "asterixdb"),
+ "d": is_missing(if_null(missing))
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": null, "b": null, "c": "asterixdb", "d": 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">{
+ "a": if_missing(),
+ "b": if_missing(missing),
+ "c": if_missing(missing, "asterixdb"),
+ "d": if_missing(null, "asterixdb")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": null, "b": null, "c": "asterixdb", "d": 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">{
+ "a": if_missing_or_null(),
+ "b": if_missing_or_null(null, missing),
+ "c": if_missing_or_null(null, missing, "asterixdb")
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": null, "b": null, "c": "asterixdb" }
+</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">{
+ "a": is_null(if_inf(null)),
+ "b": is_missing(if_inf(missing)),
+ "c": is_null(if_inf(double("INF"))),
+ "d": if_inf(1, null, missing) ],
+ "e": is_null(if_inf(null, missing, 1)) ],
+ "f": is_missing(if_inf(missing, null, 1)) ],
+ "g": if_inf(float("INF"), 1) ],
+ "h": to_string(if_inf(float("INF"), double("NaN"), 1)) ]
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": true, "b": true, "c": true, "d": 1, "e": true, "f": true, "g": 1, "h": "NaN" }
+</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">{
+ "a": is_null(if_nan(null)),
+ "b": is_missing(if_nan(missing)),
+ "c": is_null(if_nan(double("NaN"))),
+ "d": if_nan(1, null, missing) ],
+ "e": is_null(if_nan(null, missing, 1)) ],
+ "f": is_missing(if_nan(missing, null, 1)) ],
+ "g": if_nan(float("NaN"), 1) ],
+ "h": to_string(if_nan(float("NaN"), double("INF"), 1)) ]
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": true, "b": true, "c": true, "d": 1, "e": true, "f": true, "g": 1, "h": "INF" }
+</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">{
+ "a": is_null(if_nan_or_inf(null)),
+ "b": is_missing(if_nan_or_inf(missing)),
+ "c": is_null(if_nan_or_inf(double("NaN"), double("INF"))),
+ "d": if_nan_or_inf(1, null, missing) ],
+ "e": is_null(if_nan_or_inf(null, missing, 1)) ],
+ "f": is_missing(if_nan_or_inf(missing, null, 1)) ],
+ "g": if_nan_or_inf(float("NaN"), float("INF"), 1) ],
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": true, "b": true, "c": true, "d": 1, "e": true, "f": true, "g": 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">{
+ "a": null_if("asterixdb", "asterixdb"),
+ "b": null_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": null, "b": 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">{
+ "a": missing_if("asterixdb", "asterixdb")
+ "b": missing_if(1, 2),
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "b": 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">{
+ "a": to_string(nan_if("asterixdb", "asterixdb")),
+ "b": nan_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": "NaN", "b": 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">{
+ "a": to_string(posinf_if("asterixdb", "asterixdb")),
+ "b": posinf_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": "+INF", "b": 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">{
+ "a": to_string(neginf_if("asterixdb", "asterixdb")),
+ "b": neginf_if(1, 2)
+};
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "a": "-INF", "b": 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(["Hello", "World"])
+</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">{ "v1": `not`(true), "v2": `not`(false), "v3": `not`(null), "v4": `not`(missing) };
+</pre></div></div>
+</li>
+<li>
+
+<p>The expected result is:</p>
+
+<div>
+<div>
+<pre class="source">{ "v1": false, "v2": true, "v3": 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">{
+ "v1": random(),
+ "v2": 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(
+ "a",
+ "a", 0,
+ "x", 1,
+ "y", 2,
+ "z", 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(
+ "a",
+ "x", 1,
+ "y", 2,
+ "z", 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(
+ {
+ "id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"]
+ },
+ {
+ "id":1,
+ "project":"AsterixDB",
+ "address":{"city":"San Diego", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"]
+ }
+);
+</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.7.1/aql/externaldata.html b/content/docs/0.9.7.1/aql/externaldata.html
new file mode 100644
index 0000000..54852fd
--- /dev/null
+++ b/content/docs/0.9.7.1/aql/externaldata.html
@@ -0,0 +1,580 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from src/site/markdown/aql/externaldata.md at 2021-12-13
+ | 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="20211213" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>AsterixDB – Accessing External Data in AsterixDB</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: 2021-12-13</li>
+ <li id="projectVersion" class="pull-right">Version: 0.9.7.1</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 class="active"><a href="#"><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="../interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval 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>Accessing External Data in AsterixDB</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="#Introduction">Introduction</a></li>
+<li><a href="#IntroductionAdapterForAnExternalDataset">Adapter for an External Dataset</a></li>
+<li><a href="#BuiltinAdapters">Builtin Adapters</a></li>
+<li><a href="#IntroductionCreatingAnExternalDataset">Creating an External Dataset</a></li>
+<li><a href="#WritingQueriesAgainstAnExternalDataset">Writing Queries against an External Dataset</a></li>
+<li><a href="#BuildingIndexesOverExternalDatasets">Building Indexes over External Datasets</a></li>
+<li><a href="#ExternalDataSnapshot">External Data Snapshots</a></li>
+<li><a href="#FAQ">Frequently Asked Questions</a></li>
+</ul></div>
+<div class="section">
+<h2><a name="Introduction_.5BBack_to_TOC.5D"></a><a name="Introduction" id="Introduction">Introduction</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
+<p>Data that needs to be processed by AsterixDB could be residing outside AsterixDB storage. Examples include data files on a distributed file system such as HDFS or on the local file system of a machine that is part of an AsterixDB cluster. For AsterixDB to process such data, an end-user may create a regular dataset in AsterixDB (a.k.a. an internal dataset) and load the dataset with the data. AsterixDB also supports ‘‘external datasets’’ so that it is not necessary to “load” all data prior to using it. This also avoids creating multiple copies of data and the need to keep the copies in sync.</p>
+<div class="section">
+<h3><a name="Adapter_for_an_External_Dataset_.5BBack_to_TOC.5D"></a><a name="IntroductionAdapterForAnExternalDataset" id="IntroductionAdapterForAnExternalDataset">Adapter for an External Dataset</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h3>
+<p>External data is accessed using wrappers (adapters in AsterixDB) that abstract away the mechanism of connecting with an external service, receiving its data and transforming the data into ADM objects that are understood by AsterixDB. AsterixDB comes with built-in adapters for common storage systems such as HDFS or the local file system.</p></div>
+<div class="section">
+<h3><a name="Builtin_Adapters_.5BBack_to_TOC.5D"></a><a name="BuiltinAdapters" id="BuiltinAdapters">Builtin Adapters</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h3>
+<p>AsterixDB offers a set of builtin adapters that can be used to query external data or for loading data into an internal dataset using a load statement or a data feed. Each adapter requires specifying the <tt>format</tt> of the data in order to be able to parse objects correctly. Using adapters with feeds, the parameter <tt>output-type</tt> must also be specified.</p>
+<p>Following is a listing of existing built-in adapters and their configuration parameters:</p>
+<ol style="list-style-type: decimal">
+
+<li><b><i>localfs</i></b>: used for reading data stored in a local filesystem in one or more of the node controllers
+<ul>
+
+<li><tt>path</tt>: A fully qualified path of the form <tt>host://absolute_path</tt>. Comma separated list if there are multiple directories or files</li>
+<li><tt>expression</tt>: A <a class="externalLink" href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html">regular expression</a> to match and filter against file names</li>
+</ul>
+</li>
+<li><b><i>hdfs</i></b>: used for reading data stored in an HDFS instance
+<ul>
+
+<li><tt>path</tt>: A fully qualified path of the form <tt>host://absolute_path</tt>. Comma separated list if there are multiple directories or files</li>
+<li><tt>expression</tt>: A <a class="externalLink" href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html">regular expression</a> to match and filter against file names</li>
+<li><tt>input-format</tt>: A fully qualified name or an alias for a class of HDFS input format</li>
+<li><tt>hdfs</tt>: The HDFS name node URL</li>
+</ul>
+</li>
+<li><b><i>socket</i></b>: used for listening to connections that sends data streams through one or more sockets
+<ul>
+
+<li><tt>sockets</tt>: comma separated list of sockets to listen to</li>
+<li><tt>address-type</tt>: either IP if the list uses IP addresses, or NC if the list uses NC names</li>
+</ul>
+</li>
+<li><b><i>socket_client</i></b>: used for connecting to one or more sockets and reading data streams
+<ul>
+
+<li><tt>sockets</tt>: comma separated list of sockets to connect to</li>
+</ul>
+</li>
+<li><b><i>twitter_push</i></b>: used for establishing a connection and subscribing to a twitter feed
+<ul>
+
+<li><tt>consumer.key</tt>: access parameter provided by twitter OAuth</li>
+<li><tt>consumer.secret</tt>: access parameter provided by twitter OAuth</li>
+<li><tt>access.token</tt>: access parameter provided by twitter OAuth</li>
+<li><tt>access.token.secret</tt>: access parameter provided by twitter OAuth</li>
+</ul>
+</li>
+<li><b><i>twitter_pull</i></b>: used for polling a twitter feed for tweets based on a configurable frequency
+<ul>
+
+<li><tt>consumer.key</tt>: access parameter provided by twitter OAuth</li>
+<li><tt>consumer.secret</tt>: access parameter provided by twitter OAuth</li>
+<li><tt>access.token</tt>: access parameter provided by twitter OAuth</li>
+<li><tt>access.token.secret</tt>: access parameter provided by twitter OAuth</li>
+<li><tt>query</tt>: twitter query string</li>
+<li><tt>interval</tt>: poll interval in seconds</li>
+</ul>
+</li>
+<li><b><i>rss</i></b>: used for reading RSS feed
+<ul>
+
+<li><tt>url</tt>: a comma separated list of RSS urls</li>
+</ul>
+</li>
+</ol></div>
+<div class="section">
+<h3><a name="Creating_an_External_Dataset_.5BBack_to_TOC.5D"></a><a name="IntroductionCreatingAnExternalDataset" id="IntroductionCreatingAnExternalDataset">Creating an External Dataset</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h3>
+<p>As an example we consider the Lineitem dataset from the <a class="externalLink" href="http://www.openlinksw.com/dataspace/doc/dav/wiki/Main/VOSTPCHLinkedData/tpch.sql">TPCH schema</a>. We assume that you have successfully created an AsterixDB instance following the instructions at <a href="../install.html">Installing AsterixDB Using Managix</a>. <i>For constructing an example, we assume a single machine setup..</i></p>
+<p>Similar to a regular dataset, an external dataset has an associated datatype. We shall first create the datatype associated with each object in Lineitem data. Paste the following in the query textbox on the webpage at <a class="externalLink" href="http://127.0.0.1:19001">http://127.0.0.1:19001</a> and hit ‘Execute’.</p>
+
+<div>
+<div>
+<pre class="source"> create dataverse ExternalFileDemo;
+ use dataverse ExternalFileDemo;
+
+ create type LineitemType as closed {
+ l_orderkey:int32,
+ l_partkey: int32,
+ l_suppkey: int32,
+ l_linenumber: int32,
+ l_quantity: double,
+ l_extendedprice: double,
+ l_discount: double,
+ l_tax: double,
+ l_returnflag: string,
+ l_linestatus: string,
+ l_shipdate: string,
+ l_commitdate: string,
+ l_receiptdate: string,
+ l_shipinstruct: string,
+ l_shipmode: string,
+ l_comment: string}
+</pre></div></div>
+
+<p>Here, we describe two scenarios.</p>
+<div class="section">
+<h4><a name="a1.29_Data_file_resides_on_the_local_file_system_of_a_host"></a>1) Data file resides on the local file system of a host</h4>
+<p>Prerequisite: The host is a part of the ASTERIX cluster.</p>
+<p>Earlier, we assumed a single machine ASTERIX setup. To satisfy the prerequisite, log-in to the machine running ASTERIX.</p>
+<ul>
+
+<li>Download the <a href="../data/lineitem.tbl">data file</a> to an appropriate location. We denote this location by SOURCE_PATH.</li>
+</ul>
+<p>ASTERIX provides a built-in adapter for data residing on the local file system. The adapter is referred by its alias- ‘localfs’. We create an external dataset named Lineitem and use the ‘localfs’ adapter.</p>
+
+<div>
+<div>
+<pre class="source"> create external dataset Lineitem(LineitemType)
+ using localfs
+</pre></div></div>
+
+<p>Above, the definition is not complete as we need to provide a set of parameters that are specific to the source file.</p>
+
+<table border="0" class="table table-striped">
+
+<tr class="a">
+
+<td> Parameter </td>
+
+<td> Description </td>
+</tr>
+
+<tr class="b">
+
+<td> path </td>
+
+<td> A fully qualified path of the form <tt>host://<absolute path></tt>.
+ Use a comma separated list if there are multiple files.
+ E.g. <tt>host1://<absolute path></tt>, <tt>host2://<absolute path></tt> and so forth. </td>
+</tr>
+
+<tr class="a">
+
+<td> format </td>
+
+<td> The format for the content. Use 'adm' for data in ADM (ASTERIX Data Model) or <a class="externalLink" href="http://www.json.org/">JSON</a> format. Use 'delimited-text' if fields are separated by a delimiting character (eg., CSV). </td></tr>
+
+<tr class="b">
+
+<td>delimiter</td>
+
+<td>The delimiting character in the source file if format is 'delimited text'</td>
+</tr>
+</table>
+
+<p>As we are using a single single machine ASTERIX instance, we use 127.0.0.1 as host in the path parameter. We <i>complete the create dataset statement</i> as follows.</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse ExternalFileDemo;
+
+ create external dataset Lineitem(LineitemType)
+ using localfs
+ (("path"="127.0.0.1://SOURCE_PATH"),
+ ("format"="delimited-text"),
+ ("delimiter"="|"));
+</pre></div></div>
+
+<p>Please substitute SOURCE_PATH with the absolute path to the source file on the local file system.</p></div>
+<div class="section">
+<h4><a name="Common_source_of_error"></a>Common source of error</h4>
+<p>An incorrect value for the path parameter will give the following exception message when the dataset is used in a query.</p>
+
+<div>
+<div>
+<pre class="source"> org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: org.apache.hyracks.api.exceptions.HyracksDataException: org.apache.hyracks.api.exceptions.HyracksDataException: Job failed.
+</pre></div></div>
+
+<p>Verify the correctness of the path parameter provided to the localfs adapter. Note that the path parameter must be an absolute path to the data file. For e.g. if you saved your file in your home directory (assume it to be /home/joe), then the path value should be</p>
+
+<div>
+<div>
+<pre class="source"> 127.0.0.1:///home/joe/lineitem.tbl.
+</pre></div></div>
+
+<p>In your web-browser, navigate to 127.0.0.1:19001 and paste the above to the query text box. Finally hit ‘Execute’.</p>
+<p>Next we move over to the the section <a href="#Writing_Queries_against_an_External_Dataset">Writing Queries against an External Dataset</a> and try a sample query against the external dataset.</p></div>
+<div class="section">
+<h4><a name="a2.29_Data_file_resides_on_an_HDFS_instance"></a>2) Data file resides on an HDFS instance</h4>
+<p>rerequisite: It is required that the Namenode and HDFS Datanodes are reachable from the hosts that form the AsterixDB cluster. AsterixDB provides a built-in adapter for data residing on HDFS. The HDFS adapter can be referred (in AQL) by its alias - ‘hdfs’. We can create an external dataset named Lineitem and associate the HDFS adapter with it as follows;</p>
+
+<div>
+<div>
+<pre class="source"> create external dataset Lineitem(LineitemType)
+ using hdfs((“hdfs”:”hdfs://localhost:54310”),(“path”:”/asterix/Lineitem.tbl”),...,(“input- format”:”rc-format”));
+</pre></div></div>
+
+<p>The expected parameters are described below:</p>
+
+<table border="0" class="table table-striped">
+
+<tr class="a">
+
+<td> Parameter </td>
+
+<td> Description </td>
+</tr>
+
+<tr class="b">
+
+<td> hdfs </td>
+
+<td> The HDFS URL </td>
+</tr>
+
+<tr class="a">
+
+<td> path </td>
+
+<td> The absolute path to the source HDFS file or directory. Use a comma separated list if there are multiple files or directories. </td></tr>
+
+<tr class="b">
+
+<td> input-format </td>
+
+<td> The associated input format. Use 'text-input-format' for text files , 'sequence-input-format' for hadoop sequence files, 'rc-input-format' for Hadoop Object Columnar files, or a fully qualified name of an implementation of org.apache.hadoop.mapred.InputFormat. </td>
+</tr>
+
+<tr class="a">
+
+<td> format </td>
+
+<td> The format of the input content. Use 'adm' for text data in ADM (ASTERIX Data Model) or <a class="externalLink" href="http://www.json.org/">JSON</a> format, 'delimited-text' for text delimited data that has fields separated by a delimiting character, 'binary' for other data.</td>
+</tr>
+
+<tr class="b">
+
+<td> delimiter </td>
+
+<td> The delimiting character in the source file if format is 'delimited text' </td>
+</tr>
+
+<tr class="a">
+
+<td> parser </td>
+
+<td> The parser used to parse HDFS objects if the format is 'binary'. Use 'hive- parser' for data deserialized by a Hive Serde (AsterixDB can understand deserialized Hive objects) or a fully qualified class name of user- implemented parser that implements the interface org.apache.asterix.external.input.InputParser. </td>
+</tr>
+
+<tr class="b">
+
+<td> hive-serde </td>
+
+<td> The Hive serde is used to deserialize HDFS objects if format is binary and the parser is hive-parser. Use a fully qualified name of a class implementation of org.apache.hadoop.hive.serde2.SerDe. </td>
+</tr>
+
+<tr class="a">
+
+<td> local-socket-path </td>
+
+<td> The UNIX domain socket path if local short-circuit reads are enabled in the HDFS instance</td>
+</tr>
+</table>
+
+<p><i>Difference between ‘input-format’ and ‘format’</i></p>
+<p><i>input-format</i>: Files stored under HDFS have an associated storage format. For example, TextInputFormat represents plain text files. SequenceFileInputFormat indicates binary compressed files. RCFileInputFormat corresponds to objects stored in a object columnar fashion. The parameter ‘input-format’ is used to distinguish between these and other HDFS input formats.</p>
+<p><i>format</i>: The parameter ‘format’ refers to the type of the data contained in the file. For example, data contained in a file could be in json or ADM format, could be in delimited-text with fields separated by a delimiting character or could be in binary format.</p>
+<p>As an example. consider the <a href="../data/lineitem.tbl">data file</a>. The file is a text file with each line representing a object. The fields in each object are separated by the ‘|’ character.</p>
+<p>We assume the HDFS URL to be <a class="externalLink" href="hdfs://localhost:54310">hdfs://localhost:54310</a>. We further assume that the example data file is copied to HDFS at a path denoted by “/asterix/Lineitem.tbl”.</p>
+<p>The complete set of parameters for our example file are as follows. ((“hdfs”=“<a class="externalLink" href="hdfs://localhost:54310”,(“path”=“/asterix/Lineitem.tbl”),(“input-format”=“text-">hdfs://localhost:54310”,(“path”=“/asterix/Lineitem.tbl”),(“input-format”=“text-</a> input-format”),(“format”=“delimited-text”),(“delimiter”=“|”))</p></div>
+<div class="section">
+<h4><a name="Using_the_Hive_Parser"></a>Using the Hive Parser</h4>
+<p>if a user wants to create an external dataset that uses hive-parser to parse HDFS objects, it is important that the datatype associated with the dataset matches the actual data in the Hive table for the correct initialization of the Hive SerDe. Here is the conversion from the supported Hive data types to AsterixDB data types:</p>
+
+<table border="0" class="table table-striped">
+
+<tr class="a">
+
+<td> Hive </td>
+
+<td> AsterixDB </td>
+</tr>
+
+<tr class="b">
+
+<td>BOOLEAN</td>
+
+<td>Boolean</td>
+</tr>
+
+<tr class="a">
+
+<td>BYTE(TINY INT)</td>
+
+<td>Int8</td>
+</tr>
+
+<tr class="b">
+
+<td>DOUBLE</td>
+
+<td>Double</td>
+</tr>
+
+<tr class="a">
+
+<td>FLOAT</td>
+
+<td>Float</td>
+</tr>
+
+<tr class="b">
+
+<td>INT</td>
+
+<td>Int32</td>
+</tr>
+
+<tr class="a">
+
+<td>LONG(BIG INT)</td>
+
+<td>Int64</td>
+</tr>
+
+<tr class="b">
+
+<td>SHORT(SMALL INT)</td>
+
+<td>Int16</td>
+</tr>
+
+<tr class="a">
+
+<td>STRING</td>
+
+<td>String</td>
+</tr>
+
+<tr class="b">
+
+<td>TIMESTAMP</td>
+
+<td>Datetime</td>
+</tr>
+
+<tr class="a">
+
+<td>DATE</td>
+
+<td>Date</td>
+</tr>
+
+<tr class="b">
+
+<td>STRUCT</td>
+
+<td>Nested Object</td>
+</tr>
+
+<tr class="a">
+
+<td>LIST</td>
+
+<td>OrderedList or UnorderedList</td>
+</tr>
+</table>
+</div>
+<div class="section">
+<h4><a name="Examples_of_dataset_definitions_for_external_datasets"></a>Examples of dataset definitions for external datasets</h4>
+<p><i>Example 1</i>: We can modify the create external dataset statement as follows:</p>
+
+<div>
+<div>
+<pre class="source"> create external dataset Lineitem('LineitemType)
+ using hdfs(("hdfs"="hdfs://localhost:54310"),("path"="/asterix/Lineitem.tbl"),("input-format"="text- input-format"),("format"="delimited-text"),("delimiter"="|"));
+</pre></div></div>
+
+<p><i>Example 2</i>: Here, we create an external dataset of lineitem objects stored in sequence files that has content in ADM format:</p>
+
+<div>
+<div>
+<pre class="source"> create external dataset Lineitem('LineitemType)
+ using hdfs(("hdfs"="hdfs://localhost:54310"),("path"="/asterix/SequenceLineitem.tbl"),("input- format"="sequence-input-format"),("format"="adm"));
+</pre></div></div>
+
+<p><i>Example 3</i>: Here, we create an external dataset of lineitem objects stored in object-columnar files that has content in binary format parsed using hive-parser with hive ColumnarSerde:</p>
+
+<div>
+<div>
+<pre class="source"> create external dataset Lineitem('LineitemType)
+ using hdfs(("hdfs"="hdfs://localhost:54310"),("path"="/asterix/RCLineitem.tbl"),("input-format"="rc-input-format"),("format"="binary"),("parser"="hive-parser"),("hive- serde"="org.apache.hadoop.hive.serde2.columnar.ColumnarSerde"));
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h2><a name="Writing_Queries_against_an_External_Dataset_.5BBack_to_TOC.5D"></a><a name="WritingQueriesAgainstAnExternalDataset" id="WritingQueriesAgainstAnExternalDataset">Writing Queries against an External Dataset</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
+<p>You may write AQL queries against an external dataset in exactly the same way that queries are written against internal datasets. The following is an example of an AQL query that applies a filter and returns an ordered result.</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse ExternalFileDemo;
+
+ for $c in dataset('Lineitem')
+ where $c.l_orderkey <= 3
+ order by $c.l_orderkey, $c.l_linenumber
+ return $c
+</pre></div></div>
+</div>
+<div class="section">
+<h2><a name="Building_Indexes_over_External_Datasets_.5BBack_to_TOC.5D"></a><a name="BuildingIndexesOverExternalDatasets" id="BuildingIndexesOverExternalDatasets">Building Indexes over External Datasets</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
+<p>AsterixDB supports building B-Tree and R-Tree indexes over static data stored in the Hadoop Distributed File System. To create an index, first create an external dataset over the data as follows</p>
+
+<div>
+<div>
+<pre class="source"> create external dataset Lineitem(LineitemType)
+ using hdfs(("hdfs"="hdfs://localhost:54310"),("path"="/asterix/Lineitem.tbl"),("input-format"="text-input- format"),("format"="delimited-text"),("delimiter"="|"));
+</pre></div></div>
+
+<p>You can then create a B-Tree index on this dataset instance as if the dataset was internally stored as follows:</p>
+
+<div>
+<div>
+<pre class="source"> create index PartkeyIdx on Lineitem(l_partkey);
+</pre></div></div>
+
+<p>You could also create an R-Tree index as follows:</p>
+
+<div>
+<div>
+<pre class="source"> create index IndexName on DatasetName(attribute-name) type rtree;
+</pre></div></div>
+
+<p>After building the indexes, the AsterixDB query compiler can use them to access the dataset and answer queries in a more cost effective manner. AsterixDB can read all HDFS input formats, but indexes over external datasets can currently be built only for HDFS datasets with ‘text-input-format’, ‘sequence-input-format’ or ‘rc-input-format’.</p></div>
+<div class="section">
+<h2><a name="External_Data_Snapshots_.5BBack_to_TOC.5D"></a><a name="ExternalDataSnapshots" id="ExternalDataSnapshots">External Data Snapshots</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
+<p>An external data snapshot represents the status of a dataset’s files in HDFS at a point in time. Upon creating the first index over an external dataset, AsterixDB captures and stores a snapshot of the dataset in HDFS. Only objects present at the snapshot capture time are indexed, and any additional indexes created afterwards will only contain data that was present at the snapshot capture time thus preserving consistency across all indexes of a dataset. To update all indexes of an external dataset and advance the snapshot time to be the present time, a user can use the refresh external dataset command as follows:</p>
+
+<div>
+<div>
+<pre class="source"> refresh external dataset DatasetName;
+</pre></div></div>
+
+<p>After a refresh operation commits, all of the dataset’s indexes will reflect the status of the data as of the new snapshot capture time.</p></div>
+<div class="section">
+<h2><a name="Frequently_Asked_Questions_.5BBack_to_TOC.5D"></a><a name="FAQ" id="FAQ">Frequently Asked Questions</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
+<p>Q. I added data to my dataset in HDFS, Will the dataset indexes in AsterixDB be updated automatically?</p>
+<p>A. No, you must use the refresh external dataset statement to make the indexes aware of any changes in the dataset files in HDFS.</p>
+<p>Q. Why doesn’t AsterixDB update external indexes automatically?</p>
+<p>A. Since external data is managed by other users/systems with mechanisms that are system dependent, AsterixDB has no way of knowing exactly when data is added or deleted in HDFS, so the responsibility of refreshing indexes are left to the user. A user can use internal datasets for which AsterixDB manages the data and its indexes.</p>
+<p>Q. I created an index over an external dataset and then added some data to my HDFS dataset. Will a query that uses the index return different results from a query that doesn’t use the index?</p>
+<p>A. No, queries’ results are access path independent and the stored snapshot is used to determines which data are going to be included when processing queries.</p>
+<p>Q. I created an index over an external dataset and then deleted some of my dataset’s files in HDFS, Will indexed data access still return the objects in deleted files?</p>
+<p>A. No. When AsterixDB accesses external data, with or without the use of indexes, it only access files present in the file system at runtime.</p>
+<p>Q. I submitted a refresh command on a an external dataset and a failure occurred, What has happened to my indexes?</p>
+<p>A. External Indexes Refreshes are treated as a single transaction. In case of a failure, a rollback occurs and indexes are restored to their previous state. An error message with the cause of failure is returned to the user.</p>
+<p>Q. I was trying to refresh an external dataset while some queries were accessing the data using index access method. Will the queries be affected by the refresh operation?</p>
+<p>A. Queries have access to external dataset indexes state at the time where the queries are submitted. A query that was submitted before a refresh commits will only access data under the snapshot taken before the refresh; queries that are submitted after the refresh commits will access data under the snapshot taken after the refresh.</p>
+<p>Q. What happens when I try to create an additional index while a refresh operation is in progress or vice versa?</p>
+<p>A. The create index operation will wait until the refresh commits or aborts and then the index will be built according to the external data snapshot at the end of the refresh operation. Creating indexes and refreshing datasets are mutually exclusive operations and will not be run in parallel. Multiple indexes can be created in parallel, but not multiple refresh operations.</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/content/docs/0.9.7.1/aql/js-sdk.html b/content/docs/0.9.7.1/aql/js-sdk.html
new file mode 100644
index 0000000..eccdb7c
--- /dev/null
+++ b/content/docs/0.9.7.1/aql/js-sdk.html
@@ -0,0 +1,876 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from src/site/markdown/aql/js-sdk.md at 2021-12-13
+ | 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="20211213" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>AsterixDB – AsterixDB Javascript SDK</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: 2021-12-13</li>
+ <li id="projectVersion" class="pull-right">Version: 0.9.7.1</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="../interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval 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>AsterixDB Javascript SDK</h1>
+<div class="section">
+<h2><a name="Obtaining_and_Including"></a>Obtaining and Including</h2>
+<p><a class="externalLink" href="http://asterixdb.ics.uci.edu/download/bindings/asterix-sdk-stable.js">Download</a> the javascript SDK and include it like any other javascript library by adding the following line in the appropriate HTML file:</p>
+
+<div>
+<div>
+<pre class="source"><script src="path/to/asterix-sdk-stable.js"></script>
+</pre></div></div>
+</div>
+<div class="section">
+<h2><a name="Interactive_Demos"></a>Interactive Demos</h2>
+<p>There are two interactive demos that are available for download. Both of the demos illustrate how the javascript API would be used in an application:</p>
+<ul>
+
+<li><a class="externalLink" href="http://asterixdb.ics.uci.edu/download/demos/tweetbook-demo.zip">Tweetbook Demo</a>: a contrived geo-spatial application dealing with artificial Tweets allowing spatial, temporal, and keyword-based filtering.</li>
+<li><a class="externalLink" href="http://asterixdb.ics.uci.edu/download/demos/admaql101-demo.zip">ADM/AQL 101 Demo</a>: an interactive version of all of the examples that are provided in the following section.</li>
+</ul></div>
+<div class="section">
+<h2><a name="The_javascript_SDK:_by_example"></a>The javascript SDK: by example</h2>
+<p>In this section, we explore how to form AQL queries using the javascript SDK. The queries from <a href="primer.html">AsterixDB 101: An ADM and AQL Primer</a> are used as examples here. For each AQL statement, the equivalent javascript expression is shown below it, followed by the results of executing the query.</p>
+<div class="section">
+<h3><a name="Query_0-A_-_Exact-Match_Lookup"></a>Query 0-A - Exact-Match Lookup</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+where $user.id = 8
+return $user;
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression0a = new FLWOGRExpression()
+ .ForClause("$user", new AExpression("dataset FacebookUsers"))
+ .WhereClause(new AExpression("$user.id = 8"))
+ .ReturnClause("$user");
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "id": { int32: 8 } , "alias": "Nila", "name": "NilaMilliron", "user-since": { datetime: 1199182200000}, "friend-ids": { unorderedlist: [{ int32: 3 } ]}, "employment": { orderedlist: [{ "organization-name": "Plexlane", "start-date": { date: 1267315200000}, "end-date": null } ]} }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_0-B_-_Range_Scan"></a>Query 0-B - Range Scan</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+where $user.id >= 2 and $user.id <= 4
+return $user;
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression0b = new FLWOGRExpression()
+ .ForClause("$user", new AExpression("dataset FacebookUsers"))
+ .WhereClause().and(new AExpression("$user.id >= 2"), new AExpression("$user.id <= 4"))
+ .ReturnClause("$user");
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "id": { int32: 2 } , "alias": "Isbel", "name": "IsbelDull", "user-since": { datetime: 1295691000000}, "friend-ids": { unorderedlist: [{ int32: 1 } , { int32: 4 } ]}, "employment": { orderedlist: [{ "organization-name": "Hexviafind", "start-date": { date: 1272326400000}, "end-date": null } ]} }
+{ "id": { int32: 3 } , "alias": "Emory", "name": "EmoryUnk", "user-since": { datetime: 1341915000000}, "friend-ids": { unorderedlist: [{ int32: 1 } , { int32: 5 } , { int32: 8 } , { int32: 9 } ]}, "employment": { orderedlist: [{ "organization-name": "geomedia", "start-date": { date: 1276732800000}, "end-date": { date: 1264464000000} } ]} }
+{ "id": { int32: 4 } , "alias": "Nicholas", "name": "NicholasStroh", "user-since": { datetime: 1293444600000}, "friend-ids": { unorderedlist: [{ int32: 2 } ]}, "employment": { orderedlist: [{ "organization-name": "Zamcorporation", "start-date": { date: 1275955200000}, "end-date": null } ]} }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_1_-_Other_Query_Filters"></a>Query 1 - Other Query Filters</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+where $user.user-since >= datetime('2010-07-22T00:00:00')
+and $user.user-since <= datetime('2012-07-29T23:59:59')
+return $user;
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression1 = new FLWOGRExpression()
+ .ForClause("$user", new AExpression("dataset FacebookUsers"))
+ .WhereClause().and(
+ new AExpression("$user.user-since >= datetime('2010-07-22T00:00:00')"),
+ new AExpression("$user.user-since <= datetime('2012-07-29T23:59:59')")
+ ).ReturnClause("$user");
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "id": { int32: 2 } , "alias": "Isbel", "name": "IsbelDull", "user-since": { datetime: 1295691000000}, "friend-ids": { unorderedlist: [{ int32: 1 } , { int32: 4 } ]}, "employment": { orderedlist: [{ "organization-name": "Hexviafind", "start-date": { date: 1272326400000}, "end-date": null } ]} }
+{ "id": { int32: 10 } , "alias": "Bram", "name": "BramHatch", "user-since": { datetime: 1287223800000}, "friend-ids": { unorderedlist: [{ int32: 1 } , { int32: 5 } , { int32: 9 } ]}, "employment": { orderedlist: [{ "organization-name": "physcane", "start-date": { date: 1181001600000}, "end-date": { date: 1320451200000} } ]} }
+{ "id": { int32: 3 } , "alias": "Emory", "name": "EmoryUnk", "user-since": { datetime: 1341915000000}, "friend-ids": { unorderedlist: [{ int32: 1 } , { int32: 5 } , { int32: 8 } , { int32: 9 } ]}, "employment": { orderedlist: [{ "organization-name": "geomedia", "start-date": { date: 1276732800000}, "end-date": { date: 1264464000000} } ]} }
+{ "id": { int32: 4 } , "alias": "Nicholas", "name": "NicholasStroh", "user-since": { datetime: 1293444600000}, "friend-ids": { unorderedlist: [{ int32: 2 } ]}, "employment": { orderedlist: [{ "organization-name": "Zamcorporation", "start-date": { date: 1275955200000}, "end-date": null } ]} }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_2-A_-_Equijoin"></a>Query 2-A - Equijoin</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+for $message in dataset FacebookMessages
+where $message.author-id = $user.id
+return {
+ "uname": $user.name,
+ "message": $message.message
+};
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression2a = new FLWOGRExpression()
+ .ForClause ("$user", new AExpression("dataset FacebookUsers"))
+ .ForClause ("$message", new AExpression("dataset FacebookMessages"))
+ .WhereClause(new AExpression("$message.author-id = $user.id"))
+ .ReturnClause({
+ "uname" : "$user.name",
+ "message" : "$message.message"
+ });
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "uname": "MargaritaStoddard", "message": " dislike x-phone its touch-screen is horrible" }
+{ "uname": "MargaritaStoddard", "message": " like ccast the 3G is awesome:)" }
+{ "uname": "MargaritaStoddard", "message": " can't stand product-w the touch-screen is terrible" }
+{ "uname": "MargaritaStoddard", "message": " can't stand acast the network is horrible:(" }
+{ "uname": "MargaritaStoddard", "message": " can't stand acast its plan is terrible" }
+{ "uname": "IsbelDull", "message": " like product-y the plan is amazing" }
+{ "uname": "IsbelDull", "message": " like product-z its platform is mind-blowing" }
+{ "uname": "WoodrowNehling", "message": " love acast its 3G is good:)" }
+{ "uname": "BramHatch", "message": " dislike x-phone the voice-command is bad:(" }
+{ "uname": "BramHatch", "message": " can't stand product-z its voicemail-service is OMG:(" }
+{ "uname": "EmoryUnk", "message": " love product-b its shortcut-menu is awesome:)" }
+{ "uname": "EmoryUnk", "message": " love ccast its wireless is good" }
+{ "uname": "WillisWynne", "message": " love product-b the customization is mind-blowing" }
+{ "uname": "SuzannaTillson", "message": " like x-phone the voicemail-service is awesome" }
+{ "uname": "VonKemble", "message": " dislike product-b the speed is horrible" }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_2-B_-_Index_join"></a>Query 2-B - Index join</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+for $message in dataset FacebookMessages
+where $message.author-id /*+ indexnl */ = $user.id
+return {
+ "uname": $user.name,
+ "message": $message.message
+};
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression2b = new FLWOGRExpression()
+ .ForClause ("$user", new AExpression("dataset FacebookUsers"))
+ .ForClause ("$message", new AExpression("dataset FacebookMessages"))
+ .WhereClause(new AExpression("$message.author-id /*+ indexnl */ = $user.id"))
+ .ReturnClause({
+ "uname" : "$user.name",
+ "message" : "$message.message"
+ });
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "uname": "MargaritaStoddard", "message": " dislike x-phone its touch-screen is horrible" }
+{ "uname": "MargaritaStoddard", "message": " like ccast the 3G is awesome:)" }
+{ "uname": "MargaritaStoddard", "message": " can't stand product-w the touch-screen is terrible" }
+{ "uname": "MargaritaStoddard", "message": " can't stand acast the network is horrible:(" }
+{ "uname": "MargaritaStoddard", "message": " can't stand acast its plan is terrible" }
+{ "uname": "IsbelDull", "message": " like product-y the plan is amazing" }
+{ "uname": "IsbelDull", "message": " like product-z its platform is mind-blowing" }
+{ "uname": "WoodrowNehling", "message": " love acast its 3G is good:)" }
+{ "uname": "BramHatch", "message": " dislike x-phone the voice-command is bad:(" }
+{ "uname": "BramHatch", "message": " can't stand product-z its voicemail-service is OMG:(" }
+{ "uname": "EmoryUnk", "message": " love product-b its shortcut-menu is awesome:)" }
+{ "uname": "EmoryUnk", "message": " love ccast its wireless is good" }
+{ "uname": "WillisWynne", "message": " love product-b the customization is mind-blowing" }
+{ "uname": "SuzannaTillson", "message": " like x-phone the voicemail-service is awesome" }
+{ "uname": "VonKemble", "message": " dislike product-b the speed is horrible" }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_3_-_Nested_Outer_Join"></a>Query 3 - Nested Outer Join</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+return {
+ "uname": $user.name,
+ "messages": for $message in dataset FacebookMessages
+ where $message.author-id = $user.id
+ return $message.message
+};
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression3messages = new FLWOGRExpression()
+ .ForClause("$message", new AExpression("dataset FacebookMessages"))
+ .WhereClause(new AExpression("$message.author-id = $user.id"))
+ .ReturnClause("$message.message");
+
+var expression3 = new FLWOGRExpression()
+ .ForClause ("$user", new AExpression("dataset FacebookUsers"))
+ .ReturnClause({
+ "uname": "$user.name",
+ "messages" : expression3messages
+ });
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "uname": "MargaritaStoddard", "messages": { orderedlist: [" dislike x-phone its touch-screen is horrible", " like ccast the 3G is awesome:)", " can't stand product-w the touch-screen is terrible", " can't stand acast the network is horrible:(", " can't stand acast its plan is terrible" ]} }
+{ "uname": "IsbelDull", "messages": { orderedlist: [" like product-y the plan is amazing", " like product-z its platform is mind-blowing" ]} }
+{ "uname": "NilaMilliron", "messages": { orderedlist: [ ]} }
+{ "uname": "WoodrowNehling", "messages": { orderedlist: [" love acast its 3G is good:)" ]} }
+{ "uname": "BramHatch", "messages": { orderedlist: [" dislike x-phone the voice-command is bad:(", " can't stand product-z its voicemail-service is OMG:(" ]} }
+{ "uname": "EmoryUnk", "messages": { orderedlist: [" love product-b its shortcut-menu is awesome:)", " love ccast its wireless is good" ]} }
+{ "uname": "WillisWynne", "messages": { orderedlist: [" love product-b the customization is mind-blowing" ]} }
+{ "uname": "SuzannaTillson", "messages": { orderedlist: [" like x-phone the voicemail-service is awesome" ]} }
+{ "uname": "NicholasStroh", "messages": { orderedlist: [ ]} }
+{ "uname": "VonKemble", "messages": { orderedlist: [" dislike product-b the speed is horrible" ]} }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_4_-_Theta_Join"></a>Query 4 - Theta Join</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+for $t in dataset TweetMessages
+return {
+ "message": $t.message-text,
+ "nearby-messages": for $t2 in dataset TweetMessages
+ where spatial-distance($t.sender-location, $t2.sender-location) <= 1
+ return { "msgtxt":$t2.message-text}
+};
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression4messages = new FLWOGRExpression()
+ .ForClause( "$t2", new AExpression("dataset TweetMessages"))
+ .WhereClause( new AExpression("spatial-distance($t.sender-location, $t2.sender-location) <= 1"))
+ .ReturnClause({ "msgtxt" : "$t2.message-text" });
+
+var expression4 = new FLWOGRExpression()
+ .ForClause( "$t", new AExpression("dataset TweetMessages"))
+ .ReturnClause({
+ "message" : "$t.message-text",
+ "nearby-messages" : expression4messages
+ });
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "message": " hate ccast its voice-clarity is OMG:(", "nearby-messages": { orderedlist: [{ "msgtxt": " hate ccast its voice-clarity is OMG:(" }, { "msgtxt": " like product-w the speed is good:)" } ]} }
+{ "message": " like x-phone the voice-clarity is good:)", "nearby-messages": { orderedlist: [{ "msgtxt": " like x-phone the voice-clarity is good:)" } ]} }
+{ "message": " like product-y the platform is good", "nearby-messages": { orderedlist: [{ "msgtxt": " like product-y the platform is good" } ]} }
+{ "message": " love product-z its customization is good:)", "nearby-messages": { orderedlist: [{ "msgtxt": " love product-z its customization is good:)" } ]} }
+{ "message": " like product-y the voice-command is amazing:)", "nearby-messages": { orderedlist: [{ "msgtxt": " like product-y the voice-command is amazing:)" } ]} }
+{ "message": " like product-w the speed is good:)", "nearby-messages": { orderedlist: [{ "msgtxt": " hate ccast its voice-clarity is OMG:(" }, { "msgtxt": " like product-w the speed is good:)" } ]} }
+{ "message": " love ccast its voicemail-service is awesome", "nearby-messages": { orderedlist: [{ "msgtxt": " love ccast its voicemail-service is awesome" } ]} }
+{ "message": " can't stand product-w its speed is terrible:(", "nearby-messages": { orderedlist: [{ "msgtxt": " can't stand product-w its speed is terrible:(" } ]} }
+{ "message": " like product-z the shortcut-menu is awesome:)", "nearby-messages": { orderedlist: [{ "msgtxt": " like product-z the shortcut-menu is awesome:)" } ]} }
+{ "message": " can't stand x-phone its platform is terrible", "nearby-messages": { orderedlist: [{ "msgtxt": " can't stand x-phone its platform is terrible" } ]} }
+{ "message": " like ccast its shortcut-menu is awesome:)", "nearby-messages": { orderedlist: [{ "msgtxt": " like ccast its shortcut-menu is awesome:)" } ]} }
+{ "message": " like product-b the voice-command is mind-blowing:)", "nearby-messages": { orderedlist: [{ "msgtxt": " like product-b the voice-command is mind-blowing:)" } ]} }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_5_-_Fuzzy_Join"></a>Query 5 - Fuzzy Join</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+<p>use dataverse TinySocial;</p>
+
+<div>
+<div>
+<pre class="source">set simfunction "edit-distance";
+set simthreshold "3";
+
+for $fbu in dataset FacebookUsers
+return {
+ "id": $fbu.id,
+ "name": $fbu.name,
+ "similar-users": for $t in dataset TweetMessages
+ let $tu := $t.user
+ where $tu.name ~= $fbu.name
+ return {
+ "twitter-screenname": $tu.screen-name,
+ "twitter-name": $tu.name
+ }
+};
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var similarUsersExpression = new FLWOGRExpression()
+ .ForClause("$t", new AExpression("dataset TweetMessages"))
+ .LetClause ("$tu", new AExpression("$t.user"))
+ .WhereClause(new AExpression("$tu.name ~= $fbu.name"))
+ .ReturnClause({
+ "twitter-screenname": "$tu.screen-name",
+ "twitter-name": "$tu.name"
+ });
+
+var expression5 = new FLWOGRExpression()
+ .ForClause ("$fbu", new AExpression("dataset FacebookUsers"))
+ .ReturnClause(
+ {
+ "id" : "$fbu.id",
+ "name" : "$fbu.name",
+ "similar-users" : similarUsersExpression
+ }
+ );
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "id": { int32: 1 } , "name": "MargaritaStoddard", "similar-users": { orderedlist: [ ]} }
+{ "id": { int32: 2 } , "name": "IsbelDull", "similar-users": { orderedlist: [ ]} }
+{ "id": { int32: 8 } , "name": "NilaMilliron", "similar-users": { orderedlist: [{ "twitter-screenname": "NilaMilliron_tw", "twitter-name": "Nila Milliron" } ]} }
+{ "id": { int32: 9 } , "name": "WoodrowNehling", "similar-users": { orderedlist: [ ]} }
+{ "id": { int32: 10 } , "name": "BramHatch", "similar-users": { orderedlist: [ ]} }
+{ "id": { int32: 3 } , "name": "EmoryUnk", "similar-users": { orderedlist: [ ]} }
+{ "id": { int32: 6 } , "name": "WillisWynne", "similar-users": { orderedlist: [ ]} }
+{ "id": { int32: 7 } , "name": "SuzannaTillson", "similar-users": { orderedlist: [ ]} }
+{ "id": { int32: 4 } , "name": "NicholasStroh", "similar-users": { orderedlist: [ ]} }
+{ "id": { int32: 5 } , "name": "VonKemble", "similar-users": { orderedlist: [ ]} }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_6_-_Existential_Quantification"></a>Query 6 - Existential Quantification</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+for $fbu in dataset FacebookUsers
+where (some $e in $fbu.employment satisfies is-null($e.end-date))
+return $fbu;
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression6 = new FLWOGRExpression()
+ .ForClause ("$fbu", new AQLClause().set("dataset FacebookUsers"))
+ .WhereClause(
+ new QuantifiedExpression (
+ "some" ,
+ {"$e" : new AExpression("$fbu.employment") },
+ new FunctionExpression("is-null", new AExpression("$e.end-date"))
+ )
+ )
+ .ReturnClause("$fbu");
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "id": { int32: 1 } , "alias": "Margarita", "name": "MargaritaStoddard", "user-since": { datetime: 1345457400000}, "friend-ids": { unorderedlist: [{ int32: 2 } , { int32: 3 } , { int32: 6 } , { int32: 10 } ]}, "employment": { orderedlist: [{ "organization-name": "Codetechno", "start-date": { date: 1154822400000}, "end-date": null } ]} }
+{ "id": { int32: 2 } , "alias": "Isbel", "name": "IsbelDull", "user-since": { datetime: 1295691000000}, "friend-ids": { unorderedlist: [{ int32: 1 } , { int32: 4 } ]}, "employment": { orderedlist: [{ "organization-name": "Hexviafind", "start-date": { date: 1272326400000}, "end-date": null } ]} }
+{ "id": { int32: 8 } , "alias": "Nila", "name": "NilaMilliron", "user-since": { datetime: 1199182200000}, "friend-ids": { unorderedlist: [{ int32: 3 } ]}, "employment": { orderedlist: [{ "organization-name": "Plexlane", "start-date": { date: 1267315200000}, "end-date": null } ]} }
+{ "id": { int32: 6 } , "alias": "Willis", "name": "WillisWynne", "user-since": { datetime: 1105956600000}, "friend-ids": { unorderedlist: [{ int32: 1 } , { int32: 3 } , { int32: 7 } ]}, "employment": { orderedlist: [{ "organization-name": "jaydax", "start-date": { date: 1242345600000}, "end-date": null } ]} }
+{ "id": { int32: 7 } , "alias": "Suzanna", "name": "SuzannaTillson", "user-since": { datetime: 1344334200000}, "friend-ids": { unorderedlist: [{ int32: 6 } ]}, "employment": { orderedlist: [{ "organization-name": "Labzatron", "start-date": { date: 1303171200000}, "end-date": null } ]} }
+{ "id": { int32: 4 } , "alias": "Nicholas", "name": "NicholasStroh", "user-since": { datetime: 1293444600000}, "friend-ids": { unorderedlist: [{ int32: 2 } ]}, "employment": { orderedlist: [{ "organization-name": "Zamcorporation", "start-date": { date: 1275955200000}, "end-date": null } ]} }
+{ "id": { int32: 5 } , "alias": "Von", "name": "VonKemble", "user-since": { datetime: 1262686200000}, "friend-ids": { unorderedlist: [{ int32: 3 } , { int32: 6 } , { int32: 10 } ]}, "employment": { orderedlist: [{ "organization-name": "Kongreen", "start-date": { date: 1290816000000}, "end-date": null } ]} }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_7_-_Universal_Quantification"></a>Query 7 - Universal Quantification</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+for $fbu in dataset FacebookUsers
+where (every $e in $fbu.employment satisfies not(is-null($e.end-date)))
+return $fbu;
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression7 = new FLWOGRExpression()
+ .ForClause("$fbu", new AExpression("dataset FacebookUsers"))
+ .WhereClause(
+ new QuantifiedExpression (
+ "every" ,
+ {"$e" : new AExpression("$fbu.employment") },
+ new FunctionExpression("not", new FunctionExpression("is-null", new AExpression("$e.end-date")))
+ )
+ )
+ .ReturnClause("$fbu");
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "id": { int32: 9 } , "alias": "Woodrow", "name": "WoodrowNehling", "user-since": { datetime: 1127211000000}, "friend-ids": { unorderedlist: [{ int32: 3 } , { int32: 10 } ]}, "employment": { orderedlist: [{ "organization-name": "Zuncan", "start-date": { date: 1050969600000}, "end-date": { date: 1260662400000} } ]} }
+{ "id": { int32: 10 } , "alias": "Bram", "name": "BramHatch", "user-since": { datetime: 1287223800000}, "friend-ids": { unorderedlist: [{ int32: 1 } , { int32: 5 } , { int32: 9 } ]}, "employment": { orderedlist: [{ "organization-name": "physcane", "start-date": { date: 1181001600000}, "end-date": { date: 1320451200000} } ]} }
+{ "id": { int32: 3 } , "alias": "Emory", "name": "EmoryUnk", "user-since": { datetime: 1341915000000}, "friend-ids": { unorderedlist: [{ int32: 1 } , { int32: 5 } , { int32: 8 } , { int32: 9 } ]}, "employment": { orderedlist: [{ "organization-name": "geomedia", "start-date": { date: 1276732800000}, "end-date": { date: 1264464000000} } ]} }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_8_-_Simple_Aggregation"></a>Query 8 - Simple Aggregation</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+count(for $fbu in dataset FacebookUsers return $fbu);
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression8 = new FunctionExpression(
+ "count",
+ new FLWOGRExpression()
+ .ForClause("$fbu", new AExpression("dataset FacebookUsers"))
+ .ReturnClause("$fbu")
+);
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ int64: 10 }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_9-A_-_Grouping_and_Aggregation"></a>Query 9-A - Grouping and Aggregation</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+for $t in dataset TweetMessages
+group by $uid := $t.user.screen-name with $t
+return {
+ "user": $uid,
+ "count": count($t)
+};
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression9a = new FLWOGRExpression()
+ .ForClause("$t", new AExpression("dataset TweetMessages"))
+ .GroupClause("$uid", new AExpression("$t.user.screen-name"), "with", "$t")
+ .ReturnClause(
+ {
+ "user" : "$uid",
+ "count" : new FunctionExpression("count", new AExpression("$t"))
+ }
+ );
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "user": "ColineGeyer@63", "count": { int64: 3 } }
+{ "user": "OliJackson_512", "count": { int64: 1 } }
+{ "user": "NilaMilliron_tw", "count": { int64: 1 } }
+{ "user": "ChangEwing_573", "count": { int64: 1 } }
+{ "user": "NathanGiesen@211", "count": { int64: 6 } }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_9-B_-_.28Hash-Based.29_Grouping_and_Aggregation"></a>Query 9-B - (Hash-Based) Grouping and Aggregation</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+for $t in dataset TweetMessages
+/*+ hash*/
+group by $uid := $t.user.screen-name with $t
+return {
+ "user": $uid,
+ "count": count($t)
+};
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression9b = new FLWOGRExpression()
+ .ForClause("$t", new AExpression("dataset TweetMessages"))
+ .AQLClause("/*+ hash*/")
+ .GroupClause("$uid", new AExpression("$t.user.screen-name"), "with", "$t")
+ .ReturnClause(
+ {
+ "user" : "$uid",
+ "count" : new FunctionExpression("count", new AExpression("$t"))
+ }
+ );
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "user": "ColineGeyer@63", "count": { int64: 3 } }
+{ "user": "OliJackson_512", "count": { int64: 1 } }
+{ "user": "NilaMilliron_tw", "count": { int64: 1 } }
+{ "user": "ChangEwing_573", "count": { int64: 1 } }
+{ "user": "NathanGiesen@211", "count": { int64: 6 } }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_10_-_Grouping_and_Limits"></a>Query 10 - Grouping and Limits</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+for $t in dataset TweetMessages
+group by $uid := $t.user.screen-name with $t
+let $c := count($t)
+order by $c desc
+limit 3
+return {
+ "user": $uid,
+ "count": $c
+};
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression10 = new FLWOGRExpression()
+ .ForClause("$t", new AExpression("dataset TweetMessages"))
+ .GroupClause("$uid", new AExpression("$t.user.screen-name"), "with", "$t")
+ .LetClause("$c", new FunctionExpression("count", new AExpression("$t")))
+ .OrderbyClause( new AExpression("$c"), "desc" )
+ .LimitClause(new AExpression("3"))
+ .ReturnClause(
+ {
+ "user" : "$uid",
+ "count" : "$c"
+ }
+ );
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "user": "NathanGiesen@211", "count": { int64: 6 } }
+{ "user": "ColineGeyer@63", "count": { int64: 3 } }
+{ "user": "NilaMilliron_tw", "count": { int64: 1 } }
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h3><a name="Query_11_-_Left_Outer_Fuzzy_Join"></a>Query 11 - Left Outer Fuzzy Join</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+set simfunction "jaccard";
+set simthreshold "0.3";
+
+for $t in dataset TweetMessages
+return {
+ "tweet": $t,
+ "similar-tweets": for $t2 in dataset TweetMessages
+ where $t2.referred-topics ~= $t.referred-topics
+ and $t2.tweetid != $t.tweetid
+ return $t2.referred-topics
+};
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div>
+<div>
+<pre class="source">var expression11 = new FLWOGRExpression()
+ .ForClause( "$t", new AExpression("dataset TweetMessages"))
+ .ReturnClause({
+ "tweet" : new AExpression("$t"),
+ "similar-tweets": new FLWOGRExpression()
+ .ForClause( "$t2", new AExpression("dataset TweetMessages"))
+ .WhereClause().and(
+ new AExpression("$t2.referred-topics ~= $t.referred-topics"),
+ new AExpression("$t2.tweetid != $t.tweetid")
+ )
+ .ReturnClause("$t2.referred-topics")
+ });
+</pre></div></div>
+</div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div>
+<div>
+<pre class="source">{ "tweet": { "tweetid": "10", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": { int32: 121 } , "statuses_count": { int32: 362 } , "name": "Coline Geyer", "followers_count": { int32: 17159 } }, "sender-location": { point: [29.15, 76.53]}, "send-time": { datetime: 1201342200000}, "referred-topics": { unorderedlist: ["ccast", "voice-clarity" ]}, "message-text": " hate ccast its voice-clarity is OMG:(" }, "similar-tweets": { orderedlist: [{ unorderedlist: ["x-phone", "voice-clarity" ]}, { unorderedlist: ["ccast", "shortcut-menu" ]}, { unorderedlist: ["ccast", "voicemail-service" ]} ]} }
+{ "tweet": { "tweetid": "6", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": { int32: 121 } , "statuses_count": { int32: 362 } , "name": "Coline Geyer", "followers_count": { int32: 17159 } }, "sender-location": { point: [47.51, 83.99]}, "send-time": { datetime: 1273227000000}, "referred-topics": { unorderedlist: ["x-phone", "voice-clarity" ]}, "message-text": " like x-phone the voice-clarity is good:)" }, "similar-tweets": { orderedlist: [{ unorderedlist: ["ccast", "voice-clarity" ]}, { unorderedlist: ["x-phone", "platform" ]} ]} }
+{ "tweet": { "tweetid": "7", "user": { "screen-name": "ChangEwing_573", "lang": "en", "friends_count": { int32: 182 } , "statuses_count": { int32: 394 } , "name": "Chang Ewing", "followers_count": { int32: 32136 } }, "sender-location": { point: [36.21, 72.6]}, "send-time": { datetime: 1314267000000}, "referred-topics": { unorderedlist: ["product-y", "platform" ]}, "message-text": " like product-y the platform is good" }, "similar-tweets": { orderedlist: [{ unorderedlist: ["x-phone", "platform" ]}, { unorderedlist: ["product-y", "voice-command" ]} ]} }
+{ "tweet": { "tweetid": "1", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": { int32: 39339 } , "statuses_count": { int32: 473 } , "name": "Nathan Giesen", "followers_count": { int32: 49416 } }, "sender-location": { point: [47.44, 80.65]}, "send-time": { datetime: 1209204600000}, "referred-topics": { unorderedlist: ["product-z", "customization" ]}, "message-text": " love product-z its customization is good:)" }, "similar-tweets": { orderedlist: [{ unorderedlist: ["product-z", "shortcut-menu" ]} ]} }
+{ "tweet": { "tweetid": "12", "user": { "screen-name": "OliJackson_512", "lang": "en", "friends_count": { int32: 445 } , "statuses_count": { int32: 164 } , "name": "Oli Jackson", "followers_count": { int32: 22649 } }, "sender-location": { point: [24.82, 94.63]}, "send-time": { datetime: 1266055800000}, "referred-topics": { unorderedlist: ["product-y", "voice-command" ]}, "message-text": " like product-y the voice-command is amazing:)" }, "similar-tweets": { orderedlist: [{ unorderedlist: ["product-y", "platform" ]}, { unorderedlist: ["product-b", "voice-command" ]} ]} }
+{ "tweet": { "tweetid": "3", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": { int32: 39339 } , "statuses_count": { int32: 473 } , "name": "Nathan Giesen", "followers_count": { int32: 49416 } }, "sender-location": { point: [29.72, 75.8]}, "send-time": { datetime: 1162635000000}, "referred-topics": { unorderedlist: ["product-w", "speed" ]}, "message-text": " like product-w the speed is good:)" }, "similar-tweets": { orderedlist: [{ unorderedlist: ["product-w", "speed" ]} ]} }
+{ "tweet": { "tweetid": "9", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": { int32: 39339 } , "statuses_count": { int32: 473 } , "name": "Nathan Giesen", "followers_count": { int32: 49416 } }, "sender-location": { point: [36.86, 74.62]}, "send-time": { datetime: 1342865400000}, "referred-topics": { unorderedlist: ["ccast", "voicemail-service" ]}, "message-text": " love ccast its voicemail-service is awesome" }, "similar-tweets": { orderedlist: [{ unorderedlist: ["ccast", "voice-clarity" ]}, { unorderedlist: ["ccast", "shortcut-menu" ]} ]} }
+{ "tweet": { "tweetid": "5", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": { int32: 39339 } , "statuses_count": { int32: 473 } , "name": "Nathan Giesen", "followers_count": { int32: 49416 } }, "sender-location": { point: [40.09, 92.69]}, "send-time": { datetime: 1154686200000}, "referred-topics": { unorderedlist: ["product-w", "speed" ]}, "message-text": " can't stand product-w its speed is terrible:(" }, "similar-tweets": { orderedlist: [{ unorderedlist: ["product-w", "speed" ]} ]} }
+{ "tweet": { "tweetid": "8", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": { int32: 39339 } , "statuses_count": { int32: 473 } , "name": "Nathan Giesen", "followers_count": { int32: 49416 } }, "sender-location": { point: [46.05, 93.34]}, "send-time": { datetime: 1129284600000}, "referred-topics": { unorderedlist: ["product-z", "shortcut-menu" ]}, "message-text": " like product-z the shortcut-menu is awesome:)" }, "similar-tweets": { orderedlist: [{ unorderedlist: ["ccast", "shortcut-menu" ]}, { unorderedlist: ["product-z", "customization" ]} ]} }
+{ "tweet": { "tweetid": "11", "user": { "screen-name": "NilaMilliron_tw", "lang": "en", "friends_count": { int32: 445 } , "statuses_count": { int32: 164 } , "name": "Nila Milliron", "followers_count": { int32: 22649 } }, "sender-location": { point: [37.59, 68.42]}, "send-time": { datetime: 1205057400000}, "referred-topics": { unorderedlist: ["x-phone", "platform" ]}, "message-text": " can't stand x-phone its platform is terrible" }, "similar-tweets": { orderedlist: [{ unorderedlist: ["x-phone", "voice-clarity" ]}, { unorderedlist: ["product-y", "platform" ]} ]} }
+{ "tweet": { "tweetid": "2", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": { int32: 121 } , "statuses_count": { int32: 362 } , "name": "Coline Geyer", "followers_count": { int32: 17159 } }, "sender-location": { point: [32.84, 67.14]}, "send-time": { datetime: 1273745400000}, "referred-topics": { unorderedlist: ["ccast", "shortcut-menu" ]}, "message-text": " like ccast its shortcut-menu is awesome:)" }, "similar-tweets": { orderedlist: [{ unorderedlist: ["product-z", "shortcut-menu" ]}, { unorderedlist: ["ccast", "voice-clarity" ]}, { unorderedlist: ["ccast", "voicemail-service" ]} ]} }
+{ "tweet": { "tweetid": "4", "user": { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": { int32: 39339 } , "statuses_count": { int32: 473 } , "name": "Nathan Giesen", "followers_count": { int32: 49416 } }, "sender-location": { point: [39.28, 70.48]}, "send-time": { datetime: 1324894200000}, "referred-topics": { unorderedlist: ["product-b", "voice-command" ]}, "message-text": " like product-b the voice-command is mind-blowing:)" }, "similar-tweets": { orderedlist: [{ unorderedlist: ["product-y", "voice-command" ]} ]} }
+</pre></div></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.7.1/aql/manual.html b/content/docs/0.9.7.1/aql/manual.html
new file mode 100644
index 0000000..0bf6305
--- /dev/null
+++ b/content/docs/0.9.7.1/aql/manual.html
@@ -0,0 +1,1000 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from src/site/markdown/aql/manual.md at 2021-12-13
+ | 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="20211213" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>AsterixDB – The Asterix Query Language, Version 1.0</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: 2021-12-13</li>
+ <li id="projectVersion" class="pull-right">Version: 0.9.7.1</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="../interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval 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 class="active"><a href="#"><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 Query Language, Version 1.0</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="#Introduction">1. Introduction</a></li>
+<li><a href="#Expressions">2. Expressions</a></li>
+<li><a href="#Statements">3. Statements</a></li>
+</ul></div>
+<div class="section">
+<h2><a name="a1._Introduction_.5BBack_to_TOC.5D"></a><a name="Introduction" id="Introduction">1. Introduction</a><font size="4"> <a href="#toc">[Back to TOC]</a></font></h2>
+<p>This document is intended as a reference guide to the full syntax and semantics of the Asterix Query Language (AQL), the language for talking to AsterixDB. This guide covers both the data manipulation language (DML) aspects of AQL, including its support for queries and data modification, as well as its data definition language (DDL) aspects. New AsterixDB users are encouraged to read and work through the (friendlier) guide “AsterixDB 101: An ADM and AQL Primer” before attempting to make use of this document. In addition, readers are advised to read and understand the Asterix Data Model (ADM) reference guide since a basic understanding of ADM concepts is a prerequisite to understanding AQL. In what follows, we detail the features of the AQL language in a grammar-guided manner: We list and briefly explain each of the productions in the AQL grammar, offering examples for clarity in cases where doing so seems needed or helpful.</p></div>
+<div class="section">
+<h2><a name="a2._Expressions_.5BBack_to_TOC.5D"></a><a name="Expressions" id="Expressions">2. Expressions</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
+
+<div>
+<div>
+<pre class="source">Query ::= Expression
+</pre></div></div>
+
+<p>An AQL query can be any legal AQL expression.</p>
+
+<div>
+<div>
+<pre class="source">Expression ::= ( OperatorExpr | IfThenElse | FLWOR | QuantifiedExpression )
+</pre></div></div>
+
+<p>AQL is a fully composable expression language. Each AQL expression returns zero or more Asterix Data Model (ADM) instances. There are four major kinds of expressions in AQL. At the topmost level, an AQL expression can be an OperatorExpr (similar to a mathematical expression), an IfThenElse (to choose between two alternative values), a FLWOR expression (the heart of AQL, pronounced “flower expression”), or a QuantifiedExpression (which yields a boolean value). Each will be detailed as we explore the full AQL grammar.</p>
+<div class="section">
+<h3><a name="Primary_Expressions"></a>Primary Expressions</h3>
+
+<div>
+<div>
+<pre class="source">PrimaryExpr ::= Literal
+ | VariableRef
+ | ParenthesizedExpression
+ | FunctionCallExpr
+ | DatasetAccessExpression
+ | ListConstructor
+ | ObjectConstructor
+</pre></div></div>
+
+<p>The most basic building block for any AQL expression is the PrimaryExpr. This can be a simple literal (constant) value, a reference to a query variable that is in scope, a parenthesized expression, a function call, an expression accessing the ADM contents of a dataset, a newly constructed list of ADM instances, or a newly constructed ADM object.</p>
+<div class="section">
+<h4><a name="Literals"></a>Literals</h4>
+
+<div>
+<div>
+<pre class="source">Literal ::= StringLiteral
+ | IntegerLiteral
+ | FloatLiteral
+ | DoubleLiteral
+ | "null"
+ | "true"
+ | "false"
+StringLiteral ::= ("\"" (<ESCAPE_QUOT> | ~["\""])* "\"")
+ | ("\'" (<ESCAPE_APOS> | ~["\'"])* "\'")
+<ESCAPE_QUOT> ::= "\\\""
+<ESCAPE_APOS> ::= "\\\'"
+IntegerLiteral ::= <DIGITS>
+<DIGITS> ::= ["0" - "9"]+
+FloatLiteral ::= <DIGITS> ( "f" | "F" )
+ | <DIGITS> ( "." <DIGITS> ( "f" | "F" ) )?
+ | "." <DIGITS> ( "f" | "F" )
+DoubleLiteral ::= <DIGITS>
+ | <DIGITS> ( "." <DIGITS> )?
+ | "." <DIGITS>
+</pre></div></div>
+
+<p>Literals (constants) in AQL can be strings, integers, floating point values, double values, boolean constants, or the constant value null. The null value in AQL has “unknown” or “missing” value semantics, similar to (though not identical to) nulls in the relational query language SQL.</p>
+<p>The following are some simple examples of AQL literals. Since AQL is an expression language, each example is also a complete, legal AQL query (!).</p>
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">"a string"
+42
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Variable_References"></a>Variable References</h4>
+
+<div>
+<div>
+<pre class="source">VariableRef ::= <VARIABLE>
+<VARIABLE> ::= "$" <LETTER> (<LETTER> | <DIGIT> | "_")*
+<LETTER> ::= ["A" - "Z", "a" - "z"]
+</pre></div></div>
+
+<p>A variable in AQL can be bound to any legal ADM value. A variable reference refers to the value to which an in-scope variable is bound. (E.g., a variable binding may originate from one of the for or let clauses of a FLWOR expression or from an input parameter in the context of an AQL function body.)</p>
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">$tweet
+$id
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Parenthesized_Expressions"></a>Parenthesized Expressions</h4>
+
+<div>
+<div>
+<pre class="source">ParenthesizedExpression ::= "(" Expression ")"
+</pre></div></div>
+
+<p>As in most languages, an expression may be parenthesized.</p>
+<p>Since AQL is an expression language, the following example expression is actually also a complete, legal AQL query whose result is the value 2. (As such, you can have Big Fun explaining to your boss how AsterixDB and AQL can turn your 1000-node shared-nothing Big Data cluster into a $5M calculator in its spare time.)</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">( 1 + 1 )
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Function_Calls"></a>Function Calls</h4>
+
+<div>
+<div>
+<pre class="source">FunctionCallExpr ::= FunctionOrTypeName "(" ( Expression ( "," Expression )* )? ")"
+</pre></div></div>
+
+<p>Functions are included in AQL, like most languages, as a way to package useful functionality or to componentize complicated or reusable AQL computations. A function call is a legal AQL query expression that represents the ADM value resulting from the evaluation of its body expression with the given parameter bindings; the parameter value bindings can themselves be any AQL expressions.</p>
+<p>The following example is a (built-in) function call expression whose value is 8.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">string-length("a string")
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Dataset_Access"></a>Dataset Access</h4>
+
+<div>
+<div>
+<pre class="source">DatasetAccessExpression ::= "dataset" ( ( Identifier ( "." Identifier )? )
+ | ( "(" Expression ")" ) )
+Identifier ::= <IDENTIFIER> | StringLiteral
+<IDENTIFIER> ::= <LETTER> (<LETTER> | <DIGIT> | <SPECIALCHARS>)*
+<SPECIALCHARS> ::= ["$", "_", "-"]
+</pre></div></div>
+
+<p>Querying Big Data is the main point of AsterixDB and AQL. Data in AsterixDB reside in datasets (collections of ADM objects), each of which in turn resides in some namespace known as a dataverse (data universe). Data access in a query expression is accomplished via a DatasetAccessExpression. Dataset access expressions are most commonly used in FLWOR expressions, where variables are bound to their contents.</p>
+<p>Note that the Identifier that identifies a dataset (or any other Identifier in AQL) can also be a StringLiteral. This is especially useful to avoid conficts with AQL keywords (e.g. “dataset”, “null”, or “type”).</p>
+<p>The following are three examples of legal dataset access expressions. The first one accesses a dataset called Customers in the dataverse called SalesDV. The second one accesses the Customers dataverse in whatever the current dataverse is. The third one does the same thing as the second but uses a slightly older AQL syntax.</p>
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">dataset SalesDV.Customers
+dataset Customers
+dataset("Customers")
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Constructors"></a>Constructors</h4>
+
+<div>
+<div>
+<pre class="source">ListConstructor ::= ( OrderedListConstructor | UnorderedListConstructor )
+OrderedListConstructor ::= "[" ( Expression ( "," Expression )* )? "]"
+UnorderedListConstructor ::= "{{" ( Expression ( "," Expression )* )? "}}"
+ObjectConstructor ::= "{" ( FieldBinding ( "," FieldBinding )* )? "}"
+FieldBinding ::= Expression ":" Expression
+</pre></div></div>
+
+<p>A major feature of AQL is its ability to construct new ADM data instances. This is accomplished using its constructors for each of the major ADM complex object structures, namely lists (ordered or unordered) and objects. Ordered lists are like JSON arrays, while unordered lists have bag (multiset) semantics. Objects are built from attributes that are field-name/field-value pairs, again like JSON. (See the AsterixDB Data Model document for more details on each.)</p>
+<p>The following examples illustrate how to construct a new ordered list with 3 items, a new unordered list with 4 items, and a new object with 2 fields, respectively. List elements can be homogeneous (as in the first example), which is the common case, or they may be heterogeneous (as in the second example). The data values and field name values used to construct lists and objects in constructors are all simply AQL expressions. Thus the list elements, field names, and field values used in constructors can be simple literals (as in these three examples) or they can come from query variable references or even arbitrarily complex AQL expressions.</p>
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">[ "a", "b", "c" ]
+
+{{ 42, "forty-two", "AsterixDB!", 3.14f }}
+
+{
+ "project name": "AsterixDB"
+ "project members": {{ "vinayakb", "dtabass", "chenli" }}
+}
+</pre></div></div>
+</div>
+<div class="section">
+<h5><a name="Note"></a>Note</h5>
+<p>When constructing nested objects there needs to be a space between the closing braces to avoid confusion with the <tt>}}</tt> token that ends an unordered list constructor: <tt>{ "a" : { "b" : "c" }}</tt> will fail to parse while <tt>{ "a" : { "b" : "c" } }</tt> will work.</p></div></div></div>
+<div class="section">
+<h3><a name="Path_Expressions"></a>Path Expressions</h3>
+
+<div>
+<div>
+<pre class="source">ValueExpr ::= PrimaryExpr ( Field | Index )*
+Field ::= "." Identifier
+Index ::= "[" ( Expression | "?" ) "]"
+</pre></div></div>
+
+<p>Components of complex types in ADM are accessed via path expressions. Path access can be applied to the result of an AQL expression that yields an instance of such a type, e.g., a object or list instance. For objects, path access is based on field names. For ordered lists, path access is based on (zero-based) array-style indexing. AQL also supports an “I’m feeling lucky” style index accessor, [?], for selecting an arbitrary element from an ordered list. Attempts to access non-existent fields or list elements produce a null (i.e., missing information) result as opposed to signaling a runtime error.</p>
+<p>The following examples illustrate field access for a object, index-based element access for an ordered list, and also a composition thereof.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">({"list": [ "a", "b", "c"]}).list
+
+(["a", "b", "c"])[2]
+
+({ "list": [ "a", "b", "c"]}).list[2]
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Logical_Expressions"></a>Logical Expressions</h3>
+
+<div>
+<div>
+<pre class="source">OperatorExpr ::= AndExpr ( "or" AndExpr )*
+AndExpr ::= RelExpr ( "and" RelExpr )*
+</pre></div></div>
+
+<p>As in most languages, boolean expressions can be built up from smaller expressions by combining them with the logical connectives and/or. Legal boolean values in AQL are true, false, and null. (Nulls in AQL are treated much like SQL treats its unknown truth value in boolean expressions.)</p>
+<p>The following is an example of a conjuctive range predicate in AQL. It will yield true if $a is bound to 4, null if $a is bound to null, and false otherwise.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">$a > 3 and $a < 5
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Comparison_Expressions"></a>Comparison Expressions</h3>
+
+<div>
+<div>
+<pre class="source">RelExpr ::= AddExpr ( ( "<" | ">" | "<=" | ">=" | "=" | "!=" | "~=" ) AddExpr )?
+</pre></div></div>
+
+<p>AQL has the usual list of suspects, plus one, for comparing pairs of atomic values. The “plus one” is the last operator listed above, which is the “roughly equal” operator provided for similarity queries. (See the separate document on <a href="similarity.html">AsterixDB Similarity Queries</a> for more details on similarity matching.)</p>
+<p>An example comparison expression (which yields the boolean value true) is shown below.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">5 > 3
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Arithmetic_Expressions"></a>Arithmetic Expressions</h3>
+
+<div>
+<div>
+<pre class="source">AddExpr ::= MultExpr ( ( "+" | "-" ) MultExpr )*
+MultExpr ::= UnaryExpr ( ( "*" | "/" | "div" | "%" | "mod" | "^" ) UnaryExpr )*
+UnaryExpr ::= ( ( "+" | "-" ) )? ValueExpr
+</pre></div></div>
+
+<p>AQL also supports the usual cast of characters for arithmetic expressions. The example below evaluates to 25.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">3 ^ 2 + 4 ^ 2
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="FLWOR_Expression"></a>FLWOR Expression</h3>
+
+<div>
+<div>
+<pre class="source">FLWOR ::= ( ForClause | LetClause ) ( Clause )* ("return"|"select") Expression
+Clause ::= ForClause | LetClause | WhereClause | OrderbyClause
+ | GroupClause | LimitClause | DistinctClause
+ForClause ::= ("for"|"from") Variable ( "at" Variable )? "in" ( Expression )
+LetClause ::= ("let"|"with") Variable ":=" Expression
+WhereClause ::= "where" Expression
+OrderbyClause ::= "order" "by" Expression ( ( "asc" ) | ( "desc" ) )?
+ ( "," Expression ( ( "asc" ) | ( "desc" ) )? )*
+GroupClause ::= "group" "by" ( Variable ":=" )? Expression ( "," ( Variable ":=" )? Expression )*
+ ("with"|"keeping") VariableRef ( "," VariableRef )*
+LimitClause ::= "limit" Expression ( "offset" Expression )?
+DistinctClause ::= "distinct" "by" Expression ( "," Expression )*
+Variable ::= <VARIABLE>
+</pre></div></div>
+
+<p>The heart of AQL is the FLWOR (for-let-where-orderby-return) expression. The roots of this expression were borrowed from the expression of the same name in XQuery. A FLWOR expression starts with one or more clauses that establish variable bindings. A <tt>for</tt> clause binds a variable incrementally to each element of its associated expression; it includes an optional positional variable for counting/numbering the bindings. By default no ordering is implied or assumed by a <tt>for</tt> clause. A <tt>let</tt> clause binds a variable to the collection of elements computed by its associated expression.</p>
+<p>Following the initial <tt>for</tt> or <tt>let</tt> clause(s), a FLWOR expression may contain an arbitrary sequence of other clauses. The <tt>where</tt> clause in a FLWOR expression filters the preceding bindings via a boolean expression, much like a <tt>where</tt> clause does in a SQL query. The <tt>order by</tt> clause in a FLWOR expression induces an ordering on the data. The <tt>group by</tt> clause, discussed further below, forms groups based on its group by expressions, optionally naming the expressions’ values (which together form the grouping key for the expression). The <tt>with</tt> subclause of a <tt>group by</tt> clause specifies the variable(s) whose values should be grouped based on the grouping key(s); following the grouping clause, only the grouping key(s) and the variables named in the with subclause remain in scope, and the named grouping variables now contain lists formed from their input values. The <tt>limit</tt> clause caps the number of values returned, optionally starting its result count from a specified offset. (Web applications can use this feature for doing pagination.) The <tt>distinct</tt> clause is similar to the <tt>group-by</tt> clause, but it forms no groups; it serves only to eliminate duplicate values. As indicated by the grammar, the clauses in an AQL query can appear in any order. To interpret a query, one can think of data as flowing down through the query from the first clause to the <tt>return</tt> clause.</p>
+<p>The following example shows a FLWOR expression that selects and returns one user from the dataset FacebookUsers.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">for $user in dataset FacebookUsers
+where $user.id = 8
+return $user
+</pre></div></div>
+
+<p>The next example shows a FLWOR expression that joins two datasets, FacebookUsers and FacebookMessages, returning user/message pairs. The results contain one object per pair, with result objects containing the user’s name and an entire message.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">for $user in dataset FacebookUsers
+for $message in dataset FacebookMessages
+where $message.author-id = $user.id
+return
+ {
+ "uname": $user.name,
+ "message": $message.message
+ };
+</pre></div></div>
+
+<p>In the next example, a <tt>let</tt> clause is used to bind a variable to all of a user’s FacebookMessages. The query returns one object per user, with result objects containing the user’s name and the set of all messages by that user.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">for $user in dataset FacebookUsers
+let $messages :=
+ for $message in dataset FacebookMessages
+ where $message.author-id = $user.id
+ return $message.message
+return
+ {
+ "uname": $user.name,
+ "messages": $messages
+ };
+</pre></div></div>
+
+<p>The following example returns all TwitterUsers ordered by their followers count (most followers first) and language. When ordering <tt>null</tt> is treated as being smaller than any other value if <tt>null</tt>s are encountered in the ordering key(s).</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source"> for $user in dataset TwitterUsers
+ order by $user.followers_count desc, $user.lang asc
+ return $user
+</pre></div></div>
+
+<p>The next example illustrates the use of the <tt>group by</tt> clause in AQL. After the <tt>group by</tt> clause in the query, only variables that are either in the <tt>group by</tt> list or in the <tt>with</tt> list are in scope. The variables in the clause’s <tt>with</tt> list will each contain a collection of items following the <tt>group by</tt> clause; the collected items are the values that the source variable was bound to in the tuples that formed the group. For grouping <tt>null</tt> is handled as a single value.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source"> for $x in dataset FacebookMessages
+ let $messages := $x.message
+ group by $loc := $x.sender-location with $messages
+ return
+ {
+ "location" : $loc,
+ "message" : $messages
+ }
+</pre></div></div>
+
+<p>The use of the <tt>limit</tt> clause is illustrated in the next example.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source"> for $user in dataset TwitterUsers
+ order by $user.followers_count desc
+ limit 2
+ return $user
+</pre></div></div>
+
+<p>The final example shows how AQL’s <tt>distinct by</tt> clause works. Each variable in scope before the distinct clause is also in scope after the <tt>distinct by</tt> clause. This clause works similarly to <tt>group by</tt>, but for each variable that contains more than one value after the <tt>distinct by</tt> clause, one value is picked nondeterministically. (If the variable is in the <tt>distinct by</tt> list, then its value will be deterministic.) Nulls are treated as a single value when they occur in a grouping field.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source"> for $x in dataset FacebookMessages
+ distinct by $x.sender-location
+ return
+ {
+ "location" : $x.sender-location,
+ "message" : $x.message
+ }
+</pre></div></div>
+
+<p>In order to allow SQL fans to write queries in their favored ways, AQL provides synonyms: <i>from</i> for <i>for</i>, <i>select</i> for <i>return</i>, <i>with</i> for <i>let</i>, and <i>keeping</i> for <i>with</i> in the group by clause. The following query is such an example.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source"> from $x in dataset FacebookMessages
+ with $messages := $x.message
+ group by $loc := $x.sender-location keeping $messages
+ select
+ {
+ "location" : $loc,
+ "message" : $messages
+ }
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Conditional_Expression"></a>Conditional Expression</h3>
+
+<div>
+<div>
+<pre class="source">IfThenElse ::= "if" "(" Expression ")" "then" Expression "else" Expression
+</pre></div></div>
+
+<p>A conditional expression is useful for choosing between two alternative values based on a boolean condition. If its first (<tt>if</tt>) expression is true, its second (<tt>then</tt>) expression’s value is returned, and otherwise its third (<tt>else</tt>) expression is returned.</p>
+<p>The following example illustrates the form of a conditional expression.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">if (2 < 3) then "yes" else "no"
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Quantified_Expressions"></a>Quantified Expressions</h3>
+
+<div>
+<div>
+<pre class="source">QuantifiedExpression ::= ( ( "some" ) | ( "every" ) ) Variable "in" Expression
+ ( "," Variable "in" Expression )* "satisfies" Expression
+</pre></div></div>
+
+<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> (“every” value in an empty set satisfies the condition) while the second expression would yield <tt>false</tt> (since there isn’t “some” value, as there are no values in the set, that satisfies the condition).</p>
+<div class="section">
+<div class="section">
+<h5><a name="Examples"></a>Examples</h5>
+
+<div>
+<div>
+<pre class="source">every $x in [ 1, 2, 3 ] satisfies $x < 3
+some $x in [ 1, 2, 3 ] satisfies $x < 3
+</pre></div></div>
+</div></div></div></div>
+<div class="section">
+<h2><a name="a3._Statements_.5BBack_to_TOC.5D"></a><a name="Statements" id="Statements">3. Statements</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
+
+<div>
+<div>
+<pre class="source">Statement ::= ( SingleStatement ( ";" )? )* <EOF>
+SingleStatement ::= DataverseDeclaration
+ | FunctionDeclaration
+ | CreateStatement
+ | DropStatement
+ | LoadStatement
+ | SetStatement
+ | InsertStatement
+ | DeleteStatement
+ | UpsertStatement
+ | Query
+</pre></div></div>
+
+<p>In addition to expresssions for queries, AQL supports a variety of statements for data definition and manipulation purposes as well as controlling the context to be used in evaluating AQL expressions. AQL supports object-level ACID transactions that begin and terminate implicitly for each object inserted, deleted, upserted, or searched while a given AQL statement is being executed.</p>
+<p>This section details the statements supported in the AQL language.</p>
+<div class="section">
+<h3><a name="Declarations"></a>Declarations</h3>
+
+<div>
+<div>
+<pre class="source">DataverseDeclaration ::= "use" "dataverse" Identifier
+</pre></div></div>
+
+<p>The world of data in an AsterixDB cluster is organized into data namespaces called dataverses. To set the default dataverse for a series of statements, the use dataverse statement is provided.</p>
+<p>As an example, the following statement sets the default dataverse to be TinySocial.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+</pre></div></div>
+
+<p>The set statement in AQL is used to control aspects of the expression evalation context for queries.</p>
+
+<div>
+<div>
+<pre class="source">SetStatement ::= "set" Identifier StringLiteral
+</pre></div></div>
+
+<p>As an example, the following set statements request that Jaccard similarity with a similarity threshold 0.6 be used for set similarity matching when the ~= operator is used in a query expression.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">set simfunction "jaccard";
+set simthreshold "0.6f";
+</pre></div></div>
+
+<p>When writing a complex AQL query, it can sometimes be helpful to define one or more auxilliary functions that each address a sub-piece of the overall query. The declare function statement supports the creation of such helper functions.</p>
+
+<div>
+<div>
+<pre class="source">FunctionDeclaration ::= "declare" "function" Identifier ParameterList "{" Expression "}"
+ParameterList ::= "(" ( <VARIABLE> ( "," <VARIABLE> )* )? ")"
+</pre></div></div>
+
+<p>The following is a very simple example of a temporary AQL function definition.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">declare function add($a, $b) {
+ $a + $b
+};
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Lifecycle_Management_Statements"></a>Lifecycle Management Statements</h3>
+
+<div>
+<div>
+<pre class="source">CreateStatement ::= "create" ( DataverseSpecification
+ | TypeSpecification
+ | DatasetSpecification
+ | IndexSpecification
+ | FunctionSpecification )
+
+QualifiedName ::= Identifier ( "." Identifier )?
+DoubleQualifiedName ::= Identifier "." Identifier ( "." Identifier )?
+</pre></div></div>
+
+<p>The create statement in AQL is used for creating persistent artifacts in the context of dataverses. It can be used to create new dataverses, datatypes, datasets, indexes, and user-defined AQL functions.</p>
+<div class="section">
+<h4><a name="Dataverses"></a>Dataverses</h4>
+
+<div>
+<div>
+<pre class="source">DataverseSpecification ::= "dataverse" Identifier IfNotExists ( "with format" StringLiteral )?
+</pre></div></div>
+
+<p>The create dataverse statement is used to create new dataverses. To ease the authoring of reusable AQL scripts, its optional IfNotExists clause allows creation to be requested either unconditionally or only if the the dataverse does not already exist. If this clause is absent, an error will be returned if the specified dataverse already exists. The <tt>with format</tt> clause is a placeholder for future functionality that can safely be ignored.</p>
+<p>The following example creates a dataverse named TinySocial.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">create dataverse TinySocial;
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Types"></a>Types</h4>
+
+<div>
+<div>
+<pre class="source">TypeSpecification ::= "type" FunctionOrTypeName IfNotExists "as" TypeExpr
+FunctionOrTypeName ::= QualifiedName
+IfNotExists ::= ( "if not exists" )?
+TypeExpr ::= ObjectTypeDef | TypeReference | OrderedListTypeDef | UnorderedListTypeDef
+ObjectTypeDef ::= ( "closed" | "open" )? "{" ( ObjectField ( "," ObjectField )* )? "}"
+ObjectField ::= Identifier ":" ( TypeExpr ) ( "?" )?
+NestedField ::= Identifier ( "." Identifier )*
+IndexField ::= NestedField ( ":" TypeReference )?
+TypeReference ::= Identifier
+OrderedListTypeDef ::= "[" ( TypeExpr ) "]"
+UnorderedListTypeDef ::= "{{" ( TypeExpr ) "}}"
+</pre></div></div>
+
+<p>The create type statement is used to create a new named ADM datatype. This type can then be used to create datasets or utilized when defining one or more other ADM datatypes. Much more information about the Asterix Data Model (ADM) is available in the <a href="datamodel.html">data model reference guide</a> to ADM. A new type can be a object type, a renaming of another type, an ordered list type, or an unordered list 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 a new type (if neither option is specified).</p>
+<p>The following example creates a new ADM object type called FacebookUser type. Since it is closed, its instances will contain only what is specified in the type definition. The first four fields are traditional typed name/value pairs. The friend-ids field is an unordered list of 32-bit integers. The employment field is an ordered list of instances of another named object type, EmploymentType.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">create type FacebookUserType as closed {
+ "id" : int32,
+ "alias" : string,
+ "name" : string,
+ "user-since" : datetime,
+ "friend-ids" : {{ int32 }},
+ "employment" : [ EmploymentType ]
+}
+</pre></div></div>
+
+<p>The next example creates a new ADM object type called FbUserType. Note that the type of the id field is UUID. You need to use this field type if you want to have this field be an autogenerated-PK field. Refer to the Datasets section later for more details.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">create type FbUserType as closed {
+ "id" : uuid,
+ "alias" : string,
+ "name" : string
+}
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Datasets"></a>Datasets</h4>
+
+<div>
+<div>
+<pre class="source">DatasetSpecification ::= "internal"? "dataset" QualifiedName "(" QualifiedName ")" IfNotExists
+ PrimaryKey ( "on" Identifier )? ( "hints" Properties )?
+ ( "using" "compaction" "policy" CompactionPolicy ( Configuration )? )?
+ ( "with filter on" Identifier )?
+ | "external" "dataset" QualifiedName "(" QualifiedName ")" IfNotExists
+ "using" AdapterName Configuration ( "hints" Properties )?
+ ( "using" "compaction" "policy" CompactionPolicy ( Configuration )? )?
+AdapterName ::= Identifier
+Configuration ::= "(" ( KeyValuePair ( "," KeyValuePair )* )? ")"
+KeyValuePair ::= "(" StringLiteral "=" StringLiteral ")"
+Properties ::= ( "(" Property ( "," Property )* ")" )?
+Property ::= Identifier "=" ( StringLiteral | IntegerLiteral )
+FunctionSignature ::= FunctionOrTypeName "@" IntegerLiteral
+PrimaryKey ::= "primary" "key" NestedField ( "," NestedField )* ( "autogenerated ")?
+CompactionPolicy ::= Identifier
+PrimaryKey ::= "primary" "key" Identifier ( "," Identifier )* ( "autogenerated ")?
+</pre></div></div>
+
+<p>The create dataset statement is used to create a new dataset. Datasets are named, unordered collections of ADM object instances; they are where data lives persistently and are the targets for queries in AsterixDB. Datasets are typed, and AsterixDB will ensure that their contents conform to their type definitions. An Internal dataset (the default) is a dataset that is stored in and managed by AsterixDB. It must have a specified unique primary key that can be used to partition data across nodes of an AsterixDB cluster. The primary key is also used in secondary indexes to uniquely identify the indexed primary data objects. Random primary key (UUID) values can be auto-generated by declaring the field to be UUID and putting “autogenerated” after the “primary key” identifier. In this case, values for the auto-generated PK field should not be provided by the user since it will be auto-generated by AsterixDB. Optionally, a filter can be created on a field to further optimize range queries with predicates on the filter’s field. (Refer to <a href="filters.html">Filter-Based LSM Index Acceleration</a> for more information about filters.)</p>
+<p>An External dataset is stored outside of AsterixDB (currently datasets in HDFS or on the local filesystem(s) of the cluster’s nodes are supported). External dataset support allows AQL queries to treat external data as though it were stored in AsterixDB, making it possible to query “legacy” file data (e.g., Hive data) without having to physically import it into AsterixDB. For an external dataset, an appropriate adapter must be selected to handle the nature of the desired external data. (See the <a href="externaldata.html">guide to external data</a> for more information on the available adapters.)</p>
+<p>When creating a dataset, it is possible to choose a merge policy that controls which of the underlaying LSM storage components to be merged. Currently, AsterixDB provides four different merge policies that can be configured per dataset: no-merge, constant, prefix, and correlated-prefix. The no-merge policy simply never merges disk components. While the constant policy merges disk components when the number of components reaches some constant number k, which can be configured by the user. The prefix policy relies on component sizes and the number of components to decide which components to merge. Specifically, 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’s sizes exceeds M or the number of components in the sequence exceeds another threshold C. If such a sequence of components exists, then each of the components in the sequence are merged together to form a single component. Finally, the correlated-prefix 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 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 default policy for AsterixDB 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>The following example creates an internal dataset for storing FacefookUserType objects. It specifies that their id field is their primary key.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">create internal dataset FacebookUsers(FacebookUserType) primary key id;
+</pre></div></div>
+
+<p>The following example creates an internal dataset for storing FbUserType objects. It specifies that their id field is their primary key. It also specifies that the id field is an auto-generated field, meaning that a randomly generated UUID value will be assigned to each object by the system. (A user should therefore not proivde a value for this field.) Note that the id field should be UUID.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">create internal dataset FbMsgs(FbUserType) primary key id autogenerated;
+</pre></div></div>
+
+<p>The next example creates an external dataset for storing LineitemType objects. The choice of the <tt>hdfs</tt> adapter means that its data will reside in HDFS. The create statement 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 (
+ ("hdfs"="hdfs://HOST:PORT"),
+ ("path"="HDFS_PATH"),
+ ("input-format"="text-input-format"),
+ ("format"="delimited-text"),
+ ("delimiter"="|"));
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Indices"></a>Indices</h4>
+
+<div>
+<div>
+<pre class="source">IndexSpecification ::= "index" Identifier IfNotExists "on" QualifiedName
+ "(" ( IndexField ) ( "," IndexField )* ")" ( "type" IndexType )? ( "enforced" )?
+IndexType ::= "btree"
+ | "rtree"
+ | "keyword"
+ | "ngram" "(" IntegerLiteral ")"
+ | "fulltext"
+</pre></div></div>
+
+<p>The create index 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>, <tt>ngram</tt>, and <tt>fulltext</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 index field is not required to be part of the datatype associated with a dataset if that datatype is declared as open and the field’s type is provided along with its type and the <tt>enforced</tt> keyword is specified in the end of index definition. <tt>Enforcing</tt> an open field will introduce a check that will make sure that the actual type of an indexed field (if the field exists in the object) always matches this specified (open) field type.</p>
+<p>The following example creates a btree index called fbAuthorIdx on the author-id field of the FacebookMessages dataset. This index can be useful for accelerating exact-match queries, range search queries, and joins involving the author-id field.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">create index fbAuthorIdx on FacebookMessages(author-id) type btree;
+</pre></div></div>
+
+<p>The following example creates an open btree index called fbSendTimeIdx on the open send-time field of the FacebookMessages dataset having datetime type. This index can be useful for accelerating exact-match queries, range search queries, and joins involving the send-time field.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">create index fbSendTimeIdx on FacebookMessages(send-time:datetime) type btree enforced;
+</pre></div></div>
+
+<p>The following example creates a btree index called twUserScrNameIdx on the screen-name field, which is a nested field of the user field in the TweetMessages dataset. This index can be useful for accelerating exact-match queries, range search queries, and joins involving the screen-name field.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">create index twUserScrNameIdx on TweetMessages(user.screen-name) type btree;
+</pre></div></div>
+
+<p>The following example creates an rtree index called fbSenderLocIdx on the sender-location field of the FacebookMessages dataset. This index can be useful for accelerating queries that use the <a href="functions.html#spatial-intersect"><tt>spatial-intersect</tt> function</a> in a predicate involving the sender-location field.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">create index fbSenderLocIndex on FacebookMessages(sender-location) type rtree;
+</pre></div></div>
+
+<p>The following example creates a 3-gram index called fbUserIdx on the name field of the FacebookUsers dataset. This index can be used to accelerate some similarity or substring maching queries on the name field. For details refer to the <a href="similarity.html#NGram_Index">document on similarity queries</a>.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">create index fbUserIdx on FacebookUsers(name) type ngram(3);
+</pre></div></div>
+
+<p>The following example creates a keyword index called fbMessageIdx on the message field of the FacebookMessages dataset. This keyword index can be used to optimize queries with token-based similarity predicates on the message field. For details refer to the <a href="similarity.html#Keyword_Index">document on similarity queries</a>.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">create index fbMessageIdx on FacebookMessages(message) type keyword;
+</pre></div></div>
+
+<p>The following example creates a full-text index called fbMessageIdx on the message field of the FacebookMessages dataset. This full-text index can be used to optimize queries with full-text search predicates on the message field. For details refer to the <a href="fulltext.html#toc">document on full-text queries</a>.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">create index fbMessageIdx on FacebookMessages(message) type fulltext;
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Functions"></a>Functions</h4>
+<p>The create function statement creates a named function that can then be used and reused in AQL queries. The body of a function can be any AQL expression involving the function’s parameters.</p>
+
+<div>
+<div>
+<pre class="source">FunctionSpecification ::= "function" FunctionOrTypeName IfNotExists ParameterList "{" Expression "}"
+</pre></div></div>
+
+<p>The following is a very simple example of a create function statement. It differs from the declare function example shown previously in that it results in a function that is persistently registered by name in the specified dataverse.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">create function add($a, $b) {
+ $a + $b
+};
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Removal"></a>Removal</h4>
+
+<div>
+<div>
+<pre class="source">DropStatement ::= "drop" ( "dataverse" Identifier IfExists
+ | "type" FunctionOrTypeName IfExists
+ | "dataset" QualifiedName IfExists
+ | "index" DoubleQualifiedName IfExists
+ | "function" FunctionSignature IfExists )
+IfExists ::= ( "if" "exists" )?
+</pre></div></div>
+
+<p>The drop statement in AQL is the inverse of the create statement. It can be used to drop dataverses, datatypes, datasets, indexes, and functions.</p>
+<p>The following examples illustrate uses of the drop statement.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">drop dataset FacebookUsers if exists;
+
+drop index FacebookUsers.fbSenderLocIndex;
+
+drop type FacebookUserType;
+
+drop dataverse TinySocial;
+
+drop function add;
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Import.2FExport_Statements"></a>Import/Export Statements</h3>
+
+<div>
+<div>
+<pre class="source">LoadStatement ::= "load" "dataset" QualifiedName "using" AdapterName Configuration ( "pre-sorted" )?
+</pre></div></div>
+
+<p>The load 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 load statement accepts the same adapters and the same parameters as external datasets. (See the <a href="externaldata.html">guide to external data</a> for more information on the available adapters.) If a dataset has an auto-generated primary key field, a file to be imported should not include that field in it.</p>
+<p>The following example shows how to bulk load the FacebookUsers dataset from an external file containing data that has been prepared in ADM format.</p>
+<div class="section">
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">load dataset FacebookUsers using localfs
+(("path"="localhost:///Users/zuck/AsterixDB/load/fbu.adm"),("format"="adm"));
+</pre></div></div>
+</div></div></div>
+<div class="section">
+<h3><a name="Modification_Statements"></a>Modification Statements</h3>
+<div class="section">
+<h4><a name="Insert"></a>Insert</h4>
+
+<div>
+<div>
+<pre class="source">InsertStatement ::= "insert" "into" "dataset" QualifiedName ( "as" Variable )? Query ( "returning" Query )?
+</pre></div></div>
+
+<p>The AQL insert statement is used to insert data into a dataset. The data to be inserted comes from an AQL query expression. The expression can be as simple as a constant expression, or in general it can be any legal AQL query. Inserts in AsterixDB are processed transactionally, with the scope of each insert transaction being 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 insert statement itself will be a single, atomic transaction. If the query part returns multiple objects, then each object inserted will be handled independently as a tranaction. If a dataset has an auto-generated primary key field, an insert statement should not include a value for that field in it. (The system will automatically extend the provided object with this additional field and a corresponding value.). The optional “as Variable” provides a variable binding for the inserted objects, which can be used in the “returning” clause. The optional “returning Query” allows users to run simple queries/functions on the objects returned by the insert. This query cannot refer to any datasets.</p>
+<p>The following example illustrates a query-based insertion.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">insert into dataset UsersCopy as $inserted (for $user in dataset FacebookUsers return $user ) returning $inserted.screen-name
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Delete"></a>Delete</h4>
+
+<div>
+<div>
+<pre class="source">DeleteStatement ::= "delete" Variable "from" "dataset" QualifiedName ( "where" Expression )?
+</pre></div></div>
+
+<p>The AQL delete 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 delete statement. Deletes in AsterixDB are processed transactionally, with the scope of each delete transaction being 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 delete statement itself will be a single, atomic transaction. If the expression identifies multiple objects, then each object deleted will be handled independently as a transaction.</p>
+<p>The following example illustrates a single-object deletion.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">delete $user from dataset FacebookUsers where $user.id = 8;
+</pre></div></div>
+</div></div>
+<div class="section">
+<h4><a name="Upsert"></a>Upsert</h4>
+
+<div>
+<div>
+<pre class="source">UpsertStatement ::= "upsert" "into" "dataset" QualifiedName Query
+</pre></div></div>
+
+<p>The AQL upsert statement is used to couple delete (if found) with insert data into a dataset. The data to be upserted comes from an AQL query expression. The expression can be as simple as a constant expression, or in general it can be any legal AQL query. Upserts in AsterixDB are processed transactionally, with the scope of each upsert transaction being the upsertion (deletion if found + insertion) of a single object plus its affiliated secondary index entries (if any). If the query part of an upsert returns a single object, then the upsert statement itself will be a single, atomic transaction. If the query part returns multiple objects, then each object upserted will be handled independently as a tranaction.</p>
+<p>The following example illustrates a query-based upsertion.</p>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">upsert into dataset Users (for $user in dataset FacebookUsers return $user)
+</pre></div></div>
+
+<p>We close this guide to AQL with one final example of a query expression.</p></div>
+<div class="section">
+<h5><a name="Example"></a>Example</h5>
+
+<div>
+<div>
+<pre class="source">for $praise in {{ "great", "brilliant", "awesome" }}
+return
+ string-concat(["AsterixDB is ", $praise])
+</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.7.1/aql/primer.html b/content/docs/0.9.7.1/aql/primer.html
new file mode 100644
index 0000000..347c22f
--- /dev/null
+++ b/content/docs/0.9.7.1/aql/primer.html
@@ -0,0 +1,866 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.8.1 from src/site/markdown/aql/primer.md at 2021-12-13
+ | 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="20211213" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>AsterixDB – AsterixDB 101: An ADM and AQL Primer</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: 2021-12-13</li>
+ <li id="projectVersion" class="pull-right">Version: 0.9.7.1</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="../interval_join.html" title="Support of Interval Joins"><span class="none"></span>Support of Interval 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 class="active"><a href="#"><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>AsterixDB 101: An ADM and AQL Primer</h1>
+<div class="section">
+<h2><a name="Welcome_to_AsterixDB.21"></a>Welcome to AsterixDB!</h2>
+<p>This document introduces the main features of AsterixDB’s data model (ADM) and query language (AQL) by example. The example is a simple scenario involving (synthetic) sample data modeled after data from the social domain. This document describes a set of sample ADM datasets, together with a set of illustrative AQL queries, to introduce you to the “AsterixDB user experience”. The complete set of steps required to create and load a handful of sample datasets, along with runnable queries and the expected results for each query, are included.</p>
+<p>This document assumes that you are at least vaguely familiar with AsterixDB and why you might want to use it. Most importantly, it assumes you already have a running instance of AsterixDB and that you know how to query it using AsterixDB’s basic web interface. For more information on these topics, you should go through the steps in <a href="../install.html">Installing Asterix Using Managix</a> before reading this document and make sure that you have a running AsterixDB instance ready to go. To get your feet wet, you should probably start with a simple local installation of AsterixDB on your favorite machine, accepting all of the default settings that Managix offers. Later you can graduate to trying AsterixDB on a cluster, its real intended home (since it targets Big Data). (Note: With the exception of specifying the correct locations where you put the source data for this example, there should no changes needed in your ADM or AQL statements to run the examples locally and/or to run them on a cluster when you are ready to take that step.)</p>
+<p>As you read through this document, you should try each step for yourself on your own AsterixDB instance. Once you have reached the end, you will be fully armed and dangerous, with all the basic AsterixDB knowledge that you’ll need to start down the path of modeling, storing, and querying your own semistructured data.</p></div>
+<div class="section">
+<h2><a name="ADM:_Modeling_Semistructured_Data_in_AsterixDB"></a>ADM: Modeling Semistructured Data in AsterixDB</h2>
+<p>In this section you will learn all about modeling Big Data using ADM, the data model of the AsterixDB BDMS.</p>
+<div class="section">
+<h3><a name="Dataverses.2C_Datatypes.2C_and_Datasets"></a>Dataverses, Datatypes, and Datasets</h3>
+<p>The top-level organizing concept in the AsterixDB world is the <i>dataverse</i>. A dataverse—short for “data universe”—is a place (similar to a database in a relational DBMS) in which to create and manage the types, datasets, functions, and other artifacts for a given AsterixDB application. When you start using an AsterixDB instance for the first time, it starts out “empty”; it contains no data other than the AsterixDB system catalogs (which live in a special dataverse called the Metadata dataverse). To store your data in AsterixDB, you will first create a dataverse and then you use it for the <i>datatypes</i> and <i>datasets</i> for managing your own data. A datatype tells AsterixDB what you know (or more accurately, what you want it to know) a priori about one of the kinds of data instances that you want AsterixDB to hold for you. A dataset is a collection of data instances of a datatype, and AsterixDB makes sure that the data instances that you put in it conform to its specified type. Since AsterixDB targets semistructured data, you can use <i>open</i> datatypes and tell it as little or as much as you wish about your data up front; the more you tell it up front, the less information it will have to store repeatedly in the individual data instances that you give it. Instances of open datatypes are permitted to have additional content, beyond what the datatype says, as long as they at least contain the information prescribed by the datatype definition. Open typing allows data to vary from one instance to another and it leaves wiggle room for application evolution in terms of what might need to be stored in the future. If you want to restrict data instances in a dataset to have only what the datatype says, and nothing extra, you can define a <i>closed</i> datatype for that dataset and AsterixDB will keep users from storing objects that have extra data in them. Datatypes are open by default unless you tell AsterixDB otherwise. Let’s put these concepts to work</p>
+<p>Our little sample scenario involves information about users of two hypothetical social networks, Gleambook and Chirp, and their messages. We’ll start by defining a dataverse called “TinySocial” to hold our datatypes and datasets. The AsterixDB data model (ADM) is essentially a superset of JSON—it’s what you get by extending JSON with more data types and additional data modeling constructs borrowed from object databases. The following shows how we can create the TinySocial dataverse plus a set of ADM types for modeling Chirp users, their Chirps, Gleambook users, their users’ employment information, and their messages. (Note: Keep in mind that this is just a tiny and somewhat silly example intended for illustrating some of the key features of AsterixDB. :-))</p>
+
+<div>
+<div>
+<pre class="source"> drop dataverse TinySocial if exists;
+ create dataverse TinySocial;
+ use dataverse TinySocial;
+
+ create type ChirpUserType as {
+ screenName: string,
+ lang: string,
+ friendsCount: int,
+ statusesCount: int,
+ name: string,
+ followersCount: int
+ };
+
+ create type ChirpMessageType as closed {
+ chirpId: string,
+ user: ChirpUserType,
+ senderLocation: point?,
+ sendTime: datetime,
+ referredTopics: {{ string }},
+ messageText: string
+ };
+
+ create type EmploymentType as {
+ organizationName: string,
+ startDate: date,
+ endDate: date?
+ };
+
+ create type GleambookUserType as {
+ id: int,
+ alias: string,
+ name: string,
+ userSince: datetime,
+ friendIds: {{ int }},
+ employment: [EmploymentType]
+ };
+
+ create type GleambookMessageType as {
+ messageId: int,
+ authorId: int,
+ inResponseTo: int?,
+ senderLocation: point?,
+ message: string
+ };
+</pre></div></div>
+
+<p>The first three lines above tell AsterixDB to drop the old TinySocial dataverse, if one already exists, and then to create a brand new one and make it the focus of the statements that follow. The first <i>create type</i> statement creates a datatype for holding information about Chirp users. It is a object type with a mix of integer and string data, very much like a (flat) relational tuple. The indicated fields are all mandatory, but because the type is open, additional fields are welcome. The second statement creates a datatype for Chirp messages; this shows how to specify a closed type. Interestingly (based on one of Chirp’s APIs), each Chirp message actually embeds an instance of the sending user’s information (current as of when the message was sent), so this is an example of a nested object in ADM. Chirp messages can optionally contain the sender’s location, which is modeled via the senderLocation field of spatial type <i>point</i>; the question mark following the field type indicates its optionality. An optional field is like a nullable field in SQL—it may be present or missing, but when it’s present, its value’s data type will conform to the datatype’s specification. The sendTime field illustrates the use of a temporal primitive type, <i>datetime</i>. Lastly, the referredTopics field illustrates another way that ADM is richer than the relational model; this field holds a bag (<i>a.k.a.</i> an unordered list) of strings. Since the overall datatype definition for Chirp messages says “closed”, the fields that it lists are the only fields that instances of this type will be allowed to contain. The next two <i>create type</i> statements create a object type for holding information about one component of the employment history of a Gleambook user and then a object type for holding the user information itself. The Gleambook user type highlights a few additional ADM data model features. Its friendIds field is a bag of integers, presumably the Gleambook user ids for this user’s friends, and its employment field is an ordered list of employment objects. The final <i>create type</i> statement defines a type for handling the content of a Gleambook message in our hypothetical social data storage scenario.</p>
+<p>Before going on, we need to once again emphasize the idea that AsterixDB is aimed at storing and querying not just Big Data, but Big <i>Semistructured</i> Data. This means that most of the fields listed in the <i>create type</i> statements above could have been omitted without changing anything other than the resulting size of stored data instances on disk. AsterixDB stores its information about the fields defined a priori as separate metadata, whereas the information about other fields that are “just there” in instances of open datatypes is stored with each instance—making for more bits on disk and longer times for operations affected by data size (e.g., dataset scans). The only fields that <i>must</i> be specified a priori are the primary key fields of each dataset.</p></div>
+<div class="section">
+<h3><a name="Creating_Datasets_and_Indexes"></a>Creating Datasets and Indexes</h3>
+<p>Now that we have defined our datatypes, we can move on and create datasets to store the actual data. (If we wanted to, we could even have several named datasets based on any one of these datatypes.) We can do this as follows, utilizing the DDL capabilities of AsterixDB.</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ create dataset GleambookUsers(GleambookUserType)
+ primary key id;
+
+ create dataset GleambookMessages(GleambookMessageType)
+ primary key messageId;
+
+ create dataset ChirpUsers(ChirpUserType)
+ primary key screenName;
+
+ create dataset ChirpMessages(ChirpMessageType)
+ primary key chirpId
+ hints(cardinality=100);
+
+ create index gbUserSinceIdx on GleambookUsers(userSince);
+ create index gbAuthorIdx on GleambookMessages(authorId) type btree;
+ create index gbSenderLocIndex on GleambookMessages(senderLocation) type rtree;
+ create index gbMessageIdx on GleambookMessages(message) type keyword;
+
+ for $ds in dataset Metadata.Dataset return $ds;
+ for $ix in dataset Metadata.Index return $ix;
+</pre></div></div>
+
+<p>The DDL statements above create four datasets for holding our social data in the TinySocial dataverse: GleambookUsers, GleambookMessages, ChirpUsers, and ChirpMessages. The first <i>create dataset</i> statement creates the GleambookUsers data set. It specifies that this dataset will store data instances conforming to GleambookUserType and that it has a primary key which is the id field of each instance. The primary key information is used by AsterixDB to uniquely identify instances for the purpose of later lookup and for use in secondary indexes. Each AsterixDB dataset is stored (and indexed) in the form of a B+ tree on primary key; secondary indexes point to their indexed data by primary key. In AsterixDB clusters, the primary key is also used to hash-partition (<i>a.k.a.</i> shard) the dataset across the nodes of the cluster. The next three <i>create dataset</i> statements are similar. The last one illustrates an optional clause for providing useful hints to AsterixDB. In this case, the hint tells AsterixDB that the dataset definer is anticipating that the ChirpMessages dataset will contain roughly 100 objects; knowing this can help AsterixDB to more efficiently manage and query this dataset. (AsterixDB does not yet gather and maintain data statistics; it will currently, abitrarily, assume a cardinality of one million objects per dataset in the absence of such an optional definition-time hint.)</p>
+<p>The <i>create dataset</i> statements above are followed by four more DDL statements, each of which creates a secondary index on a field of one of the datasets. The first one indexes the GleambookUsers dataset on its userSince field. This index will be a B+ tree index; its type is unspecified and <i>btree</i> is the default type. The other three illustrate how you can explicitly specify the desired type of index. In addition to btree, <i>rtree</i> and inverted <i>keyword</i> indexes are supported by AsterixDB. Indexes can also have composite keys, and more advanced text indexing is available as well (ngram(k), where k is the desired gram length).</p></div>
+<div class="section">
+<h3><a name="Querying_the_Metadata_Dataverse"></a>Querying the Metadata Dataverse</h3>
+<p>The last two statements above show how you can use queries in AQL to examine the AsterixDB system catalogs and tell what artifacts you have created. Just as relational DBMSs use their own tables to store their catalogs, AsterixDB uses its own datasets to persist descriptions of its datasets, datatypes, indexes, and so on. Running the first of the two queries above will list all of your newly created datasets, and it will also show you a full list of all the metadata datasets. (You can then explore from there on your own if you are curious) These last two queries also illustrate one other factoid worth knowing: AsterixDB allows queries to span dataverses by allowing the optional use of fully-qualified dataset names (i.e., <i>dataversename.datasetname</i>) to reference datasets that live in a dataverse other than the one that was named in the most recently executed <i>use dataverse</i> directive.</p></div></div>
+<div class="section">
+<h2><a name="Loading_Data_Into_AsterixDB"></a>Loading Data Into AsterixDB</h2>
+<p>Okay, so far so good—AsterixDB is now ready for data, so let’s give it some data to store. Our next task will be to insert some sample data into the four datasets that we just defined. Here we will load a tiny set of objects, defined in ADM format (a superset of JSON), into each dataset. In the boxes below you can see insert statements with a list of the objects to be inserted. The files themselves are also linked. Take a few minutes to look carefully at each of the sample data sets. This will give you a better sense of the nature of the data that we are about to load and query. We should note that ADM format is a textual serialization of what AsterixDB will actually store; when persisted in AsterixDB, the data format will be binary and the data in the predefined fields of the data instances will be stored separately from their associated field name and type metadata.</p>
+<p><a href="../data/chu.adm">Chirp Users</a></p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ insert into dataset ChirpUsers
+ ([
+ {"screenName":"NathanGiesen@211","lang":"en","friendsCount":18,"statusesCount":473,"name":"Nathan Giesen","followersCount":49416},
+ {"screenName":"ColineGeyer@63","lang":"en","friendsCount":121,"statusesCount":362,"name":"Coline Geyer","followersCount":17159},
+ {"screenName":"NilaMilliron_tw","lang":"en","friendsCount":445,"statusesCount":164,"name":"Nila Milliron","followersCount":22649},
+ {"screenName":"ChangEwing_573","lang":"en","friendsCount":182,"statusesCount":394,"name":"Chang Ewing","followersCount":32136}
+ ]);
+</pre></div></div>
+
+<p><a href="../data/chm.adm">Chirp Messages</a></p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ insert into dataset ChirpMessages
+ ([
+ {"chirpId":"1","user":{"screenName":"NathanGiesen@211","lang":"en","friendsCount":39339,"statusesCount":473,"name":"Nathan Giesen","followersCount":49416},"senderLocation":point("47.44,80.65"),"sendTime":datetime("2008-04-26T10:10:00"),"referredTopics":{{"product-z","customization"}},"messageText":" love product-z its customization is good:)"},
+ {"chirpId":"2","user":{"screenName":"ColineGeyer@63","lang":"en","friendsCount":121,"statusesCount":362,"name":"Coline Geyer","followersCount":17159},"senderLocation":point("32.84,67.14"),"sendTime":datetime("2010-05-13T10:10:00"),"referredTopics":{{"ccast","shortcut-menu"}},"messageText":" like ccast its shortcut-menu is awesome:)"},
+ {"chirpId":"3","user":{"screenName":"NathanGiesen@211","lang":"en","friendsCount":39339,"statusesCount":473,"name":"Nathan Giesen","followersCount":49416},"senderLocation":point("29.72,75.8"),"sendTime":datetime("2006-11-04T10:10:00"),"referredTopics":{{"product-w","speed"}},"messageText":" like product-w the speed is good:)"},
+ {"chirpId":"4","user":{"screenName":"NathanGiesen@211","lang":"en","friendsCount":39339,"statusesCount":473,"name":"Nathan Giesen","followersCount":49416},"senderLocation":point("39.28,70.48"),"sendTime":datetime("2011-12-26T10:10:00"),"referredTopics":{{"product-b","voice-command"}},"messageText":" like product-b the voice-command is mind-blowing:)"},
+ {"chirpId":"5","user":{"screenName":"NathanGiesen@211","lang":"en","friendsCount":39339,"statusesCount":473,"name":"Nathan Giesen","followersCount":49416},"senderLocation":point("40.09,92.69"),"sendTime":datetime("2006-08-04T10:10:00"),"referredTopics":{{"product-w","speed"}},"messageText":" can't stand product-w its speed is terrible:("},
+ {"chirpId":"6","user":{"screenName":"ColineGeyer@63","lang":"en","friendsCount":121,"statusesCount":362,"name":"Coline Geyer","followersCount":17159},"senderLocation":point("47.51,83.99"),"sendTime":datetime("2010-05-07T10:10:00"),"referredTopics":{{"x-phone","voice-clarity"}},"messageText":" like x-phone the voice-clarity is good:)"},
+ {"chirpId":"7","user":{"screenName":"ChangEwing_573","lang":"en","friendsCount":182,"statusesCount":394,"name":"Chang Ewing","followersCount":32136},"senderLocation":point("36.21,72.6"),"sendTime":datetime("2011-08-25T10:10:00"),"referredTopics":{{"product-y","platform"}},"messageText":" like product-y the platform is good"},
+ {"chirpId":"8","user":{"screenName":"NathanGiesen@211","lang":"en","friendsCount":39339,"statusesCount":473,"name":"Nathan Giesen","followersCount":49416},"senderLocation":point("46.05,93.34"),"sendTime":datetime("2005-10-14T10:10:00"),"referredTopics":{{"product-z","shortcut-menu"}},"messageText":" like product-z the shortcut-menu is awesome:)"},
+ {"chirpId":"9","user":{"screenName":"NathanGiesen@211","lang":"en","friendsCount":39339,"statusesCount":473,"name":"Nathan Giesen","followersCount":49416},"senderLocation":point("36.86,74.62"),"sendTime":datetime("2012-07-21T10:10:00"),"referredTopics":{{"ccast","voicemail-service"}},"messageText":" love ccast its voicemail-service is awesome"},
+ {"chirpId":"10","user":{"screenName":"ColineGeyer@63","lang":"en","friendsCount":121,"statusesCount":362,"name":"Coline Geyer","followersCount":17159},"senderLocation":point("29.15,76.53"),"sendTime":datetime("2008-01-26T10:10:00"),"referredTopics":{{"ccast","voice-clarity"}},"messageText":" hate ccast its voice-clarity is OMG:("},
+ {"chirpId":"11","user":{"screenName":"NilaMilliron_tw","lang":"en","friendsCount":445,"statusesCount":164,"name":"Nila Milliron","followersCount":22649},"senderLocation":point("37.59,68.42"),"sendTime":datetime("2008-03-09T10:10:00"),"referredTopics":{{"x-phone","platform"}},"messageText":" can't stand x-phone its platform is terrible"},
+ {"chirpId":"12","user":{"screenName":"OliJackson_512","lang":"en","friendsCount":445,"statusesCount":164,"name":"Oli Jackson","followersCount":22649},"senderLocation":point("24.82,94.63"),"sendTime":datetime("2010-02-13T10:10:00"),"referredTopics":{{"product-y","voice-command"}},"messageText":" like product-y the voice-command is amazing:)"}
+ ]);
+</pre></div></div>
+
+<p><a href="../data/gbu.adm">Gleambook Users</a></p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ insert into dataset GleambookUsers
+ ([
+ {"id":1,"alias":"Margarita","name":"MargaritaStoddard","nickname":"Mags","userSince":datetime("2012-08-20T10:10:00"),"friendIds":{{2,3,6,10}},"employment":[{"organizationName":"Codetechno","startDate":date("2006-08-06")},{"organizationName":"geomedia","startDate":date("2010-06-17"),"endDate":date("2010-01-26")}],"gender":"F"},
+ {"id":2,"alias":"Isbel","name":"IsbelDull","nickname":"Izzy","userSince":datetime("2011-01-22T10:10:00"),"friendIds":{{1,4}},"employment":[{"organizationName":"Hexviafind","startDate":date("2010-04-27")}]},
+ {"id":3,"alias":"Emory","name":"EmoryUnk","userSince":datetime("2012-07-10T10:10:00"),"friendIds":{{1,5,8,9}},"employment":[{"organizationName":"geomedia","startDate":date("2010-06-17"),"endDate":date("2010-01-26")}]},
+ {"id":4,"alias":"Nicholas","name":"NicholasStroh","userSince":datetime("2010-12-27T10:10:00"),"friendIds":{{2}},"employment":[{"organizationName":"Zamcorporation","startDate":date("2010-06-08")}]},
+ {"id":5,"alias":"Von","name":"VonKemble","userSince":datetime("2010-01-05T10:10:00"),"friendIds":{{3,6,10}},"employment":[{"organizationName":"Kongreen","startDate":date("2010-11-27")}]},
+ {"id":6,"alias":"Willis","name":"WillisWynne","userSince":datetime("2005-01-17T10:10:00"),"friendIds":{{1,3,7}},"employment":[{"organizationName":"jaydax","startDate":date("2009-05-15")}]},
+ {"id":7,"alias":"Suzanna","name":"SuzannaTillson","userSince":datetime("2012-08-07T10:10:00"),"friendIds":{{6}},"employment":[{"organizationName":"Labzatron","startDate":date("2011-04-19")}]},
+ {"id":8,"alias":"Nila","name":"NilaMilliron","userSince":datetime("2008-01-01T10:10:00"),"friendIds":{{3}},"employment":[{"organizationName":"Plexlane","startDate":date("2010-02-28")}]},
+ {"id":9,"alias":"Woodrow","name":"WoodrowNehling","nickname":"Woody","userSince":datetime("2005-09-20T10:10:00"),"friendIds":{{3,10}},"employment":[{"organizationName":"Zuncan","startDate":date("2003-04-22"),"endDate":date("2009-12-13")}]},
+ {"id":10,"alias":"Bram","name":"BramHatch","userSince":datetime("2010-10-16T10:10:00"),"friendIds":{{1,5,9}},"employment":[{"organizationName":"physcane","startDate":date("2007-06-05"),"endDate":date("2011-11-05")}]}
+ ]);
+</pre></div></div>
+
+<p><a href="../data/gbm.adm">Gleambook Messages</a></p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ insert into dataset GleambookMessages
+ ([
+ {"messageId":1,"authorId":3,"inResponseTo":2,"senderLocation":point("47.16,77.75"),"message":" love product-b its shortcut-menu is awesome:)"},
+ {"messageId":2,"authorId":1,"inResponseTo":4,"senderLocation":point("41.66,80.87"),"message":" dislike x-phone its touch-screen is horrible"},
+ {"messageId":3,"authorId":2,"inResponseTo":4,"senderLocation":point("48.09,81.01"),"message":" like product-y the plan is amazing"},
+ {"messageId":4,"authorId":1,"inResponseTo":2,"senderLocation":point("37.73,97.04"),"message":" can't stand acast the network is horrible:("},
+ {"messageId":5,"authorId":6,"inResponseTo":2,"senderLocation":point("34.7,90.76"),"message":" love product-b the customization is mind-blowing"},
+ {"messageId":6,"authorId":2,"inResponseTo":1,"senderLocation":point("31.5,75.56"),"message":" like product-z its platform is mind-blowing"},
+ {"messageId":7,"authorId":5,"inResponseTo":15,"senderLocation":point("32.91,85.05"),"message":" dislike product-b the speed is horrible"},
+ {"messageId":8,"authorId":1,"inResponseTo":11,"senderLocation":point("40.33,80.87"),"message":" like ccast the 3G is awesome:)"},
+ {"messageId":9,"authorId":3,"inResponseTo":12,"senderLocation":point("34.45,96.48"),"message":" love ccast its wireless is good"},
+ {"messageId":10,"authorId":1,"inResponseTo":12,"senderLocation":point("42.5,70.01"),"message":" can't stand product-w the touch-screen is terrible"},
+ {"messageId":11,"authorId":1,"inResponseTo":1,"senderLocation":point("38.97,77.49"),"message":" can't stand acast its plan is terrible"},
+ {"messageId":12,"authorId":10,"inResponseTo":6,"senderLocation":point("42.26,77.76"),"message":" can't stand product-z its voicemail-service is OMG:("},
+ {"messageId":13,"authorId":10,"inResponseTo":4,"senderLocation":point("42.77,78.92"),"message":" dislike x-phone the voice-command is bad:("},
+ {"messageId":14,"authorId":9,"inResponseTo":12,"senderLocation":point("41.33,85.28"),"message":" love acast its 3G is good:)"},
+ {"messageId":15,"authorId":7,"inResponseTo":11,"senderLocation":point("44.47,67.11"),"message":" like x-phone the voicemail-service is awesome"}
+ ]);
+</pre></div></div>
+</div>
+<div class="section">
+<h2><a name="AQL:_Querying_Your_AsterixDB_Data"></a>AQL: Querying Your AsterixDB Data</h2>
+<p>Congratulations! You now have sample social data stored (and indexed) in AsterixDB. (You are part of an elite and adventurous group of individuals. :-)) Now that you have successfully loaded the provided sample data into the datasets that we defined, you can start running queries against them.</p>
+<p>The query language for AsterixDB is AQL—the Asterix Query Language. AQL is loosely based on XQuery, the language developed and standardized in the early to mid 2000’s by the World Wide Web Consortium (W3C) for querying semistructured data stored in their XML format. We have tossed all of the “XML cruft” out of their language but retained many of its core ideas. We did this because its design was developed over a period of years by a diverse committee of smart and experienced language designers, including “SQL people”, “functional programming people”, and “XML people”, all of whom were focused on how to design a new query language that operates well over semistructured data. (We decided to stand on their shoulders instead of starting from scratch and revisiting many of the same issues.) Note that AQL is not SQL and not based on SQL: In other words, AsterixDB is fully “NoSQL compliant”. :-)</p>
+<p>In this section we introduce AQL via a set of example queries, along with their expected results, based on the data above, to help you get started. Many of the most important features of AQL are presented in this set of representative queries. You can find more details in the document on the <a href="datamodel.html">Asterix Data Model (ADM)</a>, in the <a href="manual.html">AQL Reference Manual</a>, and a complete list of built-in functions is available in the <a href="functions.html">Asterix Functions</a> document.</p>
+<p>AQL is an expression language. Even the expression 1+1 is a valid AQL query that evaluates to 2. (Try it for yourself! Okay, maybe that’s <i>not</i> the best use of a 512-node shared-nothing compute cluster.) Most useful AQL queries will be based on the <i>FLWOR</i> (pronounced “flower”) expression structure that AQL has borrowed from XQuery ((<a class="externalLink" href="http://en.wikipedia.org/wiki/FLWOR">http://en.wikipedia.org/wiki/FLWOR</a>)). The FLWOR expression syntax supports both the incremental binding (<i>for</i>) of variables to ADM data instances in a dataset (or in the result of any AQL expression, actually) and the full binding (<i>let</i>) of variables to entire intermediate results in a fashion similar to temporary views in the SQL world. FLWOR is an acronym that is short for <i>for</i>-<i>let</i>-<i>where</i>-<i>order by</i>-<i>return</i>, naming five of the most frequently used clauses from the syntax of a full AQL query. AQL also includes <i>group by</i> and <i>limit</i> clauses, as you will see shortly. Roughly speaking, for SQL afficiandos, the <i>for</i> clause in AQL is like the <i>from</i> clause in SQL, the <i>return</i> clause in AQL is like the <i>select</i> clause in SQL (but appears at the end instead of the beginning of a query), the <i>let</i> clause in AQL is like SQL’s <i>with</i> clause, and the <i>where</i> and <i>order by</i> clauses in both languages are similar.</p>
+<p>Based on user demand, in order to let SQL afficiandos to write AQL queries in their favored ways, AQL supports a few synonyms: <i>from</i> for <i>for</i>, <i>select</i> for <i>return</i>, <i>with</i> for <i>let</i>, and <i>keeping</i> for <i>with</i> in the group by clause. These have been found to help die-hard SQL fans to feel a little more at home in AQL and to be less likely to (mis)interpret <i>for</i> as imperative looping, <i>return</i> as returning from a function call, and so on.</p>
+<p>Enough talk! Let’s go ahead and try writing some queries and see about learning AQL by example.</p>
+<div class="section">
+<h3><a name="Query_0-A_-_Exact-Match_Lookup"></a>Query 0-A - Exact-Match Lookup</h3>
+<p>For our first query, let’s find a Gleambook user based on his or her user id. Suppose the user we want is the user whose id is 8:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ for $user in dataset GleambookUsers
+ where $user.id = 8
+ return $user;
+</pre></div></div>
+
+<p>The query’s <i>for</i> clause binds the variable <tt>$user</tt> incrementally to the data instances residing in the dataset named GleambookUsers. Its <i>where</i> clause selects only those bindings having a user id of interest, filtering out the rest. The <i>return</i> clause returns the (entire) data instance for each binding that satisfies the predicate. Since this dataset is indexed on user id (its primary key), this query will be done via a quick index lookup.</p>
+<p>The expected result for our sample data is as follows:</p>
+
+<div>
+<div>
+<pre class="source"> { "id": 8, "alias": "Nila", "name": "NilaMilliron", "userSince": datetime("2008-01-01T10:10:00.000Z"), "friendIds": {{ 3 }}, "employment": [ { "organizationName": "Plexlane", "startDate": date("2010-02-28") } ] }
+</pre></div></div>
+
+<p>Note the using the SQL keyword synonyms, another way of phrasing the same query would be:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ from $user in dataset GleambookUsers
+ where $user.id = 8
+ select $user;
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Query_0-B_-_Range_Scan"></a>Query 0-B - Range Scan</h3>
+<p>AQL, like SQL, supports a variety of different predicates. For example, for our next query, let’s find the Gleambook users whose ids are in the range between 2 and 4:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ for $user in dataset GleambookUsers
+ where $user.id >= 2 and $user.id <= 4
+ return $user;
+</pre></div></div>
+
+<p>This query’s expected result, also evaluable using the primary index on user id, is:</p>
+
+<div>
+<div>
+<pre class="source"> { "id": 2, "alias": "Isbel", "name": "IsbelDull", "userSince": datetime("2011-01-22T10:10:00.000Z"), "friendIds": {{ 1, 4 }}, "employment": [ { "organizationName": "Hexviafind", "startDate": date("2010-04-27") } ], "nickname": "Izzy" }
+ { "id": 4, "alias": "Nicholas", "name": "NicholasStroh", "userSince": datetime("2010-12-27T10:10:00.000Z"), "friendIds": {{ 2 }}, "employment": [ { "organizationName": "Zamcorporation", "startDate": date("2010-06-08") } ] }
+ { "id": 3, "alias": "Emory", "name": "EmoryUnk", "userSince": datetime("2012-07-10T10:10:00.000Z"), "friendIds": {{ 1, 5, 8, 9 }}, "employment": [ { "organizationName": "geomedia", "startDate": date("2010-06-17"), "endDate": date("2010-01-26") } ] }
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Query_1_-_Other_Query_Filters"></a>Query 1 - Other Query Filters</h3>
+<p>AQL can do range queries on any data type that supports the appropriate set of comparators. As an example, this next query retrieves the Gleambook users who joined between July 22, 2010 and July 29, 2012:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ for $user in dataset GleambookUsers
+ where $user.userSince >= datetime('2010-07-22T00:00:00')
+ and $user.userSince <= datetime('2012-07-29T23:59:59')
+ return $user;
+</pre></div></div>
+
+<p>The expected result for this query, also an indexable query, is as follows:</p>
+
+<div>
+<div>
+<pre class="source"> { "id": 2, "alias": "Isbel", "name": "IsbelDull", "userSince": datetime("2011-01-22T10:10:00.000Z"), "friendIds": {{ 1, 4 }}, "employment": [ { "organizationName": "Hexviafind", "startDate": date("2010-04-27") } ], "nickname": "Izzy" }
+ { "id": 4, "alias": "Nicholas", "name": "NicholasStroh", "userSince": datetime("2010-12-27T10:10:00.000Z"), "friendIds": {{ 2 }}, "employment": [ { "organizationName": "Zamcorporation", "startDate": date("2010-06-08") } ] }
+ { "id": 10, "alias": "Bram", "name": "BramHatch", "userSince": datetime("2010-10-16T10:10:00.000Z"), "friendIds": {{ 1, 5, 9 }}, "employment": [ { "organizationName": "physcane", "startDate": date("2007-06-05"), "endDate": date("2011-11-05") } ] }
+ { "id": 3, "alias": "Emory", "name": "EmoryUnk", "userSince": datetime("2012-07-10T10:10:00.000Z"), "friendIds": {{ 1, 5, 8, 9 }}, "employment": [ { "organizationName": "geomedia", "startDate": date("2010-06-17"), "endDate": date("2010-01-26") } ] }
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Query_2-A_-_Equijoin"></a>Query 2-A - Equijoin</h3>
+<p>In addition to simply binding variables to data instances and returning them “whole”, an AQL query can construct new ADM instances to return based on combinations of its variable bindings. This gives AQL the power to do joins much like those done using multi-table <i>from</i> clauses in SQL. For example, suppose we wanted a list of all Gleambook users paired with their associated messages, with the list enumerating the author name and the message text associated with each Gleambook message. We could do this as follows in AQL:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ for $user in dataset GleambookUsers
+ for $message in dataset GleambookMessages
+ where $message.authorId = $user.id
+ return {
+ "uname": $user.name,
+ "message": $message.message
+ };
+</pre></div></div>
+
+<p>The result of this query is a sequence of new ADM instances, one for each author/message pair. Each instance in the result will be an ADM object containing two fields, “uname” and “message”, containing the user’s name and the message text, respectively, for each author/message pair. (Note that “uname” and “message” are both simple AQL expressions themselves—so in the most general case, even the resulting field names can be computed as part of the query, making AQL a very powerful tool for slicing and dicing semistructured data.)</p>
+<p>The expected result of this example AQL join query for our sample data set is:</p>
+
+<div>
+<div>
+<pre class="source"> { "uname": "WillisWynne", "message": " love product-b the customization is mind-blowing" }
+ { "uname": "MargaritaStoddard", "message": " can't stand acast its plan is terrible" }
+ { "uname": "MargaritaStoddard", "message": " dislike x-phone its touch-screen is horrible" }
+ { "uname": "MargaritaStoddard", "message": " can't stand acast the network is horrible:(" }
+ { "uname": "MargaritaStoddard", "message": " like ccast the 3G is awesome:)" }
+ { "uname": "MargaritaStoddard", "message": " can't stand product-w the touch-screen is terrible" }
+ { "uname": "IsbelDull", "message": " like product-z its platform is mind-blowing" }
+ { "uname": "IsbelDull", "message": " like product-y the plan is amazing" }
+ { "uname": "WoodrowNehling", "message": " love acast its 3G is good:)" }
+ { "uname": "BramHatch", "message": " can't stand product-z its voicemail-service is OMG:(" }
+ { "uname": "BramHatch", "message": " dislike x-phone the voice-command is bad:(" }
+ { "uname": "EmoryUnk", "message": " love product-b its shortcut-menu is awesome:)" }
+ { "uname": "EmoryUnk", "message": " love ccast its wireless is good" }
+ { "uname": "VonKemble", "message": " dislike product-b the speed is horrible" }
+ { "uname": "SuzannaTillson", "message": " like x-phone the voicemail-service is awesome" }
+</pre></div></div>
+
+<p>Again, as an aside, note that the same query expressed using AQL’s SQL keyword synonyms would be:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ from $user in dataset GleambookUsers
+ from $message in dataset GleambookMessages
+ where $message.authorId = $user.id
+ select {
+ "uname": $user.name,
+ "message": $message.message
+ };
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Query_2-B_-_Index_join"></a>Query 2-B - Index join</h3>
+<p>By default, AsterixDB evaluates equijoin queries using hash-based join methods that work well for doing ad hoc joins of very large data sets (<a class="externalLink" href="http://en.wikipedia.org/wiki/Hash_join">http://en.wikipedia.org/wiki/Hash_join</a>). On a cluster, hash partitioning is employed as AsterixDB’s divide-and-conquer strategy for computing large parallel joins. AsterixDB includes other join methods, but in the absence of data statistics and selectivity estimates, it doesn’t (yet) have the know-how to intelligently choose among its alternatives. We therefore asked ourselves the classic question—WWOD?—What Would Oracle Do?—and in the interim, AQL includes a clunky (but useful) hint-based mechanism for addressing the occasional need to suggest to AsterixDB which join method it should use for a particular AQL query.</p>
+<p>The following query is similar to Query 2-A but includes a suggestion to AsterixDB that it should consider employing an index-based nested-loop join technique to process the query:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ for $user in dataset GleambookUsers
+ for $message in dataset GleambookMessages
+ where $message.authorId /*+ indexnl */ = $user.id
+ return {
+ "uname": $user.name,
+ "message": $message.message
+ };
+</pre></div></div>
+
+<p>The expected result is (of course) the same as before, modulo the order of the instances. Result ordering is (intentionally) undefined in AQL in the absence of an <i>order by</i> clause. The query result for our sample data in this case is:</p>
+
+<div>
+<div>
+<pre class="source"> { "uname": "IsbelDull", "message": " like product-z its platform is mind-blowing" }
+ { "uname": "MargaritaStoddard", "message": " can't stand acast its plan is terrible" }
+ { "uname": "BramHatch", "message": " can't stand product-z its voicemail-service is OMG:(" }
+ { "uname": "WoodrowNehling", "message": " love acast its 3G is good:)" }
+ { "uname": "EmoryUnk", "message": " love product-b its shortcut-menu is awesome:)" }
+ { "uname": "MargaritaStoddard", "message": " dislike x-phone its touch-screen is horrible" }
+ { "uname": "MargaritaStoddard", "message": " can't stand acast the network is horrible:(" }
+ { "uname": "BramHatch", "message": " dislike x-phone the voice-command is bad:(" }
+ { "uname": "SuzannaTillson", "message": " like x-phone the voicemail-service is awesome" }
+ { "uname": "MargaritaStoddard", "message": " like ccast the 3G is awesome:)" }
+ { "uname": "EmoryUnk", "message": " love ccast its wireless is good" }
+ { "uname": "MargaritaStoddard", "message": " can't stand product-w the touch-screen is terrible" }
+ { "uname": "IsbelDull", "message": " like product-y the plan is amazing" }
+ { "uname": "WillisWynne", "message": " love product-b the customization is mind-blowing" }
+ { "uname": "VonKemble", "message": " dislike product-b the speed is horrible" }
+</pre></div></div>
+
+<p>(It is worth knowing, with respect to influencing AsterixDB’s query evaluation, that nested <i>for</i> clauses—a.k.a. joins— are currently evaluated with the “outer” clause probing the data of the “inner” clause.)</p></div>
+<div class="section">
+<h3><a name="Query_3_-_Nested_Outer_Join"></a>Query 3 - Nested Outer Join</h3>
+<p>In order to support joins between tables with missing/dangling join tuples, the designers of SQL ended up shoe-horning a subset of the relational algebra into SQL’s <i>from</i> clause syntax—and providing a variety of join types there for users to choose from. Left outer joins are particularly important in SQL, e.g., to print a summary of customers and orders, grouped by customer, without omitting those customers who haven’t placed any orders yet.</p>
+<p>The AQL language supports nesting, both of queries and of query results, and the combination allows for an arguably cleaner/more natural approach to such queries. As an example, supposed we wanted, for each Gleambook user, to produce a object that has his/her name plus a list of the messages written by that user. In SQL, this would involve a left outer join between users and messages, grouping by user, and having the user name repeated along side each message. In AQL, this sort of use case can be handled (more naturally) as follows:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ for $user in dataset GleambookUsers
+ return {
+ "uname": $user.name,
+ "messages": for $message in dataset GleambookMessages
+ where $message.authorId = $user.id
+ return $message.message
+ };
+</pre></div></div>
+
+<p>This AQL query binds the variable <tt>$user</tt> to the data instances in GleambookUsers; for each user, it constructs a result object containing a “uname” field with the user’s name and a “messages” field with a nested collection of all messages for that user. The nested collection for each user is specified by using a correlated subquery. (Note: While it looks like nested loops could be involved in computing the result, AsterixDB recognizes the equivalence of such a query to an outerjoin, and it will use an efficient hash-based strategy when actually computing the query’s result.)</p>
+<p>Here is this example query’s expected output:</p>
+
+<div>
+<div>
+<pre class="source"> { "uname": "WillisWynne", "messages": [ " love product-b the customization is mind-blowing" ] }
+ { "uname": "MargaritaStoddard", "messages": [ " can't stand acast its plan is terrible", " dislike x-phone its touch-screen is horrible", " can't stand acast the network is horrible:(", " like ccast the 3G is awesome:)", " can't stand product-w the touch-screen is terrible" ] }
+ { "uname": "IsbelDull", "messages": [ " like product-z its platform is mind-blowing", " like product-y the plan is amazing" ] }
+ { "uname": "NicholasStroh", "messages": [ ] }
+ { "uname": "NilaMilliron", "messages": [ ] }
+ { "uname": "WoodrowNehling", "messages": [ " love acast its 3G is good:)" ] }
+ { "uname": "BramHatch", "messages": [ " can't stand product-z its voicemail-service is OMG:(", " dislike x-phone the voice-command is bad:(" ] }
+ { "uname": "EmoryUnk", "messages": [ " love product-b its shortcut-menu is awesome:)", " love ccast its wireless is good" ] }
+ { "uname": "VonKemble", "messages": [ " dislike product-b the speed is horrible" ] }
+ { "uname": "SuzannaTillson", "messages": [ " like x-phone the voicemail-service is awesome" ] }
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Query_4_-_Theta_Join"></a>Query 4 - Theta Join</h3>
+<p>Not all joins are expressible as equijoins and computable using equijoin-oriented algorithms. The join predicates for some use cases involve predicates with functions; AsterixDB supports the expression of such queries and will still evaluate them as best it can using nested loop based techniques (and broadcast joins in the parallel case).</p>
+<p>As an example of such a use case, suppose that we wanted, for each chirp T, to find all of the other chirps that originated from within a circle of radius of 1 surrounding chirp T’s location. In AQL, this can be specified in a manner similar to the previous query using one of the built-in functions on the spatial data type instead of id equality in the correlated query’s <i>where</i> clause:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ for $cm in dataset ChirpMessages
+ return {
+ "message": $cm.messageText,
+ "nearbyMessages": for $cm2 in dataset ChirpMessages
+ where spatial-distance($cm.senderLocation, $cm2.senderLocation) <= 1
+ return { "msgtxt":$cm2.messageText}
+ };
+</pre></div></div>
+
+<p>Here is the expected result for this query:</p>
+
+<div>
+<div>
+<pre class="source"> { "message": " can't stand x-phone its platform is terrible", "nearbyMessages": [ { "msgtxt": " can't stand x-phone its platform is terrible" } ] }
+ { "message": " like ccast its shortcut-menu is awesome:)", "nearbyMessages": [ { "msgtxt": " like ccast its shortcut-menu is awesome:)" } ] }
+ { "message": " like product-b the voice-command is mind-blowing:)", "nearbyMessages": [ { "msgtxt": " like product-b the voice-command is mind-blowing:)" } ] }
+ { "message": " love ccast its voicemail-service is awesome", "nearbyMessages": [ { "msgtxt": " love ccast its voicemail-service is awesome" } ] }
+ { "message": " love product-z its customization is good:)", "nearbyMessages": [ { "msgtxt": " love product-z its customization is good:)" } ] }
+ { "message": " can't stand product-w its speed is terrible:(", "nearbyMessages": [ { "msgtxt": " can't stand product-w its speed is terrible:(" } ] }
+ { "message": " like product-w the speed is good:)", "nearbyMessages": [ { "msgtxt": " like product-w the speed is good:)" }, { "msgtxt": " hate ccast its voice-clarity is OMG:(" } ] }
+ { "message": " like x-phone the voice-clarity is good:)", "nearbyMessages": [ { "msgtxt": " like x-phone the voice-clarity is good:)" } ] }
+ { "message": " like product-y the platform is good", "nearbyMessages": [ { "msgtxt": " like product-y the platform is good" } ] }
+ { "message": " hate ccast its voice-clarity is OMG:(", "nearbyMessages": [ { "msgtxt": " like product-w the speed is good:)" }, { "msgtxt": " hate ccast its voice-clarity is OMG:(" } ] }
+ { "message": " like product-y the voice-command is amazing:)", "nearbyMessages": [ { "msgtxt": " like product-y the voice-command is amazing:)" } ] }
+ { "message": " like product-z the shortcut-menu is awesome:)", "nearbyMessages": [ { "msgtxt": " like product-z the shortcut-menu is awesome:)" } ] }
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Query_5_-_Fuzzy_Join"></a>Query 5 - Fuzzy Join</h3>
+<p>As another example of a non-equijoin use case, we could ask AsterixDB to find, for each Gleambook user, all Chirp users with names “similar” to their name. AsterixDB supports a variety of “fuzzy match” functions for use with textual and set-based data. As one example, we could choose to use edit distance with a threshold of 3 as the definition of name similarity, in which case we could write the following query using AQL’s operator-based syntax (~=) for testing whether or not two values are similar:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ set simfunction "edit-distance";
+ set simthreshold "3";
+
+ for $gbu in dataset GleambookUsers
+ return {
+ "id": $gbu.id,
+ "name": $gbu.name,
+ "similarUsers": for $cm in dataset ChirpMessages
+ let $cu := $cm.user
+ where $cu.name ~= $gbu.name
+ return {
+ "chirpScreenname": $cu.screenName,
+ "chirpName": $cu.name
+ }
+ };
+</pre></div></div>
+
+<p>The expected result for this query against our sample data is:</p>
+
+<div>
+<div>
+<pre class="source"> { "id": 6, "name": "WillisWynne", "similarUsers": [ ] }
+ { "id": 1, "name": "MargaritaStoddard", "similarUsers": [ ] }
+ { "id": 2, "name": "IsbelDull", "similarUsers": [ ] }
+ { "id": 4, "name": "NicholasStroh", "similarUsers": [ ] }
+ { "id": 8, "name": "NilaMilliron", "similarUsers": [ { "chirpScreenname": "NilaMilliron_tw", "chirpName": "Nila Milliron" } ] }
+ { "id": 9, "name": "WoodrowNehling", "similarUsers": [ ] }
+ { "id": 10, "name": "BramHatch", "similarUsers": [ ] }
+ { "id": 3, "name": "EmoryUnk", "similarUsers": [ ] }
+ { "id": 5, "name": "VonKemble", "similarUsers": [ ] }
+ { "id": 7, "name": "SuzannaTillson", "similarUsers": [ ] }
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Query_6_-_Existential_Quantification"></a>Query 6 - Existential Quantification</h3>
+<p>The expressive power of AQL includes support for queries involving “some” (existentially quantified) and “all” (universally quantified) query semantics. As an example of an existential AQL query, here we show a query to list the Gleambook users who are currently employed. Such employees will have an employment history containing a object with the endDate value missing, which leads us to the following AQL query:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ for $gbu in dataset GleambookUsers
+ where (some $e in $gbu.employment satisfies is-missing($e.endDate))
+ return $gbu;
+</pre></div></div>
+
+<p>The expected result in this case is:</p>
+
+<div>
+<div>
+<pre class="source"> { "id": 6, "alias": "Willis", "name": "WillisWynne", "userSince": datetime("2005-01-17T10:10:00.000Z"), "friendIds": {{ 1, 3, 7 }}, "employment": [ { "organizationName": "jaydax", "startDate": date("2009-05-15") } ] }
+ { "id": 1, "alias": "Margarita", "name": "MargaritaStoddard", "userSince": datetime("2012-08-20T10:10:00.000Z"), "friendIds": {{ 2, 3, 6, 10 }}, "employment": [ { "organizationName": "Codetechno", "startDate": date("2006-08-06") }, { "organizationName": "geomedia", "startDate": date("2010-06-17"), "endDate": date("2010-01-26") } ], "nickname": "Mags", "gender": "F" }
+ { "id": 2, "alias": "Isbel", "name": "IsbelDull", "userSince": datetime("2011-01-22T10:10:00.000Z"), "friendIds": {{ 1, 4 }}, "employment": [ { "organizationName": "Hexviafind", "startDate": date("2010-04-27") } ], "nickname": "Izzy" }
+ { "id": 4, "alias": "Nicholas", "name": "NicholasStroh", "userSince": datetime("2010-12-27T10:10:00.000Z"), "friendIds": {{ 2 }}, "employment": [ { "organizationName": "Zamcorporation", "startDate": date("2010-06-08") } ] }
+ { "id": 8, "alias": "Nila", "name": "NilaMilliron", "userSince": datetime("2008-01-01T10:10:00.000Z"), "friendIds": {{ 3 }}, "employment": [ { "organizationName": "Plexlane", "startDate": date("2010-02-28") } ] }
+ { "id": 5, "alias": "Von", "name": "VonKemble", "userSince": datetime("2010-01-05T10:10:00.000Z"), "friendIds": {{ 3, 6, 10 }}, "employment": [ { "organizationName": "Kongreen", "startDate": date("2010-11-27") } ] }
+ { "id": 7, "alias": "Suzanna", "name": "SuzannaTillson", "userSince": datetime("2012-08-07T10:10:00.000Z"), "friendIds": {{ 6 }}, "employment": [ { "organizationName": "Labzatron", "startDate": date("2011-04-19") } ] }
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Query_7_-_Universal_Quantification"></a>Query 7 - Universal Quantification</h3>
+<p>As an example of a universal AQL query, here we show a query to list the Gleambook users who are currently unemployed. Such employees will have an employment history containing no objects that miss endDate values, leading us to the following AQL query:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ for $gbu in dataset GleambookUsers
+ where (every $e in $gbu.employment satisfies not(is-missing($e.endDate)))
+ return $gbu;
+</pre></div></div>
+
+<p>Here is the expected result for our sample data:</p>
+
+<div>
+<div>
+<pre class="source"> { "id": 9, "alias": "Woodrow", "name": "WoodrowNehling", "userSince": datetime("2005-09-20T10:10:00.000Z"), "friendIds": {{ 3, 10 }}, "employment": [ { "organizationName": "Zuncan", "startDate": date("2003-04-22"), "endDate": date("2009-12-13") } ], "nickname": "Woody" }
+ { "id": 10, "alias": "Bram", "name": "BramHatch", "userSince": datetime("2010-10-16T10:10:00.000Z"), "friendIds": {{ 1, 5, 9 }}, "employment": [ { "organizationName": "physcane", "startDate": date("2007-06-05"), "endDate": date("2011-11-05") } ] }
+ { "id": 3, "alias": "Emory", "name": "EmoryUnk", "userSince": datetime("2012-07-10T10:10:00.000Z"), "friendIds": {{ 1, 5, 8, 9 }}, "employment": [ { "organizationName": "geomedia", "startDate": date("2010-06-17"), "endDate": date("2010-01-26") } ] }
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Query_8_-_Simple_Aggregation"></a>Query 8 - Simple Aggregation</h3>
+<p>Like SQL, the AQL language of AsterixDB provides support for computing aggregates over large amounts of data. As a very simple example, the following AQL query computes the total number of Gleambook users:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ count(for $gbu in dataset GleambookUsers return $gbu);
+</pre></div></div>
+
+<p>In AQL, aggregate functions can be applied to arbitrary subquery results; in this case, the count function is applied to the result of a query that enumerates the Gleambook users. The expected result here is:</p>
+
+<div>
+<div>
+<pre class="source"> 10
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Query_9-A_-_Grouping_and_Aggregation"></a>Query 9-A - Grouping and Aggregation</h3>
+<p>Also like SQL, AQL supports grouped aggregation. For every Chirp user, the following group-by/aggregate query counts the number of chirps sent by that user:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ for $cm in dataset ChirpMessages
+ group by $uid := $cm.user.screenName with $cm
+ return {
+ "user": $uid,
+ "count": count($cm)
+ };
+</pre></div></div>
+
+<p>The <i>for</i> clause incrementally binds $cm to chirps, and the <i>group by</i> clause groups the chirps by its issuer’s Chirp screenName. Unlike SQL, where data is tabular—flat—the data model underlying AQL allows for nesting. Thus, following the <i>group by</i> clause, the <i>return</i> clause in this query sees a sequence of $cm groups, with each such group having an associated $uid variable value (i.e., the chirping user’s screen name). In the context of the return clause, due to “… with $cm …”, $uid is bound to the chirper’s id and $cm is bound to the <i>set</i> of chirps issued by that chirper. The return clause constructs a result object containing the chirper’s user id and the count of the items in the associated chirp set. The query result will contain one such object per screen name. This query also illustrates another feature of AQL; notice that each user’s screen name is accessed via a path syntax that traverses each chirp’s nested object structure.</p>
+<p>Here is the expected result for this query over the sample data:</p>
+
+<div>
+<div>
+<pre class="source"> { "user": "OliJackson_512", "count": 1 }
+ { "user": "ChangEwing_573", "count": 1 }
+ { "user": "ColineGeyer@63", "count": 3 }
+ { "user": "NathanGiesen@211", "count": 6 }
+ { "user": "NilaMilliron_tw", "count": 1 }
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Query_9-B_-_.28Hash-Based.29_Grouping_and_Aggregation"></a>Query 9-B - (Hash-Based) Grouping and Aggregation</h3>
+<p>As for joins, AsterixDB has multiple evaluation strategies available for processing grouped aggregate queries. For grouped aggregation, the system knows how to employ both sort-based and hash-based aggregation methods, with sort-based methods being used by default and a hint being available to suggest that a different approach be used in processing a particular AQL query.</p>
+<p>The following query is similar to Query 9-A, but adds a hash-based aggregation hint:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ for $cm in dataset ChirpMessages
+ /*+ hash*/
+ group by $uid := $cm.user.screenName with $cm
+ return {
+ "user": $uid,
+ "count": count($cm)
+ };
+</pre></div></div>
+
+<p>Here is the expected result:</p>
+
+<div>
+<div>
+<pre class="source"> { "user": "OliJackson_512", "count": 1 }
+ { "user": "ChangEwing_573", "count": 1 }
+ { "user": "ColineGeyer@63", "count": 3 }
+ { "user": "NathanGiesen@211", "count": 6 }
+ { "user": "NilaMilliron_tw", "count": 1 }
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Query_10_-_Grouping_and_Limits"></a>Query 10 - Grouping and Limits</h3>
+<p>In some use cases it is not necessary to compute the entire answer to a query. In some cases, just having the first <i>N</i> or top <i>N</i> results is sufficient. This is expressible in AQL using the <i>limit</i> clause combined with the <i>order by</i> clause.</p>
+<p>The following AQL query returns the top 3 Chirp users based on who has issued the most chirps:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ for $cm in dataset ChirpMessages
+ group by $uid := $cm.user.screenName with $cm
+ let $c := count($cm)
+ order by $c desc
+ limit 3
+ return {
+ "user": $uid,
+ "count": $c
+ };
+</pre></div></div>
+
+<p>The expected result for this query is:</p>
+
+<div>
+<div>
+<pre class="source"> { "user": "NathanGiesen@211", "count": 6 }
+ { "user": "ColineGeyer@63", "count": 3 }
+ { "user": "OliJackson_512", "count": 1 }
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Query_11_-_Left_Outer_Fuzzy_Join"></a>Query 11 - Left Outer Fuzzy Join</h3>
+<p>As a last example of AQL and its query power, the following query, for each chirp, finds all of the chirps that are similar based on the topics that they refer to:</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ set simfunction "jaccard";
+ set simthreshold "0.3";
+
+ for $cm in dataset ChirpMessages
+ return {
+ "chirp": $cm,
+ "similarChirps": for $cm2 in dataset ChirpMessages
+ where $cm2.referredTopics ~= $cm.referredTopics
+ and $cm2.chirpId != $cm.chirpId
+ return $cm2.referredTopics
+ };
+</pre></div></div>
+
+<p>This query illustrates several things worth knowing in order to write fuzzy queries in AQL. First, as mentioned earlier, AQL offers an operator-based syntax for seeing whether two values are “similar” to one another or not. Second, recall that the referredTopics field of objects of datatype ChirpMessageType is a bag of strings. This query sets the context for its similarity join by requesting that Jaccard-based similarity semantics (<a class="externalLink" href="http://en.wikipedia.org/wiki/Jaccard_index">http://en.wikipedia.org/wiki/Jaccard_index</a>) be used for the query’s similarity operator and that a similarity index of 0.3 be used as its similarity threshold.</p>
+<p>The expected result for this fuzzy join query is:</p>
+
+<div>
+<div>
+<pre class="source"> { "chirp": { "chirpId": "11", "user": { "screenName": "NilaMilliron_tw", "lang": "en", "friendsCount": 445, "statusesCount": 164, "name": "Nila Milliron", "followersCount": 22649 }, "senderLocation": point("37.59,68.42"), "sendTime": datetime("2008-03-09T10:10:00.000Z"), "referredTopics": {{ "x-phone", "platform" }}, "messageText": " can't stand x-phone its platform is terrible" }, "similarChirps": [ {{ "x-phone", "voice-clarity" }}, {{ "product-y", "platform" }} ] }
+ { "chirp": { "chirpId": "2", "user": { "screenName": "ColineGeyer@63", "lang": "en", "friendsCount": 121, "statusesCount": 362, "name": "Coline Geyer", "followersCount": 17159 }, "senderLocation": point("32.84,67.14"), "sendTime": datetime("2010-05-13T10:10:00.000Z"), "referredTopics": {{ "ccast", "shortcut-menu" }}, "messageText": " like ccast its shortcut-menu is awesome:)" }, "similarChirps": [ {{ "ccast", "voicemail-service" }}, {{ "ccast", "voice-clarity" }}, {{ "product-z", "shortcut-menu" }} ] }
+ { "chirp": { "chirpId": "4", "user": { "screenName": "NathanGiesen@211", "lang": "en", "friendsCount": 39339, "statusesCount": 473, "name": "Nathan Giesen", "followersCount": 49416 }, "senderLocation": point("39.28,70.48"), "sendTime": datetime("2011-12-26T10:10:00.000Z"), "referredTopics": {{ "product-b", "voice-command" }}, "messageText": " like product-b the voice-command is mind-blowing:)" }, "similarChirps": [ {{ "product-y", "voice-command" }} ] }
+ { "chirp": { "chirpId": "9", "user": { "screenName": "NathanGiesen@211", "lang": "en", "friendsCount": 39339, "statusesCount": 473, "name": "Nathan Giesen", "followersCount": 49416 }, "senderLocation": point("36.86,74.62"), "sendTime": datetime("2012-07-21T10:10:00.000Z"), "referredTopics": {{ "ccast", "voicemail-service" }}, "messageText": " love ccast its voicemail-service is awesome" }, "similarChirps": [ {{ "ccast", "shortcut-menu" }}, {{ "ccast", "voice-clarity" }} ] }
+ { "chirp": { "chirpId": "1", "user": { "screenName": "NathanGiesen@211", "lang": "en", "friendsCount": 39339, "statusesCount": 473, "name": "Nathan Giesen", "followersCount": 49416 }, "senderLocation": point("47.44,80.65"), "sendTime": datetime("2008-04-26T10:10:00.000Z"), "referredTopics": {{ "product-z", "customization" }}, "messageText": " love product-z its customization is good:)" }, "similarChirps": [ {{ "product-z", "shortcut-menu" }} ] }
+ { "chirp": { "chirpId": "5", "user": { "screenName": "NathanGiesen@211", "lang": "en", "friendsCount": 39339, "statusesCount": 473, "name": "Nathan Giesen", "followersCount": 49416 }, "senderLocation": point("40.09,92.69"), "sendTime": datetime("2006-08-04T10:10:00.000Z"), "referredTopics": {{ "product-w", "speed" }}, "messageText": " can't stand product-w its speed is terrible:(" }, "similarChirps": [ {{ "product-w", "speed" }} ] }
+ { "chirp": { "chirpId": "3", "user": { "screenName": "NathanGiesen@211", "lang": "en", "friendsCount": 39339, "statusesCount": 473, "name": "Nathan Giesen", "followersCount": 49416 }, "senderLocation": point("29.72,75.8"), "sendTime": datetime("2006-11-04T10:10:00.000Z"), "referredTopics": {{ "product-w", "speed" }}, "messageText": " like product-w the speed is good:)" }, "similarChirps": [ {{ "product-w", "speed" }} ] }
+ { "chirp": { "chirpId": "6", "user": { "screenName": "ColineGeyer@63", "lang": "en", "friendsCount": 121, "statusesCount": 362, "name": "Coline Geyer", "followersCount": 17159 }, "senderLocation": point("47.51,83.99"), "sendTime": datetime("2010-05-07T10:10:00.000Z"), "referredTopics": {{ "x-phone", "voice-clarity" }}, "messageText": " like x-phone the voice-clarity is good:)" }, "similarChirps": [ {{ "x-phone", "platform" }}, {{ "ccast", "voice-clarity" }} ] }
+ { "chirp": { "chirpId": "7", "user": { "screenName": "ChangEwing_573", "lang": "en", "friendsCount": 182, "statusesCount": 394, "name": "Chang Ewing", "followersCount": 32136 }, "senderLocation": point("36.21,72.6"), "sendTime": datetime("2011-08-25T10:10:00.000Z"), "referredTopics": {{ "product-y", "platform" }}, "messageText": " like product-y the platform is good" }, "similarChirps": [ {{ "x-phone", "platform" }}, {{ "product-y", "voice-command" }} ] }
+ { "chirp": { "chirpId": "10", "user": { "screenName": "ColineGeyer@63", "lang": "en", "friendsCount": 121, "statusesCount": 362, "name": "Coline Geyer", "followersCount": 17159 }, "senderLocation": point("29.15,76.53"), "sendTime": datetime("2008-01-26T10:10:00.000Z"), "referredTopics": {{ "ccast", "voice-clarity" }}, "messageText": " hate ccast its voice-clarity is OMG:(" }, "similarChirps": [ {{ "ccast", "shortcut-menu" }}, {{ "ccast", "voicemail-service" }}, {{ "x-phone", "voice-clarity" }} ] }
+ { "chirp": { "chirpId": "12", "user": { "screenName": "OliJackson_512", "lang": "en", "friendsCount": 445, "statusesCount": 164, "name": "Oli Jackson", "followersCount": 22649 }, "senderLocation": point("24.82,94.63"), "sendTime": datetime("2010-02-13T10:10:00.000Z"), "referredTopics": {{ "product-y", "voice-command" }}, "messageText": " like product-y the voice-command is amazing:)" }, "similarChirps": [ {{ "product-b", "voice-command" }}, {{ "product-y", "platform" }} ] }
+ { "chirp": { "chirpId": "8", "user": { "screenName": "NathanGiesen@211", "lang": "en", "friendsCount": 39339, "statusesCount": 473, "name": "Nathan Giesen", "followersCount": 49416 }, "senderLocation": point("46.05,93.34"), "sendTime": datetime("2005-10-14T10:10:00.000Z"), "referredTopics": {{ "product-z", "shortcut-menu" }}, "messageText": " like product-z the shortcut-menu is awesome:)" }, "similarChirps": [ {{ "ccast", "shortcut-menu" }}, {{ "product-z", "customization" }} ] }
+</pre></div></div>
+</div>
+<div class="section">
+<h3><a name="Deleting_Existing_Data"></a>Deleting Existing Data</h3>
+<p>In addition to inserting new data, AsterixDB supports deletion from datasets via the AQL <i>delete</i> statement. The statement supports “searched delete” semantics, and its <i>where</i> clause can involve any valid XQuery expression.</p>
+<p>The following example deletes the chirp that we just added from user “NathanGiesen@211”. (Easy come, easy go. :-))</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+
+ delete $cm from dataset ChirpMessages where $cm.chirpId = "13";
+</pre></div></div>
+
+<p>It should be noted that one form of data change not yet supported by AsterixDB is in-place data modification (<i>update</i>). Currently, only insert and delete operations are supported; update is not. To achieve the effect of an update, two statements are currently needed—one to delete the old object from the dataset where it resides, and another to insert the new replacement object (with the same primary key but with different field values for some of the associated data content).</p></div>
+<div class="section">
+<h3><a name="Upserting_Data"></a>Upserting Data</h3>
+<p>In addition to loading, querying, inserting, and deleting data, AsterixDB supports upserting objects using the AQL <i>upsert</i> statement.</p>
+<p>The following example deletes the chirp with chirpId = 20 (if one exists) and inserts the new chirp with chirpId = 20 by user “SwanSmitty” to the ChirpMessages dataset. The two operations (delete if found and insert) are performed as an atomic operation that is either performed completely or not at all.</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+ upsert into dataset ChirpMessages
+ (
+ {"chirpId": "20",
+ "user":
+ {"screenName": "SwanSmitty",
+ "lang": "en",
+ "friendsCount": 91345,
+ "statusesCount": 4079,
+ "name": "Swanson Smith",
+ "followersCount": 50420
+ },
+ "senderLocation": point("47.44,80.65"),
+ "sendTime": datetime("2008-04-26T10:10:35"),
+ "referredTopics": {{"football"}},
+ "messageText": "football is the best sport, period.!"
+ }
+ );
+</pre></div></div>
+
+<p>The data to be upserted may be specified using any valid AQL query expression. For example, the following statement might be used to double the followers count of all existing users.</p>
+
+<div>
+<div>
+<pre class="source"> use dataverse TinySocial;
+ upsert into dataset ChirpUsers
+ (
+ for $user in dataset ChirpUsers
+ return {
+ "screenName": $user.screenName,
+ "lang": $user.lang,
+ "friendsCount": $user.friendsCount,
+ "statusesCount": $user.statusesCount,
+ "name": $user.name,
+ "followersCount": $user.followersCount * 2
+ }
+ );
+</pre></div></div>
+
+<p>Note that such an upsert operation is executed in two steps: The query is performed, after which the query’s locks are released, and then its result is upserted into the dataset. This means that a object can be modified between computing the query result and performing the upsert.</p></div>
+<div class="section">
+<h3><a name="Transaction_Support"></a>Transaction Support</h3>
+<p>AsterixDB supports object-level ACID transactions that begin and terminate implicitly for each object inserted, deleted, or searched while a given AQL statement is being executed. This is quite similar to the level of transaction support found in today’s NoSQL stores. AsterixDB does not support multi-statement transactions, and in fact an AQL statement that involves multiple objects can itself involve multiple independent object-level transactions. An example consequence of this is that, when an AQL statement attempts to insert 1000 objects, it is possible that the first 800 objects could end up being committed while the remaining 200 objects fail to be inserted. This situation could happen, for example, if a duplicate key exception occurs as the 801st insertion is attempted. If this happens, AsterixDB will report the error (e.g., a duplicate key exception) as the result of the offending AQL insert statement, and the application logic above will need to take the appropriate action(s) needed to assess the resulting state and to clean up and/or continue as appropriate.</p></div>
+<div class="section">
+<h3><a name="Loading_New_Data_in_Bulk"></a>Loading New Data in Bulk</h3>
+<p>In addition to incremental additions to datasets via the AQL <i>insert</i> statement, the <i>load</i> statement can be used to take a file from a given node and load it in a more efficient fashion. Note however that a dataset can currently only be loaded if it is empty.</p>
+<p>The following example loads a file in ADM format from “/home/user/gbm.adm” from the node named “nc1” into the GleambookUsers dataset.</p>
+
+<div>
+<div>
+<pre class="source">use dataverse TinySocial;
+
+load dataset GleambookUsers using localfs
+ (("path"="nc1://home/user/gbu.adm"),("format"="adm"));
+</pre></div></div>
+</div></div>
+<div class="section">
+<h2><a name="Further_Help"></a>Further Help</h2>
+<p>That’s it! You are now armed and dangerous with respect to semistructured data management using AsterixDB and AQL.</p>
+<p>AsterixDB is a powerful new BDMS—Big Data Management System—that we hope may usher in a new era of much more declarative Big Data management. AsterixDB is powerful, so use it wisely, and remember: “With great power comes great responsibility…” :-)</p>
+<p>Please e-mail the AsterixDB user group (users (at) asterixdb.apache.org) if you run into any problems or simply have further questions about the AsterixDB system, its features, or their proper use.</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>