You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by im...@apache.org on 2017/08/26 05:35:57 UTC

[14/29] asterixdb-site git commit: Update site for new release

http://git-wip-us.apache.org/repos/asf/asterixdb-site/blob/444ca1b3/docs/0.9.2/aql/externaldata.html
----------------------------------------------------------------------
diff --git a/docs/0.9.2/aql/externaldata.html b/docs/0.9.2/aql/externaldata.html
new file mode 100644
index 0000000..46d48f3
--- /dev/null
+++ b/docs/0.9.2/aql/externaldata.html
@@ -0,0 +1,758 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2017-07-27
+ | Rendered using Apache Maven Fluido Skin 1.3.0
+-->
+<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="20170727" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Accessing External Data in AsterixDB</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.3.0.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.3.0.min.js"></script>
+
+                          
+        
+<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+        ga('create', 'UA-41536543-1', 'uci.edu');
+        ga('send', 'pageview');</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: 2017-07-27</li>
+                      
+                
+                    
+                 <li id="projectVersion" class="pull-right">Version: 0.9.2-SNAPSHOT</li>
+      
+                                            <li class="divider pull-right">|</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="span3">
+          <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">
+          <i class="none"></i>
+        Option 1: using NCService</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../ansible.html" title="Option 2: using Ansible">
+          <i class="none"></i>
+        Option 2: using Ansible</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aws.html" title="Option 3: using Amazon Web Services">
+          <i class="none"></i>
+        Option 3: using Amazon Web Services</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../yarn.html" title="Option 4: using YARN">
+          <i class="none"></i>
+        Option 4: using YARN</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../install.html" title="Option 5: using Managix (deprecated)">
+          <i class="none"></i>
+        Option 5: using Managix (deprecated)</a>
+            </li>
+                              <li class="nav-header">AsterixDB Primer</li>
+                                
+      <li>
+    
+                          <a href="../sqlpp/primer-sqlpp.html" title="Option 1: using SQL++">
+          <i class="none"></i>
+        Option 1: using SQL++</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/primer.html" title="Option 2: using AQL">
+          <i class="none"></i>
+        Option 2: using AQL</a>
+            </li>
+                              <li class="nav-header">Data Model</li>
+                                
+      <li>
+    
+                          <a href="../datamodel.html" title="The Asterix Data Model">
+          <i class="none"></i>
+        The Asterix Data Model</a>
+            </li>
+                              <li class="nav-header">Queries - SQL++</li>
+                                
+      <li>
+    
+                          <a href="../sqlpp/manual.html" title="The SQL++ Query Language">
+          <i class="none"></i>
+        The SQL++ Query Language</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../sqlpp/builtins.html" title="Builtin Functions">
+          <i class="none"></i>
+        Builtin Functions</a>
+            </li>
+                              <li class="nav-header">Queries - AQL</li>
+                                
+      <li>
+    
+                          <a href="../aql/manual.html" title="The Asterix Query Language (AQL)">
+          <i class="none"></i>
+        The Asterix Query Language (AQL)</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/builtins.html" title="Builtin Functions">
+          <i class="none"></i>
+        Builtin Functions</a>
+            </li>
+                              <li class="nav-header">API/SDK</li>
+                                
+      <li>
+    
+                          <a href="../api.html" title="HTTP API">
+          <i class="none"></i>
+        HTTP API</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../csv.html" title="CSV Output">
+          <i class="none"></i>
+        CSV Output</a>
+            </li>
+                              <li class="nav-header">Advanced Features</li>
+                                
+      <li>
+    
+                          <a href="../aql/fulltext.html" title="Support of Full-text Queries">
+          <i class="none"></i>
+        Support of Full-text Queries</a>
+            </li>
+                  
+      <li class="active">
+    
+            <a href="#"><i class="none"></i>Accessing External Data</a>
+          </li>
+                  
+      <li>
+    
+                          <a href="../feeds/tutorial.html" title="Support for Data Ingestion">
+          <i class="none"></i>
+        Support for Data Ingestion</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../udf.html" title="User Defined Functions">
+          <i class="none"></i>
+        User Defined Functions</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/filters.html" title="Filter-Based LSM Index Acceleration">
+          <i class="none"></i>
+        Filter-Based LSM Index Acceleration</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/similarity.html" title="Support of Similarity Queries">
+          <i class="none"></i>
+        Support of Similarity Queries</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr class="divider" />
+
+           <div id="poweredBy">
+                            <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="span9" >
+                                  
+            <!-- ! 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_Back_to_TOC"></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 &#x2018;&#x2018;external datasets&#x2019;&#x2019; so that it is not necessary to &#x201c;load&#x201d; 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_Back_to_TOC"></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_Back_to_TOC"></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_Back_to_TOC"></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 &#x2018;Execute&#x2019;.</p>
+
+<div class="source">
+<div class="source">
+<pre>    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_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- &#x2018;localfs&#x2019;. We create an external dataset named Lineitem and use the &#x2018;localfs&#x2019; adapter.</p>
+
+<div class="source">
+<div class="source">
+<pre>    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://&lt;absolute path&gt;</tt>.
+  Use a comma separated list if there are multiple files.
+  E.g. <tt>host1://&lt;absolute path&gt;</tt>, <tt>host2://&lt;absolute path&gt;</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 class="source">
+<div class="source">
+<pre>    use dataverse ExternalFileDemo;
+
+    create external dataset Lineitem(LineitemType)
+    using localfs
+    ((&quot;path&quot;=&quot;127.0.0.1://SOURCE_PATH&quot;),
+    (&quot;format&quot;=&quot;delimited-text&quot;),
+    (&quot;delimiter&quot;=&quot;|&quot;));
+</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 class="source">
+<div class="source">
+<pre>    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 class="source">
+<div class="source">
+<pre>    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 &#x2018;Execute&#x2019;.</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_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 - &#x2018;hdfs&#x2019;. We can create an external dataset named Lineitem and associate the HDFS adapter with it as follows;</p>
+
+<div class="source">
+<div class="source">
+<pre>    create external dataset Lineitem(LineitemType)
+    using hdfs((&#x201c;hdfs&#x201d;:&#x201d;hdfs://localhost:54310&#x201d;),(&#x201c;path&#x201d;:&#x201d;/asterix/Lineitem.tbl&#x201d;),...,(&#x201c;input- format&#x201d;:&#x201d;rc-format&#x201d;));
+</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 &#x2018;input-format&#x2019; and &#x2018;format&#x2019;</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 &#x2018;input-format&#x2019; is used to distinguish between these and other HDFS input formats.</p>
+<p><i>format</i>: The parameter &#x2018;format&#x2019; 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 &#x2018;|&#x2019; 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 &#x201c;/asterix/Lineitem.tbl&#x201d;.</p>
+<p>The complete set of parameters for our example file are as follows. ((&#x201c;hdfs&#x201d;=&#x201c;hdfs://localhost:54310&#x201d;,(&#x201c;path&#x201d;=&#x201c;/asterix/Lineitem.tbl&#x201d;),(&#x201c;input-format&#x201d;=&#x201c;text- input-format&#x201d;),(&#x201c;format&#x201d;=&#x201c;delimited-text&#x201d;),(&#x201c;delimiter&#x201d;=&#x201c;|&#x201d;))</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 class="source">
+<div class="source">
+<pre>    create external dataset Lineitem('LineitemType)
+    using hdfs((&quot;hdfs&quot;=&quot;hdfs://localhost:54310&quot;),(&quot;path&quot;=&quot;/asterix/Lineitem.tbl&quot;),(&quot;input-format&quot;=&quot;text- input-format&quot;),(&quot;format&quot;=&quot;delimited-text&quot;),(&quot;delimiter&quot;=&quot;|&quot;));
+</pre></div></div>
+<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 class="source">
+<div class="source">
+<pre>    create external dataset Lineitem('LineitemType)
+    using hdfs((&quot;hdfs&quot;=&quot;hdfs://localhost:54310&quot;),(&quot;path&quot;=&quot;/asterix/SequenceLineitem.tbl&quot;),(&quot;input- format&quot;=&quot;sequence-input-format&quot;),(&quot;format&quot;=&quot;adm&quot;));
+</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 class="source">
+<div class="source">
+<pre>    create external dataset Lineitem('LineitemType)
+    using hdfs((&quot;hdfs&quot;=&quot;hdfs://localhost:54310&quot;),(&quot;path&quot;=&quot;/asterix/RCLineitem.tbl&quot;),(&quot;input-format&quot;=&quot;rc-input-format&quot;),(&quot;format&quot;=&quot;binary&quot;),(&quot;parser&quot;=&quot;hive-parser&quot;),(&quot;hive- serde&quot;=&quot;org.apache.hadoop.hive.serde2.columnar.ColumnarSerde&quot;));
+</pre></div></div></div></div></div>
+<div class="section">
+<h2><a name="Writing_Queries_against_an_External_Dataset_Back_to_TOC"></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 class="source">
+<div class="source">
+<pre>    use dataverse ExternalFileDemo;
+
+    for $c in dataset('Lineitem')
+    where $c.l_orderkey &lt;= 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_Back_to_TOC"></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 class="source">
+<div class="source">
+<pre>    create external dataset Lineitem(LineitemType)
+    using hdfs((&quot;hdfs&quot;=&quot;hdfs://localhost:54310&quot;),(&quot;path&quot;=&quot;/asterix/Lineitem.tbl&quot;),(&quot;input-format&quot;=&quot;text-input- format&quot;),(&quot;format&quot;=&quot;delimited-text&quot;),(&quot;delimiter&quot;=&quot;|&quot;));
+</pre></div></div>
+<p>You can then create a B-Tree index on this dataset instance as if the dataset was internally stored as follows:</p>
+
+<div class="source">
+<div class="source">
+<pre>    create index PartkeyIdx on Lineitem(l_partkey);
+</pre></div></div>
+<p>You could also create an R-Tree index as follows:</p>
+
+<div class="source">
+<div class="source">
+<pre>    &#xfffc;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 &#x2018;text-input-format&#x2019;, &#x2018;sequence-input-format&#x2019; or &#x2018;rc-input-format&#x2019;.</p></div>
+<div class="section">
+<h2><a name="External_Data_Snapshots_Back_to_TOC"></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&#x2019;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 class="source">
+<div class="source">
+<pre>    refresh external dataset DatasetName;
+</pre></div></div>
+<p>After a refresh operation commits, all of the dataset&#x2019;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_Back_to_TOC"></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&#x2019;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&#x2019;t use the index?</p>
+<p>A. No, queries&#x2019; 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&#x2019;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 span12">Copyright &copy;                    2017
+                        <a href="https://www.apache.org/">The Apache Software Foundation</a>.
+            All Rights Reserved.      
+                    
+      </div>
+
+                                                                  <?xml version="1.0" encoding="UTF-8"?>
+<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>
+    </footer>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/asterixdb-site/blob/444ca1b3/docs/0.9.2/aql/filters.html
----------------------------------------------------------------------
diff --git a/docs/0.9.2/aql/filters.html b/docs/0.9.2/aql/filters.html
new file mode 100644
index 0000000..8433765
--- /dev/null
+++ b/docs/0.9.2/aql/filters.html
@@ -0,0 +1,313 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2017-07-27
+ | Rendered using Apache Maven Fluido Skin 1.3.0
+-->
+<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="20170727" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; Filter-Based LSM Index Acceleration</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.3.0.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.3.0.min.js"></script>
+
+                          
+        
+<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+        ga('create', 'UA-41536543-1', 'uci.edu');
+        ga('send', 'pageview');</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: 2017-07-27</li>
+                      
+                
+                    
+                 <li id="projectVersion" class="pull-right">Version: 0.9.2-SNAPSHOT</li>
+      
+                                            <li class="divider pull-right">|</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="span3">
+          <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">
+          <i class="none"></i>
+        Option 1: using NCService</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../ansible.html" title="Option 2: using Ansible">
+          <i class="none"></i>
+        Option 2: using Ansible</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aws.html" title="Option 3: using Amazon Web Services">
+          <i class="none"></i>
+        Option 3: using Amazon Web Services</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../yarn.html" title="Option 4: using YARN">
+          <i class="none"></i>
+        Option 4: using YARN</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../install.html" title="Option 5: using Managix (deprecated)">
+          <i class="none"></i>
+        Option 5: using Managix (deprecated)</a>
+            </li>
+                              <li class="nav-header">AsterixDB Primer</li>
+                                
+      <li>
+    
+                          <a href="../sqlpp/primer-sqlpp.html" title="Option 1: using SQL++">
+          <i class="none"></i>
+        Option 1: using SQL++</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/primer.html" title="Option 2: using AQL">
+          <i class="none"></i>
+        Option 2: using AQL</a>
+            </li>
+                              <li class="nav-header">Data Model</li>
+                                
+      <li>
+    
+                          <a href="../datamodel.html" title="The Asterix Data Model">
+          <i class="none"></i>
+        The Asterix Data Model</a>
+            </li>
+                              <li class="nav-header">Queries - SQL++</li>
+                                
+      <li>
+    
+                          <a href="../sqlpp/manual.html" title="The SQL++ Query Language">
+          <i class="none"></i>
+        The SQL++ Query Language</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../sqlpp/builtins.html" title="Builtin Functions">
+          <i class="none"></i>
+        Builtin Functions</a>
+            </li>
+                              <li class="nav-header">Queries - AQL</li>
+                                
+      <li>
+    
+                          <a href="../aql/manual.html" title="The Asterix Query Language (AQL)">
+          <i class="none"></i>
+        The Asterix Query Language (AQL)</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/builtins.html" title="Builtin Functions">
+          <i class="none"></i>
+        Builtin Functions</a>
+            </li>
+                              <li class="nav-header">API/SDK</li>
+                                
+      <li>
+    
+                          <a href="../api.html" title="HTTP API">
+          <i class="none"></i>
+        HTTP API</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../csv.html" title="CSV Output">
+          <i class="none"></i>
+        CSV Output</a>
+            </li>
+                              <li class="nav-header">Advanced Features</li>
+                                
+      <li>
+    
+                          <a href="../aql/fulltext.html" title="Support of Full-text Queries">
+          <i class="none"></i>
+        Support of Full-text Queries</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/externaldata.html" title="Accessing External Data">
+          <i class="none"></i>
+        Accessing External Data</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../feeds/tutorial.html" title="Support for Data Ingestion">
+          <i class="none"></i>
+        Support for Data Ingestion</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../udf.html" title="User Defined Functions">
+          <i class="none"></i>
+        User Defined Functions</a>
+            </li>
+                  
+      <li class="active">
+    
+            <a href="#"><i class="none"></i>Filter-Based LSM Index Acceleration</a>
+          </li>
+                  
+      <li>
+    
+                          <a href="../aql/similarity.html" title="Support of Similarity Queries">
+          <i class="none"></i>
+        Support of Similarity Queries</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr class="divider" />
+
+           <div id="poweredBy">
+                            <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="span9" >
+                                  
+            <!-- ! 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>Filter-Based LSM Index Acceleration</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="#Motivation">Motivation</a></li>
+  
+<li><a href="#FiltersInAsterixDB">Filters in AsterixDB</a></li>
+  
+<li><a href="#FiltersAndMergePolicies">Filters and Merge Policies</a></li>
+</ul></div>
+<div class="section">
+<h2><a name="Motivation_Back_to_TOC"></a><a name="Motivation" id="Motivation">Motivation</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
+<p>Traditional relational databases usually employ conventional index structures such as B+ trees due to their low read latency. However, such traditional index structures use in-place writes to perform updates, resulting in costly random writes to disk. Today&#x2019;s emerging applications often involve insert-intensive workloads for which the cost of random writes prohibits efficient ingestion of data. Consequently, popular NoSQL systems such as Cassandra, HBase, LevelDB, BigTable, etc. have adopted Log-Structured Merge (LSM) Trees as their storage structure. LSM-trees avoids the cost of random writes by batching updates into a component of the index that resides in main memory &#x2013; an <i>in-memory component</i>. When the space occupancy of the in-memory component exceeds a specified threshold, its entries are <i>flushed</i> to disk forming a new component &#x2013; a <i>disk component</i>. As disk components accumulate on disk, they are periodically merged together subject to 
 a <i>merge policy</i> that decides when and what to merge. The benefit of the LSM-trees comes at the cost of possibly sacrificing read efficiency, but, it has been shown in previous studies that these inefficiencies can be mostly mitigated.</p>
+<p>AsterixDB has also embraced LSM-trees, not just by using them as primary indexes, but also by using the same LSM-ification technique for all of its secondary index structures. In particular, AsterixDB adopted a generic framework for converting a class of indexes (that includes conventional B+ trees, R trees, and inverted indexes) into LSM-based secondary indexes, allowing higher data ingestion rates. In fact, for certain index structures, our results have shown that using an LSM-based version of an index can be made to significantly outperform its conventional counterpart for <i>both</i> ingestion and query speed (an example of such an index being the R-tree for spatial data).</p>
+<p>Since an LSM-based index naturally partitions data into multiple disk components, it is possible, when answering certain queries, to exploit partitioning to only access some components and safely filter out the remaining components, thus reducing query times. For instance, referring to our <a href="primer.html#ADM:_Modeling_Semistructed_Data_in_AsterixDB">TinySocial</a> example, suppose a user always retrieves tweets from the <tt>TweetMessages</tt> dataset based on the <tt>send-time</tt> field (e.g., tweets posted in the last 24 hours). Since there is not a secondary index on the <tt>send-time</tt> field, the only available option for AsterixDB would be to scan the whole <tt>TweetMessages</tt> dataset and then apply the predicate as a post-processing step. However, if disk components of the primary index were tagged with the minimum and maximum timestamp values of the objects they contain, we could utilize the tagged information to directly access the primary index and prune comp
 onents that do not match the query predicate. Thus, we could save substantial cost by avoiding scanning the whole dataset and only access the relevant components. We simply call such tagging information that are associated with components, filters. (Note that even if there were a secondary index on <tt>send-time</tt> field, using filters could save substantial cost by avoiding accessing the secondary index, followed by probing the primary index for every fetched entry.) Moreover, the same filtering technique can also be used with any secondary LSM index (e.g., an LSM R-tree), in case the query contains multiple predicates (e.g., spatial and temporal predicates), to obtain similar pruning power.</p></div>
+<div class="section">
+<h2><a name="Filters_in_AsterixDB_Back_to_TOC"></a><a name="FiltersInAsterixDB" id="FiltersInAsterixDB">Filters in AsterixDB</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
+<p>We have added support for LSM-based filters to all of AsterixDB&#x2019;s index types. To enable the use of filters, the user must specify the filter&#x2019;s key when creating a dataset, as shown below:</p>
+<div class="section">
+<div class="section">
+<h4><a name="Creating_a_Dataset_with_a_Filter"></a>Creating a Dataset with a Filter</h4>
+
+<div class="source">
+<div class="source">
+<pre>    create dataset Tweets(TweetType) primary key tweetid with filter on send-time;
+</pre></div></div>
+<p>Filters can be created on any totally ordered datatype (i.e., any field that can be indexed using a B+ -tree), such as integers, doubles, floats, UUIDs, datetimes, etc.</p>
+<p>When a dataset with a filter is created, the name of the filter&#x2019;s key field is persisted in the <tt>Metadata.Dataset</tt> dataset (which is the metadata dataset that stores the details of each dataset in an AsterixDB instance) so that DML operations against the dataset can recognize the existence of filters and can update them or utilize them accordingly. Creating a dataset with a filter in AsterixDB implies that the primary and all secondary indexes of that dataset will maintain filters on their disk components. Once a filtered dataset is created, the user can use the dataset normally (just like any other dataset). AsterixDB will automatically maintain the filters and will leverage them to efficiently answer queries whenever possible (i.e., when a query has predicates on the filter&#x2019;s key).</p></div></div></div>
+<div class="section">
+<h2><a name="Filters_and_Merge_Policies_Back_to_TOC"></a><a name="FiltersAndMergePolicies" id="FiltersAndMergePolicies">Filters and Merge Policies</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
+<p>The AsterixDB default merge policy, the prefix merge policy, relies on component sizes and the number of components to decide which components to merge. This merge policy has proven to provide excellent performance for both ingestion and queries. However, when evaluating our filtering solution with the prefix policy, we observed a behavior that can reduce filter effectiveness. In particular, we noticed that under the prefix merge policy, the disk components of a secondary index tend to be constantly merged into a single component. This is because the prefix policy relies on a single size parameter for all of the indexes of a dataset. This parameter is typically chosen based on the sizes of the disk components of the primary index, which tend to be much larger than the sizes of the secondary indexes&#x2019; disk components. This difference caused the prefix merge policy to behave similarly to the constant merge policy (i.e., relatively poorly) when applied to secondary indexes in 
 the sense that the secondary indexes are constantly merged into a single disk component. Consequently, the effectiveness of filters on secondary indexes was greatly reduced under the prefix-merge policy, but they were still effective when probing the primary index. Based on this behavior, we developed a new merge policy, an improved version of the prefix policy, called the correlated-prefix policy. The basic idea of this policy is that 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 to the I/O scheduler on behalf of all other indexes associated with the same dataset. The end result is that secondary indexes will always have the same number of disk components as their primary index under the correlated-prefix merge policy. This has improved query perfor
 mance, since disk components of secondary indexes now have a much better chance of being pruned.</p></div>
+                  </div>
+            </div>
+          </div>
+
+    <hr/>
+
+    <footer>
+            <div class="container-fluid">
+              <div class="row span12">Copyright &copy;                    2017
+                        <a href="https://www.apache.org/">The Apache Software Foundation</a>.
+            All Rights Reserved.      
+                    
+      </div>
+
+                                                                  <?xml version="1.0" encoding="UTF-8"?>
+<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>
+    </footer>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/asterixdb-site/blob/444ca1b3/docs/0.9.2/aql/fulltext.html
----------------------------------------------------------------------
diff --git a/docs/0.9.2/aql/fulltext.html b/docs/0.9.2/aql/fulltext.html
new file mode 100644
index 0000000..b34c661
--- /dev/null
+++ b/docs/0.9.2/aql/fulltext.html
@@ -0,0 +1,372 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2017-07-27
+ | Rendered using Apache Maven Fluido Skin 1.3.0
+-->
+<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="20170727" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; AsterixDB Support of Full-text search queries</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.3.0.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.3.0.min.js"></script>
+
+                          
+        
+<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+        ga('create', 'UA-41536543-1', 'uci.edu');
+        ga('send', 'pageview');</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: 2017-07-27</li>
+                      
+                
+                    
+                 <li id="projectVersion" class="pull-right">Version: 0.9.2-SNAPSHOT</li>
+      
+                                            <li class="divider pull-right">|</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="span3">
+          <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">
+          <i class="none"></i>
+        Option 1: using NCService</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../ansible.html" title="Option 2: using Ansible">
+          <i class="none"></i>
+        Option 2: using Ansible</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aws.html" title="Option 3: using Amazon Web Services">
+          <i class="none"></i>
+        Option 3: using Amazon Web Services</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../yarn.html" title="Option 4: using YARN">
+          <i class="none"></i>
+        Option 4: using YARN</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../install.html" title="Option 5: using Managix (deprecated)">
+          <i class="none"></i>
+        Option 5: using Managix (deprecated)</a>
+            </li>
+                              <li class="nav-header">AsterixDB Primer</li>
+                                
+      <li>
+    
+                          <a href="../sqlpp/primer-sqlpp.html" title="Option 1: using SQL++">
+          <i class="none"></i>
+        Option 1: using SQL++</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/primer.html" title="Option 2: using AQL">
+          <i class="none"></i>
+        Option 2: using AQL</a>
+            </li>
+                              <li class="nav-header">Data Model</li>
+                                
+      <li>
+    
+                          <a href="../datamodel.html" title="The Asterix Data Model">
+          <i class="none"></i>
+        The Asterix Data Model</a>
+            </li>
+                              <li class="nav-header">Queries - SQL++</li>
+                                
+      <li>
+    
+                          <a href="../sqlpp/manual.html" title="The SQL++ Query Language">
+          <i class="none"></i>
+        The SQL++ Query Language</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../sqlpp/builtins.html" title="Builtin Functions">
+          <i class="none"></i>
+        Builtin Functions</a>
+            </li>
+                              <li class="nav-header">Queries - AQL</li>
+                                
+      <li>
+    
+                          <a href="../aql/manual.html" title="The Asterix Query Language (AQL)">
+          <i class="none"></i>
+        The Asterix Query Language (AQL)</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/builtins.html" title="Builtin Functions">
+          <i class="none"></i>
+        Builtin Functions</a>
+            </li>
+                              <li class="nav-header">API/SDK</li>
+                                
+      <li>
+    
+                          <a href="../api.html" title="HTTP API">
+          <i class="none"></i>
+        HTTP API</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../csv.html" title="CSV Output">
+          <i class="none"></i>
+        CSV Output</a>
+            </li>
+                              <li class="nav-header">Advanced Features</li>
+                                
+      <li class="active">
+    
+            <a href="#"><i class="none"></i>Support of Full-text Queries</a>
+          </li>
+                  
+      <li>
+    
+                          <a href="../aql/externaldata.html" title="Accessing External Data">
+          <i class="none"></i>
+        Accessing External Data</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../feeds/tutorial.html" title="Support for Data Ingestion">
+          <i class="none"></i>
+        Support for Data Ingestion</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../udf.html" title="User Defined Functions">
+          <i class="none"></i>
+        User Defined Functions</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/filters.html" title="Filter-Based LSM Index Acceleration">
+          <i class="none"></i>
+        Filter-Based LSM Index Acceleration</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/similarity.html" title="Support of Similarity Queries">
+          <i class="none"></i>
+        Support of Similarity Queries</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr class="divider" />
+
+           <div id="poweredBy">
+                            <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="span9" >
+                                  
+            <!-- ! 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 Support of Full-text search queries</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="#Motivation">Motivation</a></li>
+  
+<li><a href="#Syntax">Syntax</a></li>
+  
+<li><a href="#FulltextIndex">Creating and utilizing a Full-text index</a></li>
+</ul></div>
+<div class="section">
+<h2><a name="Motivation_Back_to_TOC"></a><a name="Motivation" id="Motivation">Motivation</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
+<p>Full-Text Search (FTS) queries are widely used in applications where users need to find records that satisfy an FTS predicate, i.e., where simple string-based matching is not sufficient. These queries are important when finding documents that contain a certain keyword is crucial. FTS queries are different from substring matching queries in that FTS queries find their query predicates as exact keywords in the given string, rather than treating a query predicate as a sequence of characters. For example, an FTS query that finds &#x201c;rain&#x201d; correctly returns a document when it contains &#x201c;rain&#x201d; as a word. However, a substring-matching query returns a document whenever it contains &#x201c;rain&#x201d; as a substring, for instance, a document with &#x201c;brain&#x201d; or &#x201c;training&#x201d; would be returned as well.</p></div>
+<div class="section">
+<h2><a name="Syntax_Back_to_TOC"></a><a name="Syntax" id="Syntax">Syntax</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
+<p>The syntax of AsterixDB FTS follows a portion of the XQuery FullText Search syntax. Two basic forms are as follows:</p>
+
+<div class="source">
+<div class="source">
+<pre>    ftcontains(Expression1, Expression2, {FullTextOption})
+    ftcontains(Expression1, Expression2)
+</pre></div></div>
+<p>For example, we can execute the following query to find tweet messages where the <tt>message-text</tt> field includes &#x201c;voice&#x201d; as a word. Please note that an FTS search is case-insensitive. Thus, &#x201c;Voice&#x201d; or &#x201c;voice&#x201d; will be evaluated as the same word.</p>
+
+<div class="source">
+<div class="source">
+<pre>    use dataverse TinySocial;
+
+    for $msg in dataset TweetMessages
+    where ftcontains($msg.message-text, &quot;voice&quot;, {&quot;mode&quot;:&quot;any&quot;})
+    return {&quot;id&quot;: $msg.id}
+</pre></div></div>
+<p>The DDL and DML of TinySocial can be found in <a href="primer.html#ADM:_Modeling_Semistructed_Data_in_AsterixDB">ADM: Modeling Semistructed Data in AsterixDB</a>.</p>
+<p>The same query can be also expressed in the SQL++.</p>
+
+<div class="source">
+<div class="source">
+<pre>    use TinySocial;
+
+    select element {&quot;id&quot;:msg.id}
+    from TweetMessages as msg
+    where TinySocial.ftcontains(msg.`message-text`, &quot;voice&quot;, {&quot;mode&quot;:&quot;any&quot;})
+</pre></div></div>
+<p>The <tt>Expression1</tt> is an expression that should be evaluable as a string at runtime as in the above example where <tt>$msg.message-text</tt> is a string field. The <tt>Expression2</tt> can be a string, an (un)ordered list of string value(s), or an expression. In the last case, the given expression should be evaluable into one of the first two types, i.e., into a string value or an (un)ordered list of string value(s).</p>
+<p>The following examples are all valid expressions.</p>
+
+<div class="source">
+<div class="source">
+<pre>   ... where ftcontains($msg.message-text, &quot;sound&quot;)
+   ... where ftcontains($msg.message-text, &quot;sound&quot;, {&quot;mode&quot;:&quot;any&quot;})
+   ... where ftcontains($msg.message-text, [&quot;sound&quot;, &quot;system&quot;], {&quot;mode&quot;:&quot;any&quot;})
+   ... where ftcontains($msg.message-text, {{&quot;speed&quot;, &quot;stand&quot;, &quot;customization&quot;}}, {&quot;mode&quot;:&quot;all&quot;})
+   ... where ftcontains($msg.message-text, let $keyword_list := [&quot;voice&quot;, &quot;system&quot;] return $keyword_list, {&quot;mode&quot;:&quot;all&quot;})
+   ... where ftcontains($msg.message-text, $keyword_list, {&quot;mode&quot;:&quot;any&quot;})
+</pre></div></div>
+<p>In the last example above, <tt>$keyword_list</tt> should evaluate to a string or an (un)ordered list of string value(s).</p>
+<p>The last <tt>FullTextOption</tt> parameter clarifies the given FTS request. If you omit the <tt>FullTextOption</tt> parameter, then the default value will be set for each possible option. Currently, we only have one option named <tt>mode</tt>. And as we extend the FTS feature, more options will be added. Please note that the format of <tt>FullTextOption</tt> is a record, thus you need to put the option(s) in a record <tt>{}</tt>. The <tt>mode</tt> option indicates whether the given FTS query is a conjunctive (AND) or disjunctive (OR) search request. This option can be either <tt>&#x201c;any&#x201d;</tt> or <tt>&#x201c;all&#x201d;</tt>. The default value for <tt>mode</tt> is <tt>&#x201c;all&#x201d;</tt>. If one specifies <tt>&#x201c;any&#x201d;</tt>, a disjunctive search will be conducted. For example, the following query will find documents whose <tt>message-text</tt> field contains &#x201c;sound&#x201d; or &#x201c;system&#x201d;, so a document will be returned if it contains eit
 her &#x201c;sound&#x201d;, &#x201c;system&#x201d;, or both of the keywords.</p>
+
+<div class="source">
+<div class="source">
+<pre>   ... where ftcontains($msg.message-text, [&quot;sound&quot;, &quot;system&quot;], {&quot;mode&quot;:&quot;any&quot;})
+</pre></div></div>
+<p>The other option parameter,<tt>&#x201c;all&#x201d;</tt>, specifies a conjunctive search. The following examples will find the documents whose <tt>message-text</tt> field contains both &#x201c;sound&#x201d; and &#x201c;system&#x201d;. If a document contains only &#x201c;sound&#x201d; or &#x201c;system&#x201d; but not both, it will not be returned.</p>
+
+<div class="source">
+<div class="source">
+<pre>   ... where ftcontains($msg.message-text, [&quot;sound&quot;, &quot;system&quot;], {&quot;mode&quot;:&quot;all&quot;})
+   ... where ftcontains($msg.message-text, [&quot;sound&quot;, &quot;system&quot;])
+</pre></div></div>
+<p>Currently AsterixDB doesn&#x2019;t (yet) support phrase searches, so the following query will not work.</p>
+
+<div class="source">
+<div class="source">
+<pre>   ... where ftcontains($msg.message-text, &quot;sound system&quot;, {&quot;mode&quot;:&quot;any&quot;})
+</pre></div></div>
+<p>As a workaround solution, the following query can be used to achieve a roughly similar goal. The difference is that the following queries will find documents where <tt>$msg.message-text</tt> contains both &#x201c;sound&#x201d; and &#x201c;system&#x201d;, but the order and adjacency of &#x201c;sound&#x201d; and &#x201c;system&#x201d; are not checked, unlike in a phrase search. As a result, the query below would also return documents with &#x201c;sound system can be installed.&#x201d;, &#x201c;system sound is perfect.&#x201d;, or &#x201c;sound is not clear. You may need to install a new system.&#x201d;</p>
+
+<div class="source">
+<div class="source">
+<pre>   ... where ftcontains($msg.message-text, [&quot;sound&quot;, &quot;system&quot;], {&quot;mode&quot;:&quot;all&quot;})
+   ... where ftcontains($msg.message-text, [&quot;sound&quot;, &quot;system&quot;])
+</pre></div></div></div>
+<div class="section">
+<h2><a name="Creating_and_utilizing_a_Full-text_index_Back_to_TOC"></a><a name="FulltextIndex" id="FulltextIndex">Creating and utilizing a Full-text index</a> <font size="4"><a href="#toc">[Back to TOC]</a></font></h2>
+<p>When there is a full-text index on the field that is being searched, rather than scanning all records, AsterixDB can utilize that index to expedite the execution of a FTS query. To create a full-text index, you need to specify the index type as <tt>fulltext</tt> in your DDL statement. For instance, the following DDL statement create a full-text index on the TweetMessages.message-text attribute.</p>
+
+<div class="source">
+<div class="source">
+<pre>create index messageFTSIdx on TweetMessages(message-text) type fulltext;
+</pre></div></div></div>
+                  </div>
+            </div>
+          </div>
+
+    <hr/>
+
+    <footer>
+            <div class="container-fluid">
+              <div class="row span12">Copyright &copy;                    2017
+                        <a href="https://www.apache.org/">The Apache Software Foundation</a>.
+            All Rights Reserved.      
+                    
+      </div>
+
+                                                                  <?xml version="1.0" encoding="UTF-8"?>
+<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>
+    </footer>
+  </body>
+</html>