mirror of
https://github.com/apache/impala.git
synced 2026-01-17 12:00:29 -05:00
DATE values describe a particular year/month/day in the form
yyyy-MM-dd. For example: DATE '2019-02-15'. DATE values do not have a
time of day component. The range of values supported for the DATE type
is 0000-01-01 to 9999-12-31.
This initial DATE type support covers TEXT and HBASE fileformats only.
'DateValue' is used as the internal type to represent DATE values.
The changes are as follows:
- Support for DATE literal syntax.
- Explicit casting between DATE and other types (note that invalid
casts will fail with an error just like invalid DECIMAL_V2 casts,
while failed casts to other types do no lead to warning or error):
- from STRING to DATE. The string value must be formatted as
yyyy-MM-dd HH:mm:ss.SSSSSSSSS. The date component is mandatory,
the time component is optional. If the time component is
present, it will be truncated silently.
- from DATE to STRING. The resulting string value is formatted as
yyyy-MM-dd.
- from TIMESTAMP to DATE. The source timestamp's time of day
component is ignored.
- from DATE to TIMESTAMP. The target timestamp's time of day
component is set to 00:00:00.
- Implicit casting between DATE and other types:
- from STRING to DATE if the source string value is used in a
context where a DATE value is expected.
- from DATE to TIMESTAMP if the source date value is used in a
context where a TIMESTAMP value is expected.
- Since STRING -> DATE, STRING -> TIMESTAMP and DATE -> TIMESTAMP
implicit conversions are now all possible, the existing function
overload resolution logic is not adequate anymore.
For example, it resolves the
if(false, '2011-01-01', DATE '1499-02-02') function call to the
if(BOOLEAN, TIMESTAMP, TIMESTAMP) version of the overloaded
function, instead of the if(BOOLEAN, DATE, DATE) version.
This is clearly wrong, so the function overload resolution logic had
to be changed to resolve function calls to the best-fit overloaded
function definition if there are multiple applicable candidates.
An overloaded function definition is an applicable candidate for a
function call if each actual parameter in the function call either
matches the corresponding formal parameter's type (without casting)
or is implicitly castable to that type.
When looking for the best-fit applicable candidate, a parameter
match score (i.e. the number of actual parameters in the function
call that match their corresponding formal parameter's type without
casting) is calculated and the applicable candidate with the highest
parameter match score is chosen.
There's one more issue that the new resolution logic has to address:
if two applicable candidates have the same parameter match score and
the only difference between the two is that the first one requires a
STRING -> TIMESTAMP implicit cast for some of its parameters while
the second one requires a STRING -> DATE implicit cast for the same
parameters then the first candidate has to be chosen not to break
backward compatibility.
E.g: year('2019-02-15') function call must resolve to
year(TIMESTAMP) instead of year(DATE). Note, that year(DATE) is not
implemented yet, so this is not an issue at the moment but it will
be in the future.
When the resolution algorithm considers overloaded function
definitions, first it orders them lexicographically by the types in
their parameter lists. To ensure the backward compatible behavior
Primitivetype.DATE enum value has to come after
PrimitiveType.TIMESTAMP.
- Codegen infrastructure changes for expression evaluation.
- 'IS [NOT] NULL' and '[NOT] IN' predicates.
- Common comparison operators (including the 'BETWEEN' operator).
- Infrastructure changes for built-in functions.
- Some built-in functions: conditional, aggregate, analytical and
math functions.
- C++ UDF/UDA support.
- Support partitioning and grouping by DATE.
- Beeswax, HiveServer2 support.
These items are tightly coupled and it makes sense to implement them
in one change-set.
Testing:
- A new partitioned TEXT table 'functional.date_tbl' (and the
corresponding HBASE table 'functional_hbase.date_tbl') was
introduced for DATE-related tests.
- BE and FE tests were extended to cover DATE type.
- E2E tests:
- since DATE type is supported for TEXT and HBASE fileformats
only, most DATE tests were implemented separately in
tests/query_test/test_date_queries.py.
Note, that this change-set is not a complete DATE type implementation,
but it lays the foundation for future work:
- Add date support to the random query generator.
- Implement a complete set of built-in functions.
- Add Parquet support.
- Add Kudu support.
- Optionally support Avro and ORC.
For further details, see IMPALA-6169.
Change-Id: Iea8155ef09557e0afa2f8b2d0b2dc9d0896dc30f
Reviewed-on: http://gerrit.cloudera.org:8080/12481
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
800 lines
41 KiB
Plaintext
800 lines
41 KiB
Plaintext
====
|
|
---- QUERY
|
|
select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col,
|
|
double_col, date_string_col, string_col, timestamp_col
|
|
from alltypessmall
|
|
---- RESULTS
|
|
0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
10,true,0,0,0,0,0,0,'01/02/09','0',2009-01-02 00:10:00.450000000
|
|
11,false,1,1,1,10,1.100000023841858,10.1,'01/02/09','1',2009-01-02 00:11:00.450000000
|
|
12,true,2,2,2,20,2.200000047683716,20.2,'01/02/09','2',2009-01-02 00:12:00.460000000
|
|
13,false,3,3,3,30,3.299999952316284,30.3,'01/02/09','3',2009-01-02 00:13:00.480000000
|
|
14,true,4,4,4,40,4.400000095367432,40.4,'01/02/09','4',2009-01-02 00:14:00.510000000
|
|
15,false,5,5,5,50,5.5,50.5,'01/02/09','5',2009-01-02 00:15:00.550000000
|
|
16,true,6,6,6,60,6.599999904632568,60.6,'01/02/09','6',2009-01-02 00:16:00.600000000
|
|
17,false,7,7,7,70,7.699999809265137,70.7,'01/02/09','7',2009-01-02 00:17:00.660000000
|
|
18,true,8,8,8,80,8.800000190734863,80.8,'01/02/09','8',2009-01-02 00:18:00.730000000
|
|
19,false,9,9,9,90,9.899999618530273,90.90000000000001,'01/02/09','9',2009-01-02 00:19:00.810000000
|
|
2,true,2,2,2,20,2.200000047683716,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000
|
|
20,true,0,0,0,0,0,0,'01/03/09','0',2009-01-03 00:20:00.900000000
|
|
21,false,1,1,1,10,1.100000023841858,10.1,'01/03/09','1',2009-01-03 00:21:00.900000000
|
|
22,true,2,2,2,20,2.200000047683716,20.2,'01/03/09','2',2009-01-03 00:22:00.910000000
|
|
23,false,3,3,3,30,3.299999952316284,30.3,'01/03/09','3',2009-01-03 00:23:00.930000000
|
|
24,true,4,4,4,40,4.400000095367432,40.4,'01/03/09','4',2009-01-03 00:24:00.960000000
|
|
25,false,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
26,true,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
27,false,2,2,2,20,2.200000047683716,20.2,'02/01/09','2',2009-02-01 00:02:00.100000000
|
|
28,true,3,3,3,30,3.299999952316284,30.3,'02/01/09','3',2009-02-01 00:03:00.300000000
|
|
29,false,4,4,4,40,4.400000095367432,40.4,'02/01/09','4',2009-02-01 00:04:00.600000000
|
|
3,false,3,3,3,30,3.299999952316284,30.3,'01/01/09','3',2009-01-01 00:03:00.300000000
|
|
30,true,5,5,5,50,5.5,50.5,'02/01/09','5',2009-02-01 00:05:00.100000000
|
|
31,false,6,6,6,60,6.599999904632568,60.6,'02/01/09','6',2009-02-01 00:06:00.150000000
|
|
32,true,7,7,7,70,7.699999809265137,70.7,'02/01/09','7',2009-02-01 00:07:00.210000000
|
|
33,false,8,8,8,80,8.800000190734863,80.8,'02/01/09','8',2009-02-01 00:08:00.280000000
|
|
34,true,9,9,9,90,9.899999618530273,90.90000000000001,'02/01/09','9',2009-02-01 00:09:00.360000000
|
|
35,false,0,0,0,0,0,0,'02/02/09','0',2009-02-02 00:10:00.450000000
|
|
36,true,1,1,1,10,1.100000023841858,10.1,'02/02/09','1',2009-02-02 00:11:00.450000000
|
|
37,false,2,2,2,20,2.200000047683716,20.2,'02/02/09','2',2009-02-02 00:12:00.460000000
|
|
38,true,3,3,3,30,3.299999952316284,30.3,'02/02/09','3',2009-02-02 00:13:00.480000000
|
|
39,false,4,4,4,40,4.400000095367432,40.4,'02/02/09','4',2009-02-02 00:14:00.510000000
|
|
4,true,4,4,4,40,4.400000095367432,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000
|
|
40,true,5,5,5,50,5.5,50.5,'02/02/09','5',2009-02-02 00:15:00.550000000
|
|
41,false,6,6,6,60,6.599999904632568,60.6,'02/02/09','6',2009-02-02 00:16:00.600000000
|
|
42,true,7,7,7,70,7.699999809265137,70.7,'02/02/09','7',2009-02-02 00:17:00.660000000
|
|
43,false,8,8,8,80,8.800000190734863,80.8,'02/02/09','8',2009-02-02 00:18:00.730000000
|
|
44,true,9,9,9,90,9.899999618530273,90.90000000000001,'02/02/09','9',2009-02-02 00:19:00.810000000
|
|
45,false,0,0,0,0,0,0,'02/03/09','0',2009-02-03 00:20:00.900000000
|
|
46,true,1,1,1,10,1.100000023841858,10.1,'02/03/09','1',2009-02-03 00:21:00.900000000
|
|
47,false,2,2,2,20,2.200000047683716,20.2,'02/03/09','2',2009-02-03 00:22:00.910000000
|
|
48,true,3,3,3,30,3.299999952316284,30.3,'02/03/09','3',2009-02-03 00:23:00.930000000
|
|
49,false,4,4,4,40,4.400000095367432,40.4,'02/03/09','4',2009-02-03 00:24:00.960000000
|
|
5,false,5,5,5,50,5.5,50.5,'01/01/09','5',2009-01-01 00:05:00.100000000
|
|
50,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00
|
|
51,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00
|
|
52,true,2,2,2,20,2.200000047683716,20.2,'03/01/09','2',2009-03-01 00:02:00.100000000
|
|
53,false,3,3,3,30,3.299999952316284,30.3,'03/01/09','3',2009-03-01 00:03:00.300000000
|
|
54,true,4,4,4,40,4.400000095367432,40.4,'03/01/09','4',2009-03-01 00:04:00.600000000
|
|
55,false,5,5,5,50,5.5,50.5,'03/01/09','5',2009-03-01 00:05:00.100000000
|
|
56,true,6,6,6,60,6.599999904632568,60.6,'03/01/09','6',2009-03-01 00:06:00.150000000
|
|
57,false,7,7,7,70,7.699999809265137,70.7,'03/01/09','7',2009-03-01 00:07:00.210000000
|
|
58,true,8,8,8,80,8.800000190734863,80.8,'03/01/09','8',2009-03-01 00:08:00.280000000
|
|
59,false,9,9,9,90,9.899999618530273,90.90000000000001,'03/01/09','9',2009-03-01 00:09:00.360000000
|
|
6,true,6,6,6,60,6.599999904632568,60.6,'01/01/09','6',2009-01-01 00:06:00.150000000
|
|
60,true,0,0,0,0,0,0,'03/02/09','0',2009-03-02 00:10:00.450000000
|
|
61,false,1,1,1,10,1.100000023841858,10.1,'03/02/09','1',2009-03-02 00:11:00.450000000
|
|
62,true,2,2,2,20,2.200000047683716,20.2,'03/02/09','2',2009-03-02 00:12:00.460000000
|
|
63,false,3,3,3,30,3.299999952316284,30.3,'03/02/09','3',2009-03-02 00:13:00.480000000
|
|
64,true,4,4,4,40,4.400000095367432,40.4,'03/02/09','4',2009-03-02 00:14:00.510000000
|
|
65,false,5,5,5,50,5.5,50.5,'03/02/09','5',2009-03-02 00:15:00.550000000
|
|
66,true,6,6,6,60,6.599999904632568,60.6,'03/02/09','6',2009-03-02 00:16:00.600000000
|
|
67,false,7,7,7,70,7.699999809265137,70.7,'03/02/09','7',2009-03-02 00:17:00.660000000
|
|
68,true,8,8,8,80,8.800000190734863,80.8,'03/02/09','8',2009-03-02 00:18:00.730000000
|
|
69,false,9,9,9,90,9.899999618530273,90.90000000000001,'03/02/09','9',2009-03-02 00:19:00.810000000
|
|
7,false,7,7,7,70,7.699999809265137,70.7,'01/01/09','7',2009-01-01 00:07:00.210000000
|
|
70,true,0,0,0,0,0,0,'03/03/09','0',2009-03-03 00:20:00.900000000
|
|
71,false,1,1,1,10,1.100000023841858,10.1,'03/03/09','1',2009-03-03 00:21:00.900000000
|
|
72,true,2,2,2,20,2.200000047683716,20.2,'03/03/09','2',2009-03-03 00:22:00.910000000
|
|
73,false,3,3,3,30,3.299999952316284,30.3,'03/03/09','3',2009-03-03 00:23:00.930000000
|
|
74,true,4,4,4,40,4.400000095367432,40.4,'03/03/09','4',2009-03-03 00:24:00.960000000
|
|
75,false,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00
|
|
76,true,1,1,1,10,1.100000023841858,10.1,'04/01/09','1',2009-04-01 00:01:00
|
|
77,false,2,2,2,20,2.200000047683716,20.2,'04/01/09','2',2009-04-01 00:02:00.100000000
|
|
78,true,3,3,3,30,3.299999952316284,30.3,'04/01/09','3',2009-04-01 00:03:00.300000000
|
|
79,false,4,4,4,40,4.400000095367432,40.4,'04/01/09','4',2009-04-01 00:04:00.600000000
|
|
8,true,8,8,8,80,8.800000190734863,80.8,'01/01/09','8',2009-01-01 00:08:00.280000000
|
|
80,true,5,5,5,50,5.5,50.5,'04/01/09','5',2009-04-01 00:05:00.100000000
|
|
81,false,6,6,6,60,6.599999904632568,60.6,'04/01/09','6',2009-04-01 00:06:00.150000000
|
|
82,true,7,7,7,70,7.699999809265137,70.7,'04/01/09','7',2009-04-01 00:07:00.210000000
|
|
83,false,8,8,8,80,8.800000190734863,80.8,'04/01/09','8',2009-04-01 00:08:00.280000000
|
|
84,true,9,9,9,90,9.899999618530273,90.90000000000001,'04/01/09','9',2009-04-01 00:09:00.360000000
|
|
85,false,0,0,0,0,0,0,'04/02/09','0',2009-04-02 00:10:00.450000000
|
|
86,true,1,1,1,10,1.100000023841858,10.1,'04/02/09','1',2009-04-02 00:11:00.450000000
|
|
87,false,2,2,2,20,2.200000047683716,20.2,'04/02/09','2',2009-04-02 00:12:00.460000000
|
|
88,true,3,3,3,30,3.299999952316284,30.3,'04/02/09','3',2009-04-02 00:13:00.480000000
|
|
89,false,4,4,4,40,4.400000095367432,40.4,'04/02/09','4',2009-04-02 00:14:00.510000000
|
|
9,false,9,9,9,90,9.899999618530273,90.90000000000001,'01/01/09','9',2009-01-01 00:09:00.360000000
|
|
90,true,5,5,5,50,5.5,50.5,'04/02/09','5',2009-04-02 00:15:00.550000000
|
|
91,false,6,6,6,60,6.599999904632568,60.6,'04/02/09','6',2009-04-02 00:16:00.600000000
|
|
92,true,7,7,7,70,7.699999809265137,70.7,'04/02/09','7',2009-04-02 00:17:00.660000000
|
|
93,false,8,8,8,80,8.800000190734863,80.8,'04/02/09','8',2009-04-02 00:18:00.730000000
|
|
94,true,9,9,9,90,9.899999618530273,90.90000000000001,'04/02/09','9',2009-04-02 00:19:00.810000000
|
|
95,false,0,0,0,0,0,0,'04/03/09','0',2009-04-03 00:20:00.900000000
|
|
96,true,1,1,1,10,1.100000023841858,10.1,'04/03/09','1',2009-04-03 00:21:00.900000000
|
|
97,false,2,2,2,20,2.200000047683716,20.2,'04/03/09','2',2009-04-03 00:22:00.910000000
|
|
98,true,3,3,3,30,3.299999952316284,30.3,'04/03/09','3',2009-04-03 00:23:00.930000000
|
|
99,false,4,4,4,40,4.400000095367432,40.4,'04/03/09','4',2009-04-03 00:24:00.960000000
|
|
---- TYPES
|
|
INT, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, STRING, STRING, TIMESTAMP
|
|
====
|
|
---- QUERY
|
|
# Notice the columns are ordered by family/qualifier
|
|
# and are not in the order declared in the DDL
|
|
select * from alltypessmall
|
|
---- RESULTS
|
|
0,0,true,'01/01/09',0,0,0,1,0,'0',2009-01-01 00:00:00,0,2009
|
|
1,10,false,'01/01/09',10.1,1.100000023841858,1,1,1,'1',2009-01-01 00:01:00,1,2009
|
|
10,0,true,'01/02/09',0,0,0,1,0,'0',2009-01-02 00:10:00.450000000,0,2009
|
|
11,10,false,'01/02/09',10.1,1.100000023841858,1,1,1,'1',2009-01-02 00:11:00.450000000,1,2009
|
|
12,20,true,'01/02/09',20.2,2.200000047683716,2,1,2,'2',2009-01-02 00:12:00.460000000,2,2009
|
|
13,30,false,'01/02/09',30.3,3.299999952316284,3,1,3,'3',2009-01-02 00:13:00.480000000,3,2009
|
|
14,40,true,'01/02/09',40.4,4.400000095367432,4,1,4,'4',2009-01-02 00:14:00.510000000,4,2009
|
|
15,50,false,'01/02/09',50.5,5.5,5,1,5,'5',2009-01-02 00:15:00.550000000,5,2009
|
|
16,60,true,'01/02/09',60.6,6.599999904632568,6,1,6,'6',2009-01-02 00:16:00.600000000,6,2009
|
|
17,70,false,'01/02/09',70.7,7.699999809265137,7,1,7,'7',2009-01-02 00:17:00.660000000,7,2009
|
|
18,80,true,'01/02/09',80.8,8.800000190734863,8,1,8,'8',2009-01-02 00:18:00.730000000,8,2009
|
|
19,90,false,'01/02/09',90.90000000000001,9.899999618530273,9,1,9,'9',2009-01-02 00:19:00.810000000,9,2009
|
|
2,20,true,'01/01/09',20.2,2.200000047683716,2,1,2,'2',2009-01-01 00:02:00.100000000,2,2009
|
|
20,0,true,'01/03/09',0,0,0,1,0,'0',2009-01-03 00:20:00.900000000,0,2009
|
|
21,10,false,'01/03/09',10.1,1.100000023841858,1,1,1,'1',2009-01-03 00:21:00.900000000,1,2009
|
|
22,20,true,'01/03/09',20.2,2.200000047683716,2,1,2,'2',2009-01-03 00:22:00.910000000,2,2009
|
|
23,30,false,'01/03/09',30.3,3.299999952316284,3,1,3,'3',2009-01-03 00:23:00.930000000,3,2009
|
|
24,40,true,'01/03/09',40.4,4.400000095367432,4,1,4,'4',2009-01-03 00:24:00.960000000,4,2009
|
|
25,0,false,'02/01/09',0,0,0,2,0,'0',2009-02-01 00:00:00,0,2009
|
|
26,10,true,'02/01/09',10.1,1.100000023841858,1,2,1,'1',2009-02-01 00:01:00,1,2009
|
|
27,20,false,'02/01/09',20.2,2.200000047683716,2,2,2,'2',2009-02-01 00:02:00.100000000,2,2009
|
|
28,30,true,'02/01/09',30.3,3.299999952316284,3,2,3,'3',2009-02-01 00:03:00.300000000,3,2009
|
|
29,40,false,'02/01/09',40.4,4.400000095367432,4,2,4,'4',2009-02-01 00:04:00.600000000,4,2009
|
|
3,30,false,'01/01/09',30.3,3.299999952316284,3,1,3,'3',2009-01-01 00:03:00.300000000,3,2009
|
|
30,50,true,'02/01/09',50.5,5.5,5,2,5,'5',2009-02-01 00:05:00.100000000,5,2009
|
|
31,60,false,'02/01/09',60.6,6.599999904632568,6,2,6,'6',2009-02-01 00:06:00.150000000,6,2009
|
|
32,70,true,'02/01/09',70.7,7.699999809265137,7,2,7,'7',2009-02-01 00:07:00.210000000,7,2009
|
|
33,80,false,'02/01/09',80.8,8.800000190734863,8,2,8,'8',2009-02-01 00:08:00.280000000,8,2009
|
|
34,90,true,'02/01/09',90.90000000000001,9.899999618530273,9,2,9,'9',2009-02-01 00:09:00.360000000,9,2009
|
|
35,0,false,'02/02/09',0,0,0,2,0,'0',2009-02-02 00:10:00.450000000,0,2009
|
|
36,10,true,'02/02/09',10.1,1.100000023841858,1,2,1,'1',2009-02-02 00:11:00.450000000,1,2009
|
|
37,20,false,'02/02/09',20.2,2.200000047683716,2,2,2,'2',2009-02-02 00:12:00.460000000,2,2009
|
|
38,30,true,'02/02/09',30.3,3.299999952316284,3,2,3,'3',2009-02-02 00:13:00.480000000,3,2009
|
|
39,40,false,'02/02/09',40.4,4.400000095367432,4,2,4,'4',2009-02-02 00:14:00.510000000,4,2009
|
|
4,40,true,'01/01/09',40.4,4.400000095367432,4,1,4,'4',2009-01-01 00:04:00.600000000,4,2009
|
|
40,50,true,'02/02/09',50.5,5.5,5,2,5,'5',2009-02-02 00:15:00.550000000,5,2009
|
|
41,60,false,'02/02/09',60.6,6.599999904632568,6,2,6,'6',2009-02-02 00:16:00.600000000,6,2009
|
|
42,70,true,'02/02/09',70.7,7.699999809265137,7,2,7,'7',2009-02-02 00:17:00.660000000,7,2009
|
|
43,80,false,'02/02/09',80.8,8.800000190734863,8,2,8,'8',2009-02-02 00:18:00.730000000,8,2009
|
|
44,90,true,'02/02/09',90.90000000000001,9.899999618530273,9,2,9,'9',2009-02-02 00:19:00.810000000,9,2009
|
|
45,0,false,'02/03/09',0,0,0,2,0,'0',2009-02-03 00:20:00.900000000,0,2009
|
|
46,10,true,'02/03/09',10.1,1.100000023841858,1,2,1,'1',2009-02-03 00:21:00.900000000,1,2009
|
|
47,20,false,'02/03/09',20.2,2.200000047683716,2,2,2,'2',2009-02-03 00:22:00.910000000,2,2009
|
|
48,30,true,'02/03/09',30.3,3.299999952316284,3,2,3,'3',2009-02-03 00:23:00.930000000,3,2009
|
|
49,40,false,'02/03/09',40.4,4.400000095367432,4,2,4,'4',2009-02-03 00:24:00.960000000,4,2009
|
|
5,50,false,'01/01/09',50.5,5.5,5,1,5,'5',2009-01-01 00:05:00.100000000,5,2009
|
|
50,0,true,'03/01/09',0,0,0,3,0,'0',2009-03-01 00:00:00,0,2009
|
|
51,10,false,'03/01/09',10.1,1.100000023841858,1,3,1,'1',2009-03-01 00:01:00,1,2009
|
|
52,20,true,'03/01/09',20.2,2.200000047683716,2,3,2,'2',2009-03-01 00:02:00.100000000,2,2009
|
|
53,30,false,'03/01/09',30.3,3.299999952316284,3,3,3,'3',2009-03-01 00:03:00.300000000,3,2009
|
|
54,40,true,'03/01/09',40.4,4.400000095367432,4,3,4,'4',2009-03-01 00:04:00.600000000,4,2009
|
|
55,50,false,'03/01/09',50.5,5.5,5,3,5,'5',2009-03-01 00:05:00.100000000,5,2009
|
|
56,60,true,'03/01/09',60.6,6.599999904632568,6,3,6,'6',2009-03-01 00:06:00.150000000,6,2009
|
|
57,70,false,'03/01/09',70.7,7.699999809265137,7,3,7,'7',2009-03-01 00:07:00.210000000,7,2009
|
|
58,80,true,'03/01/09',80.8,8.800000190734863,8,3,8,'8',2009-03-01 00:08:00.280000000,8,2009
|
|
59,90,false,'03/01/09',90.90000000000001,9.899999618530273,9,3,9,'9',2009-03-01 00:09:00.360000000,9,2009
|
|
6,60,true,'01/01/09',60.6,6.599999904632568,6,1,6,'6',2009-01-01 00:06:00.150000000,6,2009
|
|
60,0,true,'03/02/09',0,0,0,3,0,'0',2009-03-02 00:10:00.450000000,0,2009
|
|
61,10,false,'03/02/09',10.1,1.100000023841858,1,3,1,'1',2009-03-02 00:11:00.450000000,1,2009
|
|
62,20,true,'03/02/09',20.2,2.200000047683716,2,3,2,'2',2009-03-02 00:12:00.460000000,2,2009
|
|
63,30,false,'03/02/09',30.3,3.299999952316284,3,3,3,'3',2009-03-02 00:13:00.480000000,3,2009
|
|
64,40,true,'03/02/09',40.4,4.400000095367432,4,3,4,'4',2009-03-02 00:14:00.510000000,4,2009
|
|
65,50,false,'03/02/09',50.5,5.5,5,3,5,'5',2009-03-02 00:15:00.550000000,5,2009
|
|
66,60,true,'03/02/09',60.6,6.599999904632568,6,3,6,'6',2009-03-02 00:16:00.600000000,6,2009
|
|
67,70,false,'03/02/09',70.7,7.699999809265137,7,3,7,'7',2009-03-02 00:17:00.660000000,7,2009
|
|
68,80,true,'03/02/09',80.8,8.800000190734863,8,3,8,'8',2009-03-02 00:18:00.730000000,8,2009
|
|
69,90,false,'03/02/09',90.90000000000001,9.899999618530273,9,3,9,'9',2009-03-02 00:19:00.810000000,9,2009
|
|
7,70,false,'01/01/09',70.7,7.699999809265137,7,1,7,'7',2009-01-01 00:07:00.210000000,7,2009
|
|
70,0,true,'03/03/09',0,0,0,3,0,'0',2009-03-03 00:20:00.900000000,0,2009
|
|
71,10,false,'03/03/09',10.1,1.100000023841858,1,3,1,'1',2009-03-03 00:21:00.900000000,1,2009
|
|
72,20,true,'03/03/09',20.2,2.200000047683716,2,3,2,'2',2009-03-03 00:22:00.910000000,2,2009
|
|
73,30,false,'03/03/09',30.3,3.299999952316284,3,3,3,'3',2009-03-03 00:23:00.930000000,3,2009
|
|
74,40,true,'03/03/09',40.4,4.400000095367432,4,3,4,'4',2009-03-03 00:24:00.960000000,4,2009
|
|
75,0,false,'04/01/09',0,0,0,4,0,'0',2009-04-01 00:00:00,0,2009
|
|
76,10,true,'04/01/09',10.1,1.100000023841858,1,4,1,'1',2009-04-01 00:01:00,1,2009
|
|
77,20,false,'04/01/09',20.2,2.200000047683716,2,4,2,'2',2009-04-01 00:02:00.100000000,2,2009
|
|
78,30,true,'04/01/09',30.3,3.299999952316284,3,4,3,'3',2009-04-01 00:03:00.300000000,3,2009
|
|
79,40,false,'04/01/09',40.4,4.400000095367432,4,4,4,'4',2009-04-01 00:04:00.600000000,4,2009
|
|
8,80,true,'01/01/09',80.8,8.800000190734863,8,1,8,'8',2009-01-01 00:08:00.280000000,8,2009
|
|
80,50,true,'04/01/09',50.5,5.5,5,4,5,'5',2009-04-01 00:05:00.100000000,5,2009
|
|
81,60,false,'04/01/09',60.6,6.599999904632568,6,4,6,'6',2009-04-01 00:06:00.150000000,6,2009
|
|
82,70,true,'04/01/09',70.7,7.699999809265137,7,4,7,'7',2009-04-01 00:07:00.210000000,7,2009
|
|
83,80,false,'04/01/09',80.8,8.800000190734863,8,4,8,'8',2009-04-01 00:08:00.280000000,8,2009
|
|
84,90,true,'04/01/09',90.90000000000001,9.899999618530273,9,4,9,'9',2009-04-01 00:09:00.360000000,9,2009
|
|
85,0,false,'04/02/09',0,0,0,4,0,'0',2009-04-02 00:10:00.450000000,0,2009
|
|
86,10,true,'04/02/09',10.1,1.100000023841858,1,4,1,'1',2009-04-02 00:11:00.450000000,1,2009
|
|
87,20,false,'04/02/09',20.2,2.200000047683716,2,4,2,'2',2009-04-02 00:12:00.460000000,2,2009
|
|
88,30,true,'04/02/09',30.3,3.299999952316284,3,4,3,'3',2009-04-02 00:13:00.480000000,3,2009
|
|
89,40,false,'04/02/09',40.4,4.400000095367432,4,4,4,'4',2009-04-02 00:14:00.510000000,4,2009
|
|
9,90,false,'01/01/09',90.90000000000001,9.899999618530273,9,1,9,'9',2009-01-01 00:09:00.360000000,9,2009
|
|
90,50,true,'04/02/09',50.5,5.5,5,4,5,'5',2009-04-02 00:15:00.550000000,5,2009
|
|
91,60,false,'04/02/09',60.6,6.599999904632568,6,4,6,'6',2009-04-02 00:16:00.600000000,6,2009
|
|
92,70,true,'04/02/09',70.7,7.699999809265137,7,4,7,'7',2009-04-02 00:17:00.660000000,7,2009
|
|
93,80,false,'04/02/09',80.8,8.800000190734863,8,4,8,'8',2009-04-02 00:18:00.730000000,8,2009
|
|
94,90,true,'04/02/09',90.90000000000001,9.899999618530273,9,4,9,'9',2009-04-02 00:19:00.810000000,9,2009
|
|
95,0,false,'04/03/09',0,0,0,4,0,'0',2009-04-03 00:20:00.900000000,0,2009
|
|
96,10,true,'04/03/09',10.1,1.100000023841858,1,4,1,'1',2009-04-03 00:21:00.900000000,1,2009
|
|
97,20,false,'04/03/09',20.2,2.200000047683716,2,4,2,'2',2009-04-03 00:22:00.910000000,2,2009
|
|
98,30,true,'04/03/09',30.3,3.299999952316284,3,4,3,'3',2009-04-03 00:23:00.930000000,3,2009
|
|
99,40,false,'04/03/09',40.4,4.400000095367432,4,4,4,'4',2009-04-03 00:24:00.960000000,4,2009
|
|
---- TYPES
|
|
INT, BIGINT, BOOLEAN, STRING, DOUBLE, FLOAT, INT, INT, SMALLINT, STRING, TIMESTAMP, TINYINT, INT
|
|
====
|
|
---- QUERY
|
|
select count(*) from alltypesagg where smallint_col is null and string_col is not null
|
|
---- RESULTS
|
|
100
|
|
---- TYPES
|
|
BIGINT
|
|
====
|
|
---- QUERY
|
|
# show that the hdfs table has identical results
|
|
select count(*) from functional.alltypesagg where smallint_col is null and string_col is not null
|
|
---- RESULTS
|
|
200
|
|
---- TYPES
|
|
BIGINT
|
|
====
|
|
---- QUERY
|
|
# HBase does not return rows if the selected columns don't exist.
|
|
# Since only smallint_col is selected, those expected NULLs don't appear.
|
|
# Therefore, the result returned by this query is zero.
|
|
select count(*) from alltypesagg where smallint_col is null
|
|
---- RESULTS
|
|
0
|
|
---- TYPES
|
|
BIGINT
|
|
====
|
|
---- QUERY
|
|
# Compare this hdfs-equivalent query with the above one.
|
|
select count(*) from functional.alltypesagg where smallint_col is null
|
|
---- RESULTS
|
|
200
|
|
---- TYPES
|
|
BIGINT
|
|
====
|
|
---- QUERY
|
|
# test adapted from aggregation.test but using the hbase equivalent table
|
|
select tinyint_col, count(bool_col) from alltypesagg group by 1
|
|
---- RESULTS
|
|
3,1000
|
|
4,1000
|
|
NULL,1000
|
|
1,1000
|
|
8,1000
|
|
6,1000
|
|
2,1000
|
|
5,1000
|
|
7,1000
|
|
9,1000
|
|
---- TYPES
|
|
TINYINT, BIGINT
|
|
====
|
|
---- QUERY
|
|
# test adapted from aggregation.test but using the hbase equivalent table
|
|
# notice that the NULL value is missing because HBase does not
|
|
# return those rows where tinyint_col does not exist
|
|
select tinyint_col, count(*) from alltypesagg group by 1
|
|
---- RESULTS
|
|
3,1000
|
|
4,1000
|
|
1,1000
|
|
8,1000
|
|
6,1000
|
|
2,1000
|
|
5,1000
|
|
7,1000
|
|
9,1000
|
|
---- TYPES
|
|
TINYINT, BIGINT
|
|
====
|
|
---- QUERY
|
|
select tinyint_col, int_col % 10, count(*) from alltypesagg group by 1, 2
|
|
---- RESULTS
|
|
7,7,1000
|
|
6,6,1000
|
|
5,5,1000
|
|
NULL,0,990
|
|
4,4,1000
|
|
3,3,1000
|
|
2,2,1000
|
|
8,8,1000
|
|
1,1,1000
|
|
9,9,1000
|
|
---- TYPES
|
|
TINYINT, INT, BIGINT
|
|
====
|
|
---- QUERY
|
|
select tinyint_col, count(*) from alltypesagg where (int_col % 10) = 0 group by tinyint_col
|
|
---- RESULTS
|
|
NULL,990
|
|
---- TYPES
|
|
TINYINT, BIGINT
|
|
====
|
|
---- QUERY
|
|
# test that conjuncts are evaluated even if no columns are referenced
|
|
select 1 from functional.alltypestiny where 3 > 4
|
|
---- RESULTS
|
|
---- TYPES
|
|
TINYINT
|
|
====
|
|
---- QUERY
|
|
select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, float_col,
|
|
double_col, date_string_col, string_col, timestamp_col
|
|
from alltypessmallbinary
|
|
---- RESULTS
|
|
0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00
|
|
1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00
|
|
2,true,2,2,2,20,2.200000047683716,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000
|
|
3,false,3,3,3,30,3.299999952316284,30.3,'01/01/09','3',2009-01-01 00:03:00.300000000
|
|
4,true,4,4,4,40,4.400000095367432,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000
|
|
5,false,5,5,5,50,5.5,50.5,'01/01/09','5',2009-01-01 00:05:00.100000000
|
|
6,true,6,6,6,60,6.599999904632568,60.59999999999999,'01/01/09','6',2009-01-01 00:06:00.150000000
|
|
7,false,7,7,7,70,7.699999809265137,70.7,'01/01/09','7',2009-01-01 00:07:00.210000000
|
|
8,true,8,8,8,80,8.800000190734863,80.8,'01/01/09','8',2009-01-01 00:08:00.280000000
|
|
9,false,9,9,9,90,9.899999618530273,90.89999999999999,'01/01/09','9',2009-01-01 00:09:00.360000000
|
|
10,true,0,0,0,0,0,0,'01/02/09','0',2009-01-02 00:10:00.450000000
|
|
11,false,1,1,1,10,1.100000023841858,10.1,'01/02/09','1',2009-01-02 00:11:00.450000000
|
|
12,true,2,2,2,20,2.200000047683716,20.2,'01/02/09','2',2009-01-02 00:12:00.460000000
|
|
13,false,3,3,3,30,3.299999952316284,30.3,'01/02/09','3',2009-01-02 00:13:00.480000000
|
|
14,true,4,4,4,40,4.400000095367432,40.4,'01/02/09','4',2009-01-02 00:14:00.510000000
|
|
15,false,5,5,5,50,5.5,50.5,'01/02/09','5',2009-01-02 00:15:00.550000000
|
|
16,true,6,6,6,60,6.599999904632568,60.59999999999999,'01/02/09','6',2009-01-02 00:16:00.600000000
|
|
17,false,7,7,7,70,7.699999809265137,70.7,'01/02/09','7',2009-01-02 00:17:00.660000000
|
|
18,true,8,8,8,80,8.800000190734863,80.8,'01/02/09','8',2009-01-02 00:18:00.730000000
|
|
19,false,9,9,9,90,9.899999618530273,90.89999999999999,'01/02/09','9',2009-01-02 00:19:00.810000000
|
|
20,true,0,0,0,0,0,0,'01/03/09','0',2009-01-03 00:20:00.900000000
|
|
21,false,1,1,1,10,1.100000023841858,10.1,'01/03/09','1',2009-01-03 00:21:00.900000000
|
|
22,true,2,2,2,20,2.200000047683716,20.2,'01/03/09','2',2009-01-03 00:22:00.910000000
|
|
23,false,3,3,3,30,3.299999952316284,30.3,'01/03/09','3',2009-01-03 00:23:00.930000000
|
|
24,true,4,4,4,40,4.400000095367432,40.4,'01/03/09','4',2009-01-03 00:24:00.960000000
|
|
25,false,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00
|
|
26,true,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00
|
|
27,false,2,2,2,20,2.200000047683716,20.2,'02/01/09','2',2009-02-01 00:02:00.100000000
|
|
28,true,3,3,3,30,3.299999952316284,30.3,'02/01/09','3',2009-02-01 00:03:00.300000000
|
|
29,false,4,4,4,40,4.400000095367432,40.4,'02/01/09','4',2009-02-01 00:04:00.600000000
|
|
30,true,5,5,5,50,5.5,50.5,'02/01/09','5',2009-02-01 00:05:00.100000000
|
|
31,false,6,6,6,60,6.599999904632568,60.59999999999999,'02/01/09','6',2009-02-01 00:06:00.150000000
|
|
32,true,7,7,7,70,7.699999809265137,70.7,'02/01/09','7',2009-02-01 00:07:00.210000000
|
|
33,false,8,8,8,80,8.800000190734863,80.8,'02/01/09','8',2009-02-01 00:08:00.280000000
|
|
34,true,9,9,9,90,9.899999618530273,90.89999999999999,'02/01/09','9',2009-02-01 00:09:00.360000000
|
|
35,false,0,0,0,0,0,0,'02/02/09','0',2009-02-02 00:10:00.450000000
|
|
36,true,1,1,1,10,1.100000023841858,10.1,'02/02/09','1',2009-02-02 00:11:00.450000000
|
|
37,false,2,2,2,20,2.200000047683716,20.2,'02/02/09','2',2009-02-02 00:12:00.460000000
|
|
38,true,3,3,3,30,3.299999952316284,30.3,'02/02/09','3',2009-02-02 00:13:00.480000000
|
|
39,false,4,4,4,40,4.400000095367432,40.4,'02/02/09','4',2009-02-02 00:14:00.510000000
|
|
40,true,5,5,5,50,5.5,50.5,'02/02/09','5',2009-02-02 00:15:00.550000000
|
|
41,false,6,6,6,60,6.599999904632568,60.59999999999999,'02/02/09','6',2009-02-02 00:16:00.600000000
|
|
42,true,7,7,7,70,7.699999809265137,70.7,'02/02/09','7',2009-02-02 00:17:00.660000000
|
|
43,false,8,8,8,80,8.800000190734863,80.8,'02/02/09','8',2009-02-02 00:18:00.730000000
|
|
44,true,9,9,9,90,9.899999618530273,90.89999999999999,'02/02/09','9',2009-02-02 00:19:00.810000000
|
|
45,false,0,0,0,0,0,0,'02/03/09','0',2009-02-03 00:20:00.900000000
|
|
46,true,1,1,1,10,1.100000023841858,10.1,'02/03/09','1',2009-02-03 00:21:00.900000000
|
|
47,false,2,2,2,20,2.200000047683716,20.2,'02/03/09','2',2009-02-03 00:22:00.910000000
|
|
48,true,3,3,3,30,3.299999952316284,30.3,'02/03/09','3',2009-02-03 00:23:00.930000000
|
|
49,false,4,4,4,40,4.400000095367432,40.4,'02/03/09','4',2009-02-03 00:24:00.960000000
|
|
50,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00
|
|
51,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00
|
|
52,true,2,2,2,20,2.200000047683716,20.2,'03/01/09','2',2009-03-01 00:02:00.100000000
|
|
53,false,3,3,3,30,3.299999952316284,30.3,'03/01/09','3',2009-03-01 00:03:00.300000000
|
|
54,true,4,4,4,40,4.400000095367432,40.4,'03/01/09','4',2009-03-01 00:04:00.600000000
|
|
55,false,5,5,5,50,5.5,50.5,'03/01/09','5',2009-03-01 00:05:00.100000000
|
|
56,true,6,6,6,60,6.599999904632568,60.59999999999999,'03/01/09','6',2009-03-01 00:06:00.150000000
|
|
57,false,7,7,7,70,7.699999809265137,70.7,'03/01/09','7',2009-03-01 00:07:00.210000000
|
|
58,true,8,8,8,80,8.800000190734863,80.8,'03/01/09','8',2009-03-01 00:08:00.280000000
|
|
59,false,9,9,9,90,9.899999618530273,90.89999999999999,'03/01/09','9',2009-03-01 00:09:00.360000000
|
|
60,true,0,0,0,0,0,0,'03/02/09','0',2009-03-02 00:10:00.450000000
|
|
61,false,1,1,1,10,1.100000023841858,10.1,'03/02/09','1',2009-03-02 00:11:00.450000000
|
|
62,true,2,2,2,20,2.200000047683716,20.2,'03/02/09','2',2009-03-02 00:12:00.460000000
|
|
63,false,3,3,3,30,3.299999952316284,30.3,'03/02/09','3',2009-03-02 00:13:00.480000000
|
|
64,true,4,4,4,40,4.400000095367432,40.4,'03/02/09','4',2009-03-02 00:14:00.510000000
|
|
65,false,5,5,5,50,5.5,50.5,'03/02/09','5',2009-03-02 00:15:00.550000000
|
|
66,true,6,6,6,60,6.599999904632568,60.59999999999999,'03/02/09','6',2009-03-02 00:16:00.600000000
|
|
67,false,7,7,7,70,7.699999809265137,70.7,'03/02/09','7',2009-03-02 00:17:00.660000000
|
|
68,true,8,8,8,80,8.800000190734863,80.8,'03/02/09','8',2009-03-02 00:18:00.730000000
|
|
69,false,9,9,9,90,9.899999618530273,90.89999999999999,'03/02/09','9',2009-03-02 00:19:00.810000000
|
|
70,true,0,0,0,0,0,0,'03/03/09','0',2009-03-03 00:20:00.900000000
|
|
71,false,1,1,1,10,1.100000023841858,10.1,'03/03/09','1',2009-03-03 00:21:00.900000000
|
|
72,true,2,2,2,20,2.200000047683716,20.2,'03/03/09','2',2009-03-03 00:22:00.910000000
|
|
73,false,3,3,3,30,3.299999952316284,30.3,'03/03/09','3',2009-03-03 00:23:00.930000000
|
|
74,true,4,4,4,40,4.400000095367432,40.4,'03/03/09','4',2009-03-03 00:24:00.960000000
|
|
75,false,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00
|
|
76,true,1,1,1,10,1.100000023841858,10.1,'04/01/09','1',2009-04-01 00:01:00
|
|
77,false,2,2,2,20,2.200000047683716,20.2,'04/01/09','2',2009-04-01 00:02:00.100000000
|
|
78,true,3,3,3,30,3.299999952316284,30.3,'04/01/09','3',2009-04-01 00:03:00.300000000
|
|
79,false,4,4,4,40,4.400000095367432,40.4,'04/01/09','4',2009-04-01 00:04:00.600000000
|
|
80,true,5,5,5,50,5.5,50.5,'04/01/09','5',2009-04-01 00:05:00.100000000
|
|
81,false,6,6,6,60,6.599999904632568,60.59999999999999,'04/01/09','6',2009-04-01 00:06:00.150000000
|
|
82,true,7,7,7,70,7.699999809265137,70.7,'04/01/09','7',2009-04-01 00:07:00.210000000
|
|
83,false,8,8,8,80,8.800000190734863,80.8,'04/01/09','8',2009-04-01 00:08:00.280000000
|
|
84,true,9,9,9,90,9.899999618530273,90.89999999999999,'04/01/09','9',2009-04-01 00:09:00.360000000
|
|
85,false,0,0,0,0,0,0,'04/02/09','0',2009-04-02 00:10:00.450000000
|
|
86,true,1,1,1,10,1.100000023841858,10.1,'04/02/09','1',2009-04-02 00:11:00.450000000
|
|
87,false,2,2,2,20,2.200000047683716,20.2,'04/02/09','2',2009-04-02 00:12:00.460000000
|
|
88,true,3,3,3,30,3.299999952316284,30.3,'04/02/09','3',2009-04-02 00:13:00.480000000
|
|
89,false,4,4,4,40,4.400000095367432,40.4,'04/02/09','4',2009-04-02 00:14:00.510000000
|
|
90,true,5,5,5,50,5.5,50.5,'04/02/09','5',2009-04-02 00:15:00.550000000
|
|
91,false,6,6,6,60,6.599999904632568,60.59999999999999,'04/02/09','6',2009-04-02 00:16:00.600000000
|
|
92,true,7,7,7,70,7.699999809265137,70.7,'04/02/09','7',2009-04-02 00:17:00.660000000
|
|
93,false,8,8,8,80,8.800000190734863,80.8,'04/02/09','8',2009-04-02 00:18:00.730000000
|
|
94,true,9,9,9,90,9.899999618530273,90.89999999999999,'04/02/09','9',2009-04-02 00:19:00.810000000
|
|
95,false,0,0,0,0,0,0,'04/03/09','0',2009-04-03 00:20:00.900000000
|
|
96,true,1,1,1,10,1.100000023841858,10.1,'04/03/09','1',2009-04-03 00:21:00.900000000
|
|
97,false,2,2,2,20,2.200000047683716,20.2,'04/03/09','2',2009-04-03 00:22:00.910000000
|
|
98,true,3,3,3,30,3.299999952316284,30.3,'04/03/09','3',2009-04-03 00:23:00.930000000
|
|
99,false,4,4,4,40,4.400000095367432,40.4,'04/03/09','4',2009-04-03 00:24:00.960000000
|
|
---- TYPES
|
|
INT, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, STRING, STRING, TIMESTAMP
|
|
====
|
|
---- QUERY
|
|
select id from alltypessmallbinary
|
|
---- RESULTS
|
|
0
|
|
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
|
|
---- TYPES
|
|
INT
|
|
====
|
|
---- QUERY
|
|
# Notice the columns are ordered by family/qualifier
|
|
# and are not in the order declared in the DDL
|
|
select * from alltypessmallbinary
|
|
---- RESULTS
|
|
0,0,true,'01/01/09',0,0,0,1,0,'0',2009-01-01 00:00:00,0,2009
|
|
1,10,false,'01/01/09',10.1,1.100000023841858,1,1,1,'1',2009-01-01 00:01:00,1,2009
|
|
2,20,true,'01/01/09',20.2,2.200000047683716,2,1,2,'2',2009-01-01 00:02:00.100000000,2,2009
|
|
3,30,false,'01/01/09',30.3,3.299999952316284,3,1,3,'3',2009-01-01 00:03:00.300000000,3,2009
|
|
4,40,true,'01/01/09',40.4,4.400000095367432,4,1,4,'4',2009-01-01 00:04:00.600000000,4,2009
|
|
5,50,false,'01/01/09',50.5,5.5,5,1,5,'5',2009-01-01 00:05:00.100000000,5,2009
|
|
6,60,true,'01/01/09',60.59999999999999,6.599999904632568,6,1,6,'6',2009-01-01 00:06:00.150000000,6,2009
|
|
7,70,false,'01/01/09',70.7,7.699999809265137,7,1,7,'7',2009-01-01 00:07:00.210000000,7,2009
|
|
8,80,true,'01/01/09',80.8,8.800000190734863,8,1,8,'8',2009-01-01 00:08:00.280000000,8,2009
|
|
9,90,false,'01/01/09',90.89999999999999,9.899999618530273,9,1,9,'9',2009-01-01 00:09:00.360000000,9,2009
|
|
10,0,true,'01/02/09',0,0,0,1,0,'0',2009-01-02 00:10:00.450000000,0,2009
|
|
11,10,false,'01/02/09',10.1,1.100000023841858,1,1,1,'1',2009-01-02 00:11:00.450000000,1,2009
|
|
12,20,true,'01/02/09',20.2,2.200000047683716,2,1,2,'2',2009-01-02 00:12:00.460000000,2,2009
|
|
13,30,false,'01/02/09',30.3,3.299999952316284,3,1,3,'3',2009-01-02 00:13:00.480000000,3,2009
|
|
14,40,true,'01/02/09',40.4,4.400000095367432,4,1,4,'4',2009-01-02 00:14:00.510000000,4,2009
|
|
15,50,false,'01/02/09',50.5,5.5,5,1,5,'5',2009-01-02 00:15:00.550000000,5,2009
|
|
16,60,true,'01/02/09',60.59999999999999,6.599999904632568,6,1,6,'6',2009-01-02 00:16:00.600000000,6,2009
|
|
17,70,false,'01/02/09',70.7,7.699999809265137,7,1,7,'7',2009-01-02 00:17:00.660000000,7,2009
|
|
18,80,true,'01/02/09',80.8,8.800000190734863,8,1,8,'8',2009-01-02 00:18:00.730000000,8,2009
|
|
19,90,false,'01/02/09',90.89999999999999,9.899999618530273,9,1,9,'9',2009-01-02 00:19:00.810000000,9,2009
|
|
20,0,true,'01/03/09',0,0,0,1,0,'0',2009-01-03 00:20:00.900000000,0,2009
|
|
21,10,false,'01/03/09',10.1,1.100000023841858,1,1,1,'1',2009-01-03 00:21:00.900000000,1,2009
|
|
22,20,true,'01/03/09',20.2,2.200000047683716,2,1,2,'2',2009-01-03 00:22:00.910000000,2,2009
|
|
23,30,false,'01/03/09',30.3,3.299999952316284,3,1,3,'3',2009-01-03 00:23:00.930000000,3,2009
|
|
24,40,true,'01/03/09',40.4,4.400000095367432,4,1,4,'4',2009-01-03 00:24:00.960000000,4,2009
|
|
25,0,false,'02/01/09',0,0,0,2,0,'0',2009-02-01 00:00:00,0,2009
|
|
26,10,true,'02/01/09',10.1,1.100000023841858,1,2,1,'1',2009-02-01 00:01:00,1,2009
|
|
27,20,false,'02/01/09',20.2,2.200000047683716,2,2,2,'2',2009-02-01 00:02:00.100000000,2,2009
|
|
28,30,true,'02/01/09',30.3,3.299999952316284,3,2,3,'3',2009-02-01 00:03:00.300000000,3,2009
|
|
29,40,false,'02/01/09',40.4,4.400000095367432,4,2,4,'4',2009-02-01 00:04:00.600000000,4,2009
|
|
30,50,true,'02/01/09',50.5,5.5,5,2,5,'5',2009-02-01 00:05:00.100000000,5,2009
|
|
31,60,false,'02/01/09',60.59999999999999,6.599999904632568,6,2,6,'6',2009-02-01 00:06:00.150000000,6,2009
|
|
32,70,true,'02/01/09',70.7,7.699999809265137,7,2,7,'7',2009-02-01 00:07:00.210000000,7,2009
|
|
33,80,false,'02/01/09',80.8,8.800000190734863,8,2,8,'8',2009-02-01 00:08:00.280000000,8,2009
|
|
34,90,true,'02/01/09',90.89999999999999,9.899999618530273,9,2,9,'9',2009-02-01 00:09:00.360000000,9,2009
|
|
35,0,false,'02/02/09',0,0,0,2,0,'0',2009-02-02 00:10:00.450000000,0,2009
|
|
36,10,true,'02/02/09',10.1,1.100000023841858,1,2,1,'1',2009-02-02 00:11:00.450000000,1,2009
|
|
37,20,false,'02/02/09',20.2,2.200000047683716,2,2,2,'2',2009-02-02 00:12:00.460000000,2,2009
|
|
38,30,true,'02/02/09',30.3,3.299999952316284,3,2,3,'3',2009-02-02 00:13:00.480000000,3,2009
|
|
39,40,false,'02/02/09',40.4,4.400000095367432,4,2,4,'4',2009-02-02 00:14:00.510000000,4,2009
|
|
40,50,true,'02/02/09',50.5,5.5,5,2,5,'5',2009-02-02 00:15:00.550000000,5,2009
|
|
41,60,false,'02/02/09',60.59999999999999,6.599999904632568,6,2,6,'6',2009-02-02 00:16:00.600000000,6,2009
|
|
42,70,true,'02/02/09',70.7,7.699999809265137,7,2,7,'7',2009-02-02 00:17:00.660000000,7,2009
|
|
43,80,false,'02/02/09',80.8,8.800000190734863,8,2,8,'8',2009-02-02 00:18:00.730000000,8,2009
|
|
44,90,true,'02/02/09',90.89999999999999,9.899999618530273,9,2,9,'9',2009-02-02 00:19:00.810000000,9,2009
|
|
45,0,false,'02/03/09',0,0,0,2,0,'0',2009-02-03 00:20:00.900000000,0,2009
|
|
46,10,true,'02/03/09',10.1,1.100000023841858,1,2,1,'1',2009-02-03 00:21:00.900000000,1,2009
|
|
47,20,false,'02/03/09',20.2,2.200000047683716,2,2,2,'2',2009-02-03 00:22:00.910000000,2,2009
|
|
48,30,true,'02/03/09',30.3,3.299999952316284,3,2,3,'3',2009-02-03 00:23:00.930000000,3,2009
|
|
49,40,false,'02/03/09',40.4,4.400000095367432,4,2,4,'4',2009-02-03 00:24:00.960000000,4,2009
|
|
50,0,true,'03/01/09',0,0,0,3,0,'0',2009-03-01 00:00:00,0,2009
|
|
51,10,false,'03/01/09',10.1,1.100000023841858,1,3,1,'1',2009-03-01 00:01:00,1,2009
|
|
52,20,true,'03/01/09',20.2,2.200000047683716,2,3,2,'2',2009-03-01 00:02:00.100000000,2,2009
|
|
53,30,false,'03/01/09',30.3,3.299999952316284,3,3,3,'3',2009-03-01 00:03:00.300000000,3,2009
|
|
54,40,true,'03/01/09',40.4,4.400000095367432,4,3,4,'4',2009-03-01 00:04:00.600000000,4,2009
|
|
55,50,false,'03/01/09',50.5,5.5,5,3,5,'5',2009-03-01 00:05:00.100000000,5,2009
|
|
56,60,true,'03/01/09',60.59999999999999,6.599999904632568,6,3,6,'6',2009-03-01 00:06:00.150000000,6,2009
|
|
57,70,false,'03/01/09',70.7,7.699999809265137,7,3,7,'7',2009-03-01 00:07:00.210000000,7,2009
|
|
58,80,true,'03/01/09',80.8,8.800000190734863,8,3,8,'8',2009-03-01 00:08:00.280000000,8,2009
|
|
59,90,false,'03/01/09',90.89999999999999,9.899999618530273,9,3,9,'9',2009-03-01 00:09:00.360000000,9,2009
|
|
60,0,true,'03/02/09',0,0,0,3,0,'0',2009-03-02 00:10:00.450000000,0,2009
|
|
61,10,false,'03/02/09',10.1,1.100000023841858,1,3,1,'1',2009-03-02 00:11:00.450000000,1,2009
|
|
62,20,true,'03/02/09',20.2,2.200000047683716,2,3,2,'2',2009-03-02 00:12:00.460000000,2,2009
|
|
63,30,false,'03/02/09',30.3,3.299999952316284,3,3,3,'3',2009-03-02 00:13:00.480000000,3,2009
|
|
64,40,true,'03/02/09',40.4,4.400000095367432,4,3,4,'4',2009-03-02 00:14:00.510000000,4,2009
|
|
65,50,false,'03/02/09',50.5,5.5,5,3,5,'5',2009-03-02 00:15:00.550000000,5,2009
|
|
66,60,true,'03/02/09',60.59999999999999,6.599999904632568,6,3,6,'6',2009-03-02 00:16:00.600000000,6,2009
|
|
67,70,false,'03/02/09',70.7,7.699999809265137,7,3,7,'7',2009-03-02 00:17:00.660000000,7,2009
|
|
68,80,true,'03/02/09',80.8,8.800000190734863,8,3,8,'8',2009-03-02 00:18:00.730000000,8,2009
|
|
69,90,false,'03/02/09',90.89999999999999,9.899999618530273,9,3,9,'9',2009-03-02 00:19:00.810000000,9,2009
|
|
70,0,true,'03/03/09',0,0,0,3,0,'0',2009-03-03 00:20:00.900000000,0,2009
|
|
71,10,false,'03/03/09',10.1,1.100000023841858,1,3,1,'1',2009-03-03 00:21:00.900000000,1,2009
|
|
72,20,true,'03/03/09',20.2,2.200000047683716,2,3,2,'2',2009-03-03 00:22:00.910000000,2,2009
|
|
73,30,false,'03/03/09',30.3,3.299999952316284,3,3,3,'3',2009-03-03 00:23:00.930000000,3,2009
|
|
74,40,true,'03/03/09',40.4,4.400000095367432,4,3,4,'4',2009-03-03 00:24:00.960000000,4,2009
|
|
75,0,false,'04/01/09',0,0,0,4,0,'0',2009-04-01 00:00:00,0,2009
|
|
76,10,true,'04/01/09',10.1,1.100000023841858,1,4,1,'1',2009-04-01 00:01:00,1,2009
|
|
77,20,false,'04/01/09',20.2,2.200000047683716,2,4,2,'2',2009-04-01 00:02:00.100000000,2,2009
|
|
78,30,true,'04/01/09',30.3,3.299999952316284,3,4,3,'3',2009-04-01 00:03:00.300000000,3,2009
|
|
79,40,false,'04/01/09',40.4,4.400000095367432,4,4,4,'4',2009-04-01 00:04:00.600000000,4,2009
|
|
80,50,true,'04/01/09',50.5,5.5,5,4,5,'5',2009-04-01 00:05:00.100000000,5,2009
|
|
81,60,false,'04/01/09',60.59999999999999,6.599999904632568,6,4,6,'6',2009-04-01 00:06:00.150000000,6,2009
|
|
82,70,true,'04/01/09',70.7,7.699999809265137,7,4,7,'7',2009-04-01 00:07:00.210000000,7,2009
|
|
83,80,false,'04/01/09',80.8,8.800000190734863,8,4,8,'8',2009-04-01 00:08:00.280000000,8,2009
|
|
84,90,true,'04/01/09',90.89999999999999,9.899999618530273,9,4,9,'9',2009-04-01 00:09:00.360000000,9,2009
|
|
85,0,false,'04/02/09',0,0,0,4,0,'0',2009-04-02 00:10:00.450000000,0,2009
|
|
86,10,true,'04/02/09',10.1,1.100000023841858,1,4,1,'1',2009-04-02 00:11:00.450000000,1,2009
|
|
87,20,false,'04/02/09',20.2,2.200000047683716,2,4,2,'2',2009-04-02 00:12:00.460000000,2,2009
|
|
88,30,true,'04/02/09',30.3,3.299999952316284,3,4,3,'3',2009-04-02 00:13:00.480000000,3,2009
|
|
89,40,false,'04/02/09',40.4,4.400000095367432,4,4,4,'4',2009-04-02 00:14:00.510000000,4,2009
|
|
90,50,true,'04/02/09',50.5,5.5,5,4,5,'5',2009-04-02 00:15:00.550000000,5,2009
|
|
91,60,false,'04/02/09',60.59999999999999,6.599999904632568,6,4,6,'6',2009-04-02 00:16:00.600000000,6,2009
|
|
92,70,true,'04/02/09',70.7,7.699999809265137,7,4,7,'7',2009-04-02 00:17:00.660000000,7,2009
|
|
93,80,false,'04/02/09',80.8,8.800000190734863,8,4,8,'8',2009-04-02 00:18:00.730000000,8,2009
|
|
94,90,true,'04/02/09',90.89999999999999,9.899999618530273,9,4,9,'9',2009-04-02 00:19:00.810000000,9,2009
|
|
95,0,false,'04/03/09',0,0,0,4,0,'0',2009-04-03 00:20:00.900000000,0,2009
|
|
96,10,true,'04/03/09',10.1,1.100000023841858,1,4,1,'1',2009-04-03 00:21:00.900000000,1,2009
|
|
97,20,false,'04/03/09',20.2,2.200000047683716,2,4,2,'2',2009-04-03 00:22:00.910000000,2,2009
|
|
98,30,true,'04/03/09',30.3,3.299999952316284,3,4,3,'3',2009-04-03 00:23:00.930000000,3,2009
|
|
99,40,false,'04/03/09',40.4,4.400000095367432,4,4,4,'4',2009-04-03 00:24:00.960000000,4,2009
|
|
---- TYPES
|
|
INT, BIGINT, BOOLEAN, STRING, DOUBLE, FLOAT, INT, INT, SMALLINT, STRING, TIMESTAMP, TINYINT, INT
|
|
====
|
|
---- QUERY
|
|
# Scan an HBase table with multiple column families (IMPALA-4220)
|
|
select * from hbasecolumnfamilies
|
|
---- RESULTS
|
|
0,true,0,0,0,0,'01/01/09',0,0,'0',2009-01-01 00:00:00
|
|
1,false,1,1,1,10,'01/01/09',10.1,1.100000023841858,'1',2009-01-01 00:01:00
|
|
2,true,0,0,0,0,'02/01/09',0,0,'0',2009-02-01 00:00:00
|
|
3,false,1,1,1,10,'02/01/09',10.1,1.100000023841858,'1',2009-02-01 00:01:00
|
|
4,true,0,0,0,0,'03/01/09',0,0,'0',2009-03-01 00:00:00
|
|
5,false,1,1,1,10,'03/01/09',10.1,1.100000023841858,'1',2009-03-01 00:01:00
|
|
6,true,0,0,0,0,'04/01/09',0,0,'0',2009-04-01 00:00:00
|
|
7,false,1,1,1,10,'04/01/09',10.1,1.100000023841858,'1',2009-04-01 00:01:00
|
|
---- TYPES
|
|
INT, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, STRING, DOUBLE, FLOAT, STRING, TIMESTAMP
|
|
====
|
|
---- QUERY
|
|
select id_col, date_part, date_col from date_tbl;
|
|
---- RESULTS
|
|
0,0001-01-01,0001-01-01
|
|
1,0001-01-01,0001-12-31
|
|
2,0001-01-01,0002-01-01
|
|
3,0001-01-01,1399-12-31
|
|
4,0001-01-01,2017-11-28
|
|
5,0001-01-01,9999-12-31
|
|
6,0001-01-01,NULL
|
|
10,1399-06-27,2017-11-28
|
|
11,1399-06-27,NULL
|
|
12,1399-06-27,2018-12-31
|
|
20,2017-11-27,0001-06-21
|
|
21,2017-11-27,0001-06-22
|
|
22,2017-11-27,0001-06-23
|
|
23,2017-11-27,0001-06-24
|
|
24,2017-11-27,0001-06-25
|
|
25,2017-11-27,0001-06-26
|
|
26,2017-11-27,0001-06-27
|
|
27,2017-11-27,0001-06-28
|
|
28,2017-11-27,0001-06-29
|
|
29,2017-11-27,2017-11-28
|
|
30,9999-12-31,9999-12-01
|
|
31,9999-12-31,9999-12-31
|
|
---- TYPES
|
|
INT,DATE,DATE
|
|
====
|
|
---- QUERY
|
|
select count(*) from date_tbl where date_col is null and date_part is not null
|
|
---- RESULTS
|
|
2
|
|
---- TYPES
|
|
BIGINT
|
|
====
|
|
---- QUERY
|
|
# show that the hdfs table has identical results
|
|
select count(*) from functional.date_tbl where date_col is null and date_part is not null
|
|
---- RESULTS
|
|
2
|
|
---- TYPES
|
|
BIGINT
|
|
====
|
|
---- QUERY
|
|
# HBase does not return rows if the selected columns don't exist.
|
|
# Since only date_col is selected, those expected NULLs don't appear.
|
|
# Therefore, the result returned by this query is zero.
|
|
select count(*) from date_tbl where date_col is null
|
|
---- RESULTS
|
|
0
|
|
---- TYPES
|
|
BIGINT
|
|
====
|
|
---- QUERY
|
|
# Compare this hdfs-equivalent query with the above one.
|
|
select count(*) from functional.date_tbl where date_col is null
|
|
---- RESULTS
|
|
2
|
|
---- TYPES
|
|
BIGINT
|
|
====
|
|
---- QUERY
|
|
select date_col, count(date_part) from date_tbl group by 1
|
|
---- RESULTS
|
|
1399-12-31,1
|
|
0001-06-28,1
|
|
9999-12-31,2
|
|
0001-06-27,1
|
|
2018-12-31,1
|
|
0001-06-23,1
|
|
0002-01-01,1
|
|
0001-06-21,1
|
|
2017-11-28,3
|
|
0001-06-29,1
|
|
0001-06-22,1
|
|
0001-12-31,1
|
|
0001-06-24,1
|
|
0001-06-26,1
|
|
9999-12-01,1
|
|
0001-06-25,1
|
|
0001-01-01,1
|
|
NULL,2
|
|
---- TYPES
|
|
DATE, BIGINT
|
|
====
|
|
---- QUERY
|
|
# Notice that the NULL value is missing because HBase does not
|
|
# return those rows where date_col does not exist
|
|
select date_col, count(*) from date_tbl group by 1
|
|
---- RESULTS
|
|
1399-12-31,1
|
|
0001-06-28,1
|
|
9999-12-31,2
|
|
0001-06-27,1
|
|
2018-12-31,1
|
|
0001-06-23,1
|
|
0002-01-01,1
|
|
0001-06-21,1
|
|
2017-11-28,3
|
|
0001-06-29,1
|
|
0001-06-22,1
|
|
0001-12-31,1
|
|
0001-06-24,1
|
|
0001-06-26,1
|
|
9999-12-01,1
|
|
0001-06-25,1
|
|
0001-01-01,1
|
|
---- TYPES
|
|
DATE, BIGINT
|
|
====
|
|
---- QUERY
|
|
select date_col, date_part, count(*) from date_tbl group by 1, 2
|
|
---- RESULTS
|
|
0001-01-01,0001-01-01,1
|
|
0001-06-21,2017-11-27,1
|
|
0001-06-22,2017-11-27,1
|
|
0001-06-23,2017-11-27,1
|
|
0001-06-24,2017-11-27,1
|
|
0001-06-25,2017-11-27,1
|
|
0001-06-26,2017-11-27,1
|
|
0001-06-27,2017-11-27,1
|
|
0001-06-28,2017-11-27,1
|
|
0001-06-29,2017-11-27,1
|
|
0001-12-31,0001-01-01,1
|
|
0002-01-01,0001-01-01,1
|
|
1399-12-31,0001-01-01,1
|
|
2017-11-28,0001-01-01,1
|
|
2017-11-28,1399-06-27,1
|
|
2017-11-28,2017-11-27,1
|
|
2018-12-31,1399-06-27,1
|
|
9999-12-01,9999-12-31,1
|
|
9999-12-31,0001-01-01,1
|
|
9999-12-31,9999-12-31,1
|
|
NULL,0001-01-01,1
|
|
NULL,1399-06-27,1
|
|
---- TYPES
|
|
DATE, DATE, BIGINT
|
|
====
|
|
---- QUERY
|
|
select date_col, count(*) from date_tbl where date_part = '1399-06-27' group by date_col
|
|
---- RESULTS
|
|
NULL,1
|
|
2018-12-31,1
|
|
2017-11-28,1
|
|
---- TYPES
|
|
DATE, BIGINT
|
|
====
|