mirror of
https://github.com/apache/impala.git
synced 2026-01-22 09:01:58 -05:00
Implements read path for the date type in ORC scanner. The internal representation of a date is an int32 meaning the number of days since Unix epoch using proleptic Gregorian calendar. Similarly to the Parquet implementation (IMPALA-7370) this representation introduces an interoperability issue between Impala and older versions of Hive (before 3.1). For more details see the commit message of the mentioned Parquet implementation. Change-Id: I672a2cdd2452a46b676e0e36942fd310f55c4956 Reviewed-on: http://gerrit.cloudera.org:8080/14982 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
111 lines
2.5 KiB
Plaintext
111 lines
2.5 KiB
Plaintext
====
|
|
---- QUERY
|
|
# Inserting into parquet table works.
|
|
insert into $DATABASE.parquet_date_tbl
|
|
values ('2011-05-06'), ('9999-12-31'), ('0001-01-01');
|
|
---- RESULTS
|
|
: 3
|
|
====
|
|
---- QUERY
|
|
# Querying parquet table written by Parquet-MR and Impala works.
|
|
select * from $DATABASE.parquet_date_tbl;
|
|
---- RESULTS
|
|
1970-02-12
|
|
1970-04-11
|
|
1972-09-27
|
|
2011-05-06
|
|
9999-12-31
|
|
0001-01-01
|
|
---- TYPES
|
|
DATE
|
|
====
|
|
---- QUERY
|
|
# Querying avro table is supported.
|
|
select * from $DATABASE.avro_date_tbl;
|
|
---- RESULTS
|
|
1970-01-01
|
|
1970-01-02
|
|
1224-05-19
|
|
8543-11-21
|
|
---- TYPES
|
|
DATE
|
|
====
|
|
---- QUERY
|
|
# Querying ORC table is supported.
|
|
select * from $DATABASE.orc_date_tbl;
|
|
---- TYPES
|
|
DATE
|
|
---- RESULTS
|
|
1970-06-12
|
|
2008-11-21
|
|
9999-12-31
|
|
NULL
|
|
====
|
|
---- QUERY
|
|
# Inserting text partitions to $DATABASE.date_tbl is OK.
|
|
insert into $DATABASE.date_tbl partition (date_part)
|
|
select date_col, date_part from functional.date_tbl;
|
|
---- RESULTS
|
|
date_part=0001-01-01/: 7
|
|
date_part=1399-06-27/: 3
|
|
date_part=2017-11-27/: 10
|
|
date_part=9999-12-31/: 2
|
|
====
|
|
---- QUERY
|
|
# Inserting into parquet partition is supported.
|
|
insert into $DATABASE.date_tbl partition(date_part='1899-12-31')
|
|
select date_col from functional_parquet.date_tbl where date_part = '1399-06-27';
|
|
---- RESULTS
|
|
date_part=1899-12-31/: 3
|
|
====
|
|
---- QUERY
|
|
# Adding ORC partition works even though Impala cannot write ORC format.
|
|
# Querying all the partitions also works.
|
|
alter table $DATABASE.date_tbl add partition (date_part='2099-12-31')
|
|
location '$NAMENODE/test-warehouse/$DATABASE.db/orc_date_tbl';
|
|
alter table $DATABASE.date_tbl partition (date_part='2099-12-31') set fileformat orc;
|
|
select date_part, date_col from $DATABASE.date_tbl;
|
|
---- RESULTS
|
|
0001-01-01,0001-01-01
|
|
0001-01-01,0001-12-31
|
|
0001-01-01,0002-01-01
|
|
0001-01-01,1399-12-31
|
|
0001-01-01,2017-11-28
|
|
0001-01-01,9999-12-31
|
|
0001-01-01,NULL
|
|
1399-06-27,2017-11-28
|
|
1399-06-27,NULL
|
|
1399-06-27,2018-12-31
|
|
2017-11-27,0001-06-21
|
|
2017-11-27,0001-06-22
|
|
2017-11-27,0001-06-23
|
|
2017-11-27,0001-06-24
|
|
2017-11-27,0001-06-25
|
|
2017-11-27,0001-06-26
|
|
2017-11-27,0001-06-27
|
|
2017-11-27,0001-06-28
|
|
2017-11-27,0001-06-29
|
|
2017-11-27,2017-11-28
|
|
9999-12-31,9999-12-01
|
|
9999-12-31,9999-12-31
|
|
1899-12-31,1970-02-12
|
|
1899-12-31,1970-04-11
|
|
1899-12-31,1972-09-27
|
|
1899-12-31,2011-05-06
|
|
1899-12-31,9999-12-31
|
|
1899-12-31,0001-01-01
|
|
1899-12-31,2017-11-28
|
|
1899-12-31,NULL
|
|
1899-12-31,2018-12-31
|
|
1999-12-31,1970-01-01
|
|
1999-12-31,1970-01-02
|
|
1999-12-31,1224-05-19
|
|
1999-12-31,8543-11-21
|
|
2099-12-31,1970-06-12
|
|
2099-12-31,2008-11-21
|
|
2099-12-31,9999-12-31
|
|
2099-12-31,NULL
|
|
---- TYPES
|
|
DATE,DATE
|
|
====
|