drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudhe...@apache.org
Subject [4/4] drill git commit: DRILL-4544: Improve error messages for REFRESH TABLE METADATA command 1. Added error message when storage plugin or workspace does not exist 2. Updated error message when refresh metadata is not supported 3. Unit tests
Date Thu, 07 Apr 2016 01:07:16 GMT
DRILL-4544: Improve error messages for REFRESH TABLE METADATA command
1. Added error message when storage plugin or workspace does not exist
2. Updated error message when refresh metadata is not supported
3. Unit tests

closes #448


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/a7595525
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/a7595525
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/a7595525

Branch: refs/heads/master
Commit: a7595525419935e40cef75251b43b946e0cf79ec
Parents: 68269af
Author: Arina Ielchiieva <arina.yelchiyeva@gmail.com>
Authored: Mon Mar 28 10:55:56 2016 +0000
Committer: Sudheesh Katkam <skatkam@maprtech.com>
Committed: Wed Apr 6 16:57:40 2016 -0700

----------------------------------------------------------------------
 .../sql/handlers/RefreshMetadataHandler.java    |  8 +++++-
 .../store/parquet/TestParquetMetadataCache.java | 28 ++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/a7595525/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/RefreshMetadataHandler.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/RefreshMetadataHandler.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/RefreshMetadataHandler.java
index 059f7d0..7be46f0 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/RefreshMetadataHandler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/RefreshMetadataHandler.java
@@ -30,6 +30,7 @@ import org.apache.drill.common.logical.FormatPluginConfig;
 import org.apache.drill.exec.physical.PhysicalPlan;
 import org.apache.drill.exec.planner.logical.DrillTable;
 import org.apache.drill.exec.planner.sql.DirectPlan;
+import org.apache.drill.exec.planner.sql.SchemaUtilites;
 import org.apache.drill.exec.planner.sql.parser.SqlRefreshMetadata;
 import org.apache.drill.exec.store.dfs.DrillFileSystem;
 import org.apache.drill.exec.store.dfs.FileSystemPlugin;
@@ -52,7 +53,7 @@ public class RefreshMetadataHandler extends DefaultSqlHandler {
   }
 
   private PhysicalPlan notSupported(String tbl){
-    return direct(false, "Table %s does not support metadata refresh.  Support is currently
limited to single-directory-based Parquet tables.", tbl);
+    return direct(false, "Table %s does not support metadata refresh. Support is currently
limited to directory-based Parquet tables.", tbl);
   }
 
   @Override
@@ -64,6 +65,11 @@ public class RefreshMetadataHandler extends DefaultSqlHandler {
       final SchemaPlus schema = findSchema(config.getConverter().getDefaultSchema(),
           refreshTable.getSchemaPath());
 
+      if (schema == null) {
+        return direct(false, "Storage plugin or workspace does not exist [%s]",
+            SchemaUtilites.SCHEMA_PATH_JOINER.join(refreshTable.getSchemaPath()));
+      }
+
       final String tableName = refreshTable.getName();
 
       if (tableName.contains("*") || tableName.contains("?")) {

http://git-wip-us.apache.org/repos/asf/drill/blob/a7595525/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java
index 4330c96..afcea87 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java
@@ -177,6 +177,34 @@ public class TestParquetMetadataCache extends PlanTestBase {
       .go();
   }
 
+  @Test
+  public void testAbsentPluginOrWorkspaceError() throws Exception {
+    testBuilder()
+        .sqlQuery("refresh table metadata dfs_test.incorrect.table_name")
+        .unOrdered()
+        .baselineColumns("ok", "summary")
+        .baselineValues(false, "Storage plugin or workspace does not exist [dfs_test.incorrect]")
+        .go();
+
+    testBuilder()
+        .sqlQuery("refresh table metadata incorrect.table_name")
+        .unOrdered()
+        .baselineColumns("ok", "summary")
+        .baselineValues(false, "Storage plugin or workspace does not exist [incorrect]")
+        .go();
+  }
+
+  @Test
+  public void testNoSupportedError() throws Exception {
+    testBuilder()
+        .sqlQuery("refresh table metadata cp.`tpch/nation.parquet`")
+        .unOrdered()
+        .baselineColumns("ok", "summary")
+        .baselineValues(false, "Table tpch/nation.parquet does not support metadata refresh.
" +
+            "Support is currently limited to directory-based Parquet tables.")
+        .go();
+  }
+
   private void checkForMetadataFile(String table) throws Exception {
     String tmpDir = getDfsTestTmpSchemaLocation();
     String metaFile = Joiner.on("/").join(tmpDir, table, Metadata.METADATA_FILENAME);


Mime
View raw message