AngersZhuuuu commented on code in PR #5693:
URL: https://github.com/apache/kyuubi/pull/5693#discussion_r1395447527
##########
extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/rule/Authorization.scala:
##########
@@ -41,6 +48,11 @@ abstract class Authorization(spark: SparkSession) extends
Rule[LogicalPlan] {
object Authorization {
val KYUUBI_AUTHZ_TAG = TreeNodeTag[Unit]("__KYUUBI_AUTHZ_TAG")
+ var EXPLAIN_COMMAND_EXECUTION_ID: InheritableThreadLocal[Option[String]] = {
Review Comment:
> when do we clean it?
For a simple query
```
EXPLAIN SELECT id FROM default.table1
```
Will pass four LogicalPlan to Authorization.
```
ExplainCommand 'Project ['id], SimpleMode
ExplainCommand 'Project ['id], SimpleMode
Project [id#11]
+- HiveTableRelation [`default`.`table1`,
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, Data Cols: [id#11,
scope#12], Partition Cols: []]
Project [id#11]
+- HiveTableRelation [`default`.`table1`,
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, Data Cols: [id#11,
scope#12], Partition Cols: []]
```
If we want to clean the `EXPLAIN_COMMAND_EXECUTION_ID `, need match
condition twice
`EXPLAIN_COMMAND_EXECUTION_ID.get().contains(executionId(spark))`
It's too weird and necessary. Since for one thread we only reserve one
object, the cost is small.
The execution id also won't be repeated for one live spark session
##########
extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/rule/Authorization.scala:
##########
@@ -41,6 +48,11 @@ abstract class Authorization(spark: SparkSession) extends
Rule[LogicalPlan] {
object Authorization {
val KYUUBI_AUTHZ_TAG = TreeNodeTag[Unit]("__KYUUBI_AUTHZ_TAG")
+ var EXPLAIN_COMMAND_EXECUTION_ID: InheritableThreadLocal[Option[String]] = {
Review Comment:
> when do we clean it?
For a simple query
```
EXPLAIN SELECT id FROM default.table1
```
Will pass four LogicalPlan to Authorization.
```
ExplainCommand 'Project ['id], SimpleMode
ExplainCommand 'Project ['id], SimpleMode
Project [id#11]
+- HiveTableRelation [`default`.`table1`,
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, Data Cols: [id#11,
scope#12], Partition Cols: []]
Project [id#11]
+- HiveTableRelation [`default`.`table1`,
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, Data Cols: [id#11,
scope#12], Partition Cols: []]
```
If we want to clean the `EXPLAIN_COMMAND_EXECUTION_ID `, need match
condition twice
`EXPLAIN_COMMAND_EXECUTION_ID.get().contains(executionId(spark))`
It's too weird and necessary. Since for one thread we only reserve one
object, the cost is small.
The execution id also won't be repeated for one live spark session
--
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]