Skip to content

[Bug] Dupllicated AnalyzesTablesCommand in kyuubi authz #5269

@AngersZhuuuu

Description

@AngersZhuuuu

Code of Conduct

Search before asking

  • I have searched in the issues and found no similar issues.

Describe the bug

plan.getClass.getName match {
case classname if DB_COMMAND_SPECS.contains(classname) =>
val desc = DB_COMMAND_SPECS(classname)
desc.databaseDescs.foreach { databaseDesc =>
try {
val database = databaseDesc.extract(plan)
if (databaseDesc.isInput) {
inputObjs += PrivilegeObject(database)
} else {
outputObjs += PrivilegeObject(database)
}
} catch {
case e: Exception =>
LOG.debug(databaseDesc.error(plan, e))
}
}
desc.operationType
case classname if TABLE_COMMAND_SPECS.contains(classname) =>
val spec = TABLE_COMMAND_SPECS(classname)
spec.tableDescs.foreach { td =>
if (td.isInput) {
inputObjs ++= getTablePriv(td)
} else {
outputObjs ++= getTablePriv(td)
}
}
spec.queries(plan).foreach(buildQuery(_, inputObjs, spark = spark))
spec.operationType

As the code listed above, duplicated AnalyzeTablesCommand in authz seems to be an issue, it won't be processed more than one time.

lQLPJwxXbrAm0aDNATLNB76wsMmYIhDggCME7Tui64DSAA_1982_306

additionally, the extractor is incorrect.

"classname" : "org.apache.spark.sql.execution.command.AnalyzeTablesCommand",
"tableDescs" : [ {
"fieldName" : "tableIdent",
"fieldExtractor" : "TableIdentifierTableExtractor",
"columnDesc" : null,
"actionTypeDesc" : null,
"tableTypeDesc" : null,
"catalogDesc" : null,
"isInput" : true,
"setCurrentDatabaseIfMissing" : false

case class AnalyzeTablesCommand(
    databaseName: Option[String],
    noScan: Boolean) extends LeafRunnableCommand {
  ...
}

Affects Version(s)

master

Kyuubi Server Log Output

No response

Kyuubi Engine Log Output

No response

Kyuubi Server Configurations

No response

Kyuubi Engine Configurations

No response

Additional context

No response

Are you willing to submit PR?

  • Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
  • No. I cannot submit a PR at this time.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions