mihaibudiu commented on code in PR #4974:
URL: https://github.com/apache/calcite/pull/4974#discussion_r3322458319
##########
core/src/main/java/org/apache/calcite/plan/VisitorDataContext.java:
##########
@@ -150,9 +150,14 @@ public VisitorDataContext(@Nullable Object[] values) {
return Pair.of(index, rexLiteral.getValueAs(Integer.class));
case CHAR:
case VARCHAR:
- return Pair.of(index,
- new
DateString(requireNonNull(rexLiteral.getValueAs(String.class)))
- .getDaysSinceEpoch());
+ try {
+ return Pair.of(index,
+ new
DateString(requireNonNull(rexLiteral.getValueAs(String.class)))
+ .getDaysSinceEpoch());
+ } catch (IllegalArgumentException e) {
+ LOGGER.warn("Invalid date literal: {}",
rexLiteral.getValueAs(String.class), e);
Review Comment:
Is NULL the correct result in these cases?
Is there a spec for what is supposed to happen?
Maybe you can add some documentation to the function about when it returns
null.
Normally the program you are showing below in your test should use type
coercion to insert a CAST of the string literal to date, and thus this case
should probably be unreachable.
--
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]