aboutsummaryrefslogtreecommitdiff
path: root/exec/java-exec/src/main/java/org/apache/drill/exec/ops
diff options
context:
space:
mode:
authorchunhui-shi <cshi@maprtech.com>2017-11-02 17:06:25 -0700
committerParth Chandra <parthc@apache.org>2017-11-21 11:38:25 -0800
commitd4c61cadbe5c7d88fd4393cc1b29648fbadfb9f1 (patch)
treef3b212106101a70b912651fffe914c7fb81e06c5 /exec/java-exec/src/main/java/org/apache/drill/exec/ops
parent5490f3dc0133fb9f0f24229e09c4cc053192ac5b (diff)
DRILL-5089: Dynamically load schema of storage plugin only when needed for every query
For each query, loading all storage plugins and loading all workspaces under file system plugins is not needed. This patch use DynamicRootSchema as the root schema for Drill. Which loads correspondent storage only when needed. infoschema to read full schema information and load second level schema accordingly. for workspaces under the same Filesyetm, no need to create FileSystem for each workspace. use fs.access API to check permission which is available after HDFS 2.6 except for windows + local file system case. Add unit tests to test with a broken mock storage: with a storage that will throw Exception in regiterSchema method, all queries even on good storages shall fail without this fix(Drill still load all schemas from all storages). This closes #1032
Diffstat (limited to 'exec/java-exec/src/main/java/org/apache/drill/exec/ops')
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java9
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/ops/QueryContext.java11
2 files changed, 17 insertions, 3 deletions
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java
index 1cde97ac7..405d37ae8 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java
@@ -230,7 +230,12 @@ public class FragmentContext extends BaseFragmentContext implements AutoCloseabl
return context;
}
- public SchemaPlus getRootSchema() {
+ /**
+ * This method is only used to construt InfoSchemaReader, it is for the reader to get full schema, so here we
+ * are going to return a fully initialized schema tree.
+ * @return root schema's plus
+ */
+ public SchemaPlus getFullRootSchema() {
if (queryContext == null) {
fail(new UnsupportedOperationException("Schema tree can only be created in root fragment. " +
"This is a non-root fragment."));
@@ -248,7 +253,7 @@ public class FragmentContext extends BaseFragmentContext implements AutoCloseabl
.setIgnoreAuthErrors(isImpersonationEnabled)
.build();
- return queryContext.getRootSchema(schemaConfig);
+ return queryContext.getFullRootSchema(schemaConfig);
}
/**
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/QueryContext.java b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/QueryContext.java
index 86074f0b4..125dfacf7 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/QueryContext.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/QueryContext.java
@@ -163,14 +163,23 @@ public class QueryContext implements AutoCloseable, OptimizerRulesContext, Schem
}
/**
- * Create and return a SchemaTree with given <i>schemaConfig</i>.
+ * Create and return a SchemaTree with given <i>schemaConfig</i> but some schemas (from storage plugins)
+ * could be initialized later.
* @param schemaConfig
* @return
*/
public SchemaPlus getRootSchema(SchemaConfig schemaConfig) {
return schemaTreeProvider.createRootSchema(schemaConfig);
}
+ /**
+ * Create and return a fully initialized SchemaTree with given <i>schemaConfig</i>.
+ * @param schemaConfig
+ * @return
+ */
+ public SchemaPlus getFullRootSchema(SchemaConfig schemaConfig) {
+ return schemaTreeProvider.createFullRootSchema(schemaConfig);
+ }
/**
* Get the user name of the user who issued the query that is managed by this QueryContext.
* @return