Skip to content

Commit 594b202

Browse files
committed
Update PrivilegesBuilder.scala
1 parent 2f87c61 commit 594b202

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/PrivilegesBuilder.scala

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ object PrivilegesBuilder {
101101

102102
case p =>
103103
for (child <- p.children) {
104-
// If current plan's references don't have relation to it's input, have two case
105-
// 1. Such as `MapInPandas`, `ScriptTransformation`
106-
// 2. Project output only have constant value
104+
// If current plan's references don't have relation to it's input, have two cases
105+
// 1. `MapInPandas`, `ScriptTransformation`
106+
// 2. `Project` output only have constant value
107107
if (columnPrune(p.references.toSeq ++ p.output, p.inputSet).isEmpty) {
108108
buildQuery(
109109
child,
@@ -115,6 +115,13 @@ object PrivilegesBuilder {
115115
buildQuery(
116116
child,
117117
privilegeObjects,
118+
// Here we use `projectList ++ p.reference` do column prune since:
119+
// For `Project`, project's output is contained by plan's referenced
120+
// For `Aggregate`, aggregation's output also in it's reference.
121+
// For `Filter`, `Sort` etc... it rely on upper `Project` node,
122+
// so we wrap a `Project` before call `buildQuery()`.
123+
// So here we use upper node's projectionList and current's references
124+
// to do column pruning can get the correct column.
118125
columnPrune(projectionList ++ p.references.toSeq, p.inputSet).distinct,
119126
conditionList ++ p.references,
120127
spark)

0 commit comments

Comments
 (0)