Author: ramkrishna
Date: Wed Jul  9 12:30:08 2014
New Revision: 1609131

URL: http://svn.apache.org/r1609131
Log:
Phoenix-1067 Add documentation for ANY/ALL support with arrays (Ram)

Modified:
    phoenix/site/publish/array_type.html

Modified: phoenix/site/publish/array_type.html
URL: 
http://svn.apache.org/viewvc/phoenix/site/publish/array_type.html?rev=1609131&r1=1609130&r2=1609131&view=diff
==============================================================================
--- phoenix/site/publish/array_type.html (original)
+++ phoenix/site/publish/array_type.html Wed Jul  9 12:30:08 2014
@@ -1,370 +1,385 @@
-
-<!DOCTYPE html>
-<!--
- Generated by Apache Maven Doxia at 2014-06-03
- Rendered using Reflow Maven Skin 1.1.0 
(http://andriusvelykis.github.io/reflow-maven-skin)
--->
-<html  xml:lang="en" lang="en">
-
-       <head>
-               <meta charset="UTF-8" />
-               <title>ARRAY Type | Apache Phoenix</title>
-               <meta name="viewport" content="width=device-width, 
initial-scale=1.0" />
-               <meta name="description" content="" />
-               <meta http-equiv="content-language" content="en" />
-
-               <link 
href="http://netdna.bootstrapcdn.com/bootswatch/2.3.2/united/bootstrap.min.css"; 
rel="stylesheet" />
-               <link 
href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css";
 rel="stylesheet" />
-               <link href="./css/bootswatch.css" rel="stylesheet" />
-               <link href="./css/reflow-skin.css" rel="stylesheet" />
-
-               <link 
href="http://yandex.st/highlightjs/7.5/styles/default.min.css"; rel="stylesheet" 
/>
-               
-               <link href="./css/lightbox.css" rel="stylesheet" />
-               
-               <link href="./css/site.css" rel="stylesheet" />
-               <link href="./css/print.css" rel="stylesheet" media="print" />
-               
-               <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
-               <!--[if lt IE 9]>
-                       <script 
src="http://html5shim.googlecode.com/svn/trunk/html5.js";></script>
-               <![endif]-->
-
-
-
-       </head>
-
-       <body class="page-array_type project-phoenix-site" data-spy="scroll" 
data-offset="60" data-target="#toc-scroll-target">
-
-               <div class="navbar navbar-fixed-top">
-                       <div class="navbar-inner">
-                               <div class="container">
-                                       <a class="btn btn-navbar" 
data-toggle="collapse" data-target="#top-nav-collapse">
-                                               <span class="icon-bar"></span>
-                                               <span class="icon-bar"></span>
-                                               <span class="icon-bar"></span>
-                                       </a>
-                                       <a class="brand" href="index.html"><div 
class="xtoplogo"></div></a>
-                                       <div class="nav-collapse collapse" 
id="top-nav-collapse">
-                                               <ul class="nav pull-right">
-                                                       <li class="dropdown">
-                                                               <a href="#" 
class="dropdown-toggle" data-toggle="dropdown">About <b class="caret"></b></a>
-                                                               <ul 
class="dropdown-menu">
-                                                                       <li ><a 
href="index.html" title="Overview">Overview</a></li>
-                                                                       <li ><a 
href="recent.html" title="New Features">New Features</a></li>
-                                                                       <li ><a 
href="roadmap.html" title="Roadmap">Roadmap</a></li>
-                                                                       <li ><a 
href="performance.html" title="Performance">Performance</a></li>
-                                                                       <li ><a 
href="team.html" title="Team">Team</a></li>
-                                                                       <li ><a 
href="contributing.html" title="Contributing">Contributing</a></li>
-                                                                       <li ><a 
href="resources.html" title="Resources">Resources</a></li>
-                                                                       <li ><a 
href="mailing_list.html" title="Mailing Lists">Mailing Lists</a></li>
-                                                                       <li ><a 
href="source.html" title="Source Repository">Source Repository</a></li>
-                                                                       <li ><a 
href="issues.html" title="Issue Tracking">Issue Tracking</a></li>
-                                                                       <li ><a 
href="download.html" title="Download">Download</a></li>
-                                                                       <li 
class="divider"/>
-                                                                       <li ><a 
href="http://www.apache.org/licenses/"; title="License" 
class="externalLink">License</a></li>
-                                                                       <li ><a 
href="http://www.apache.org/foundation/sponsorship.html"; title="Sponsorship" 
class="externalLink">Sponsorship</a></li>
-                                                                       <li ><a 
href="http://www.apache.org/foundation/thanks.html"; title="Thanks" 
class="externalLink">Thanks</a></li>
-                                                                       <li ><a 
href="http://www.apache.org/security/"; title="Security" 
class="externalLink">Security</a></li>
-                                                               </ul>
-                                                       </li>
-                                                       <li class="dropdown">
-                                                               <a href="#" 
class="dropdown-toggle" data-toggle="dropdown">Using <b class="caret"></b></a>
-                                                               <ul 
class="dropdown-menu">
-                                                                       <li ><a 
href="faq.html" title="F.A.Q.">F.A.Q.</a></li>
-                                                                       <li ><a 
href="Phoenix-in-15-minutes-or-less.html" title="Quick Start">Quick 
Start</a></li>
-                                                                       <li ><a 
href="building.html" title="Building">Building</a></li>
-                                                                       <li ><a 
href="tuning.html" title="Tuning">Tuning</a></li>
-                                                                       <li ><a 
href="upgrade_from_2_2.html" title="Upgrade from 2.2">Upgrade from 2.2</a></li>
-                                                                       <li 
class="divider"/>
-                                                                       <li ><a 
href="secondary_indexing.html" title="Secondary Indexes">Secondary 
Indexes</a></li>
-                                                                       <li ><a 
href="joins.html" title="Joins">Joins</a></li>
-                                                                       <li ><a 
href="views.html" title="Views">Views</a></li>
-                                                                       <li ><a 
href="multi-tenancy.html" title="Multi tenancy">Multi tenancy</a></li>
-                                                                       <li ><a 
href="sequences.html" title="Sequences">Sequences</a></li>
-                                                                       <li 
class="active"><a href="" title="ARRAY type">ARRAY type</a></li>
-                                                                       <li ><a 
href="salted.html" title="Salted Tables">Salted Tables</a></li>
-                                                                       <li ><a 
href="paged.html" title="Paged Queries">Paged Queries</a></li>
-                                                                       <li ><a 
href="dynamic_columns.html" title="Dynamic Columns">Dynamic Columns</a></li>
-                                                                       <li ><a 
href="skip_scan.html" title="Skip Scan">Skip Scan</a></li>
-                                                                       <li ><a 
href="bulk_dataload.html" title="Bulk Loading">Bulk Loading</a></li>
-                                                                       <li 
class="divider"/>
-                                                                       <li ><a 
href="phoenix_on_emr.html" title="Amazon EMR Support">Amazon EMR 
Support</a></li>
-                                                                       <li ><a 
href="flume.html" title="Apache Flume Plugin">Apache Flume Plugin</a></li>
-                                                                       <li ><a 
href="pig_integration.html" title="Apache Pig Integration">Apache Pig 
Integration</a></li>
-                                                               </ul>
-                                                       </li>
-                                                       <li class="dropdown">
-                                                               <a href="#" 
class="dropdown-toggle" data-toggle="dropdown">Reference <b 
class="caret"></b></a>
-                                                               <ul 
class="dropdown-menu">
-                                                                       <li ><a 
href="language/index.html" title="Grammar">Grammar</a></li>
-                                                                       <li ><a 
href="language/functions.html" title="Functions">Functions</a></li>
-                                                                       <li ><a 
href="language/datatypes.html" title="Datatypes">Datatypes</a></li>
-                                                               </ul>
-                                                       </li>
-                                               </ul>
-                                       </div><!--/.nav-collapse -->
-                               </div>
-                       </div>
-               </div>
-               
-       <div class="container">
-       
-       <!-- Masthead
-       ================================================== -->
-
-       <header>
-       </header>
-
-       <div class="main-body">
-       <div class="row">
-               <div class="span12">
-                       <div class="body-content">
-<div class="page-header">
- <h1>ARRAY Type</h1>
-</div> 
-<p>The Apache Phoenix 3.0/4.0 release introduces support for the <a 
class="externalLink" 
href="http://docs.oracle.com/javase/tutorial/jdbc/basics/array.html";>JDBC ARRAY 
type</a>. Any primitive type may be used in an ARRAY. Here is an example of 
declaring an array type when creating a table:</p> 
-<div class="source"> 
- <pre>CREATE TABLE regions (
-    region_name VARCHAR PRIMARY KEY,
-    zips VARCHAR ARRAY[10],
-    CONSTRAINT pk PRIMARY KEY (region_name));
-</pre> 
-</div> 
-<p>or alternately:</p> 
-<div class="source"> 
- <pre>CREATE TABLE regions (
-    region_name VARCHAR PRIMARY KEY,
-    zips VARCHAR[],
-    CONSTRAINT pk PRIMARY KEY (region_name));
-</pre> 
-</div> 
-<p>Insertion into the array may be done entirely through a SQL statement:</p> 
-<div class="source"> 
- <pre>UPSERT INTO regions(region_name,zips)
-VALUES('SF Bay Area',ARRAY['94115','94030','94125']);
-</pre> 
-</div> 
-<p>or programmatically through JDBC:</p> 
-<div class="source"> 
- <pre>PreparedStatement stmt = conn.prepareStatement(&quot;UPSERT INTO regions 
VALUES(?,?)&quot;);
-stmt.setString(1,&quot;SF Bay Area&quot;);
-String[] zips =  new String[] 
{&quot;94115&quot;,&quot;94030&quot;,&quot;94125&quot;};
-Array array = conn.createArrayOf(&quot;VARCHAR&quot;, zips);
-stmt.setArray(2, array);
-stmt.execute();
-</pre> 
-</div> 
-<p>The entire array may be selected:</p> 
-<div class="source"> 
- <pre>SELECT zips FROM regions WHERE region_name = 'SF Bay Area';
-</pre> 
-</div> 
-<p>or an individual element in the array may be accessed via a subscript 
notation. The subscript is one-based, so the following would select the first 
element:</p> 
-<div class="source"> 
- <pre>SELECT zip[1] FROM regions WHERE region_name = 'SF Bay Area';
-</pre> 
-</div> 
-<p>Use of the array subscript notation is supported in other expressions as 
well, for example in a WHERE clause:</p> 
-<div class="source"> 
- <pre>SELECT region_name FROM regions WHERE zip[1] = '94030' OR zip[2] = 
'94030' OR zip[3] = '94030';
-</pre> 
-</div> 
-<p>The length of the array grows dynamically as needed with the current length 
and is accessible through the ARRAY_LENGTH build it function:</p> 
-<div class="source"> 
- <pre>SELECT ARRAY_LENGTH(zips) FROM regions;
-</pre> 
-</div> 
-<p>Attempts to access an array element beyond the current length will evaluate 
to <tt>null</tt>.</p> 
-<div class="section"> 
- <div class="section"> 
-  <h3 id="Limitations">Limitations</h3> 
-  <ul> 
-   <li>Only one dimensional arrays are currently supported</li> 
-   <li>For an array of fixed width types, null elements occurring in the 
middle of an array are not tracked.</li> 
-   <li>The declaration of an array length at DDL time is not enforced 
currently, but maybe in the future. Note that it is persisted with the table 
metadata.</li> 
-   <li>An array may only be used as the last column in a primary key 
constraint.</li> 
-   <li>Partial update of an array is currently not possible. Instead, the 
array may be manipulated on the client-side and then upserted back in its 
entirety.</li> 
-   <li>No support currently exists for searching in an array through the ALL 
or ANY built-in functions, but we welcome community contributions.</li> 
-  </ul> 
- </div> 
-</div>
-                       </div>
-               </div>
-       </div>
-       </div>
-
-       </div><!-- /container -->
-       
-       <!-- Footer
-       ================================================== -->
-       <footer class="well">
-               <div class="container">
-                       <div class="row">
-                               <div class="span3 bottom-nav">
-                                       <ul class="nav nav-list">
-                                               <li 
class="nav-header">About</li>
-                                               <li >
-                                                       <a href="index.html" 
title="Overview">Overview</a>
-                                               </li>
-                                               <li >
-                                                       <a href="recent.html" 
title="New Features">New Features</a>
-                                               </li>
-                                               <li >
-                                                       <a href="roadmap.html" 
title="Roadmap">Roadmap</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="performance.html" title="Performance">Performance</a>
-                                               </li>
-                                               <li >
-                                                       <a href="team.html" 
title="Team">Team</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="contributing.html" title="Contributing">Contributing</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="resources.html" title="Resources">Resources</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="mailing_list.html" title="Mailing Lists">Mailing Lists</a>
-                                               </li>
-                                               <li >
-                                                       <a href="source.html" 
title="Source Repository">Source Repository</a>
-                                               </li>
-                                               <li >
-                                                       <a href="issues.html" 
title="Issue Tracking">Issue Tracking</a>
-                                               </li>
-                                               <li >
-                                                       <a href="download.html" 
title="Download">Download</a>
-                                               </li>
-                                               <li >
-                                                       <a href="http:divider" 
title=""></a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="http://www.apache.org/licenses/"; title="License" 
class="externalLink">License</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="http://www.apache.org/foundation/sponsorship.html"; title="Sponsorship" 
class="externalLink">Sponsorship</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="http://www.apache.org/foundation/thanks.html"; title="Thanks" 
class="externalLink">Thanks</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="http://www.apache.org/security/"; title="Security" 
class="externalLink">Security</a>
-                                               </li>
-                                       </ul>
-                               </div>
-                               <div class="span3 bottom-nav">
-                                       <ul class="nav nav-list">
-                                               <li 
class="nav-header">Using</li>
-                                               <li >
-                                                       <a href="faq.html" 
title="F.A.Q.">F.A.Q.</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="Phoenix-in-15-minutes-or-less.html" title="Quick Start">Quick Start</a>
-                                               </li>
-                                               <li >
-                                                       <a href="building.html" 
title="Building">Building</a>
-                                               </li>
-                                               <li >
-                                                       <a href="tuning.html" 
title="Tuning">Tuning</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="upgrade_from_2_2.html" title="Upgrade from 2.2">Upgrade from 2.2</a>
-                                               </li>
-                                               <li >
-                                                       <a href="http:divider" 
title=""></a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="secondary_indexing.html" title="Secondary Indexes">Secondary Indexes</a>
-                                               </li>
-                                               <li >
-                                                       <a href="joins.html" 
title="Joins">Joins</a>
-                                               </li>
-                                               <li >
-                                                       <a href="views.html" 
title="Views">Views</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="multi-tenancy.html" title="Multi tenancy">Multi tenancy</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="sequences.html" title="Sequences">Sequences</a>
-                                               </li>
-                                               <li class="active">
-                                                       <a href="#" 
title="ARRAY type">ARRAY type</a>
-                                               </li>
-                                               <li >
-                                                       <a href="salted.html" 
title="Salted Tables">Salted Tables</a>
-                                               </li>
-                                               <li >
-                                                       <a href="paged.html" 
title="Paged Queries">Paged Queries</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="dynamic_columns.html" title="Dynamic Columns">Dynamic Columns</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="skip_scan.html" title="Skip Scan">Skip Scan</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="bulk_dataload.html" title="Bulk Loading">Bulk Loading</a>
-                                               </li>
-                                               <li >
-                                                       <a href="http:divider" 
title=""></a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="phoenix_on_emr.html" title="Amazon EMR Support">Amazon EMR Support</a>
-                                               </li>
-                                               <li >
-                                                       <a href="flume.html" 
title="Apache Flume Plugin">Apache Flume Plugin</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="pig_integration.html" title="Apache Pig Integration">Apache Pig 
Integration</a>
-                                               </li>
-                                       </ul>
-                               </div>
-                               <div class="span3 bottom-nav">
-                                       <ul class="nav nav-list">
-                                               <li 
class="nav-header">Reference</li>
-                                               <li >
-                                                       <a 
href="language/index.html" title="Grammar">Grammar</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="language/functions.html" title="Functions">Functions</a>
-                                               </li>
-                                               <li >
-                                                       <a 
href="language/datatypes.html" title="Datatypes">Datatypes</a>
-                                               </li>
-                                       </ul>
-                               </div>
-                               <div class="span3 bottom-description">
-                                       <form 
action="https://www.google.com/search"; method="get"><input 
value="phoenix.incubator.apache.org" name="sitesearch" type="hidden"><input 
placeholder="Search the site&hellip;" required="required" style="width:170px;" 
size="18" name="q" id="query" type="search"></form>
-                               </div>
-                       </div>
-               </div>
-       </footer>
-               
-       <div class="container subfooter">
-               <div class="row">
-                       <div class="span12">
-                               <p class="pull-right"><a href="#">Back to 
top</a></p>
-                               <p class="copyright">Copyright &copy;2014 <a 
href="http://www.apache.org";>Apache Software Foundation</a>. All Rights 
Reserved.</p>
-                       </div>
-               </div>
-       </div>
-
-       <!-- Le javascript
-       ================================================== -->
-       <!-- Placed at the end of the document so the pages load faster -->
-       <script 
src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js";></script>
-       
-       <script 
src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js";></script>
-       <script src="./js/lightbox.js"></script>
-       <script src="./js/jquery.smooth-scroll.min.js"></script>
-       <!-- back button support for smooth scroll -->
-       <script src="./js/jquery.ba-bbq.min.js"></script>
-       <script 
src="http://yandex.st/highlightjs/7.5/highlight.min.js";></script>
-
-       <script src="./js/reflow-skin.js"></script>
-       
-       </body>
-</html>
+
+<!DOCTYPE html>
+<!--
+ Generated by Apache Maven Doxia at 2014-07-09
+ Rendered using Reflow Maven Skin 1.1.0 
(http://andriusvelykis.github.io/reflow-maven-skin)
+-->
+<html  xml:lang="en" lang="en">
+
+       <head>
+               <meta charset="UTF-8" />
+               <title>ARRAY Type | Apache Phoenix</title>
+               <meta name="viewport" content="width=device-width, 
initial-scale=1.0" />
+               <meta name="description" content="" />
+               <meta http-equiv="content-language" content="en" />
+
+               <link 
href="http://netdna.bootstrapcdn.com/bootswatch/2.3.2/united/bootstrap.min.css"; 
rel="stylesheet" />
+               <link 
href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css";
 rel="stylesheet" />
+               <link href="./css/bootswatch.css" rel="stylesheet" />
+               <link href="./css/reflow-skin.css" rel="stylesheet" />
+
+               <link 
href="http://yandex.st/highlightjs/7.5/styles/default.min.css"; rel="stylesheet" 
/>
+               
+               <link href="./css/lightbox.css" rel="stylesheet" />
+               
+               <link href="./css/site.css" rel="stylesheet" />
+               <link href="./css/print.css" rel="stylesheet" media="print" />
+               
+               <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
+               <!--[if lt IE 9]>
+                       <script 
src="http://html5shim.googlecode.com/svn/trunk/html5.js";></script>
+               <![endif]-->
+
+
+
+       </head>
+
+       <body class="page-array_type project-phoenix-site" data-spy="scroll" 
data-offset="60" data-target="#toc-scroll-target">
+
+               <div class="navbar navbar-fixed-top">
+                       <div class="navbar-inner">
+                               <div class="container">
+                                       <a class="btn btn-navbar" 
data-toggle="collapse" data-target="#top-nav-collapse">
+                                               <span class="icon-bar"></span>
+                                               <span class="icon-bar"></span>
+                                               <span class="icon-bar"></span>
+                                       </a>
+                                       <a class="brand" href="index.html"><div 
class="xtoplogo"></div></a>
+                                       <div class="nav-collapse collapse" 
id="top-nav-collapse">
+                                               <ul class="nav pull-right">
+                                                       <li class="dropdown">
+                                                               <a href="#" 
class="dropdown-toggle" data-toggle="dropdown">About <b class="caret"></b></a>
+                                                               <ul 
class="dropdown-menu">
+                                                                       <li ><a 
href="index.html" title="Overview">Overview</a></li>
+                                                                       <li ><a 
href="recent.html" title="New Features">New Features</a></li>
+                                                                       <li ><a 
href="roadmap.html" title="Roadmap">Roadmap</a></li>
+                                                                       <li ><a 
href="performance.html" title="Performance">Performance</a></li>
+                                                                       <li ><a 
href="team.html" title="Team">Team</a></li>
+                                                                       <li ><a 
href="contributing.html" title="Contributing">Contributing</a></li>
+                                                                       <li ><a 
href="resources.html" title="Resources">Resources</a></li>
+                                                                       <li ><a 
href="mailing_list.html" title="Mailing Lists">Mailing Lists</a></li>
+                                                                       <li ><a 
href="source.html" title="Source Repository">Source Repository</a></li>
+                                                                       <li ><a 
href="issues.html" title="Issue Tracking">Issue Tracking</a></li>
+                                                                       <li ><a 
href="download.html" title="Download">Download</a></li>
+                                                                       <li 
class="divider"/>
+                                                                       <li ><a 
href="http://www.apache.org/licenses/"; title="License" 
class="externalLink">License</a></li>
+                                                                       <li ><a 
href="http://www.apache.org/foundation/sponsorship.html"; title="Sponsorship" 
class="externalLink">Sponsorship</a></li>
+                                                                       <li ><a 
href="http://www.apache.org/foundation/thanks.html"; title="Thanks" 
class="externalLink">Thanks</a></li>
+                                                                       <li ><a 
href="http://www.apache.org/security/"; title="Security" 
class="externalLink">Security</a></li>
+                                                               </ul>
+                                                       </li>
+                                                       <li class="dropdown">
+                                                               <a href="#" 
class="dropdown-toggle" data-toggle="dropdown">Using <b class="caret"></b></a>
+                                                               <ul 
class="dropdown-menu">
+                                                                       <li ><a 
href="faq.html" title="F.A.Q.">F.A.Q.</a></li>
+                                                                       <li ><a 
href="Phoenix-in-15-minutes-or-less.html" title="Quick Start">Quick 
Start</a></li>
+                                                                       <li ><a 
href="building.html" title="Building">Building</a></li>
+                                                                       <li ><a 
href="tuning.html" title="Tuning">Tuning</a></li>
+                                                                       <li ><a 
href="upgrade_from_2_2.html" title="Upgrade from 2.2">Upgrade from 2.2</a></li>
+                                                                       <li 
class="divider"/>
+                                                                       <li ><a 
href="secondary_indexing.html" title="Secondary Indexes">Secondary 
Indexes</a></li>
+                                                                       <li ><a 
href="joins.html" title="Joins">Joins</a></li>
+                                                                       <li ><a 
href="views.html" title="Views">Views</a></li>
+                                                                       <li ><a 
href="multi-tenancy.html" title="Multi tenancy">Multi tenancy</a></li>
+                                                                       <li ><a 
href="sequences.html" title="Sequences">Sequences</a></li>
+                                                                       <li 
class="active"><a href="" title="ARRAY type">ARRAY type</a></li>
+                                                                       <li ><a 
href="salted.html" title="Salted Tables">Salted Tables</a></li>
+                                                                       <li ><a 
href="paged.html" title="Paged Queries">Paged Queries</a></li>
+                                                                       <li ><a 
href="dynamic_columns.html" title="Dynamic Columns">Dynamic Columns</a></li>
+                                                                       <li ><a 
href="skip_scan.html" title="Skip Scan">Skip Scan</a></li>
+                                                                       <li ><a 
href="bulk_dataload.html" title="Bulk Loading">Bulk Loading</a></li>
+                                                                       <li 
class="divider"/>
+                                                                       <li ><a 
href="phoenix_on_emr.html" title="Amazon EMR Support">Amazon EMR 
Support</a></li>
+                                                                       <li ><a 
href="flume.html" title="Apache Flume Plugin">Apache Flume Plugin</a></li>
+                                                                       <li ><a 
href="pig_integration.html" title="Apache Pig Integration">Apache Pig 
Integration</a></li>
+                                                               </ul>
+                                                       </li>
+                                                       <li class="dropdown">
+                                                               <a href="#" 
class="dropdown-toggle" data-toggle="dropdown">Reference <b 
class="caret"></b></a>
+                                                               <ul 
class="dropdown-menu">
+                                                                       <li ><a 
href="language/index.html" title="Grammar">Grammar</a></li>
+                                                                       <li ><a 
href="language/functions.html" title="Functions">Functions</a></li>
+                                                                       <li ><a 
href="language/datatypes.html" title="Datatypes">Datatypes</a></li>
+                                                               </ul>
+                                                       </li>
+                                               </ul>
+                                       </div><!--/.nav-collapse -->
+                               </div>
+                       </div>
+               </div>
+               
+       <div class="container">
+       
+       <!-- Masthead
+       ================================================== -->
+
+       <header>
+       </header>
+
+       <div class="main-body">
+       <div class="row">
+               <div class="span12">
+                       <div class="body-content">
+<div class="page-header">
+ <h1>ARRAY Type</h1>
+</div> 
+<p>The Apache Phoenix 3.0/4.0 release introduces support for the <a 
class="externalLink" 
href="http://docs.oracle.com/javase/tutorial/jdbc/basics/array.html";>JDBC ARRAY 
type</a>. Any primitive type may be used in an ARRAY. Here is an example of 
declaring an array type when creating a table:</p> 
+<div class="source"> 
+ <pre>CREATE TABLE regions (
+    region_name VARCHAR PRIMARY KEY,
+    zips VARCHAR ARRAY[10],
+    CONSTRAINT pk PRIMARY KEY (region_name));
+</pre> 
+</div> 
+<p>or alternately:</p> 
+<div class="source"> 
+ <pre>CREATE TABLE regions (
+    region_name VARCHAR PRIMARY KEY,
+    zips VARCHAR[],
+    CONSTRAINT pk PRIMARY KEY (region_name));
+</pre> 
+</div> 
+<p>Insertion into the array may be done entirely through a SQL statement:</p> 
+<div class="source"> 
+ <pre>UPSERT INTO regions(region_name,zips)
+VALUES('SF Bay Area',ARRAY['94115','94030','94125']);
+</pre> 
+</div> 
+<p>or programmatically through JDBC:</p> 
+<div class="source"> 
+ <pre>PreparedStatement stmt = conn.prepareStatement(&quot;UPSERT INTO regions 
VALUES(?,?)&quot;);
+stmt.setString(1,&quot;SF Bay Area&quot;);
+String[] zips =  new String[] 
{&quot;94115&quot;,&quot;94030&quot;,&quot;94125&quot;};
+Array array = conn.createArrayOf(&quot;VARCHAR&quot;, zips);
+stmt.setArray(2, array);
+stmt.execute();
+</pre> 
+</div> 
+<p>The entire array may be selected:</p> 
+<div class="source"> 
+ <pre>SELECT zips FROM regions WHERE region_name = 'SF Bay Area';
+</pre> 
+</div> 
+<p>or an individual element in the array may be accessed via a subscript 
notation. The subscript is one-based, so the following would select the first 
element:</p> 
+<div class="source"> 
+ <pre>SELECT zip[1] FROM regions WHERE region_name = 'SF Bay Area';
+</pre> 
+</div> 
+<p>Use of the array subscript notation is supported in other expressions as 
well, for example in a WHERE clause:</p> 
+<div class="source"> 
+ <pre>SELECT region_name FROM regions WHERE zip[1] = '94030' OR zip[2] = 
'94030' OR zip[3] = '94030';
+</pre> 
+</div> 
+<p>The length of the array grows dynamically as needed with the current length 
and is accessible through the ARRAY_LENGTH build it function:</p> 
+<div class="source"> 
+ <pre>SELECT ARRAY_LENGTH(zips) FROM regions;
+</pre> 
+</div> 
+<p>Attempts to access an array element beyond the current length will evaluate 
to <tt>null</tt>.</p> 
+<p>For searching in an array, built-in functions like ANY and ALL are 
provided. For example,</p> 
+<div class="source"> 
+ <pre>SELECT region_name FROM regions WHERE '94030' = ANY(zip);
+SELECT region_name FROM regions WHERE '94030' = ALL(zip);
+</pre> 
+</div> 
+<p>The built-in function ANY checks if any of the element in the array 
satisfies the condition and it is equivalent to OR condition:</p> 
+<div class="source"> 
+ <pre>SELECT region_name FROM regions WHERE zip[1] = '94030' OR zip[2] = 
'94030' OR zip[3] = '94030';
+</pre> 
+</div> 
+<p>The built-in function ALL checks if all the elements in the array satisfies 
the condition and it is equivalent to AND condition:</p> 
+<div class="source"> 
+ <pre>SELECT region_name FROM regions WHERE zip[1] = '94030' AND zip[2] = 
'94030' AND zip[3] = '94030';
+</pre> 
+</div> 
+<div class="section"> 
+ <div class="section"> 
+  <h3 id="Limitations">Limitations</h3> 
+  <ul> 
+   <li>Only one dimensional arrays are currently supported</li> 
+   <li>For an array of fixed width types, null elements occurring in the 
middle of an array are not tracked.</li> 
+   <li>The declaration of an array length at DDL time is not enforced 
currently, but maybe in the future. Note that it is persisted with the table 
metadata.</li> 
+   <li>An array may only be used as the last column in a primary key 
constraint.</li> 
+   <li>Partial update of an array is currently not possible. Instead, the 
array may be manipulated on the client-side and then upserted back in its 
entirety.</li> 
+  </ul> 
+ </div> 
+</div>
+                       </div>
+               </div>
+       </div>
+       </div>
+
+       </div><!-- /container -->
+       
+       <!-- Footer
+       ================================================== -->
+       <footer class="well">
+               <div class="container">
+                       <div class="row">
+                               <div class="span3 bottom-nav">
+                                       <ul class="nav nav-list">
+                                               <li 
class="nav-header">About</li>
+                                               <li >
+                                                       <a href="index.html" 
title="Overview">Overview</a>
+                                               </li>
+                                               <li >
+                                                       <a href="recent.html" 
title="New Features">New Features</a>
+                                               </li>
+                                               <li >
+                                                       <a href="roadmap.html" 
title="Roadmap">Roadmap</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="performance.html" title="Performance">Performance</a>
+                                               </li>
+                                               <li >
+                                                       <a href="team.html" 
title="Team">Team</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="contributing.html" title="Contributing">Contributing</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="resources.html" title="Resources">Resources</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="mailing_list.html" title="Mailing Lists">Mailing Lists</a>
+                                               </li>
+                                               <li >
+                                                       <a href="source.html" 
title="Source Repository">Source Repository</a>
+                                               </li>
+                                               <li >
+                                                       <a href="issues.html" 
title="Issue Tracking">Issue Tracking</a>
+                                               </li>
+                                               <li >
+                                                       <a href="download.html" 
title="Download">Download</a>
+                                               </li>
+                                               <li >
+                                                       <a href="http:divider" 
title=""></a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="http://www.apache.org/licenses/"; title="License" 
class="externalLink">License</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="http://www.apache.org/foundation/sponsorship.html"; title="Sponsorship" 
class="externalLink">Sponsorship</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="http://www.apache.org/foundation/thanks.html"; title="Thanks" 
class="externalLink">Thanks</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="http://www.apache.org/security/"; title="Security" 
class="externalLink">Security</a>
+                                               </li>
+                                       </ul>
+                               </div>
+                               <div class="span3 bottom-nav">
+                                       <ul class="nav nav-list">
+                                               <li 
class="nav-header">Using</li>
+                                               <li >
+                                                       <a href="faq.html" 
title="F.A.Q.">F.A.Q.</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="Phoenix-in-15-minutes-or-less.html" title="Quick Start">Quick Start</a>
+                                               </li>
+                                               <li >
+                                                       <a href="building.html" 
title="Building">Building</a>
+                                               </li>
+                                               <li >
+                                                       <a href="tuning.html" 
title="Tuning">Tuning</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="upgrade_from_2_2.html" title="Upgrade from 2.2">Upgrade from 2.2</a>
+                                               </li>
+                                               <li >
+                                                       <a href="http:divider" 
title=""></a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="secondary_indexing.html" title="Secondary Indexes">Secondary Indexes</a>
+                                               </li>
+                                               <li >
+                                                       <a href="joins.html" 
title="Joins">Joins</a>
+                                               </li>
+                                               <li >
+                                                       <a href="views.html" 
title="Views">Views</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="multi-tenancy.html" title="Multi tenancy">Multi tenancy</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="sequences.html" title="Sequences">Sequences</a>
+                                               </li>
+                                               <li class="active">
+                                                       <a href="#" 
title="ARRAY type">ARRAY type</a>
+                                               </li>
+                                               <li >
+                                                       <a href="salted.html" 
title="Salted Tables">Salted Tables</a>
+                                               </li>
+                                               <li >
+                                                       <a href="paged.html" 
title="Paged Queries">Paged Queries</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="dynamic_columns.html" title="Dynamic Columns">Dynamic Columns</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="skip_scan.html" title="Skip Scan">Skip Scan</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="bulk_dataload.html" title="Bulk Loading">Bulk Loading</a>
+                                               </li>
+                                               <li >
+                                                       <a href="http:divider" 
title=""></a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="phoenix_on_emr.html" title="Amazon EMR Support">Amazon EMR Support</a>
+                                               </li>
+                                               <li >
+                                                       <a href="flume.html" 
title="Apache Flume Plugin">Apache Flume Plugin</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="pig_integration.html" title="Apache Pig Integration">Apache Pig 
Integration</a>
+                                               </li>
+                                       </ul>
+                               </div>
+                               <div class="span3 bottom-nav">
+                                       <ul class="nav nav-list">
+                                               <li 
class="nav-header">Reference</li>
+                                               <li >
+                                                       <a 
href="language/index.html" title="Grammar">Grammar</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="language/functions.html" title="Functions">Functions</a>
+                                               </li>
+                                               <li >
+                                                       <a 
href="language/datatypes.html" title="Datatypes">Datatypes</a>
+                                               </li>
+                                       </ul>
+                               </div>
+                               <div class="span3 bottom-description">
+                                       <form 
action="https://www.google.com/search"; method="get"><input 
value="phoenix.incubator.apache.org" name="sitesearch" type="hidden"><input 
placeholder="Search the site&hellip;" required="required" style="width:170px;" 
size="18" name="q" id="query" type="search"></form>
+                               </div>
+                       </div>
+               </div>
+       </footer>
+               
+       <div class="container subfooter">
+               <div class="row">
+                       <div class="span12">
+                               <p class="pull-right"><a href="#">Back to 
top</a></p>
+                               <p class="copyright">Copyright &copy;2014 <a 
href="http://www.apache.org";>Apache Software Foundation</a>. All Rights 
Reserved.</p>
+                       </div>
+               </div>
+       </div>
+
+       <!-- Le javascript
+       ================================================== -->
+       <!-- Placed at the end of the document so the pages load faster -->
+       <script 
src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js";></script>
+       
+       <script 
src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js";></script>
+       <script src="./js/lightbox.js"></script>
+       <script src="./js/jquery.smooth-scroll.min.js"></script>
+       <!-- back button support for smooth scroll -->
+       <script src="./js/jquery.ba-bbq.min.js"></script>
+       <script 
src="http://yandex.st/highlightjs/7.5/highlight.min.js";></script>
+
+       <script src="./js/reflow-skin.js"></script>
+       
+       </body>
+</html>


Reply via email to