You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ar...@apache.org on 2019/04/08 10:40:55 UTC

[drill] 02/06: DRILL-7157: Wrap SchemaParsingException into UserException when creating schema

This is an automated email from the ASF dual-hosted git repository.

arina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git

commit 9ffd6d933cdd16e10a5818991dd80ab3c36cf88f
Author: Arina Ielchiieva <ar...@gmail.com>
AuthorDate: Mon Apr 8 10:32:11 2019 +0300

    DRILL-7157: Wrap SchemaParsingException into UserException when creating schema
    
    closes #1740
---
 .../org/apache/drill/exec/planner/sql/handlers/SchemaHandler.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/SchemaHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/SchemaHandler.java
index f1f7353..4e7c8ae 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/SchemaHandler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/SchemaHandler.java
@@ -35,6 +35,7 @@ import org.apache.drill.exec.record.metadata.schema.FsMetastoreSchemaProvider;
 import org.apache.drill.exec.record.metadata.schema.PathSchemaProvider;
 import org.apache.drill.exec.record.metadata.schema.SchemaContainer;
 import org.apache.drill.exec.record.metadata.schema.SchemaProvider;
+import org.apache.drill.exec.record.metadata.schema.parser.SchemaParsingException;
 import org.apache.drill.exec.store.AbstractSchema;
 import org.apache.drill.exec.store.StorageStrategy;
 import org.apache.drill.exec.store.dfs.WorkspaceSchemaFactory;
@@ -133,7 +134,11 @@ public abstract class SchemaHandler extends DefaultSqlHandler {
           ExecConstants.PERSISTENT_TABLE_UMASK).string_val, false);
         schemaProvider.store(schemaString, sqlCall.getProperties(), storageStrategy);
         return DirectPlan.createDirectPlan(context, true, String.format("Created schema for [%s]", schemaSource));
-
+      } catch (SchemaParsingException e) {
+        throw UserException.parseError(e)
+          .message(e.getMessage())
+          .addContext("Schema: " + schemaString)
+          .build(logger);
       } catch (IOException e) {
         throw UserException.resourceError(e)
           .message(e.getMessage())