julianhyde commented on code in PR #3677:
URL: https://github.com/apache/calcite/pull/3677#discussion_r1483662654
##########
core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java:
##########
@@ -684,7 +686,13 @@ protected RexNode convertCast(
final boolean safe = kind == SqlKind.SAFE_CAST;
final SqlNode left = call.operand(0);
final SqlNode right = call.operand(1);
+ final SqlNode format = call.getOperandList().size() > 2 ?
+ call.operand(2) : null;
+
final RexBuilder rexBuilder = cx.getRexBuilder();
+ final RexNode arg = cx.convertExpression(left);
+ final RexNode formatArg = isNull(format) ? null :
cx.convertExpression(format);
Review Comment:
Why use the `isNull` method, here and elsewhere? `isNull` detects the `NULL`
literal, but I don't think that `CAST(d AS DATE FORMAT NULL)` is even allowed
(correct me if I'm wrong).
The only null is a java null, where you pass a RexLiteral whose value is
null if there was no `FORMAT` clause.
I am wondering whether you intend to support an expression for the format
clause, e.g. `CAST(d AS DATE FORMAT 'yyyy-' || 'mm')` but as there are no tests
I can't answer that question.
--
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]