Skip to content

Commit 8394158

Browse files
Mariam-AlmesferMariamalmesfer
authored andcommitted
Add validation test for CurrentTimestamp
1 parent eb8133b commit 8394158

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,4 +1521,22 @@ abstract class ScalarFunctionsValidateSuite extends FunctionsValidateSuite {
15211521
}
15221522
}
15231523
}
1524+
1525+
test("current_timestamp") {
1526+
withSQLConf("spark.sql.optimizer.excludedRules" -> "") {
1527+
val df = spark.sql("SELECT current_timestamp()")
1528+
1529+
val optimizedPlan = df.queryExecution.optimizedPlan.toString()
1530+
assert(
1531+
optimizedPlan.contains("Project") && !optimizedPlan.contains("CurrentTimestamp"),
1532+
s"Expected CurrentTimestamp to be folded to a literal, but got: $optimizedPlan"
1533+
)
1534+
1535+
checkFallbackOperators(df, 1)
1536+
1537+
val result = df.collect()
1538+
assert(result.length == 1, "Expected exactly one row")
1539+
assert(result(0).getTimestamp(0) != null, "Expected a non-null timestamp")
1540+
}
1541+
}
15241542
}

0 commit comments

Comments
 (0)