blob: d064195d2aea4d96ac5ff26a107ce82e089cd4fd [file] [log] [blame]
Ian Maxon444ca1b2017-08-25 11:41:41 -07001<!DOCTYPE html>
2<!--
Ian Maxon7a4bed92017-09-15 02:01:18 +02003 | Generated by Apache Maven Doxia at 2017-09-14
Ian Maxon444ca1b2017-08-25 11:41:41 -07004 | Rendered using Apache Maven Fluido Skin 1.3.0
5-->
6<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7 <head>
8 <meta charset="UTF-8" />
9 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
Ian Maxon7a4bed92017-09-15 02:01:18 +020010 <meta name="Date-Revision-yyyymmdd" content="20170914" />
Ian Maxon444ca1b2017-08-25 11:41:41 -070011 <meta http-equiv="Content-Language" content="en" />
12 <title>AsterixDB &#x2013; The Asterix Data Model (ADM)</title>
13 <link rel="stylesheet" href="./css/apache-maven-fluido-1.3.0.min.css" />
14 <link rel="stylesheet" href="./css/site.css" />
15 <link rel="stylesheet" href="./css/print.css" media="print" />
16
17
18 <script type="text/javascript" src="./js/apache-maven-fluido-1.3.0.min.js"></script>
19
20
21
22<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
23 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
24 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
25 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
26
27 ga('create', 'UA-41536543-1', 'uci.edu');
28 ga('send', 'pageview');</script>
29
30 </head>
31 <body class="topBarDisabled">
32
33
34
35
36 <div class="container-fluid">
37 <div id="banner">
38 <div class="pull-left">
39 <a href="./" id="bannerLeft">
40 <img src="images/asterixlogo.png" alt="AsterixDB"/>
41 </a>
42 </div>
43 <div class="pull-right"> </div>
44 <div class="clear"><hr/></div>
45 </div>
46
47 <div id="breadcrumbs">
48 <ul class="breadcrumb">
49
50
Ian Maxon7a4bed92017-09-15 02:01:18 +020051 <li id="publishDate">Last Published: 2017-09-14</li>
Ian Maxon444ca1b2017-08-25 11:41:41 -070052
53
54
Ian Maxon7a4bed92017-09-15 02:01:18 +020055 <li id="projectVersion" class="pull-right">Version: 0.9.2</li>
Ian Maxon444ca1b2017-08-25 11:41:41 -070056
57 <li class="divider pull-right">|</li>
58
59 <li class="pull-right"> <a href="index.html" title="Documentation Home">
60 Documentation Home</a>
61 </li>
62
63 </ul>
64 </div>
65
66
67 <div class="row-fluid">
68 <div id="leftColumn" class="span3">
69 <div class="well sidebar-nav">
70
71
72 <ul class="nav nav-list">
73 <li class="nav-header">Get Started - Installation</li>
74
75 <li>
76
77 <a href="ncservice.html" title="Option 1: using NCService">
78 <i class="none"></i>
79 Option 1: using NCService</a>
80 </li>
81
82 <li>
83
84 <a href="ansible.html" title="Option 2: using Ansible">
85 <i class="none"></i>
86 Option 2: using Ansible</a>
87 </li>
88
89 <li>
90
91 <a href="aws.html" title="Option 3: using Amazon Web Services">
92 <i class="none"></i>
93 Option 3: using Amazon Web Services</a>
94 </li>
95
96 <li>
97
98 <a href="yarn.html" title="Option 4: using YARN">
99 <i class="none"></i>
100 Option 4: using YARN</a>
101 </li>
102
103 <li>
104
105 <a href="install.html" title="Option 5: using Managix (deprecated)">
106 <i class="none"></i>
107 Option 5: using Managix (deprecated)</a>
108 </li>
109 <li class="nav-header">AsterixDB Primer</li>
110
111 <li>
112
113 <a href="sqlpp/primer-sqlpp.html" title="Option 1: using SQL++">
114 <i class="none"></i>
115 Option 1: using SQL++</a>
116 </li>
117
118 <li>
119
120 <a href="aql/primer.html" title="Option 2: using AQL">
121 <i class="none"></i>
122 Option 2: using AQL</a>
123 </li>
124 <li class="nav-header">Data Model</li>
125
126 <li class="active">
127
128 <a href="#"><i class="none"></i>The Asterix Data Model</a>
129 </li>
130 <li class="nav-header">Queries - SQL++</li>
131
132 <li>
133
134 <a href="sqlpp/manual.html" title="The SQL++ Query Language">
135 <i class="none"></i>
136 The SQL++ Query Language</a>
137 </li>
138
139 <li>
140
141 <a href="sqlpp/builtins.html" title="Builtin Functions">
142 <i class="none"></i>
143 Builtin Functions</a>
144 </li>
145 <li class="nav-header">Queries - AQL</li>
146
147 <li>
148
149 <a href="aql/manual.html" title="The Asterix Query Language (AQL)">
150 <i class="none"></i>
151 The Asterix Query Language (AQL)</a>
152 </li>
153
154 <li>
155
156 <a href="aql/builtins.html" title="Builtin Functions">
157 <i class="none"></i>
158 Builtin Functions</a>
159 </li>
160 <li class="nav-header">API/SDK</li>
161
162 <li>
163
164 <a href="api.html" title="HTTP API">
165 <i class="none"></i>
166 HTTP API</a>
167 </li>
168
169 <li>
170
171 <a href="csv.html" title="CSV Output">
172 <i class="none"></i>
173 CSV Output</a>
174 </li>
175 <li class="nav-header">Advanced Features</li>
176
177 <li>
178
179 <a href="aql/fulltext.html" title="Support of Full-text Queries">
180 <i class="none"></i>
181 Support of Full-text Queries</a>
182 </li>
183
184 <li>
185
186 <a href="aql/externaldata.html" title="Accessing External Data">
187 <i class="none"></i>
188 Accessing External Data</a>
189 </li>
190
191 <li>
192
193 <a href="feeds/tutorial.html" title="Support for Data Ingestion">
194 <i class="none"></i>
195 Support for Data Ingestion</a>
196 </li>
197
198 <li>
199
200 <a href="udf.html" title="User Defined Functions">
201 <i class="none"></i>
202 User Defined Functions</a>
203 </li>
204
205 <li>
206
207 <a href="aql/filters.html" title="Filter-Based LSM Index Acceleration">
208 <i class="none"></i>
209 Filter-Based LSM Index Acceleration</a>
210 </li>
211
212 <li>
213
214 <a href="aql/similarity.html" title="Support of Similarity Queries">
215 <i class="none"></i>
216 Support of Similarity Queries</a>
217 </li>
218 </ul>
219
220
221
222 <hr class="divider" />
223
224 <div id="poweredBy">
225 <div class="clear"></div>
226 <div class="clear"></div>
227 <div class="clear"></div>
228 <a href="./" title="AsterixDB" class="builtBy">
229 <img class="builtBy" alt="AsterixDB" src="images/asterixlogo.png" />
230 </a>
231 </div>
232 </div>
233 </div>
234
235
236 <div id="bodyColumn" class="span9" >
237
238 <!-- ! Licensed to the Apache Software Foundation (ASF) under one
239 ! or more contributor license agreements. See the NOTICE file
240 ! distributed with this work for additional information
241 ! regarding copyright ownership. The ASF licenses this file
242 ! to you under the Apache License, Version 2.0 (the
243 ! "License"); you may not use this file except in compliance
244 ! with the License. You may obtain a copy of the License at
245 !
246 ! http://www.apache.org/licenses/LICENSE-2.0
247 !
248 ! Unless required by applicable law or agreed to in writing,
249 ! software distributed under the License is distributed on an
250 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
251 ! KIND, either express or implied. See the License for the
252 ! specific language governing permissions and limitations
253 ! under the License.
254 ! --><h1>The Asterix Data Model (ADM)</h1>
255<div class="section">
256<h2><a name="Table_of_Contents"></a><a name="toc" id="toc">Table of Contents</a></h2>
257
258<ul>
259
260<li><a href="#PrimitiveTypes">Primitive Types</a>
261
262<ul>
263
264<li><a href="#PrimitiveTypesBoolean">Boolean</a></li>
265
Ian Maxon7a4bed92017-09-15 02:01:18 +0200266<li><a href="#PrimitiveTypesString">String</a></li>
267
Ian Maxon444ca1b2017-08-25 11:41:41 -0700268<li><a href="#PrimitiveTypesInt">Tinyint / Smallint / Integer (Int) / Bigint</a></li>
269
270<li><a href="#PrimitiveTypesFloat">Float</a></li>
271
272<li><a href="#PrimitiveTypesDouble">Double (Double Precision)</a></li>
273
Ian Maxon444ca1b2017-08-25 11:41:41 -0700274<li><a href="#PrimitiveTypesBinary">Binary</a></li>
275
276<li><a href="#PrimitiveTypesPoint">Point</a></li>
277
278<li><a href="#PrimitiveTypesLine">Line</a></li>
279
280<li><a href="#PrimitiveTypesRectangle">Rectangle</a></li>
281
282<li><a href="#PrimitiveTypesCircle">Circle</a></li>
283
284<li><a href="#PrimitiveTypesPolygon">Polygon</a></li>
285
286<li><a href="#PrimitiveTypesDate">Date</a></li>
287
288<li><a href="#PrimitiveTypesTime">Time</a></li>
289
290<li><a href="#PrimitiveTypesDateTime">Datetime (Timestamp)</a></li>
291
292<li><a href="#PrimitiveTypesDuration">Duration/Year_month_duration/Day_time_duration</a></li>
293
294<li><a href="#PrimitiveTypesInterval">Interval</a></li>
295
296<li><a href="#PrimitiveTypesUUID">UUID</a></li>
297 </ul></li>
298
Ian Maxon7a4bed92017-09-15 02:01:18 +0200299<li><a href="#IncompleteInformationTypes">Incomplete Information Types</a>
Ian Maxon444ca1b2017-08-25 11:41:41 -0700300
301<ul>
302
303<li><a href="#IncompleteInformationTypesNull">Null</a></li>
304
305<li><a href="#IncompleteInformationTypesMissing">Missing</a></li>
306 </ul></li>
307
308<li><a href="#DerivedTypes">Derived Types</a>
309
310<ul>
311
312<li><a href="#DerivedTypesObject">Object</a></li>
313
314<li><a href="#DerivedTypesArray">Array</a></li>
315
316<li><a href="#DerivedTypesMultiset">Multiset</a></li>
317 </ul></li>
318</ul>
319<p>An instance of Asterix data model (ADM) can be a <i><i>primitive type</i></i> (<tt>boolean</tt>, <tt>tinyint</tt>, <tt>smallint</tt>, <tt>integer</tt>, <tt>bigint</tt>, <tt>string</tt>, <tt>float</tt>, <tt>double</tt>, <tt>date</tt>, <tt>time</tt>, <tt>datetime</tt>, etc.), a <i><i>special type</i></i> (<tt>null</tt> or <tt>missing</tt>), or a <i><i>derived type</i></i>.</p>
Ian Maxon7a4bed92017-09-15 02:01:18 +0200320<p>The type names are case-insensitive, e.g., both <tt>BIGINT</tt> and <tt>bigint</tt> are acceptable.</p>
321<!-- ! Licensed to the Apache Software Foundation (ASF) under one
322 ! or more contributor license agreements. See the NOTICE file
323 ! distributed with this work for additional information
324 ! regarding copyright ownership. The ASF licenses this file
325 ! to you under the Apache License, Version 2.0 (the
326 ! "License"); you may not use this file except in compliance
327 ! with the License. You may obtain a copy of the License at
328 !
329 ! http://www.apache.org/licenses/LICENSE-2.0
330 !
331 ! Unless required by applicable law or agreed to in writing,
332 ! software distributed under the License is distributed on an
333 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
334 ! KIND, either express or implied. See the License for the
335 ! specific language governing permissions and limitations
336 ! under the License.
337 ! --></div>
Ian Maxon444ca1b2017-08-25 11:41:41 -0700338<div class="section">
339<h2><a name="Primitive_Types"></a><a name="PrimitiveTypes" id="PrimitiveTypes">Primitive Types</a></h2>
340<div class="section">
341<h3><a name="Boolean"></a><a name="PrimitiveTypesBoolean" id="PrimitiveTypesBoolean">Boolean</a></h3>
342<p><tt>boolean</tt> data type can have one of the two values: <i><i>true</i></i> or <i><i>false</i></i>.</p>
343
344<ul>
345
346<li>
347<p>Example:</p>
348
349<div class="source">
350<div class="source">
351<pre>{ &quot;true&quot;: true, &quot;false&quot;: false };
352</pre></div></div></li>
353</ul>
354
355<ul>
356
357<li>
358<p>The expected result is:</p>
359
360<div class="source">
361<div class="source">
362<pre>{ &quot;true&quot;: true, &quot;false&quot;: false }
363</pre></div></div></li>
364</ul></div>
365<div class="section">
Ian Maxon7a4bed92017-09-15 02:01:18 +0200366<h3><a name="String"></a><a name="PrimitiveTypesString" id="PrimitiveTypesString">String</a></h3>
367<p><tt>string</tt> represents a sequence of characters. The total length of the sequence can be up to 2,147,483,648.</p>
368
369<ul>
370
371<li>
372<p>Example:</p>
373
374<div class="source">
375<div class="source">
376<pre>{ &quot;v1&quot;: string(&quot;This is a string.&quot;), &quot;v2&quot;: string(&quot;\&quot;This is a quoted string\&quot;&quot;) };
377</pre></div></div></li>
378</ul>
379
380<ul>
381
382<li>
383<p>The expected result is:</p>
384
385<div class="source">
386<div class="source">
387<pre>{ &quot;v1&quot;: &quot;This is a string.&quot;, &quot;v2&quot;: &quot;\&quot;This is a quoted string\&quot;&quot; }
388</pre></div></div></li>
389</ul></div>
390<div class="section">
Ian Maxon444ca1b2017-08-25 11:41:41 -0700391<h3><a name="Tinyint__Smallint__Integer_Int__Bigint"></a><a name="PrimitiveTypesInt" id="PrimitiveTypesInt">Tinyint / Smallint / Integer (Int) / Bigint</a></h3>
392<p>Integer types using 8, 16, 32, or 64 bits. The ranges of these types are:</p>
393
394<ul>
395
Ian Maxon7a4bed92017-09-15 02:01:18 +0200396<li><tt>tinyint</tt>: -128 to 127</li>
Ian Maxon444ca1b2017-08-25 11:41:41 -0700397
Ian Maxon7a4bed92017-09-15 02:01:18 +0200398<li><tt>smallint</tt>: -32768 to 32767</li>
Ian Maxon444ca1b2017-08-25 11:41:41 -0700399
Ian Maxon7a4bed92017-09-15 02:01:18 +0200400<li><tt>integer</tt>: -2147483648 to 2147483647</li>
Ian Maxon444ca1b2017-08-25 11:41:41 -0700401
402<li><tt>bigint</tt>: -9223372036854775808 to 9223372036854775807</li>
403</ul>
404<p><tt>int</tt> is an abbreviated alias for integer.</p>
405
406<ul>
407
408<li>
409<p>Example:</p>
410
411<div class="source">
412<div class="source">
413<pre>{ &quot;tinyint&quot;: tiny(&quot;125&quot;), &quot;smallint&quot;: smallint(&quot;32765&quot;), &quot;integer&quot;: 294967295, &quot;bigint&quot;: bigint(&quot;1700000000000000000&quot;)};
414</pre></div></div></li>
415</ul>
416
417<ul>
418
419<li>
420<p>The expected result is:</p>
421
422<div class="source">
423<div class="source">
424<pre>{ &quot;tinyint&quot;: 125, &quot;smallint&quot;: 32765, &quot;integer&quot;: 294967295, &quot;bigint&quot;: 17000000 }
425</pre></div></div></li>
426</ul></div>
427<div class="section">
428<h3><a name="Float"></a><a name="PrimitiveTypesFloat" id="PrimitiveTypesFloat">Float</a></h3>
429<p><tt>float</tt> represents approximate numeric data values using 4 bytes. The range of a float value can be from 2^(-149) to (2-2^(-23)&#xb7;2^(127) for both positive and negative. Beyond these ranges will get <tt>INF</tt> or <tt>-INF</tt>.</p>
430
431<ul>
432
433<li>
434<p>Example:</p>
435
436<div class="source">
437<div class="source">
438<pre>{ &quot;v1&quot;: float(&quot;NaN&quot;), &quot;v2&quot;: float(&quot;INF&quot;), &quot;v3&quot;: float(&quot;-INF&quot;), &quot;v4&quot;: float(&quot;-2013.5&quot;) };
439</pre></div></div></li>
440</ul>
441
442<ul>
443
444<li>
445<p>The expected result is:</p>
446
447<div class="source">
448<div class="source">
Ian Maxon7a4bed92017-09-15 02:01:18 +0200449<pre>{ &quot;v1&quot;: &quot;NaN&quot;, &quot;v2&quot;: &quot;Infinity&quot;, &quot;v3&quot;: &quot;-Infinity&quot;, &quot;v4&quot;: -2013.5 }
Ian Maxon444ca1b2017-08-25 11:41:41 -0700450</pre></div></div></li>
451</ul></div>
452<div class="section">
453<h3><a name="Double_double_precision"></a><a name="PrimitiveTypesDouble" id="PrimitiveTypesDouble">Double (double precision)</a></h3>
454<p><tt>double</tt> represents approximate numeric data values using 8 bytes. The range of a double value can be from (2^(-1022)) to (2-2^(-52))&#xb7;2^(1023) for both positive and negative. Beyond these ranges will get <tt>INF</tt> or <tt>-INF</tt>.</p>
455
456<ul>
457
458<li>
459<p>Example:</p>
460
461<div class="source">
462<div class="source">
463<pre>{ &quot;v1&quot;: double(&quot;NaN&quot;), &quot;v2&quot;: double(&quot;INF&quot;), &quot;v3&quot;: double(&quot;-INF&quot;), &quot;v4&quot;: &quot;-2013.593823748327284&quot; };
464</pre></div></div></li>
465</ul>
466
467<ul>
468
469<li>
470<p>The expected result is:</p>
471
472<div class="source">
473<div class="source">
Ian Maxon7a4bed92017-09-15 02:01:18 +0200474<pre>{ &quot;v1&quot;: &quot;NaN&quot;, &quot;v2&quot;: &quot;Infinity&quot;, &quot;v3&quot;: &quot;-Infinity&quot;, &quot;v4&quot;: -2013.5938237483274 }
Ian Maxon444ca1b2017-08-25 11:41:41 -0700475</pre></div></div></li>
476</ul>
Ian Maxon7a4bed92017-09-15 02:01:18 +0200477<p><tt>Double precision</tt> is an alias of <tt>double</tt>.</p>
478<!-- ! Licensed to the Apache Software Foundation (ASF) under one
479 ! or more contributor license agreements. See the NOTICE file
480 ! distributed with this work for additional information
481 ! regarding copyright ownership. The ASF licenses this file
482 ! to you under the Apache License, Version 2.0 (the
483 ! "License"); you may not use this file except in compliance
484 ! with the License. You may obtain a copy of the License at
485 !
486 ! http://www.apache.org/licenses/LICENSE-2.0
487 !
488 ! Unless required by applicable law or agreed to in writing,
489 ! software distributed under the License is distributed on an
490 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
491 ! KIND, either express or implied. See the License for the
492 ! specific language governing permissions and limitations
493 ! under the License.
494 ! --></div>
Ian Maxon444ca1b2017-08-25 11:41:41 -0700495<div class="section">
496<h3><a name="Binary"></a><a name="PrimitiveTypesBinary" id="PrimitiveTypesBinary">Binary</a></h3>
497<p><tt>binary</tt> represents a sequence of bytes. It can be constructed from a <tt>hex</tt> or a <tt>base64</tt> string sequence. The total length of the byte sequence can be up to 2,147,483,648.</p>
498
499<ul>
500
501<li>
502<p>Example:</p>
503
504<div class="source">
505<div class="source">
506<pre>{
507 &quot;hex1&quot; : hex(&quot;ABCDEF0123456789&quot;),
508 &quot;hex2&quot;: hex(&quot;abcdef0123456789&quot;),
509 &quot;base64_1&quot; : base64(&quot;0123456789qwertyui+/&quot;),
510 &quot;base64_2&quot; : base64('QXN0ZXJpeA==')
511};
512</pre></div></div></li>
513
514<li>
515<p>The default output format is in <tt>hex</tt> format. Thus, the expected result is:</p>
516
517<div class="source">
518<div class="source">
519<pre>{
520 &quot;hex1&quot;: hex(&quot;ABCDEF0123456789&quot;),
521 &quot;hex2&quot;: hex(&quot;ABCDEF0123456789&quot;),
522 &quot;base64_1&quot;: hex(&quot;D35DB7E39EBBF3DAB07ABB72BA2FBF&quot;),
523 &quot;base64_2&quot;: hex(&quot;41737465726978&quot;)
524}
525</pre></div></div></li>
526</ul></div>
527<div class="section">
528<h3><a name="Point"></a><a name="PrimitiveTypesPoint" id="PrimitiveTypesPoint">Point</a></h3>
529<p><tt>point</tt> is the fundamental two-dimensional building block for spatial types. It consists of two <tt>double</tt> coordinates x and y.</p>
530
531<ul>
532
533<li>
534<p>Example:</p>
535
536<div class="source">
537<div class="source">
538<pre>{ &quot;v1&quot;: point(&quot;80.10d, -10E5&quot;), &quot;v2&quot;: point(&quot;5.10E-10d, -10E5&quot;) };
539</pre></div></div></li>
540</ul>
541
542<ul>
543
544<li>
545<p>The expected result is:</p>
546
547<div class="source">
548<div class="source">
549<pre>{ &quot;v1&quot;: point(&quot;80.1,-1000000.0&quot;), &quot;v2&quot;: point(&quot;5.1E-10,-1000000.0&quot;) }
550</pre></div></div></li>
551</ul></div>
552<div class="section">
553<h3><a name="Line"></a><a name="PrimitiveTypesLine" id="PrimitiveTypesLine">Line</a></h3>
554<p><tt>line</tt> consists of two points that represent the start and the end points of a line segment.</p>
555
556<ul>
557
558<li>
559<p>Example:</p>
560
561<div class="source">
562<div class="source">
563<pre>{ &quot;v1&quot;: line(&quot;10.1234,11.1e-1 +10.2E-2,-11.22&quot;), &quot;v2&quot;: line(&quot;0.1234,-1.00e-10 +10.5E-2,-01.02&quot;) };
564</pre></div></div></li>
565</ul>
566
567<ul>
568
569<li>
570<p>The expected result is:</p>
571
572<div class="source">
573<div class="source">
574<pre>{ &quot;v1&quot;: line(&quot;10.1234,1.11 0.102,-11.22&quot;), &quot;v2&quot;: line(&quot;0.1234,-1.0E-10 0.105,-1.02&quot;) }
575</pre></div></div></li>
576</ul></div>
577<div class="section">
578<h3><a name="Rectangle"></a><a name="PrimitiveTypesRectangle" id="PrimitiveTypesRectangle">Rectangle</a></h3>
579<p><tt>rectangle</tt> consists of two points that represent the <i><i>bottom left</i></i> and <i><i>upper right</i></i> corners of a rectangle.</p>
580
581<ul>
582
583<li>
584<p>Example:</p>
585
586<div class="source">
587<div class="source">
588<pre>{ &quot;v1&quot;: rectangle(&quot;5.1,11.8 87.6,15.6548&quot;), &quot;v2&quot;: rectangle(&quot;0.1234,-1.00e-10 5.5487,0.48765&quot;) };
589</pre></div></div></li>
590</ul>
591
592<ul>
593
594<li>
595<p>The expected result is:</p>
596
597<div class="source">
598<div class="source">
599<pre>{ &quot;v1&quot;: rectangle(&quot;5.1,11.8 87.6,15.6548&quot;), &quot;v2&quot;: rectangle(&quot;0.1234,-1.0E-10 5.5487,0.48765&quot;) }
600</pre></div></div></li>
601</ul></div>
602<div class="section">
603<h3><a name="Circle"></a><a name="PrimitiveTypesCircle" id="PrimitiveTypesCircle">Circle</a></h3>
604<p><tt>circle</tt> consists of one point that represents the center of the circle and a radius of type <tt>double</tt>.</p>
605
606<ul>
607
608<li>
609<p>Example:</p>
610
611<div class="source">
612<div class="source">
613<pre>{ &quot;v1&quot;: circle(&quot;10.1234,11.1e-1 +10.2E-2&quot;), &quot;v2&quot;: circle(&quot;0.1234,-1.00e-10 +10.5E-2&quot;) };
614</pre></div></div></li>
615</ul>
616
617<ul>
618
619<li>
620<p>The expected result is:</p>
621
622<div class="source">
623<div class="source">
624<pre>{ &quot;v1&quot;: circle(&quot;10.1234,1.11 0.102&quot;), &quot;v2&quot;: circle(&quot;0.1234,-1.0E-10 0.105&quot;) }
625</pre></div></div></li>
626</ul></div>
627<div class="section">
628<h3><a name="Polygon"></a><a name="PrimitiveTypesPolygon" id="PrimitiveTypesPolygon">Polygon</a></h3>
629<p><tt>polygon</tt> consists of <i><i>n</i></i> points that represent the vertices of a <i><i>simple closed</i></i> polygon.</p>
630
631<ul>
632
633<li>
634<p>Example:</p>
635
636<div class="source">
637<div class="source">
638<pre>{
639 &quot;v1&quot;: polygon(&quot;-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81&quot;),
640 &quot;v2&quot;: polygon(&quot;-1.0,+10.5e2 -02.15E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75&quot;)
641};
642</pre></div></div></li>
643</ul>
644
645<ul>
646
647<li>
648<p>The expected result is:</p>
649
650<div class="source">
651<div class="source">
652<pre>{
653 &quot;v1&quot;: polygon(&quot;-1.2,130.0 -214000.0,2.15 -350.0,3.6 -0.0046,4.81&quot;),
654 &quot;v2&quot;: polygon(&quot;-1.0,1050.0 -2.15E50,2.5 -1.0,3300.0 -250000.0,20.15 350.0,3.6 -0.0046,4.75 -2.0,100.0 -200000.0,20.1 30.5,3.25 -0.00433,4.75&quot;) }
655}
656</pre></div></div></li>
657</ul></div>
658<div class="section">
659<h3><a name="Date"></a><a name="PrimitiveTypesDate" id="PrimitiveTypesDate">Date</a></h3>
660<p><tt>date</tt> represents a time point along the Gregorian calendar system specified by the year, month and day. ASTERIX supports the date from <tt>-9999-01-01</tt> to <tt>9999-12-31</tt>.</p>
661<p>A date value can be represented in two formats, extended format and basic format.</p>
662
663<ul>
664
665<li>Extended format is represented as <tt>[-]yyyy-mm-dd</tt> for <tt>year-month-day</tt>. Each field should be padded if there are less digits than the format specified.</li>
666
667<li>Basic format is in the format of <tt>[-]yyyymmdd</tt>.</li>
668
669<li>
670<p>Example:</p>
671
672<div class="source">
673<div class="source">
674<pre>{ &quot;v1&quot;: date(&quot;2013-01-01&quot;), &quot;v2&quot;: date(&quot;-19700101&quot;) };
675</pre></div></div></li>
676</ul>
677
678<ul>
679
680<li>
681<p>The expected result is:</p>
682
683<div class="source">
684<div class="source">
685<pre>{ &quot;v1&quot;: date(&quot;2013-01-01&quot;), &quot;v2&quot;: date(&quot;-1970-01-01&quot;) }
686</pre></div></div></li>
687</ul></div>
688<div class="section">
689<h3><a name="Time"></a><a name="PrimitiveTypesTime" id="PrimitiveTypesTime">Time</a></h3>
690<p><tt>time</tt> type describes the time within the range of a day. It is represented by three fields: hour, minute and second. Millisecond field is optional as the fraction of the second field. Its extended format is as <tt>hh:mm:ss[.mmm]</tt> and the basic format is <tt>hhmmss[mmm]</tt>. The value domain is from <tt>00:00:00.000</tt> to <tt>23:59:59.999</tt>.</p>
691<p>Timezone field is optional for a time value. Timezone is represented as <tt>[+|-]hh:mm</tt> for extended format or <tt>[+|-]hhmm</tt> for basic format. Note that the sign designators cannot be omitted. <tt>Z</tt> can also be used to represent the UTC local time. If no timezone information is given, it is UTC by default.</p>
692
693<ul>
694
695<li>
696<p>Example:</p>
697
698<div class="source">
699<div class="source">
700<pre>{ &quot;v1&quot;: time(&quot;12:12:12.039Z&quot;), &quot;v2&quot;: time(&quot;000000000-0800&quot;) };
701</pre></div></div></li>
702</ul>
703
704<ul>
705
706<li>
707<p>The expected result is:</p>
708
709<div class="source">
710<div class="source">
711<pre>{ &quot;v1&quot;: time(&quot;12:12:12.039Z&quot;), &quot;v2&quot;: time(&quot;08:00:00.000Z&quot;) }
712</pre></div></div></li>
713</ul></div>
714<div class="section">
715<h3><a name="Datetime_Timestamp"></a><a name="PrimitiveTypesDateTime" id="PrimitiveTypesDateTime">Datetime (Timestamp)</a></h3>
716<p>A <tt>datetime</tt> value is a combination of an <tt>date</tt> and <tt>time</tt>, representing a fixed time point along the Gregorian calendar system. The value is among <tt>-9999-01-01 00:00:00.000</tt> and <tt>9999-12-31 23:59:59.999</tt>.</p>
717<p>A <tt>datetime</tt> value is represented as a combination of the representation of its <tt>date</tt> part and <tt>time</tt> part, separated by a separator <tt>T</tt>. Either extended or basic format can be used, and the two parts should be the same format.</p>
718<p>Millisecond field and timezone field are optional, as specified in the <tt>time</tt> type.</p>
719
720<ul>
721
722<li>
723<p>Example:</p>
724
725<div class="source">
726<div class="source">
727<pre>{ &quot;v1&quot;: datetime(&quot;2013-01-01T12:12:12.039Z&quot;), &quot;v2&quot;: datetime(&quot;-19700101T000000000-0800&quot;) };
728</pre></div></div></li>
729</ul>
730
731<ul>
732
733<li>
734<p>The expected result is:</p>
735
736<div class="source">
737<div class="source">
738<pre>{ &quot;v1&quot;: datetime(&quot;2013-01-01T12:12:12.039Z&quot;), &quot;v2&quot;: datetime(&quot;-1970-01-01T08:00:00.000Z&quot;) }
739</pre></div></div></li>
740</ul>
741<p><tt>timestamp</tt> is an alias of <tt>datetime</tt>.</p></div>
742<div class="section">
743<h3><a name="DurationYear_month_durationDay_time_duration"></a><a name="PrimitiveTypesDuration" id="PrimitiveTypesDuration">Duration/Year_month_duration/Day_time_duration</a></h3>
744<p><tt>duration</tt> represents a duration of time. A duration value is specified by integers on at least one of the following fields: year, month, day, hour, minute, second, and millisecond.</p>
745<p>A duration value is in the format of <tt>[-]PnYnMnDTnHnMn.mmmS</tt>. The millisecond part (as the fraction of the second field) is optional, and when no millisecond field is used, the decimal point should also be absent.</p>
746<p>Negative durations are also supported for the arithmetic operations between time instance types (<tt>date</tt>, <tt>time</tt> and <tt>datetime</tt>), and is used to roll the time back for the given duration. For example <tt>date(&quot;2012-01-01&quot;) + duration(&quot;-P3D&quot;)</tt> will return <tt>date(&quot;2011-12-29&quot;)</tt>.</p>
747<p>There are also two sub-duration types, namely <tt>year_month_duration</tt> and <tt>day_time_duration</tt>. <tt>year_month_duration</tt> represents only the years and months of a duration, while <tt>day_time_duration</tt> represents only the day to millisecond fields. Different from the <tt>duration</tt> type, both these two subtypes are totally ordered, so they can be used for comparison and index construction.</p>
748<p>Note that a canonical representation of the duration is always returned, regardless whether the duration is in the canonical representation or not from the user&#x2019;s input. More information about canonical representation can be found from <a class="externalLink" href="http://www.w3.org/TR/xpath-functions/#canonical-dayTimeDuration">XPath dayTimeDuration Canonical Representation</a> and <a class="externalLink" href="http://www.w3.org/TR/xpath-functions/#canonical-yearMonthDuration">yearMonthDuration Canonical Representation</a>.</p>
749
750<ul>
751
752<li>
753<p>Example:</p>
754
755<div class="source">
756<div class="source">
757<pre>{ &quot;v1&quot;: duration(&quot;P100Y12MT12M&quot;), &quot;v2&quot;: duration(&quot;-PT20.943S&quot;) };
758</pre></div></div></li>
759</ul>
760
761<ul>
762
763<li>
764<p>The expected result is:</p>
765
766<div class="source">
767<div class="source">
768<pre>{ &quot;v1&quot;: duration(&quot;P101YT12M&quot;), &quot;v2&quot;: duration(&quot;-PT20.943S&quot;) }
769</pre></div></div></li>
770</ul></div>
771<div class="section">
772<h3><a name="Interval"></a><a name="PrimitiveTypesInterval" id="PrimitiveTypesInterval">Interval</a></h3>
773<p><tt>interval</tt> represents inclusive-exclusive ranges of time. It is defined by two time point values with the same temporal type(<tt>date</tt>, <tt>time</tt> or <tt>datetime</tt>).</p>
774
775<ul>
776
777<li>
778<p>Example:</p>
779
780<div class="source">
781<div class="source">
782<pre>{
783 &quot;v1&quot;: interval(date(&quot;2013-01-01&quot;), date(&quot;20130505&quot;)),
784 &quot;v2&quot;: interval(time(&quot;00:01:01&quot;), time(&quot;213901049+0800&quot;)),
785 &quot;v3&quot;: interval(datetime(&quot;2013-01-01T00:01:01&quot;), datetime(&quot;20130505T213901049+0800&quot;))
786};
787</pre></div></div></li>
788</ul>
789
790<ul>
791
792<li>
793<p>The expected result is:</p>
794
795<div class="source">
796<div class="source">
797<pre>{
798 &quot;v1&quot;: interval(date(&quot;2013-01-01&quot;), date(&quot;2013-05-05&quot;)),
799 &quot;v2&quot;: interval(time(&quot;00:01:01.000Z&quot;), time(&quot;13:39:01.049Z&quot;)),
800 &quot;v3&quot;: interval(datetime(&quot;2013-01-01T00:01:01.000Z&quot;), datetime(&quot;2013-05-05T13:39:01.049Z&quot;))
801}
802</pre></div></div></li>
803</ul></div>
804<div class="section">
805<h3><a name="UUID"></a><a name="PrimitiveTypesUUID" id="PrimitiveTypesUUID">UUID</a></h3>
806<p><tt>uuid</tt> represents a UUID value, which stands for Universally unique identifier. It is defined by a canonical format using hexadecimal text with inserted hyphen characters. (E.g.: 5a28ce1e-6a74-4201-9e8f-683256e5706f). This type is generally used to store auto-generated primary key values.</p>
807
808<ul>
809
810<li>
811<p>Example:</p>
812
813<div class="source">
814<div class="source">
815<pre>return { &quot;v1&quot;:uuid(&quot;5c848e5c-6b6a-498f-8452-8847a2957421&quot;) }
816</pre></div></div></li>
817</ul>
818
819<ul>
820
821<li>
822<p>The expected result is:</p>
823
824<div class="source">
825<div class="source">
826<pre>{ &quot;v1&quot;: uuid(&quot;5c848e5c-6b6a-498f-8452-8847a2957421&quot;) }
827</pre></div></div></li>
Ian Maxon7a4bed92017-09-15 02:01:18 +0200828</ul>
829<!-- ! Licensed to the Apache Software Foundation (ASF) under one
830 ! or more contributor license agreements. See the NOTICE file
831 ! distributed with this work for additional information
832 ! regarding copyright ownership. The ASF licenses this file
833 ! to you under the Apache License, Version 2.0 (the
834 ! "License"); you may not use this file except in compliance
835 ! with the License. You may obtain a copy of the License at
836 !
837 ! http://www.apache.org/licenses/LICENSE-2.0
838 !
839 ! Unless required by applicable law or agreed to in writing,
840 ! software distributed under the License is distributed on an
841 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
842 ! KIND, either express or implied. See the License for the
843 ! specific language governing permissions and limitations
844 ! under the License.
845 ! --></div></div>
Ian Maxon444ca1b2017-08-25 11:41:41 -0700846<div class="section">
847<h2><a name="Incomplete_Information_Types"></a><a name="IncompleteInformationTypes" id="IncompleteInformationTypes">Incomplete Information Types</a></h2>
848<div class="section">
849<h3><a name="Null"></a><a name="IncompleteInformationTypesNull" id="IncompleteInformationTypesNull">Null</a></h3>
850<p><tt>null</tt> is a special value that is often used to represent an unknown value. For example, a user might not be able to know the value of a field and let it be <tt>null</tt>.</p>
851
852<ul>
853
854<li>
855<p>Example:</p>
856
857<div class="source">
858<div class="source">
859<pre>{ &quot;field&quot;: null };
860</pre></div></div></li>
861</ul>
862
863<ul>
864
865<li>
866<p>The expected result is:</p>
867
868<div class="source">
869<div class="source">
870<pre>{ &quot;field&quot;: null }
871</pre></div></div></li>
872</ul></div>
873<div class="section">
874<h3><a name="Missing"></a><a name="IncompleteInformationTypesMissing" id="IncompleteInformationTypesMissing">Missing</a></h3>
Ian Maxon7a4bed92017-09-15 02:01:18 +0200875<p><tt>missing</tt> indicates that a name-value pair is missing from an object. If a missing name-value pair is accessed, an empty result value is returned by the query.</p>
Ian Maxon444ca1b2017-08-25 11:41:41 -0700876<p>As neither the data model nor the system enforces homogeneity for datasets or collections, items in a dataset or collection can be of heterogeneous types and so a field can be present in one object and <tt>missing</tt> in another.</p>
877
878<ul>
879
880<li>
881<p>Example:</p>
882
883<div class="source">
884<div class="source">
885<pre>{ &quot;field&quot;: missing };
886</pre></div></div></li>
887</ul>
888
889<ul>
890
891<li>
892<p>The expected result is:</p>
893
894<div class="source">
895<div class="source">
896<pre>{ }
897</pre></div></div></li>
898</ul>
Ian Maxon7a4bed92017-09-15 02:01:18 +0200899<p>Since a field with value <tt>missing</tt> means the field is absent, we get an empty object.</p>
900<!-- ! Licensed to the Apache Software Foundation (ASF) under one
901 ! or more contributor license agreements. See the NOTICE file
902 ! distributed with this work for additional information
903 ! regarding copyright ownership. The ASF licenses this file
904 ! to you under the Apache License, Version 2.0 (the
905 ! "License"); you may not use this file except in compliance
906 ! with the License. You may obtain a copy of the License at
907 !
908 ! http://www.apache.org/licenses/LICENSE-2.0
909 !
910 ! Unless required by applicable law or agreed to in writing,
911 ! software distributed under the License is distributed on an
912 ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
913 ! KIND, either express or implied. See the License for the
914 ! specific language governing permissions and limitations
915 ! under the License.
916 ! --></div></div>
Ian Maxon444ca1b2017-08-25 11:41:41 -0700917<div class="section">
918<h2><a name="Derived_Types"></a><a name="DerivedTypes" id="DerivedTypes">Derived Types</a></h2>
919<div class="section">
920<h3><a name="Object"></a><a name="DerivedTypesObject" id="DerivedTypesObject">Object</a></h3>
921<p>An <tt>object</tt> contains a set of &#xfb01;elds, where each &#xfb01;eld is described by its name and type. An object type may be defined as either open or closed. Open objects (instances of open object types) are permitted to contain &#xfb01;elds that are not part of the type de&#xfb01;nition, while closed objects do not permit their instances to carry extra fields. An example type definition for an object is:</p>
922
923<div class="source">
924<div class="source">
925<pre> create type SoldierType as open {
926 name: string?,
927 rank: string,
928 serialno: int
929 };
930</pre></div></div>
931<p>Syntactically, object constructors are surrounded by curly braces &#x201c;{&#x2026;}&#x201d;. Some examples of legitimate instances of the above type include:</p>
932
933<div class="source">
934<div class="source">
935<pre> { &quot;name&quot;: &quot;Joe Blow&quot;, &quot;rank&quot;: &quot;Sergeant&quot;, &quot;serialno&quot;: 1234567 }
936 { &quot;rank&quot;: &quot;Private&quot;, &quot;serialno&quot;: 9876543 }
937 { &quot;name&quot;: &quot;Sally Forth&quot;, &quot;rank&quot;: &quot;Major&quot;, &quot;serialno&quot;: 2345678, &quot;gender&quot;: &quot;F&quot; }
938</pre></div></div>
939<p>The first instance has all of the type&#x2019;s prescribed content. The second instance is missing the name field, which is fine because it is optional (due to the ?). The third instance has an extra field; that is fine because the type definition specifies that it is open (which is also true by default, if open is not specified). To more tightly control object content, specifying closed instead of open in the type definition for SoldierType would have made the third example instance an invalid instance of the type.</p></div>
940<div class="section">
941<h3><a name="Array"></a><a name="DerivedTypesArray" id="DerivedTypesArray">Array</a></h3>
942<p>An <tt>array</tt> is a container that holds a fixed number of values. Array constructors are denoted by brackets: &#x201c;[&#x2026;]&#x201d;.</p>
943<p>An example would be</p>
944
945<div class="source">
946<div class="source">
947<pre> [&quot;alice&quot;, 123, &quot;bob&quot;, null]
948</pre></div></div></div>
949<div class="section">
950<h3><a name="Multiset"></a><a name="DerivedTypesMultiset" id="DerivedTypesMultiset">Multiset</a></h3>
951<p>A <tt>multiset</tt> is a generalization of the concept of a set that, unlike a set, allows multiple instances of the multiset&#x2019;s elements. Multiset constructors are denoted by two opening curly braces followed by data and two closing curly braces, like &#x201c;{{&#x2026;}}&#x201d;.</p>
952<p>An example would be</p>
953
954<div class="source">
955<div class="source">
956<pre> {{&quot;hello&quot;, 9328, &quot;world&quot;, [1, 2, null]}}
957</pre></div></div></div></div>
958 </div>
959 </div>
960 </div>
961
962 <hr/>
963
964 <footer>
965 <div class="container-fluid">
966 <div class="row span12">Copyright &copy; 2017
967 <a href="https://www.apache.org/">The Apache Software Foundation</a>.
968 All Rights Reserved.
969
970 </div>
971
972 <?xml version="1.0" encoding="UTF-8"?>
973<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
974 feather logo, and the Apache AsterixDB project logo are either
975 registered trademarks or trademarks of The Apache Software
976 Foundation in the United States and other countries.
977 All other marks mentioned may be trademarks or registered
978 trademarks of their respective owners.</div>
979
980
981 </div>
982 </footer>
983 </body>
984</html>