wankunde commented on code in PR #44366:
URL: https://github.com/apache/spark/pull/44366#discussion_r1427783240


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/UnwrapCastInBinaryComparisonSuite.scala:
##########
@@ -406,30 +407,62 @@ class UnwrapCastInBinaryComparisonSuite extends PlanTest 
with ExpressionEvalHelp
   }
 
   test("SPARK-46069: Support unwrap timestamp type to date type") {
-    val tsLit = Literal.create(ts1, TimestampType)
-    val tsNTZLit = Literal.create(ts1, TimestampNTZType)
-    val floorDate = Cast(tsLit, DateType, Some(conf.sessionLocalTimeZone))
-    val floorDateNTZ = Cast(tsNTZLit, DateType, 
Some(conf.sessionLocalTimeZone))
-    val dateAddOne = DateAdd(floorDate, Literal(1, IntegerType))
-    val dateAddOneNTZ = DateAdd(floorDateNTZ, Literal(1, IntegerType))
-    assertEquivalent(
-      castTimestamp(f7) > tsLit || castTimestampNTZ(f7) > tsNTZLit,
-      f7 > floorDate || f7 > floorDateNTZ)
-    assertEquivalent(
-      castTimestamp(f7) >= tsLit || castTimestampNTZ(f7) >= tsNTZLit,
-      f7 >= dateAddOne || f7 >= dateAddOneNTZ)
-    assertEquivalent(
-      castTimestamp(f7) === tsLit || castTimestampNTZ(f7) === tsNTZLit,
-      f7 === floorDate && f7 === dateAddOne || f7 === floorDateNTZ && f7 === 
dateAddOneNTZ)
-    assertEquivalent(
-      castTimestamp(f7) <=> tsLit || castTimestampNTZ(f7) <=> tsNTZLit,
-      FalseLiteral || FalseLiteral)
-    assertEquivalent(
-      castTimestamp(f7) < tsLit || castTimestampNTZ(f7) < tsNTZLit,
-      f7 < dateAddOne || f7 < dateAddOneNTZ)
-    assertEquivalent(
-      castTimestamp(f7) <= tsLit || castTimestampNTZ(f7) <= tsNTZLit,
-      f7 <= floorDate || f7 <= floorDateNTZ)
+    def doTest(tsLit: Literal, tsNTZLit: Literal): Unit = {
+      val floorDate = Cast(tsLit, DateType, Some(conf.sessionLocalTimeZone))
+      val floorDateNTZ = Cast(tsNTZLit, DateType, 
Some(conf.sessionLocalTimeZone))
+      val dateAddOne = DateAdd(floorDate, Literal(1, IntegerType))
+      val dateAddOneNTZ = DateAdd(floorDateNTZ, Literal(1, IntegerType))
+      val isStartOfDay =

Review Comment:
   Done



-- 
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]

Reply via email to