olivrlee commented on code in PR #3093:
URL: https://github.com/apache/calcite/pull/3093#discussion_r1133012102


##########
linq4j/src/main/java/org/apache/calcite/linq4j/tree/Expressions.java:
##########
@@ -1198,6 +1200,26 @@ public static <T, F extends Function<? extends T>> 
FunctionExpression<F> lambda(
     return lambda(type, Blocks.toFunctionBlock(body), toList(parameters));
   }
 
+  public static Expression safeExpression(Expression body){

Review Comment:
   Using this block I can get it to generate an Expression with the try/catch
   ```
   public Object[] apply(Object root0) {
     return new Object[] {
         (Integer) new org.apache.calcite.linq4j.function.Function0() {
           public Object apply() {
             try {
               return 
org.apache.calcite.avatica.util.DateTimeUtils.timeStringToUnixDate("12:12:11");
             } catch (Exception e) {
               return null;
             }
           }
         }
       };
   }
   ```
   
   However, in RexExecutable compile line 55 it doesn't like the cast to 
integer / block : `org.codehaus.commons.compiler.CompileException: Line 3, 
Column 15: Cannot cast "Reducer$1" to "java.lang.Integer"` 
   
   Any suggestions here?



-- 
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