-
Notifications
You must be signed in to change notification settings - Fork 189
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
[Coral-Trino] Migrate FROM_UNIXTIME and FROM_UTC_TIMESTAMP #426
Conversation
4bcf9c2
to
5908d3b
Compare
7af502b
to
b198ad2
Compare
coral-trino/src/main/java/com/linkedin/coral/trino/rel2trino/CoralToTrinoSqlCallConverter.java
Show resolved
Hide resolved
...in/java/com/linkedin/coral/trino/rel2trino/transformers/FromUnixtimeOperatorTransformer.java
Show resolved
Hide resolved
...ava/com/linkedin/coral/trino/rel2trino/transformers/FromUtcTimestampOperatorTransformer.java
Show resolved
Hide resolved
|
||
@Override | ||
protected boolean condition(SqlCall sqlCall) { | ||
return sqlCall.getOperator().getName().equalsIgnoreCase(FROM_UNIXTIME); |
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.
@findinpath If we make this check not simply based on the name so we make sure it only matches the Hive operator and not the Trino one, would we still need TimestampFromUnixtimeTransformer
from #464? Also, can the operator in this case live only in coral-trino
?
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.
from_unixtime
takes for both Trino and Hive a numeric value, I don't know how to distinguish it
- Trino reference https://trino.io/docs/current/functions/datetime.html?highlight=from_unixtime#from_unixtime returning timestamp(3) with time zone#
- Hive reference https://cwiki.apache.org/confluence/display/hive/languagemanual+udf returning string type
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.
Discussed offline. We can use timestamp_from_unixtime
as a different name to disambiguate. @findinpath will try it.
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.
Thank you @wmoustafa for the hint and help in putting together the PR.
Before this PR,
FROM_UNIXTIME
andFROM_UTC_TIMESTAMP
operators were transformed to trino engine compatible operators in the RelShuttleCalcite2TrinoUDFConverter
.This PR migrates the transformation to SqlShuttles -
CoralToTrinoSqlCallConverter
andDataTypeDerivedSqlCallConverter
respectively.What changes are proposed in this pull request, and why are they necessary?
How was this patch tested?
./gradlew spotlessApply
./gradlew build
modified UTs
i-tested against production views