[ 
https://issues.apache.org/jira/browse/DRILL-6523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16519574#comment-16519574
 ] 

ASF GitHub Bot commented on DRILL-6523:
---------------------------------------

vdiravka commented on a change in pull request #1332: DRILL-6523: Fix NPE for 
describe of partial schema
URL: https://github.com/apache/drill/pull/1332#discussion_r197203825
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DescribeSchemaHandler.java
 ##########
 @@ -68,33 +70,38 @@ public SerializableString getEscapeSequence(int i) {
 
 
   @Override
-  public PhysicalPlan getPlan(SqlNode sqlNode) {
-    SqlIdentifier schema = ((SqlDescribeSchema) sqlNode).getSchema();
-    SchemaPlus drillSchema = 
SchemaUtilites.findSchema(config.getConverter().getDefaultSchema(), 
schema.names);
-
-    if (drillSchema != null) {
-      StoragePlugin storagePlugin;
-      try {
-        storagePlugin = context.getStorage().getPlugin(schema.names.get(0));
-      } catch (ExecutionSetupException e) {
-        throw new DrillRuntimeException("Failure while retrieving storage 
plugin", e);
+  public PhysicalPlan getPlan(SqlNode sqlNode) throws ForemanSetupException {
+    SqlIdentifier schema = unwrap(sqlNode, 
SqlDescribeSchema.class).getSchema();
+    SchemaPlus schemaPlus = 
SchemaUtilites.findSchema(config.getConverter().getDefaultSchema(), 
schema.names);
+
+    if (schemaPlus == null) {
+      throw UserException.validationError()
+        .message(String.format("Invalid schema name [%s]", 
Joiner.on(".").join(schema.names)))
 
 Review comment:
   message involves `String.format`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Fix NPE for describe of partial schema
> --------------------------------------
>
>                 Key: DRILL-6523
>                 URL: https://issues.apache.org/jira/browse/DRILL-6523
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.13.0
>            Reporter: Arina Ielchiieva
>            Assignee: Arina Ielchiieva
>            Priority: Major
>             Fix For: 1.14.0
>
>
> To reproduce:
> {noformat}
> 0: jdbc:drill:drillbit=localhost> use dfs;
> +-------+----------------------------------+
> |  ok   |             summary              |
> +-------+----------------------------------+
> | true  | Default schema changed to [dfs]  |
> +-------+----------------------------------+
> 1 row selected (0.849 seconds)
> 0: jdbc:drill:drillbit=localhost> describe schema tmp;
> Error: SYSTEM ERROR: NullPointerException;
>   Caused By (java.lang.NullPointerException) null
>     
> org.apache.drill.exec.planner.sql.handlers.DescribeSchemaHandler.getPlan():84
>     org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan():145
>     org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan():83
>     org.apache.drill.exec.work.foreman.Foreman.runSQL():567
>     org.apache.drill.exec.work.foreman.Foreman.run():266
>     java.util.concurrent.ThreadPoolExecutor.runWorker():1149
>     java.util.concurrent.ThreadPoolExecutor$Worker.run():624
>     java.lang.Thread.run():748 (state=,code=0)
> {noformat}
> The root cause is that we try to retrieve storage config by workspace name 
> but by not actual schema name.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to