Skip to content

refactor(isthmus): drop the unused TIME_WITH_LOCAL_TIME_ZONE precision override - #1150

Open
alexandrefimov wants to merge 1 commit into
substrait-io:mainfrom
alexandrefimov:issue-1149-time-tz-precision
Open

refactor(isthmus): drop the unused TIME_WITH_LOCAL_TIME_ZONE precision override#1150
alexandrefimov wants to merge 1 commit into
substrait-io:mainfrom
alexandrefimov:issue-1149-time-tz-precision

Conversation

@alexandrefimov

Copy link
Copy Markdown
Contributor

getMaxPrecision raised the maximum precision to 6 for TIME_WITH_LOCAL_TIME_ZONE alongside the types Isthmus actually converts. Substrait has precision_timestamp_tz but no time-with-timezone counterpart, so the type appears in neither direction of TypeConverter, and the case was the only mention of the name in the repository. It has been there since the initial commit rather than added to keep a validation path working.

Removing it changes nothing observable. Calcite's type factory clamps a precision above the maximum instead of rejecting it, so the entry was not letting a bad precision get further than it otherwise would: with it CAST(NULL AS TIME(4) WITH LOCAL TIME ZONE) reaches the converter as TIME_WITH_LOCAL_TIME_ZONE(4), without it as TIME_WITH_LOCAL_TIME_ZONE(3), and both fail with the same UnsupportedOperationException. Precisions 0 through 6 failed at conversion before and still do.

The test pins the premise as well as the entry: if the type ever does convert, the assertion that toSubstrait rejects it fails and points at the maximum that would then need setting.

Closes #1149.

…n override

getMaxPrecision raised the maximum precision to 6 for
TIME_WITH_LOCAL_TIME_ZONE alongside the types Isthmus actually converts.
Substrait has precision_timestamp_tz but no time-with-timezone
counterpart, so the type appears in neither direction of TypeConverter,
and the case was the only mention of the name in the repository. It has
been there since the initial commit rather than added to keep a
validation path working.

Removing it changes nothing observable. Calcite's type factory clamps a
precision above the maximum instead of rejecting it, so the entry was not
letting a bad precision get further than it otherwise would: with it
CAST(NULL AS TIME(4) WITH LOCAL TIME ZONE) reaches the converter as
TIME_WITH_LOCAL_TIME_ZONE(4), without it as TIME_WITH_LOCAL_TIME_ZONE(3),
and both fail with the same UnsupportedOperationException. Precisions 0
through 6 failed at conversion before and still do.

The test pins the premise as well as the entry: if the type ever does
convert, the assertion that toSubstrait rejects it fails and points at
the maximum that would then need setting.
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.

SubstraitTypeSystem sets a max precision for TIME_WITH_LOCAL_TIME_ZONE, which nothing converts

1 participant