-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for variable precision timestamps in Hive connector (read path) #4953
Conversation
bda3d8d
to
3e1c765
Compare
|
||
private long shortTimestamp(Timestamp value, Type type) | ||
{ | ||
//noinspection unchecked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the annotation version
presto-plugin-toolkit/src/main/java/io/prestosql/plugin/base/type/DecodedTimestamp.java
Show resolved
Hide resolved
46ab785
to
a910574
Compare
presto-plugin-toolkit/src/main/java/io/prestosql/plugin/base/type/LongTimestampEncoder.java
Show resolved
Hide resolved
presto-plugin-toolkit/src/main/java/io/prestosql/plugin/base/type/LongTimestampEncoder.java
Show resolved
Hide resolved
...lugin-toolkit/src/main/java/io/prestosql/plugin/base/type/PrestoTimestampEncoderFactory.java
Outdated
Show resolved
Hide resolved
...o-product-tests/src/main/java/io/prestosql/tests/hive/TestAllDatatypesFromHiveConnector.java
Outdated
Show resolved
Hide resolved
...cher/src/main/resources/docker/presto-product-tests/common/hadoop/hadoop-presto-init-hdp3.sh
Outdated
Show resolved
Hide resolved
presto-orc/src/main/java/io/prestosql/orc/reader/TimestampColumnReader.java
Show resolved
Hide resolved
presto-parquet/src/main/java/io/prestosql/parquet/ParquetTimestampUtils.java
Outdated
Show resolved
Hide resolved
presto-plugin-toolkit/src/main/java/io/prestosql/plugin/base/type/DecodedTimestamp.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(still at skimming)
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveStorageFormats.java
Outdated
Show resolved
Hide resolved
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveStorageFormats.java
Outdated
Show resolved
Hide resolved
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveStorageFormats.java
Outdated
Show resolved
Hide resolved
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveStorageFormats.java
Outdated
Show resolved
Hide resolved
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveStorageFormats.java
Outdated
Show resolved
Hide resolved
presto-parquet/src/main/java/io/prestosql/parquet/ParquetTimestampUtils.java
Outdated
Show resolved
Hide resolved
...ugin-toolkit/src/main/java/io/prestosql/plugin/base/type/AbstractPrestoTimestampEncoder.java
Outdated
Show resolved
Hide resolved
presto-plugin-toolkit/src/main/java/io/prestosql/plugin/base/type/ShortTimestampEncoder.java
Outdated
Show resolved
Hide resolved
int nanosOfSecond = (int) round(decodedTimestamp.getNanosOfSecond(), 9 - type.getPrecision()); | ||
return micros + nanosOfSecond / NANOSECONDS_PER_MICROSECOND; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added some in the product test.
presto-plugin-toolkit/src/main/java/io/prestosql/plugin/base/type/PrestoTimestampEncoder.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks great!
presto-hive/src/main/java/io/prestosql/plugin/hive/GenericHiveRecordCursor.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/GenericHiveRecordCursor.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveConfig.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveSessionProperties.java
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadata.java
Outdated
Show resolved
Hide resolved
...lugin-toolkit/src/main/java/io/prestosql/plugin/base/type/PrestoTimestampEncoderFactory.java
Outdated
Show resolved
Hide resolved
...lugin-toolkit/src/main/java/io/prestosql/plugin/base/type/PrestoTimestampEncoderFactory.java
Outdated
Show resolved
Hide resolved
presto-rcfile/src/main/java/io/prestosql/rcfile/text/TimestampEncoding.java
Outdated
Show resolved
Hide resolved
presto-rcfile/src/main/java/io/prestosql/rcfile/text/TimestampEncoding.java
Outdated
Show resolved
Hide resolved
presto-rcfile/src/main/java/io/prestosql/rcfile/text/TimestampEncoding.java
Outdated
Show resolved
Hide resolved
@aalbu you have merge conflict so you need to rebase in order for CI to run next time please rebase and apply comments separately (eg fixups) for easier re-rev |
cdd8016
to
8357ae5
Compare
8357ae5
to
1f1df50
Compare
1f1df50
to
6d3e022
Compare
c3f5917
to
6a212d3
Compare
6a212d3
to
3c28e21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveTimestampPrecision.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveType.java
Outdated
Show resolved
Hide resolved
presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveFileFormats.java
Outdated
Show resolved
Hide resolved
presto-parquet/src/main/java/io/prestosql/parquet/ParquetTimestampUtils.java
Outdated
Show resolved
Hide resolved
presto-parquet/src/test/java/io/prestosql/parquet/TestTupleDomainParquetPredicate.java
Outdated
Show resolved
Hide resolved
@@ -254,20 +254,23 @@ else if (type instanceof DateType && columnStatistics.getDateStatistics() != nul | |||
return createDomain(type, hasNullValue, columnStatistics.getDateStatistics(), value -> (long) value); | |||
} | |||
else if ((type.equals(TIMESTAMP_MILLIS) || type.equals(TIMESTAMP_MICROS)) && columnStatistics.getTimestampStatistics() != null) { | |||
// ORC timestamp statistics are truncated to millisecond precision, regardless of the precision of the actual data column. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have a regression test covering this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestHiveStorageFormats
has a test that verifies the behavior is correct when doing predicate push-down.
presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadata.java
Outdated
Show resolved
Hide resolved
presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveIntegrationSmokeTest.java
Outdated
Show resolved
Hide resolved
presto-hive/src/test/java/io/prestosql/plugin/hive/TestHiveIntegrationSmokeTest.java
Outdated
Show resolved
Hide resolved
presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveStorageFormats.java
Outdated
Show resolved
Hide resolved
b745c68
to
6a24566
Compare
6a24566
to
413c1b8
Compare
Squashed and merged as 86fcd1f, thanks! |
Hive represents timestamps with nanosecond precision, but Presto currently maps them to
timestamp(3)
columns. This PR introduces the ability to specify the precision oftimestamp
columns in Presto. It can be done through a catalog or session property. This is not yet supported for write operations - they must use the default precision (3).relates to: #3977