Skip to content

Commit

Permalink
fix InsertIntoHiveDirCommand classname
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Apr 4, 2023
1 parent 0c6ba94 commit 5c652d3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@
"fieldExtractor" : "LogicalPlanQueryExtractor"
} ]
}, {
"classname" : "org.apache.spark.sql.execution.datasources.InsertIntoHiveDirCommand",
"classname" : "org.apache.spark.sql.hive.execution.InsertIntoHiveDirCommand",
"tableDescs" : [ ],
"opType" : "QUERY",
"queryDescs" : [ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ object TableCommands {
"org.apache.spark.sql.execution.datasources.SaveIntoDataSourceCommand"),
InsertIntoHadoopFsRelationCommand,
InsertIntoDataSourceDir.copy(classname =
"org.apache.spark.sql.execution.datasources.InsertIntoHiveDirCommand"),
"org.apache.spark.sql.hive.execution.InsertIntoHiveDirCommand"),
InsertIntoHiveTable,
LoadData,
MergeIntoTable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,4 +707,21 @@ class HiveCatalogRangerSparkExtensionSuite extends RangerSparkExtensionSuite {
sql(s"SHOW TABLES IN $db").queryExecution.optimizedPlan.stats
}
}

test("[KYUUBI #4658] INSERT OVERWRITE DIRECTORY did check query permission") {
val db1 = "default"
val table = "src"

withCleanTmpResources(Seq((s"$db1.$table", "table"))) {
doAs("bob", sql(s"CREATE TABLE IF NOT EXISTS $db1.$table (id int, name string)"))
val e1 = intercept[AccessControlException](
doAs("someone",
sql(
s"""INSERT OVERWRITE DIRECTORY '/tmp/test_dir' ROW FORMAT DELIMITED FIELDS
| TERMINATED BY ','
| SELECT * FROM $db1.$table;""".stripMargin))
)
assert(e1.getMessage.contains(s"does not have [select] privilege on [$db1/$table/id"))
}
}
}

0 comments on commit 5c652d3

Please sign in to comment.