refactor(isthmus): strptime function mapping#701
refactor(isthmus): strptime function mapping#701bestbeforetoday wants to merge 2 commits intosubstrait-io:mainfrom
Conversation
|
ACTION NEEDED Substrait follows the Conventional Commits The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification. |
6cf15e1 to
f7c8a94
Compare
I recall that in the past when I added unit tests that there was a preference to rely on Calcite's |
Avoid code duplication. Also test operator name and operands explicitly instead of relying on Calcite's toString implementation, which might change over time. Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
f7c8a94 to
4b76d05
Compare
Revert to comparison with the Calcite call's toString output instead of using APIs to explicitly access required values. Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
4b76d05 to
e68496d
Compare
|
I generally avoid using
I don't see anything in the Calcite Javadoc that confirms the toString format or that it is stable across releases. For now I have just reverted to using toString. It can be revisited later if it ever breaks. |
| * @param calciteOperator the Calcite operator to map from (e.g., SqlLibraryOperators.PARSE_DATE) | ||
| * @param functions the list of all available scalar function variants | ||
| */ | ||
| protected AbstractStrptimeFunctionMapper( |
There was a problem hiding this comment.
if you want to have even more reuse then PositionFunctionMapper also just swaps the position of the first two arguments of its function call
There was a problem hiding this comment.
This refactor consolidates a family of closely related date/time parsing functions that require the same argument mapping and differ only by the type they return. POSITION deals with string searching so, while it also requires the same argument mapping, the relationship is not obvious and could be confusing. I would prefer to keep this PR focused on removing duplication in the closely related date/time parsing functions.
Avoid code duplication. Also test operator name and operands explicitly instead of relying on Calcite's toString implementation, which might change over time.