cloud-fan commented on code in PR #37439:
URL: https://github.com/apache/spark/pull/37439#discussion_r952932976
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/UnwrapCastInBinaryComparison.scala:
##########
@@ -156,29 +157,36 @@ object UnwrapCastInBinaryComparison extends
Rule[LogicalPlan] {
case lit @ Literal(null, _) => nullList += lit
case lit @ NonNullLiteral(_, _) =>
unwrapCast(EqualTo(in.value, lit)) match {
- case EqualTo(_, unwrapLit: Literal) => canCastList += unwrapLit
- case e @ And(IsNull(_), Literal(null, BooleanType)) =>
cannotCastList += e
+ // the function `unwrapCast` returns None means the literal can
not cast to fromType,
+ // for instance: (the boundreference is of type DECIMAL(5,2))
+ // CAST(boundreference() AS DECIMAL(10,4)) = 123456.1234BD
+ // Due to `cast(lit, fromExp.dataType) == null` we simply return
+ // `falseIfNotNull(fromExp)`.
+ case None | Some(And(IsNull(_), Literal(null, BooleanType))) =>
Review Comment:
what's wrong with `And(IsNull(_), Literal(null, BooleanType))`?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]