mihaibudiu commented on code in PR #3889:
URL: https://github.com/apache/calcite/pull/3889#discussion_r1695625902
##########
core/src/main/java/org/apache/calcite/sql/validate/implicit/AbstractTypeCoercion.java:
##########
@@ -258,7 +258,7 @@ protected boolean needToCast(SqlValidatorScope scope,
SqlNode node,
RelDataType fromType = validator.deriveType(scope, node);
// This depends on the fact that type validate happens before coercion.
// We do not have inferred type for some node, i.e. LOCALTIME.
- if (fromType == null) {
+ if (fromType == null || fromType.getSqlTypeName() == SqlTypeName.NULL) {
Review Comment:
I don't see why this is right, and I don't see why it's needed for this
optimization.
In general many tests will fail if you supply a NULL, but will pass if you
cast the NULL to the correct type. So I suspect this is actually needed.
--
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]