Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/666#discussion_r96509598
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/SchemaUtilites.java
---
@@ -177,4 +186,34 @@ public static AbstractSchema
resolveToMutableDrillSchema(final SchemaPlus defaul
return drillSchema;
}
+
+ /**
+ * Looks in schema tree for default temporary workspace instance.
+ * Makes sure that temporary workspace is mutable and file-based
+ * (instance of {@link WorkspaceSchemaFactory.WorkspaceSchema}).
+ *
+ * @param defaultSchema default schema
+ * @param config drill config
+ * @return default temporary workspace
+ */
+ public static AbstractSchema getTemporaryWorkspace(SchemaPlus
defaultSchema, DrillConfig config) {
+ List<String> temporarySchemaPath =
Lists.newArrayList(config.getString(ExecConstants.DEFAULT_TEMPORARY_WORKSPACE));
+ AbstractSchema temporarySchema =
resolveToMutableDrillSchema(defaultSchema, temporarySchemaPath);
+ if (!(temporarySchema instanceof
WorkspaceSchemaFactory.WorkspaceSchema)) {
+ DrillRuntimeException.format("Temporary workspace [%s] must be
file-based, instance of " +
+ "WorkspaceSchemaFactory.WorkspaceSchema", temporarySchemaPath);
+ }
+ return temporarySchema;
+ }
+
+ /**
+ * Checks that passed schema path is the same as temporary workspace
path.
+ *
+ * @param schemaPath schema path
+ * @param config drill config
+ * @return true is schema path corresponds to temporary workspace, false
otherwise
+ */
+ public static boolean isTemporaryWorkspace(String schemaPath,
DrillConfig config) {
--- End diff --
When matching the temp workspace name, should the names be... case
sensitive or case insensitive? These are name spaces we define (like column or
table aliases), so should they follow the SQL rules or file system rules?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---