j1wonpark commented on code in PR #7569:
URL: https://github.com/apache/kyuubi/pull/7569#discussion_r3585331264
##########
extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/ranger/RangerSparkExtensionSuite.scala:
##########
@@ -1387,6 +1387,56 @@ class HiveCatalogRangerSparkExtensionSuite extends
RangerSparkExtensionSuite {
}
}
+ test("[KYUUBI #7568][AUTHZ] Typeof expression is eliminated below the root
plan node") {
+ // RuleEliminateTypeOf must walk the whole plan, mirroring
RuleApplyTypeOfMarker which
+ // marks with transformAllExpressions. When only the root node is visited,
a TypeOfPlaceHolder
+ // living under Sort/Union/Aggregate survives into execution and fails with
+ // CLASS_NOT_OVERRIDE_EXPECTED_METHOD, since the placeholder implements no
eval.
+ val db1 = defaultDb
+ val table1 = "table1"
+ withSingleCallEnabled {
+ withCleanTmpResources(Seq((s"$db1.$table1", "table"))) {
+ doAs(
+ admin,
+ sql(
+ s"""
+ |CREATE TABLE IF NOT EXISTS $db1.$table1(
+ |id int,
+ |scope int,
+ |day string)
+ |""".stripMargin))
+ doAs(admin, sql(s"INSERT INTO $db1.$table1 SELECT 1, 2, 'TONY'"))
+
+ // root is Sort
+ checkAnswer(
+ admin,
+ s"SELECT typeof(id) AS t FROM $db1.$table1 ORDER BY t",
+ Seq(Row("int")))
+
+ // root is Union
+ checkAnswer(
+ admin,
+ s"""
+ |SELECT typeof(id) FROM $db1.$table1
+ |UNION ALL
+ |SELECT typeof(day) FROM $db1.$table1""".stripMargin,
+ Seq(Row("int"), Row("string")))
Review Comment:
Fixed in 38464f17f — sorted the collected rows on the Scala side to keep
Union as the root node.
--
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]