Skip to content

Commit d0a9fb0

Browse files
author
Mariam-Almesfer
committed
Add validation test for CurrentTimestamp and Now
1 parent a3c973f commit d0a9fb0

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,4 +1521,27 @@ abstract class ScalarFunctionsValidateSuite extends FunctionsValidateSuite {
15211521
}
15221522
}
15231523
}
1524+
test("test_current_timestamp") {
1525+
val df = spark.sql("SELECT l_orderkey, current_timestamp() from lineitem limit 1")
1526+
val optimizedPlan = df.queryExecution.optimizedPlan.toString()
1527+
assert(
1528+
!optimizedPlan.contains("CurrentTimestamp"),
1529+
s"Expected CurrentTimestamp to be folded to a literal, but got: $optimizedPlan"
1530+
)
1531+
checkGlutenPlan[ProjectExecTransformer](df)
1532+
checkFallbackOperators(df, 0)
1533+
df.collect()
1534+
}
1535+
1536+
test("test_now") {
1537+
val df = spark.sql("SELECT l_orderkey, now() from lineitem limit 1")
1538+
val optimizedPlan = df.queryExecution.optimizedPlan.toString()
1539+
assert(
1540+
!optimizedPlan.contains("Now"),
1541+
s"Expected Now to be folded to a literal, but got: $optimizedPlan"
1542+
)
1543+
checkGlutenPlan[ProjectExecTransformer](df)
1544+
checkFallbackOperators(df, 0)
1545+
df.collect()
1546+
}
15241547
}

0 commit comments

Comments
 (0)