IMPALA-7370: DATE: Read/Write to parquet.

This change is a follow-up to IMPALA-7368 and adds support for DATE
type to the parquet scanner/writer. CREATE TABLE LIKE PARQUET
statements associated with data files that contain dates are also
supported.

Parquet uses DATE logical type for dates. DATE logical type annotates
an INT32 that stores the number of days from the Unix epoch, 1 January
1970.

This representation introduces a parquet interoperability issue
between Impala and older versions of Hive:
- Before version 3.1, Hive used Julian calendar to represent dates
  up to 1582-10-05 and Gregorian calendar for dates starting with
  1582-10-15. Dates between 1582-10-05 and 1582-10-15 were lost.
- Impala uses proleptic Gregorian calendar, extending the Gregorian
  calendar backward to dates preceding its official introduction in
  1582-10-15.
This means that pre-1582-10-15 dates written to a parquet table by
Hive will be read back incorrectly by Impala and vice versa.

Note that Hive 3.1 switched to proleptic Gregorian calendar too, so
for Hive 3.1+ this is no longer an issue.

Change-Id: I67da03754531660bc8de3b6935580d46deae1814
Reviewed-on: http://gerrit.cloudera.org:8080/13189
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Attila Jeges
2019-04-23 16:02:25 +02:00
committed by Impala Public Jenkins
parent ae7aefe34c
commit 2bce974990
29 changed files with 465 additions and 148 deletions

View File

@@ -403,7 +403,11 @@ error_codes = (
("UNRESPONSIVE_BACKEND", 133,
"Query $0 cancelled due to unresponsive backend: $1 has not sent a report in $2ms "
"(max allowed lag is $3ms)")
"(max allowed lag is $3ms)"),
("PARQUET_DATE_OUT_OF_RANGE", 134,
"Parquet file '$0' column '$1' contains an out of range date. "
"The valid date range is 0000-01-01..9999-12-31."),
)
import sys