Skip to content

[KYUUBI #7852][AUTHZ] Parse procedure table arguments as quote-aware multipart identifiers - #7883

Open
arimu1 wants to merge 1 commit into
apache:masterfrom
arimu1:kyuubi-7852-procedure-table-identifier
Open

arimu1 wants to merge 1 commit into
apache:masterfrom
arimu1:kyuubi-7852-procedure-table-identifier

Conversation

@arimu1

@arimu1 arimu1 commented Nov 29, 2026

Copy link
Copy Markdown

Fixes #7852

Why are the changes needed?

ExpressionSeqTableExtractor (used by Spark Call and Paimon PaimonCallCommand plans) turned the first procedure argument into a table with Expression.toString() and a plain split("\\."). The procedures themselves parse that argument with the quote-aware parseMultipartIdentifier, so equivalent arguments authorized different resources:

  • table => 'local.db.tbl' is checked as db/tbl.
  • table => 'local.db.tbl' is checked as `db`/`tbl` (backticks kept in the names), so a user with ALTER on db/tbl is denied.
  • A quoted part containing a dot, such as `cat`.`my.db`.`my.tbl`, splits into five parts and throws MatchError.

This change parses the argument with spark.sessionState.sqlParser.parseMultipartIdentifier, as the procedures do. An argument that is not a parsable 1-3 part identifier falls back to the previous StringTableExtractor splitting, so previously handled inputs keep their behavior. The hunk in StringTableExtractor is left untouched.

Affected versions: 1.9.0 through master, as reported in #7852.

How was this patch tested?

Added ExpressionSeqTableExtractorSuite (unquoted, quoted vs unquoted equivalence, quoted dots and escaped backticks, non-parsable fallback).

build/mvn test -pl extensions/spark/kyuubi-spark-authz -am -Dtest=none \
  -DwildcardSuites=org.apache.kyuubi.plugin.spark.authz.serde.ExpressionSeqTableExtractorSuite

With the fix: Tests: succeeded 4, failed 0 (Temurin 21, Spark 3.5 / Scala 2.12 defaults). With the change in tableExtractors.scala reverted, the same suite gives succeeded 2, failed 2 (the quoted-equivalence test fails and the quoted-dots test fails with scala.MatchError: 5). Scala files pass spotless:check.

Was this patch assisted by generative AI tooling?

Assisted-by: Claude Sonnet 5.5 (Cursor)

…aware multipart identifiers

ExpressionSeqTableExtractor split the table argument of CALL procedures on '.', so a quoted argument such as `local`.`db`.`tbl` was checked as the Ranger resource `db` / `tbl` with backticks, and quoted dots produced more than three parts and a MatchError. Parse the argument with the session parser's parseMultipartIdentifier, as the procedures do, and keep the previous splitting for arguments that are not a parsable identifier.

Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Hello @arimu1,
Thanks for finding the time to submit the Pull request, the Kyuubi community thanks you!
We really appreciate the community's efforts to improve Apache Kyuubi.
If you are new to Apache Kyuubi for code changes, please take some time to read our contributing guide.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][AUTHZ] Procedure table identifiers are parsed differently from Spark execution

1 participant