asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject [12/13] incubator-asterixdb-site git commit: Initial commit with Till's changes
Date Sat, 30 May 2015 01:47:27 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-site/blob/ed124d8f/aql/externaldata.html
----------------------------------------------------------------------
diff --git a/aql/externaldata.html b/aql/externaldata.html
new file mode 100644
index 0000000..9ea42c5
--- /dev/null
+++ b/aql/externaldata.html
@@ -0,0 +1,443 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2015-05-29
+ | 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="20150529" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>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>
+
+    
+            </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">                  <a href="http://incubator.apache.org/" id="bannerRight">
+                                                                                                <img src="../images/egg-logo.png"  alt="Apache Software Foundation Incubator"/>
+                </a>
+      </div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+                
+                    
+                  <li id="publishDate">Last Published: 2015-05-29</li>
+                      
+                
+                    
+                 <li id="projectVersion" class="pull-right">Version: 0.8.7-SNAPSHOT</li>
+      
+                                            <li class="divider pull-right">|</li>
+                        
+    <li class="pull-right">              <a href="../index.html" title="Home">
+        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">Apache Software Foundation</li>
+                                
+      <li>
+    
+                          <a href="http://www.apache.org/" class="externalLink" title="Home">
+          <i class="none"></i>
+        Home</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Donate">
+          <i class="none"></i>
+        Donate</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks">
+          <i class="none"></i>
+        Thanks</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="http://www.apache.org/security/" class="externalLink" title="Security">
+          <i class="none"></i>
+        Security</a>
+            </li>
+                              <li class="nav-header">User Documentation</li>
+                                
+      <li>
+    
+                          <a href="../install.html" title="Installing and Managing AsterixDB using Managix">
+          <i class="none"></i>
+        Installing and Managing AsterixDB using Managix</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/primer.html" title="AsterixDB 101: An ADM and AQL Primer">
+          <i class="none"></i>
+        AsterixDB 101: An ADM and AQL Primer</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/primer-sql-like.html" title="AsterixDB 101: An ADM and AQL Primer (For SQL Fans)">
+          <i class="none"></i>
+        AsterixDB 101: An ADM and AQL Primer (For SQL Fans)</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/js-sdk.html" title="AsterixDB Javascript SDK">
+          <i class="none"></i>
+        AsterixDB Javascript SDK</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/datamodel.html" title="Asterix Data Model (ADM)">
+          <i class="none"></i>
+        Asterix Data Model (ADM)</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/manual.html" title="Asterix Query Language (AQL)">
+          <i class="none"></i>
+        Asterix Query Language (AQL)</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/functions.html" title="AQL Functions">
+          <i class="none"></i>
+        AQL Functions</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/allens.html" title="AQL Allen's Relations Functions">
+          <i class="none"></i>
+        AQL Allen's Relations Functions</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/similarity.html" title="AQL Support of Similarity Queries">
+          <i class="none"></i>
+        AQL Support of Similarity Queries</a>
+            </li>
+                  
+      <li class="active">
+    
+            <a href="#"><i class="none"></i>Accessing External Data</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="../api.html" title="REST API to AsterixDB">
+          <i class="none"></i>
+        REST API to AsterixDB</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr class="divider" />
+
+           <div id="poweredBy">
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                                                                                                                         <a href=".././" title="Hyracks" class="builtBy">
+        <img class="builtBy"  alt="Hyracks" src="../images/hyrax_ts.png"    />
+      </a>
+                      </div>
+          </div>
+        </div>
+        
+                
+        <div id="bodyColumn"  class="span9" >
+                                  
+            <h1>Accessing External Data in AsterixDB</h1>
+<div class="section">
+<h2><a name="toc" id="toc">Table of Contents</a><a name="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="#IntroductionCreatingAnExternalDataset">Creating an External Dataset</a></li>
+  
+<li><a href="#WritingQueriesAgainstAnExternalDataset">Writing Queries against an External Dataset</a></li>
+</ul></div>
+<div class="section">
+<h2><a name="Introduction" id="Introduction">Introduction</a> <font size="4"><a href="#toc">[Back to TOC]</a></font><a name="Introduction_Back_to_TOC"></a></h2>
+<p>Data that needs to be processed by ASTERIX could be residing outside ASTERIX 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 ASTERIX cluster. For ASTERIX to process such data, end-user may create a regular dataset in ASTERIX (a.k.a. internal dataset) and load the dataset with the data. ASTERIX 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="IntroductionAdapterForAnExternalDataset" id="IntroductionAdapterForAnExternalDataset">Adapter for an External Dataset</a> <font size="4"><a href="#toc">[Back to TOC]</a></font><a name="Adapter_for_an_External_Dataset_Back_to_TOC"></a></h3>
+<p>External data is accessed using wrappers (adapters in ASTERIX) that abstract away the mechanism of connecting with an external service, receiving data and transforming the data into ADM records that are understood by ASTERIX. ASTERIX 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="IntroductionCreatingAnExternalDataset" id="IntroductionCreatingAnExternalDataset">Creating an External Dataset</a> <font size="4"><a href="#toc">[Back to TOC]</a></font><a name="Creating_an_External_Dataset_Back_to_TOC"></a></h3>
+<p>As an example we consider the Lineitem dataset from <a class="externalLink" href="http://www.openlinksw.com/dataspace/doc/dav/wiki/Main/VOSTPCHLinkedData/tpch.sql">TPCH schema</a>.</p>
+<p>We assume that you have successfully created an ASTERIX instance following the instructions at <a href="../install.html">Installing Asterix 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 record 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">
+<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>
+<p>We describe here two scenarios.</p>
+<div class="section">
+<h4>1) Data file resides on the local file system of a host<a name="a1_Data_file_resides_on_the_local_file_system_of_a_host"></a></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 class="externalLink" href="https://code.google.com/p/asterixdb/downloads/detail?name=lineitem.tbl&amp;can=2&amp;q=">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">
+<pre>    create external dataset Lineitem(LineitemType)
+    using localfs
+</pre></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">
+<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>
+<p>Please substitute SOURCE_PATH with the absolute path to the source file on the local file system.</p></div>
+<div class="section">
+<h4>Common source of error<a name="Common_source_of_error"></a></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">
+<pre>    edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException: edu.uci.ics.hyracks.api.exceptions.HyracksDataException: edu.uci.ics.hyracks.api.exceptions.HyracksDataException: Job failed.
+</pre></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">
+<pre>    127.0.0.1:///home/joe/lineitem.tbl.
+</pre></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>2) Data file resides on an HDFS instance<a name="a2_Data_file_resides_on_an_HDFS_instance"></a></h4>
+<p>Pre-requisite: It is required that the Namenode and atleast one of the HDFS Datanodes are reachable from the hosts that form the ASTERIX cluster. ASTERIX provides a built-in adapter for data residing on HDFS. The HDFS adapter is referred (in AQL) by its alias - &#x2018;hdfs&#x2019;. We create an external dataset named Lineitem and associate the HDFS adapter with it.</p>
+
+<div class="source">
+<pre>    create external dataset Lineitem(LineitemType)
+    using hdfs
+</pre></div>
+<p>The above statement is <i>not complete</i> as we need to provide a set of parameters specific to the HDFS instance and the source file. These 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. Use a comma separated list if there are multiple files. </td></tr>
+
+<tr class="b">
+  
+<td> input-format </td>
+  
+<td> The associated input format. Use 'text-input-format' for textual data or 'sequence-input-format' for binary data (sequence files). </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 and use 'delimited-text' for delimited data 
+  that has fields separated by a delimiting character. </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><i>Difference between &#x2018;input-format&#x2019; and &#x2018;format&#x2019;</i></p>
+<p><i>input-format</i>: File stored under HDFS have an associated storage format For example, TextInputFormat represents plain text files. SequenceFileInputFormat indicates binary compressed file. The parameter &#x2018;input-format&#x2019; is used to distinguish between these two kind of files.</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, ADM format or could be delimited-text with fields separated by a delimiting character.</p>
+<p>As an example. consider the <a class="externalLink" href="https://code.google.com/p/asterixdb/downloads/detail?name=lineitem.tbl&amp;can=2&amp;q=">data file</a>. The file is a text file with each line representing a record. The fields in each record are separated by the &#x2018;|&#x2019; character.</p>
+<p>We assume the HDFS URL to be <a class="externalLink" href="hdfs://host:port">hdfs://host:port</a>. We further assume that the example data file is copied to the HDFS at a path denoted by HDFS_PATH.</p>
+<p>The complete set of parameters for our example file are as follows. ((&#x201c;hdfs&#x201d;=&#x201c;HDFS_URL&#x201d;,(&#x201c;path&#x201d;=&#x201c;HDFS_PATH&#x201d;),(&#x201c;input-format&#x201d;=&#x201c;text-input-format&#x201d;),(&#x201c;format&#x201d;=&#x201c;delimited-text&#x201d;),(&#x201c;delimiter&#x201d;=&#x201c;|&#x201d;))</p>
+<p>We modify the create external dataset statement as follows.</p>
+
+<div class="source">
+<pre>    create external dataset Lineitem('LineitemType)
+    using hdfs
+    ((&quot;hdfs&quot;=&quot;HDFS_URL&quot;),(&quot;path&quot;=&quot;HDFS_PATH&quot;),(&quot;input-format&quot;=&quot;text-input-format&quot;),(&quot;format&quot;=&quot;delimited-text&quot;),(&quot;delimiter&quot;=&quot;|&quot;));
+</pre></div>
+<p>Once you have copied the source data file to your HDFS instance, substitute the values of HDFS_URL and HDFS_PATH in the above statement. In your web-browser, navigate to <a class="externalLink" href="http://127.0.0.1:19001">http://127.0.0.1:19001</a> and execute the above statement with substituted values.</p>
+<p>You may now run the sample query in next section.</p></div></div></div>
+<div class="section">
+<h2><a name="WritingQueriesAgainstAnExternalDataset" id="WritingQueriesAgainstAnExternalDataset">Writing Queries against an External Dataset</a> <font size="4"><a href="#toc">[Back to TOC]</a></font><a name="Writing_Queries_against_an_External_Dataset_Back_to_TOC"></a></h2>
+<p>You may write AQL queries against an external dataset. Following is an example AQL query that applies a filter and returns an ordered result.</p>
+
+<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>
+<p>The expected result is:</p>
+
+<div class="source">
+<pre>    { &quot;l_orderkey&quot;: 1, &quot;l_partkey&quot;: 156, &quot;l_suppkey&quot;: 4, &quot;l_linenumber&quot;: 1, &quot;l_quantity&quot;: 17, &quot;l_extendedprice&quot;: 17954.55d, &quot;l_discount&quot;: 0.04d, &quot;l_tax&quot;: 0.02d, &quot;l_returnflag&quot;: &quot;N&quot;, &quot;l_linestatus&quot;: &quot;O&quot;, &quot;l_shipdate&quot;: &quot;1996-03-13&quot;, &quot;l_commitdate&quot;: &quot;1996-02-12&quot;, &quot;l_receiptdate&quot;: &quot;1996-03-22&quot;, &quot;l_shipinstruct&quot;: &quot;DELIVER IN PERSON&quot;, &quot;l_shipmode&quot;: &quot;TRUCK&quot;, &quot;l_comment&quot;: &quot;egular courts above the&quot; }
+    { &quot;l_orderkey&quot;: 1, &quot;l_partkey&quot;: 68, &quot;l_suppkey&quot;: 9, &quot;l_linenumber&quot;: 2, &quot;l_quantity&quot;: 36, &quot;l_extendedprice&quot;: 34850.16d, &quot;l_discount&quot;: 0.09d, &quot;l_tax&quot;: 0.06d, &quot;l_returnflag&quot;: &quot;N&quot;, &quot;l_linestatus&quot;: &quot;O&quot;, &quot;l_shipdate&quot;: &quot;1996-04-12&quot;, &quot;l_commitdate&quot;: &quot;1996-02-28&quot;, &quot;l_receiptdate&quot;: &quot;1996-04-20&quot;, &quot;l_shipinstruct&quot;: &quot;TAKE BACK RETURN&quot;, &quot;l_shipmode&quot;: &quot;MAIL&quot;, &quot;l_comment&quot;: &quot;ly final dependencies: slyly bold &quot; }
+    { &quot;l_orderkey&quot;: 1, &quot;l_partkey&quot;: 64, &quot;l_suppkey&quot;: 5, &quot;l_linenumber&quot;: 3, &quot;l_quantity&quot;: 8, &quot;l_extendedprice&quot;: 7712.48d, &quot;l_discount&quot;: 0.1d, &quot;l_tax&quot;: 0.02d, &quot;l_returnflag&quot;: &quot;N&quot;, &quot;l_linestatus&quot;: &quot;O&quot;, &quot;l_shipdate&quot;: &quot;1996-01-29&quot;, &quot;l_commitdate&quot;: &quot;1996-03-05&quot;, &quot;l_receiptdate&quot;: &quot;1996-01-31&quot;, &quot;l_shipinstruct&quot;: &quot;TAKE BACK RETURN&quot;, &quot;l_shipmode&quot;: &quot;REG AIR&quot;, &quot;l_comment&quot;: &quot;riously. regular, express dep&quot; }
+    { &quot;l_orderkey&quot;: 1, &quot;l_partkey&quot;: 3, &quot;l_suppkey&quot;: 6, &quot;l_linenumber&quot;: 4, &quot;l_quantity&quot;: 28, &quot;l_extendedprice&quot;: 25284.0d, &quot;l_discount&quot;: 0.09d, &quot;l_tax&quot;: 0.06d, &quot;l_returnflag&quot;: &quot;N&quot;, &quot;l_linestatus&quot;: &quot;O&quot;, &quot;l_shipdate&quot;: &quot;1996-04-21&quot;, &quot;l_commitdate&quot;: &quot;1996-03-30&quot;, &quot;l_receiptdate&quot;: &quot;1996-05-16&quot;, &quot;l_shipinstruct&quot;: &quot;NONE&quot;, &quot;l_shipmode&quot;: &quot;AIR&quot;, &quot;l_comment&quot;: &quot;lites. fluffily even de&quot; }
+    { &quot;l_orderkey&quot;: 1, &quot;l_partkey&quot;: 25, &quot;l_suppkey&quot;: 8, &quot;l_linenumber&quot;: 5, &quot;l_quantity&quot;: 24, &quot;l_extendedprice&quot;: 22200.48d, &quot;l_discount&quot;: 0.1d, &quot;l_tax&quot;: 0.04d, &quot;l_returnflag&quot;: &quot;N&quot;, &quot;l_linestatus&quot;: &quot;O&quot;, &quot;l_shipdate&quot;: &quot;1996-03-30&quot;, &quot;l_commitdate&quot;: &quot;1996-03-14&quot;, &quot;l_receiptdate&quot;: &quot;1996-04-01&quot;, &quot;l_shipinstruct&quot;: &quot;NONE&quot;, &quot;l_shipmode&quot;: &quot;FOB&quot;, &quot;l_comment&quot;: &quot; pending foxes. slyly re&quot; }
+    { &quot;l_orderkey&quot;: 1, &quot;l_partkey&quot;: 16, &quot;l_suppkey&quot;: 3, &quot;l_linenumber&quot;: 6, &quot;l_quantity&quot;: 32, &quot;l_extendedprice&quot;: 29312.32d, &quot;l_discount&quot;: 0.07d, &quot;l_tax&quot;: 0.02d, &quot;l_returnflag&quot;: &quot;N&quot;, &quot;l_linestatus&quot;: &quot;O&quot;, &quot;l_shipdate&quot;: &quot;1996-01-30&quot;, &quot;l_commitdate&quot;: &quot;1996-02-07&quot;, &quot;l_receiptdate&quot;: &quot;1996-02-03&quot;, &quot;l_shipinstruct&quot;: &quot;DELIVER IN PERSON&quot;, &quot;l_shipmode&quot;: &quot;MAIL&quot;, &quot;l_comment&quot;: &quot;arefully slyly ex&quot; }
+    { &quot;l_orderkey&quot;: 2, &quot;l_partkey&quot;: 107, &quot;l_suppkey&quot;: 2, &quot;l_linenumber&quot;: 1, &quot;l_quantity&quot;: 38, &quot;l_extendedprice&quot;: 38269.8d, &quot;l_discount&quot;: 0.0d, &quot;l_tax&quot;: 0.05d, &quot;l_returnflag&quot;: &quot;N&quot;, &quot;l_linestatus&quot;: &quot;O&quot;, &quot;l_shipdate&quot;: &quot;1997-01-28&quot;, &quot;l_commitdate&quot;: &quot;1997-01-14&quot;, &quot;l_receiptdate&quot;: &quot;1997-02-02&quot;, &quot;l_shipinstruct&quot;: &quot;TAKE BACK RETURN&quot;, &quot;l_shipmode&quot;: &quot;RAIL&quot;, &quot;l_comment&quot;: &quot;ven requests. deposits breach a&quot; }
+    { &quot;l_orderkey&quot;: 3, &quot;l_partkey&quot;: 5, &quot;l_suppkey&quot;: 2, &quot;l_linenumber&quot;: 1, &quot;l_quantity&quot;: 45, &quot;l_extendedprice&quot;: 40725.0d, &quot;l_discount&quot;: 0.06d, &quot;l_tax&quot;: 0.0d, &quot;l_returnflag&quot;: &quot;R&quot;, &quot;l_linestatus&quot;: &quot;F&quot;, &quot;l_shipdate&quot;: &quot;1994-02-02&quot;, &quot;l_commitdate&quot;: &quot;1994-01-04&quot;, &quot;l_receiptdate&quot;: &quot;1994-02-23&quot;, &quot;l_shipinstruct&quot;: &quot;NONE&quot;, &quot;l_shipmode&quot;: &quot;AIR&quot;, &quot;l_comment&quot;: &quot;ongside of the furiously brave acco&quot; }
+    { &quot;l_orderkey&quot;: 3, &quot;l_partkey&quot;: 20, &quot;l_suppkey&quot;: 10, &quot;l_linenumber&quot;: 2, &quot;l_quantity&quot;: 49, &quot;l_extendedprice&quot;: 45080.98d, &quot;l_discount&quot;: 0.1d, &quot;l_tax&quot;: 0.0d, &quot;l_returnflag&quot;: &quot;R&quot;, &quot;l_linestatus&quot;: &quot;F&quot;, &quot;l_shipdate&quot;: &quot;1993-11-09&quot;, &quot;l_commitdate&quot;: &quot;1993-12-20&quot;, &quot;l_receiptdate&quot;: &quot;1993-11-24&quot;, &quot;l_shipinstruct&quot;: &quot;TAKE BACK RETURN&quot;, &quot;l_shipmode&quot;: &quot;RAIL&quot;, &quot;l_comment&quot;: &quot; unusual accounts. eve&quot; }
+    { &quot;l_orderkey&quot;: 3, &quot;l_partkey&quot;: 129, &quot;l_suppkey&quot;: 8, &quot;l_linenumber&quot;: 3, &quot;l_quantity&quot;: 27, &quot;l_extendedprice&quot;: 27786.24d, &quot;l_discount&quot;: 0.06d, &quot;l_tax&quot;: 0.07d, &quot;l_returnflag&quot;: &quot;A&quot;, &quot;l_linestatus&quot;: &quot;F&quot;, &quot;l_shipdate&quot;: &quot;1994-01-16&quot;, &quot;l_commitdate&quot;: &quot;1993-11-22&quot;, &quot;l_receiptdate&quot;: &quot;1994-01-23&quot;, &quot;l_shipinstruct&quot;: &quot;DELIVER IN PERSON&quot;, &quot;l_shipmode&quot;: &quot;SHIP&quot;, &quot;l_comment&quot;: &quot;nal foxes wake. &quot; }
+    { &quot;l_orderkey&quot;: 3, &quot;l_partkey&quot;: 30, &quot;l_suppkey&quot;: 5, &quot;l_linenumber&quot;: 4, &quot;l_quantity&quot;: 2, &quot;l_extendedprice&quot;: 1860.06d, &quot;l_discount&quot;: 0.01d, &quot;l_tax&quot;: 0.06d, &quot;l_returnflag&quot;: &quot;A&quot;, &quot;l_linestatus&quot;: &quot;F&quot;, &quot;l_shipdate&quot;: &quot;1993-12-04&quot;, &quot;l_commitdate&quot;: &quot;1994-01-07&quot;, &quot;l_receiptdate&quot;: &quot;1994-01-01&quot;, &quot;l_shipinstruct&quot;: &quot;NONE&quot;, &quot;l_shipmode&quot;: &quot;TRUCK&quot;, &quot;l_comment&quot;: &quot;y. fluffily pending d&quot; }
+    { &quot;l_orderkey&quot;: 3, &quot;l_partkey&quot;: 184, &quot;l_suppkey&quot;: 5, &quot;l_linenumber&quot;: 5, &quot;l_quantity&quot;: 28, &quot;l_extendedprice&quot;: 30357.04d, &quot;l_discount&quot;: 0.04d, &quot;l_tax&quot;: 0.0d, &quot;l_returnflag&quot;: &quot;R&quot;, &quot;l_linestatus&quot;: &quot;F&quot;, &quot;l_shipdate&quot;: &quot;1993-12-14&quot;, &quot;l_commitdate&quot;: &quot;1994-01-10&quot;, &quot;l_receiptdate&quot;: &quot;1994-01-01&quot;, &quot;l_shipinstruct&quot;: &quot;TAKE BACK RETURN&quot;, &quot;l_shipmode&quot;: &quot;FOB&quot;, &quot;l_comment&quot;: &quot;ages nag slyly pending&quot; }
+    { &quot;l_orderkey&quot;: 3, &quot;l_partkey&quot;: 63, &quot;l_suppkey&quot;: 8, &quot;l_linenumber&quot;: 6, &quot;l_quantity&quot;: 26, &quot;l_extendedprice&quot;: 25039.56d, &quot;l_discount&quot;: 0.1d, &quot;l_tax&quot;: 0.02d, &quot;l_returnflag&quot;: &quot;A&quot;, &quot;l_linestatus&quot;: &quot;F&quot;, &quot;l_shipdate&quot;: &quot;1993-10-29&quot;, &quot;l_commitdate&quot;: &quot;1993-12-18&quot;, &quot;l_receiptdate&quot;: &quot;1993-11-04&quot;, &quot;l_shipinstruct&quot;: &quot;TAKE BACK RETURN&quot;, &quot;l_shipmode&quot;: &quot;RAIL&quot;, &quot;l_comment&quot;: &quot;ges sleep after the caref&quot; }
+</pre></div></div>
+                  </div>
+            </div>
+          </div>
+
+    <hr/>
+
+    <footer>
+            <div class="container-fluid">
+              <div class="row span12">Copyright &copy;                   2015.
+          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/incubator-asterixdb-site/blob/ed124d8f/aql/filters.html
----------------------------------------------------------------------
diff --git a/aql/filters.html b/aql/filters.html
new file mode 100644
index 0000000..33169a1
--- /dev/null
+++ b/aql/filters.html
@@ -0,0 +1,256 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2015-05-29
+ | 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="20150529" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>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>
+
+    
+            </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">                  <a href="http://incubator.apache.org/" id="bannerRight">
+                                                                                                <img src="../images/egg-logo.png"  alt="Apache Software Foundation Incubator"/>
+                </a>
+      </div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+                
+                    
+                  <li id="publishDate">Last Published: 2015-05-29</li>
+                      
+                
+                    
+                 <li id="projectVersion" class="pull-right">Version: 0.8.7-SNAPSHOT</li>
+      
+                                            <li class="divider pull-right">|</li>
+                        
+    <li class="pull-right">              <a href="../index.html" title="Home">
+        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">Apache Software Foundation</li>
+                                
+      <li>
+    
+                          <a href="http://www.apache.org/" class="externalLink" title="Home">
+          <i class="none"></i>
+        Home</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Donate">
+          <i class="none"></i>
+        Donate</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks">
+          <i class="none"></i>
+        Thanks</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="http://www.apache.org/security/" class="externalLink" title="Security">
+          <i class="none"></i>
+        Security</a>
+            </li>
+                              <li class="nav-header">User Documentation</li>
+                                
+      <li>
+    
+                          <a href="../install.html" title="Installing and Managing AsterixDB using Managix">
+          <i class="none"></i>
+        Installing and Managing AsterixDB using Managix</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/primer.html" title="AsterixDB 101: An ADM and AQL Primer">
+          <i class="none"></i>
+        AsterixDB 101: An ADM and AQL Primer</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/primer-sql-like.html" title="AsterixDB 101: An ADM and AQL Primer (For SQL Fans)">
+          <i class="none"></i>
+        AsterixDB 101: An ADM and AQL Primer (For SQL Fans)</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/js-sdk.html" title="AsterixDB Javascript SDK">
+          <i class="none"></i>
+        AsterixDB Javascript SDK</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/datamodel.html" title="Asterix Data Model (ADM)">
+          <i class="none"></i>
+        Asterix Data Model (ADM)</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/manual.html" title="Asterix Query Language (AQL)">
+          <i class="none"></i>
+        Asterix Query Language (AQL)</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/functions.html" title="AQL Functions">
+          <i class="none"></i>
+        AQL Functions</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/allens.html" title="AQL Allen's Relations Functions">
+          <i class="none"></i>
+        AQL Allen's Relations Functions</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/similarity.html" title="AQL Support of Similarity Queries">
+          <i class="none"></i>
+        AQL Support of Similarity Queries</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/externaldata.html" title="Accessing External Data">
+          <i class="none"></i>
+        Accessing External Data</a>
+            </li>
+                  
+      <li class="active">
+    
+            <a href="#"><i class="none"></i>Filter-Based LSM Index Acceleration</a>
+          </li>
+                  
+      <li>
+    
+                          <a href="../api.html" title="REST API to AsterixDB">
+          <i class="none"></i>
+        REST API to AsterixDB</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr class="divider" />
+
+           <div id="poweredBy">
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                                                                                                                         <a href=".././" title="Hyracks" class="builtBy">
+        <img class="builtBy"  alt="Hyracks" src="../images/hyrax_ts.png"    />
+      </a>
+                      </div>
+          </div>
+        </div>
+        
+                
+        <div id="bodyColumn"  class="span9" >
+                                  
+            <h1>Filter-Based LSM Index Acceleration</h1>
+<div class="section">
+<h2><a name="toc" id="toc">Table of Contents</a><a name="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" id="Motivation">Motivation</a> <font size="4"><a href="#toc">[Back to TOC]</a></font><a name="Motivation_Back_to_TOC"></a></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 records 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="FiltersInAsterixDB" id="FiltersInAsterixDB">Filters in AsterixDB</a> <font size="4"><a href="#toc">[Back to TOC]</a></font><a name="Filters_in_AsterixDB_Back_to_TOC"></a></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>Creating a Dataset with a Filter<a name="Creating_a_Dataset_with_a_Filter"></a></h4>
+
+<div class="source">
+<pre>    create dataset Tweets(TweetType) primary key tweetid with filter on send-time;
+</pre></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="FiltersAndMergePolicies" id="FiltersAndMergePolicies">Filters and Merge Policies</a> <font size="4"><a href="#toc">[Back to TOC]</a></font><a name="Filters_and_Merge_Policies_Back_to_TOC"></a></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;                   2015.
+          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>



Mime
View raw message