MaxGekk opened a new pull request #30915:
URL: https://github.com/apache/spark/pull/30915


   ### What changes were proposed in this pull request?
   Remove `assert(ns.nonEmpty)` in `ResolveSessionCatalog` for:
   - `SHOW TABLES`
   - `SHOW TABLE EXTENDED`
   - `SHOW VIEWS`
   
   ### Why are the changes needed?
   Spark SQL shouldn't fail with internal assert failures even for invalid user 
inputs. For instance:
   ```sql
   spark-sql> show tables in spark_catalog;
   20/12/24 11:19:46 ERROR SparkSQLDriver: Failed in [show tables in 
spark_catalog]
   java.lang.AssertionError: assertion failed
        at scala.Predef$.assert(Predef.scala:208)
        at 
org.apache.spark.sql.catalyst.analysis.ResolveSessionCatalog$$anonfun$apply$1.applyOrElse(ResolveSessionCatalog.scala:366)
        at 
org.apache.spark.sql.catalyst.analysis.ResolveSessionCatalog$$anonfun$apply$1.applyOrElse(ResolveSessionCatalog.scala:49)
        at 
org.apache.spark.sql.catalyst.plans.logical.AnalysisHelper.$anonfun$resolveOperatorsUp$3(AnalysisHelper.scala:90)
        at 
org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:73)
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. After the changes, for the example above:
   ```sql
   spark-sql> show tables in spark_catalog;
   Error in query: multi-part identifier cannot be empty.
   ```
   
   ### How was this patch tested?
   Added new UT to `v1/ShowTablesSuite`.
   


----------------------------------------------------------------
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]

Reply via email to