tkalkirill commented on code in PR #13569:
URL: https://github.com/apache/ignite/pull/13569#discussion_r4093134620


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/TypeUtils.java:
##########
@@ -528,4 +570,11 @@ public static RexNode toRexLiteral(Object dfltVal, 
RelDataType type, DataContext
 
         return rexBuilder.makeLiteral(dfltVal, type, true);
     }
+
+    /** */
+    private static TimeZone timeZone(DataContext ctx) {
+        TimeZone tz = DataContext.Variable.TIME_ZONE.get(ctx);
+
+        return tz != null ? tz : TimeZone.getDefault();

Review 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`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to