-
Notifications
You must be signed in to change notification settings - Fork 93
feat(isthmus): support month()-style datetime operators #643
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
feat(isthmus): support month()-style datetime operators #643
Conversation
c8844e9 to
0f67f0f
Compare
0f67f0f to
b963373
Compare
bestbeforetoday
left a comment
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.
Generally looks good to me with just a few minor tweaks desirable.
isthmus/src/main/java/io/substrait/isthmus/expression/ExtractDateFunctionMapper.java
Outdated
Show resolved
Hide resolved
isthmus/src/main/java/io/substrait/isthmus/expression/ExtractDateFunctionMapper.java
Outdated
Show resolved
Hide resolved
isthmus/src/main/java/io/substrait/isthmus/expression/ExtractDateFunctionMapper.java
Outdated
Show resolved
Hide resolved
isthmus/src/main/java/io/substrait/isthmus/expression/LiteralConverter.java
Outdated
Show resolved
Hide resolved
isthmus/src/main/java/io/substrait/isthmus/expression/ScalarFunctionConverter.java
Outdated
Show resolved
Hide resolved
isthmus/src/main/java/io/substrait/isthmus/expression/ScalarFunctionConverter.java
Outdated
Show resolved
Hide resolved
| _data | ||
| **/*/bin | ||
| build | ||
| substrait.plan |
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.
Why do we need to ignore these?
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.
It's created for the examples, and I was used them as a test and kept adding it to the commit.
isthmus/src/main/java/io/substrait/isthmus/expression/EnumConverter.java
Outdated
Show resolved
Hide resolved
isthmus/src/main/java/io/substrait/isthmus/expression/EnumConverter.java
Outdated
Show resolved
Hide resolved
MONTH() style functions for calcite224bff1 to
1bcd2f9
Compare
1bcd2f9 to
6a4d236
Compare
|
@vbarua @bestbeforetoday hopefully I've been able to address all your points. Thanks |
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 one issue I see is that a LOGGER was added to EnumArg and is now unused. Otherwise looks good to me.
| @Value.Immutable | ||
| public interface EnumArg extends FunctionArg { | ||
|
|
||
| Logger LOGGER = LoggerFactory.getLogger(EnumArg.class); |
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.
This is not used.
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.
This is such a minor issue I pushed an additional commit to fix this so the PR doesn't need to be held out until you change it.
The Substrait Function for Month style mappings doesn't work as the calcite only has 2 arguments, but substrait has three. Isthmus (in either direction) assumes that there is a 1:1 mapping betwen a substrait function and a calicte function. With the same number of arguments in each. (although types can be coerced if needeed) In this case, the 3 arg Substrait function needs to be mapped to a 2 arg calcite one. In effect this is working by swapping out the function to a different one and then letting the rest of the logic work as before. A concern is the increased complexity - and the code as a whole wasn't built with this in mind. Signed-off-by: MBWhite <whitemat@uk.ibm.com>
Signed-off-by: MBWhite <whitemat@uk.ibm.com>
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
6a4d236 to
99ab784
Compare
The Substrait Function for Month style mappings doesn't work as the calcite only has 2 arguments, but substrait has three.
Isthmus (in either direction) assumes that there is a 1:1 mapping between a substrait function and a calcite function. With the same number of arguments in each. (although types can be coerced if needed)
In this case, the 3 arg Substrait function needs to be mapped to a 2 arg calcite one. In effect this is working by swapping out the function to a different one and then letting the rest of the logic work as before.
A concern is the increased complexity - and the code as a whole wasn't built with this in mind.