Repository: incubator-drill
Updated Branches:
  refs/heads/master 69c571ccd -> 059caed97


DRILL-533: Queries fail with NPE if dfs/cp schema has no default workspace but 
has non-default workspace

We currently add the "default" workspace only if there are no workspaces 
defined, but we always choose the workspace with "default" name as the default 
workspace. As in the repro case there is no default workspace, we end with a 
null.

Fix: Add default workspace if there is no "default" given in 
storage-engines.json


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

Branch: refs/heads/master
Commit: 7a4fee42406516e729b9bdae31945cec4858a332
Parents: 69c571c
Author: vkorukanti <[email protected]>
Authored: Wed Apr 16 10:32:24 2014 -0700
Committer: Jacques Nadeau <[email protected]>
Committed: Wed Apr 23 08:08:47 2014 -0700

----------------------------------------------------------------------
 .../java/org/apache/drill/exec/store/dfs/FileSystemPlugin.java  | 5 +++++
 sqlparser/src/test/resources/storage-plugins.json               | 3 +--
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/7a4fee42/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemPlugin.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemPlugin.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemPlugin.java
index 840a011..97427f6 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemPlugin.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemPlugin.java
@@ -88,6 +88,11 @@ public class FileSystemPlugin extends AbstractStoragePlugin{
         for(Map.Entry<String, String> space : config.workspaces.entrySet()){
           factories.add(new WorkspaceSchemaFactory(this, space.getKey(), name, 
fs, space.getValue(), matchers));
         }
+
+        // if the "default" workspace is not given add one.
+        if (!config.workspaces.containsKey("default")) {
+          factories.add(new WorkspaceSchemaFactory(this, "default", name, fs, 
"/", matchers));
+        }
       }
       this.schemaFactory = new FileSystemSchemaFactory(name, factories);
     }catch(IOException e){

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/7a4fee42/sqlparser/src/test/resources/storage-plugins.json
----------------------------------------------------------------------
diff --git a/sqlparser/src/test/resources/storage-plugins.json 
b/sqlparser/src/test/resources/storage-plugins.json
index b9a4bd8..60efa50 100644
--- a/sqlparser/src/test/resources/storage-plugins.json
+++ b/sqlparser/src/test/resources/storage-plugins.json
@@ -4,7 +4,6 @@
       type: "file",
       connection: "file:///",
       workspaces: {
-        default: "/",
         home: "/"
       },
       formats: {
@@ -44,4 +43,4 @@
           }
       }
   }
-}
\ No newline at end of file
+}

Reply via email to