Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1507,4 +1507,27 @@ abstract class ScalarFunctionsValidateSuite extends FunctionsValidateSuite {
}
}
}
test("test_current_timestamp") {
val df = spark.sql("SELECT l_orderkey, current_timestamp() from lineitem limit 1")
val optimizedPlan = df.queryExecution.optimizedPlan.toString()
assert(
!optimizedPlan.contains("CurrentTimestamp"),
s"Expected CurrentTimestamp to be folded to a literal, but got: $optimizedPlan"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excluding the org.apache.spark.sql.catalyst.optimizer.ConstantFolding rule via configuring spark.sql.optimizer.excludedRules might could help verify whether this function can be offloaded to native computing.

)
checkGlutenPlan[ProjectExecTransformer](df)
checkFallbackOperators(df, 0)
df.collect()
}

test("test_now") {
val df = spark.sql("SELECT l_orderkey, now() from lineitem limit 1")
val optimizedPlan = df.queryExecution.optimizedPlan.toString()
assert(
!optimizedPlan.contains("Now"),
s"Expected Now to be folded to a literal, but got: $optimizedPlan"
)
checkGlutenPlan[ProjectExecTransformer](df)
checkFallbackOperators(df, 0)
df.collect()
}
}
Loading