MaxGekk commented on a change in pull request #30963:
URL: https://github.com/apache/spark/pull/30963#discussion_r549835323
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
##########
@@ -710,4 +678,29 @@ class ResolveSessionCatalog(
case _ => false
}
}
+
+ private class DatabaseInSessionCatalog(namespace: Seq[String]) {
+ def name: String = {
+ val len = namespace.length
+ if (len == 0) {
+ throw new AnalysisException("Database from v1 session catalog is not
specified")
+ } else if (len > 1) {
+ val quotedNames = namespace.map(quoteIfNeeded).mkString(".")
+ throw new AnalysisException(
+ s"Nested databases are not supported by v1 session catalog:
$quotedNames")
+ } else {
+ namespace(0)
+ }
+ }
+ }
+
+ private object DatabaseInSessionCatalog {
+ def unapply(resolved: ResolvedNamespace): Option[DatabaseInSessionCatalog]
= {
+ if (isSessionCatalog(resolved.catalog)) {
+ Some(new DatabaseInSessionCatalog(resolved.namespace))
Review comment:
Agree, it should look simpler. Let me try it.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]