-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Treat precision as NANOSECONDS for timestamp to be coerced #18003
Treat precision as NANOSECONDS for timestamp to be coerced #18003
Conversation
0c657ad
to
b941d64
Compare
@@ -48,29 +48,6 @@ public final class TimestampCoercer | |||
|
|||
private TimestampCoercer() {} | |||
|
|||
public static class ShortTimestampToVarcharCoercer |
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 am a little bit missed, why it's safe to remove it here?
It's because of this change in HivePageSource:
if (fromType instanceof TimestampType timestampType && toType instanceof VarcharType varcharType) {
// --deleted-- if (timestampType.isShort()) {
// --deleted-- return Optional.of(new ShortTimestampToVarcharCoercer(timestampType, varcharType));
// }
return Optional.of(new LongTimestampToVarcharCoercer(timestampType, varcharType));
}
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.
Previously we were respecting the timestamp precision - so we need a coercer which would could have timestamp read as long
or it could be as LongTimestamp
- but this change would ensure that we would be reading the timestamp column as a NANOSECOND - so we don't need ShortTimestampToVarcharCoercer
b941d64
to
e520eb3
Compare
plugin/trino-hive/src/main/java/io/trino/plugin/hive/coercions/CoercionUtils.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/coercions/CoercionUtils.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/coercions/CoercionUtils.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/coercions/CoercionUtils.java
Outdated
Show resolved
Hide resolved
e520eb3
to
c34eeea
Compare
@krvikash Thanks for the review. Addressed the comments |
eb18007
to
6be4816
Compare
6be4816
to
a2cf304
Compare
squashed to make reviewable |
skimmed. looks directionally correct |
656b77a
to
d3bd7e2
Compare
@@ -366,7 +365,7 @@ else if (column.getBaseHiveColumnIndex() < fileColumns.size()) { | |||
Type readType = column.getType(); | |||
if (orcColumn != null) { | |||
int sourceIndex = fileReadColumns.size(); | |||
Optional<TypeCoercer<?, ?>> coercer = createCoercer(orcColumn.getColumnType(), readType, getTimestampPrecision(session)); |
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.
Just a question: We are no longer relay on a session?
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.
Previously we rely on the session to determine the timestamp precision so that we could read the timestamp column with that precision and now we would read them as NANOSECOND
irrespective of the precision configured.
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.
LGTM
plugin/trino-hive/src/main/java/io/trino/plugin/hive/coercions/CoercionUtils.java
Outdated
Show resolved
Hide resolved
plugin/trino-hive/src/main/java/io/trino/plugin/hive/coercions/CoercionUtils.java
Outdated
Show resolved
Hide resolved
This will be irrespective of the precision configured or specified as session property.
d3bd7e2
to
e864bce
Compare
@krvikash AC |
Description
This will be irrespective of the precision configured or specified as
session property.
Additional context and related issues
Depends on #17900.
Release notes
( ) This is not user-visible or docs only and no release notes are required.
(x) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: