sandeep-katta commented on a change in pull request #24766: [SPARK-27917][SQL]
canonical form of CaseWhen object is incorrect
URL: https://github.com/apache/spark/pull/24766#discussion_r289685148
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ConditionalExpressionSuite.scala
##########
@@ -248,4 +248,18 @@ class ConditionalExpressionSuite extends SparkFunSuite
with ExpressionEvalHelper
.contains("CASE WHEN ... THEN struct<x:int> WHEN ... THEN struct<y:int>
" +
"ELSE struct<z:int> END"))
}
+
+ test("SPARK-27917 test semantic equals of CaseWhen") {
+ val attrRef = AttributeReference("ACCESS_CHECK", StringType)()
+ val aliasAttrRef = attrRef.withName("access_check")
+ // Test for Equality
+ val caseWhenObj1 = CaseWhen(Seq((attrRef, Literal("A"))))
+ var caseWhenObj2 = CaseWhen(Seq((aliasAttrRef, Literal("A"))))
+ assert(caseWhenObj1.semanticEquals(caseWhenObj2))
+ assert(caseWhenObj2.semanticEquals(caseWhenObj1))
+ // Test for inEquality
+ caseWhenObj2 = CaseWhen(Seq((attrRef, Literal("a"))))
+ assert(!caseWhenObj1.semanticEquals(caseWhenObj2))
+ assert(!caseWhenObj2.semanticEquals(caseWhenObj1))
Review comment:
thanks for noticing this out, I had missed this. Have updated the test and
source code accordingly
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]