forked from phoenix-hbase/phoenix-hbase.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatatypes.html
309 lines (268 loc) · 10.2 KB
/
datatypes.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>
Data Types
</title><link rel="stylesheet" type="text/css" href="stylesheet.css" />
<!-- [search] { -->
<script type="text/javascript" src="navigation.js"></script>
</head><body onload="highlightTab();">
<div class="pageTitle">Phoenix Language Reference</div>
<div>
<p>Phoenix is a SQL layer over HBase delivered as an embedded JDBC driver.
The top level commands, SQL syntax, built-in functions, and supported data types are documented in the separate tabs below.
</p>
<br/>
</div>
<div class="menu">
<a id="grammarTab" class="inactiveTab" href="index.html">SQL Grammar</a>
<a id="functionsTab" class="inactiveTab" href="functions.html">Functions</a>
<a id="dataTypesTab" class="inactiveTab" href="datatypes.html">Data Types</a>
</div>
<div id="content" class="content">
<!-- } -->
<h2 id="dataTypes">Index</h2>
<!-- syntax-start
<p class="notranslate">
<a href="#integer_type" >INTEGER Type</a><br />
<a href="#unsigned_int_type" >UNSIGNED_INT Type</a><br />
<a href="#bigint_type" >BIGINT Type</a><br />
<a href="#unsigned_long_type" >UNSIGNED_LONG Type</a><br />
<a href="#decimal_type" >DECIMAL Type</a><br />
<a href="#boolean_type" >BOOLEAN Type</a><br />
<a href="#time_type" >TIME Type</a><br />
<a href="#date_type" >DATE Type</a><br />
<a href="#timestamp_type" >TIMESTAMP Type</a><br />
<a href="#varchar_type" >VARCHAR Type</a><br />
<a href="#char_type" >CHAR Type</a><br />
<a href="#binary_type" >BINARY Type</a><br />
</p>
syntax-end -->
<!-- railroad-start -->
<table class="notranslate index">
<tr>
<td class="index">
<a href="#integer_type" >INTEGER Type</a><br />
<a href="#unsigned_int_type" >UNSIGNED_INT Type</a><br />
<a href="#bigint_type" >BIGINT Type</a><br />
<a href="#unsigned_long_type" >UNSIGNED_LONG Type</a><br />
</td><td class="index">
<a href="#decimal_type" >DECIMAL Type</a><br />
<a href="#boolean_type" >BOOLEAN Type</a><br />
<a href="#time_type" >TIME Type</a><br />
<a href="#date_type" >DATE Type</a><br />
</td><td class="index">
<a href="#timestamp_type" >TIMESTAMP Type</a><br />
<a href="#varchar_type" >VARCHAR Type</a><br />
<a href="#char_type" >CHAR Type</a><br />
<a href="#binary_type" >BINARY Type</a><br />
</td>
</tr>
</table>
<!-- railroad-end -->
<h3 id="integer_type" class="notranslate">INTEGER Type</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
INTEGER
</pre>
<div name="railroad">
<code class="c">INTEGER</code>
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
INTEGER
</pre>
syntax-end -->
<p>Possible values: -2147483648 to 2147483647.</p><p>Mapped to <code>java.lang.Integer</code>. The binary representation is a 4 byte integer with the sign bit flipped (for binary comparability).</p>
<p>Example:</p>
<p class="notranslate">INTEGER</p>
<h3 id="unsigned_int_type" class="notranslate">UNSIGNED_INT Type</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
UNSIGNED_INT
</pre>
<div name="railroad">
<code class="c">UNSIGNED_INT</code>
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
UNSIGNED_INT
</pre>
syntax-end -->
<p>Possible values: 0 to 2147483647. Mapped to <code>java.lang.Integer</code>. The binary representation is a 4 byte integer, matching the <code>HBase.toBytes</code>(int) method.</p>
<p>Example:</p>
<p class="notranslate">UNSIGNED_INT</p>
<h3 id="bigint_type" class="notranslate">BIGINT Type</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
BIGINT
</pre>
<div name="railroad">
<code class="c">BIGINT</code>
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
BIGINT
</pre>
syntax-end -->
<p>Possible values: -9223372036854775808 to 9223372036854775807. Mapped to <code>java.lang.Long</code>. The binary representation is an 8 byte long with the sign bit flipped (for binary comparability).</p>
<p>Example:</p>
<p class="notranslate">BIGINT</p>
<h3 id="unsigned_long_type" class="notranslate">UNSIGNED_LONG Type</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
UNSIGNED_LONG
</pre>
<div name="railroad">
<code class="c">UNSIGNED_LONG</code>
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
UNSIGNED_LONG
</pre>
syntax-end -->
<p>Possible values: 0 to 9223372036854775807. Mapped to <code>java.lang.Long</code>. The binary representation is an 8 byte integer, matching the <code>HBase.toBytes</code>(long) method.</p>
<p>Example:</p>
<p class="notranslate">UNSIGNED_LONG</p>
<h3 id="decimal_type" class="notranslate">DECIMAL Type</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
DECIMAL
</pre>
<div name="railroad">
<code class="c">DECIMAL</code>
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
DECIMAL
</pre>
syntax-end -->
<p>Data type with fixed precision and scale. The maximum precision is 18 digits. Mapped to <code>java.math.BigDecimal</code>. The binary representation is binary comparable, variable length format. When used in a row key, it is terminated with a null byte unless it is the last column.</p>
<p>Example:</p>
<p class="notranslate">DECIMAL</p>
<h3 id="boolean_type" class="notranslate">BOOLEAN Type</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
BOOLEAN
</pre>
<div name="railroad">
<code class="c">BOOLEAN</code>
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
BOOLEAN
</pre>
syntax-end -->
<p>Possible values: <code>TRUE</code> and <code>FALSE</code>.</p><p>Mapped to <code>java.lang.Boolean</code>. The binary representation is a single byte with 0 for false and 1 for true</p>
<p>Example:</p>
<p class="notranslate">BOOLEAN</p>
<h3 id="time_type" class="notranslate">TIME Type</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
TIME
</pre>
<div name="railroad">
<code class="c">TIME</code>
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
TIME
</pre>
syntax-end -->
<p>The time data type. The format is yyyy-<code>MM</code>-dd hh:mm:ss, with both the date and time parts maintained. Mapped to <code>java.sql.Time</code>. The binary representation is an 8 byte long (the number of milliseconds from the epoch).</p>
<p>Example:</p>
<p class="notranslate">TIME</p>
<h3 id="date_type" class="notranslate">DATE Type</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
DATE
</pre>
<div name="railroad">
<code class="c">DATE</code>
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
DATE
</pre>
syntax-end -->
<p>The date data type. The format is yyyy-<code>MM</code>-dd hh:mm:ss, with both the date and time parts maintained to a millisecond accuracy. Mapped to <code>java.sql.Date</code>. The binary representation is an 8 byte long (the number of milliseconds from the epoch).</p>
<p>Example:</p>
<p class="notranslate">DATE</p>
<h3 id="timestamp_type" class="notranslate">TIMESTAMP Type</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
TIMESTAMP
</pre>
<div name="railroad">
<code class="c">TIMESTAMP</code>
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
TIMESTAMP
</pre>
syntax-end -->
<p>The timestamp data type. The format is yyyy-<code>MM</code>-dd hh:mm:ss[.nnnnnnnnn]. Mapped to <code>java.sql.Timestamp</code> with an internal representation of the number of nanos from the epoch. The binary representation is 12 bytes: an 8 byte long for the epoch time plus a 4 byte integer for the nanos.</p>
<p>Example:</p>
<p class="notranslate">TIMESTAMP</p>
<h3 id="varchar_type" class="notranslate">VARCHAR Type</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
VARCHAR [ ( <a href="index.html#int">precisionInt</a> ) ]
</pre>
<div name="railroad">
<table class="railroad"><tr class="railroad"><td class="d"><code class="c">VARCHAR</code></td><td class="d"><table class="railroad"><tr class="railroad"><td class="ts"></td><td class="d"> </td><td class="te"></td></tr><tr class="railroad"><td class="ls"></td><td class="d"><table class="railroad"><tr class="railroad"><td class="d"><code class="c">( <a href="index.html#int">precisionInt</a> )</code></td></tr></table></td><td class="le"></td></tr></table></td></tr></table>
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
VARCHAR [ ( <a href="index.html#int">precisionInt</a> ) ]
</pre>
syntax-end -->
<p>A variable length String with an optional max byte length. The binary representation is <code>UTF8</code> matching the <code>HBase</code> Bytes.toBytes(String) method. When used in a row key, it is terminated with a null byte unless it is the last column.</p><p>Mapped to <code>java.lang.String</code>.</p>
<p>Example:</p>
<p class="notranslate">VARCHAR<br />VARCHAR(255)</p>
<h3 id="char_type" class="notranslate">CHAR Type</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
CHAR ( <a href="index.html#int">precisionInt</a> )
</pre>
<div name="railroad">
<table class="railroad"><tr class="railroad"><td class="d"><code class="c">CHAR ( <a href="index.html#int">precisionInt</a> )</code></td></tr></table>
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
CHAR ( <a href="index.html#int">precisionInt</a> )
</pre>
syntax-end -->
<p>A fixed length String with single-byte characters. The binary representation is <code>UTF8</code> matching the <code>HBase</code> Bytes.toBytes(String) method.</p><p>Mapped to <code>java.lang.String</code>.</p>
<p>Example:</p>
<p class="notranslate">CHAR(10)</p>
<h3 id="binary_type" class="notranslate">BINARY Type</h3>
<!-- railroad-start -->
<pre name="bnf" style="display: none">
BINARY
</pre>
<div name="railroad">
<code class="c">BINARY</code>
</div>
<!-- railroad-end -->
<!-- syntax-start
<pre>
BINARY
</pre>
syntax-end -->
<p>Raw byte array.</p><p>Mapped to <code>byte[]</code>.</p>
<p>Example:</p>
<p class="notranslate">BINARY</p>
<!-- [close] { -->
</div>
<!-- } --></body></html>