drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arina-ielchiieva <...@git.apache.org>
Subject [GitHub] drill pull request #666: DRILL-4956: Temporary tables support
Date Wed, 18 Jan 2017 10:30:00 GMT
Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/666#discussion_r96604582
  
    --- 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 --
    
    According to Drill documentation (and Drill implementation): storage plugin and workspace
names are case-sensitive.
    For example:
    `use dfs.tmp` -> succeeds
    `use DFS.TMP` or `use dfs.TMP` -> fails
    That's why I have left check for temporary workspace case-sensitive as well.
    I'll add comment that check is case-sensitive.
    
    [1] https://drill.apache.org/docs/lexical-structure/ (Storage Plugin and Workspace References
section)


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message