Files
impala/testdata/workloads/functional-query/queries/QueryTest/date-fileformat-support.test
Attila Jeges 684a54a89e IMPALA-7368: Change supported year range for DATE values to 1..9999
Before this patch the supported year range for DATE type started with
year 0. This contradicts the ANSI SQL standard that defines the valid
DATE value range to be 0001-01-01 to 9999-12-31.

Change-Id: Iefdf1c036834763f52d44d0c39a25a1f04e41e07
Reviewed-on: http://gerrit.cloudera.org:8080/14349
Reviewed-by: Attila Jeges <attilaj@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2019-10-04 18:36:22 +00:00

116 lines
3.0 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 not supported.
select * from $DATABASE.orc_date_tbl;
---- CATCH
NotImplementedException: Scanning DATE values in table '$DATABASE.orc_date_tbl' is not supported for fileformat ORC
====
---- 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 scan/write DATE values in orc.
# Querying all the partitions fails because of the one orc partition.
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 * from $DATABASE.date_tbl;
---- CATCH
NotImplementedException: Scanning DATE values in table '$DATABASE.date_tbl' is not supported for fileformat ORC
====
---- QUERY
# Querying text, parquet and avro partitions is OK.
select date_part, date_col
from $DATABASE.date_tbl
where date_part != '2099-12-31';
---- 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
---- TYPES
DATE,DATE
====
---- QUERY
# Querying the orc partition separately fails.
select date_part, date_col from $DATABASE.date_tbl where date_part='2099-12-31';
---- CATCH
NotImplementedException: Scanning DATE values in table '$DATABASE.date_tbl' is not supported for fileformat ORC
====