Skip to content

Conversation

@mbwhite
Copy link
Contributor

@mbwhite mbwhite commented Dec 17, 2025

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.

@mbwhite mbwhite force-pushed the fix-month-datetime branch 3 times, most recently from c8844e9 to 0f67f0f Compare December 17, 2025 13:04
@mbwhite mbwhite marked this pull request as ready for review December 17, 2025 13:05
Copy link
Member

@bestbeforetoday bestbeforetoday left a 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.

_data
**/*/bin
build
substrait.plan
Copy link
Member

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?

Copy link
Contributor Author

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.

@vbarua vbarua changed the title Code to map MONTH() style functions for calcite feat(isthmus): support month()-style datetime operators Dec 18, 2025
@mbwhite
Copy link
Contributor Author

mbwhite commented Dec 19, 2025

@vbarua @bestbeforetoday hopefully I've been able to address all your points. Thanks

Copy link
Member

@bestbeforetoday bestbeforetoday left a 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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used.

Copy link
Member

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.

mbwhite and others added 3 commits December 19, 2025 18:08
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>
@bestbeforetoday bestbeforetoday merged commit 82141bb into substrait-io:main Dec 19, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants