You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2026/07/22 12:25:35 UTC
Re: [PR] [SPARK-58226][SQL] Honor persistentCatalogFirst for DDL on two-part name resolution [spark]
cloud-fan commented on code in PR #57381:
URL: https://github.com/apache/spark/pull/57381#discussion_r3630155855
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -1317,6 +1319,19 @@ class Analyzer(
case _ => None
}
}
+ // Two-part `session.<name>`: the name can denote either a local temp view `name` or a
+ // persistent relation `name` in schema `session`. Order follows
+ // `SQLConf.prioritizeSystemCatalog` (the inverse of `PERSISTENT_CATALOG_FIRST`), matching
+ // the SELECT/DML path in `RelationResolution.resolveRelation`. Without this, DDL and misc
+ // commands (e.g. DESCRIBE TABLE, ALTER TABLE) would always resolve the temp view first and
+ // ignore `PERSISTENT_CATALOG_FIRST`, diverging from how the same name resolves in a query.
+ if (identifier.length == 2 &&
+ identifier.head.equalsIgnoreCase(CatalogManager.SESSION_NAMESPACE) &&
+ !conf.prioritizeSystemCatalog) {
+ persistentCandidate.orElse(tempViewCandidate)
+ } else {
+ tempViewCandidate.orElse(persistentCandidate)
Review Comment:
Please keep `system.session.<name>` temp-only before taking this fallback. Three-part names also reach this `else`, so a missing temp view evaluates `persistentCandidate`, unlike SELECT/DML's early return from `resolveTempView`. The new test always creates the temp view and cannot catch that miss path; please add a no-temp case as well.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org