You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2024/01/08 09:14:39 UTC

Re: [PR] [SPARK-46331][SQL] Removing CodegenFallback from subset of DateTime expressions and version() expression [spark]

cloud-fan commented on code in PR #44261:
URL: https://github.com/apache/spark/pull/44261#discussion_r1444322549


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/ComputeCurrentTimeSuite.scala:
##########
@@ -51,6 +53,19 @@ class ComputeCurrentTimeSuite extends PlanTest {
     assert(lits(0) == lits(1))
   }
 
+  test("analyzer should respect time flow in current timestamp calls") {
+    val inT1 = Project(Alias(CurrentTimestamp(), "t1")() :: Nil, LocalRelation())
+    val planT1 = Optimize.execute(inT1.analyze).asInstanceOf[Project]
+    val t1 = DateTimeUtils.microsToMillis(
+      literals[Long](planT1)(0))
+
+    val inT2 = Project(Alias(CurrentTimestamp(), "t1")() :: Nil, LocalRelation())

Review Comment:
   do we need `inT2` as it's exactly the same as `inT1`? Seems we can just do
   ```
   val planT2 = Optimize.execute(inT1.analyze).asInstanceOf[Project]
   ```



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org