Skip to content
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

fix(isthmus): use explicit return type for scalar function expressions #355

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nielspardon
Copy link
Contributor

When converting a Substrait plan back to Apache Calcite which contains a datetime subtract such as the one generated by SQL-to-Substrait code for TPC-H query no. 1 the mapping fails with a java.lang.ArrayIndexOutOfBoundsException because the Substrait-to-Calcite mapping code relies on Calcite's type inference for determining the return type of the subtract function call.

Since the Substrait plan contains an explicitly return type in this case for this function call we can simply provide the return type explicitly to Calcite and avoid using the return type inference.

This PRs provides the function return type from the Substrait plan to Calcite and adds a test case for verifying that the expression conversion no longer throws an Exception and sets the function return type correctly in Calcite.

@nielspardon nielspardon force-pushed the par-subtract-return-type branch 2 times, most recently from e1ce145 to 9497a5a Compare March 27, 2025 16:52
@nielspardon nielspardon force-pushed the par-subtract-return-type branch from 9497a5a to 9baddc2 Compare March 28, 2025 07:55
@nielspardon nielspardon changed the title fix(isthmus): use explicit return type for datetime subtract fix(isthmus): use explicit return type for scalar function expressions Mar 28, 2025
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.

1 participant