Skip to content

Conversation

@nielspardon
Copy link
Member

@nielspardon nielspardon commented Jan 29, 2026

This adds Calcite mappings for the following 3 Substrait functions:

  • strptime_time -> PARSE_TIME
  • strptime_timestamp -> PARSE_TIMESTAMP
  • strptime_date -> PARSE_DATE

I added the ScalarFunctionConverter into the RexExpressionConverter instance in FunctionConversionTest in order to round-trip test Substrait <-> Calcite expression mappings which also made the subtractDateIDay test case work.

The Calcite functions are Big Query specific variants which happen to be defined closest to the Substrait variants of this functions vs. other alternatives TO_DATE and TO_TIMESTAMP.

Signed-off-by: Niels Pardon <par@zurich.ibm.com>
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.

There is quite a bit of duplication between the three Strptime function mapping and test implementations that might benefit from being factored out, perhaps into a StrptimeMapper superclass and using a parameterized test. It is fine as-is if you prefer to defer any refactoring to a future PR though.

Just a few unnecessary casts noted with inline comments that are worth removing to avoid redundant code.

Co-authored-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
@bestbeforetoday bestbeforetoday merged commit d93efe4 into substrait-io:main Jan 30, 2026
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.

2 participants