-
- Downloads
[SPARK-17328][SQL] Fix NPE with EXPLAIN DESCRIBE TABLE
## What changes were proposed in this pull request? This PR fixes the following NPE scenario in two ways. **Reported Error Scenario** ```scala scala> sql("EXPLAIN DESCRIBE TABLE x").show(truncate = false) INFO SparkSqlParser: Parsing command: EXPLAIN DESCRIBE TABLE x java.lang.NullPointerException ``` - **DESCRIBE**: Extend `DESCRIBE` syntax to accept `TABLE`. - **EXPLAIN**: Prevent NPE in case of the parsing failure of target statement, e.g., `EXPLAIN DESCRIBE TABLES x`. ## How was this patch tested? Pass the Jenkins test with a new test case. Author: Dongjoon Hyun <dongjoon@apache.org> Closes #15357 from dongjoon-hyun/SPARK-17328.
Showing
- sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 1 addition, 1 deletion...in/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
- sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala 3 additions, 1 deletion...scala/org/apache/spark/sql/execution/SparkSqlParser.scala
- sql/core/src/test/resources/sql-tests/inputs/describe.sql 4 additions, 0 deletionssql/core/src/test/resources/sql-tests/inputs/describe.sql
- sql/core/src/test/resources/sql-tests/results/describe.sql.out 44 additions, 14 deletions...ore/src/test/resources/sql-tests/results/describe.sql.out
- sql/core/src/test/scala/org/apache/spark/sql/execution/SparkSqlParserSuite.scala 16 additions, 2 deletions.../org/apache/spark/sql/execution/SparkSqlParserSuite.scala
Please register or sign in to comment