IGNITE-29045 SQL Calcite: Support Java temporal types in UDF and UDTF parameters and results - #13569
tkalkirill wants to merge 9 commits into
Conversation
| private static TimeZone timeZone(DataContext ctx) { | ||
| TimeZone tz = DataContext.Variable.TIME_ZONE.get(ctx); | ||
|
|
||
| return tz != null ? tz : TimeZone.getDefault(); |
There was a problem hiding this comment.
Looks like DataContext.Variable.TIME_ZONE.get(ctx) is never can be null, why do we need this new check?
There was a problem hiding this comment.
Constant folding uses RexExecutorImpl(DataContexts.EMPTY), where TIME_ZONE is null. Without this fallback, temporal conversions throw an NPE and Calcite skips constant folding. I verified this with deterministic UDFs accepting and returning java.util.Date. The fallback uses the same JVM default as BaseDataContext.
| /** */ | ||
| private static long fromLocalTs(DataContext ctx, long ts) { | ||
| TimeZone tz = DataContext.Variable.TIME_ZONE.get(ctx); | ||
| if (ts < GREGORIAN_CUTOVER) { |
There was a problem hiding this comment.
This is more correct fix for https://issues.apache.org/jira/browse/IGNITE-23772 ticket. Maybe we should check tests from PR for this ticket and if all these tests pass, close IGNITE-23772 after your fix?
There was a problem hiding this comment.
This fix addresses the incorrect conversion of historical dates, and the tests from PR #11822 pass. However, literals such as DATE '1582-10-05' still fail during parsing. After this fix is merged, we should address those remaining cases under IGNITE-23772.
https://issues.apache.org/jira/browse/IGNITE-29045