Peng-Lei commented on pull request #33339:
URL: https://github.com/apache/spark/pull/33339#issuecomment-908831779
> > it will throw the exception.
>
> which exception does it throw? and what's the stacktrace?
The testcase:
```scala
withNamespace("testcat.testcat") {
sql("CREATE NAMESPACE IF NOT EXISTS testcat.testcat COMMENT " +
"'test namespace' LOCATION '/tmp/ns_test'")
sql("use testcat")
val descriptionDf = sql("DESCRIBE NAMESPACE testcat")
...
}
```
The stacktrace:
```scala
next on empty iterator
java.util.NoSuchElementException: next on empty iterator
at scala.collection.Iterator$$anon$2.next(Iterator.scala:41)
at scala.collection.Iterator$$anon$2.next(Iterator.scala:39)
at scala.collection.IterableLike.head(IterableLike.scala:109)
at scala.collection.IterableLike.head$(IterableLike.scala:108)
at
scala.collection.mutable.ArrayOps$ofRef.scala$collection$IndexedSeqOptimized$$super$head(ArrayOps.scala:198)
at
scala.collection.IndexedSeqOptimized.head(IndexedSeqOptimized.scala:129)
at
scala.collection.IndexedSeqOptimized.head$(IndexedSeqOptimized.scala:129)
at scala.collection.mutable.ArrayOps$ofRef.head(ArrayOps.scala:198)
at scala.collection.TraversableLike.last(TraversableLike.scala:627)
at scala.collection.TraversableLike.last$(TraversableLike.scala:626)
at
scala.collection.mutable.ArrayOps$ofRef.scala$collection$IndexedSeqOptimized$$super$last(ArrayOps.scala:198)
at
scala.collection.IndexedSeqOptimized.last(IndexedSeqOptimized.scala:135)
at
scala.collection.IndexedSeqOptimized.last$(IndexedSeqOptimized.scala:135)
at scala.collection.mutable.ArrayOps$ofRef.last(ArrayOps.scala:198)
at
org.apache.spark.sql.execution.datasources.v2.DescribeNamespaceExec.run(DescribeNamespaceExec.scala:40)
at
org.apache.spark.sql.execution.datasources.v2.V2CommandExec.result$lzycompute(V2CommandExec.scala:43)
at
org.apache.spark.sql.execution.datasources.v2.V2CommandExec.result(V2CommandExec.scala:43)
at
org.apache.spark.sql.execution.datasources.v2.V2CommandExec.executeCollect(V2CommandExec.scala:49)
at
org.apache.spark.sql.execution.QueryExecution$$anonfun$eagerlyExecuteCommands$1.$anonfun$applyOrElse$1(QueryExecution.scala:110)
at
org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$5(SQLExecution.scala:103)
at
org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:163)
at
org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:90)
at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:775)
...
```
The `testcat` is a catalog of
`org.apache.spark.sql.connector.catalog.InMemoryCatalog` in test package.
main cause:
when resolve Namespace the Object of `CatalogAndNamespace`
```scala
try {
Some((catalogManager.catalog(nameParts.head), nameParts.tail)) //
nameParts.head == "catalog" , nameParts.tail == null
} catch {
case _: CatalogNotFoundException =>
Some((currentCatalog, nameParts))
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]