drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #666: DRILL-4956: Temporary tables support
Date Tue, 06 Dec 2016 06:12:51 GMT
Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/666#discussion_r91012871
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserSession.java
---
    @@ -207,25 +239,165 @@ public SchemaPlus getDefaultSchema(SchemaPlus rootSchema) {
           return null;
         }
     
    -    final SchemaPlus defaultSchema = SchemaUtilites.findSchema(rootSchema, defaultSchemaPath);
    -
    -    if (defaultSchema == null) {
    -      // If the current schema resolves to null, return root schema as the current default
schema.
    -      return defaultSchema;
    -    }
    -
    -    return defaultSchema;
    +    return SchemaUtilites.findSchema(rootSchema, defaultSchemaPath);
       }
     
       public boolean setSessionOption(String name, String value) {
         return true;
       }
     
    +  /**
    +   * @return unique session identifier
    +   */
    +  public String getUuid() { return uuid; }
    +
    +  /**
    +   * Adds temporary table to temporary tables cache.
    +   *
    +   * @param schema table schema
    +   * @param tableName original table name
    +   * @return generated temporary table name
    +   */
    +  public String registerTemporaryTable(AbstractSchema schema, String tableName) {
    +    return temporaryTablesCache.add(schema, tableName);
    +  }
    +
    +  /**
    +   * Looks for temporary table in temporary tables cache by its name in specified schema.
    +   *
    +   * @param fullSchemaName table full schema name (example, dfs.tmp)
    +   * @param tableName original table name
    +   * @return temporary table name if found, null otherwise
    +   */
    +  public String findTemporaryTable(String fullSchemaName, String tableName) {
    +    return temporaryTablesCache.find(fullSchemaName, tableName);
    +  }
    +
    +  /**
    +   * Before removing temporary table from temporary tables cache,
    +   * checks if table exists physically on disk, if yes, removes it.
    +   *
    +   * @param fullSchemaName full table schema name (example, dfs.tmp)
    +   * @param tableName original table name
    +   * @return true if table was physically removed, false otherwise
    +   */
    +  public boolean removeTemporaryTable(String fullSchemaName, String tableName) {
    +    final AtomicBoolean result = new AtomicBoolean();
    --- End diff --
    
    This is single threaded? And, the inner class can see the result member? Can we just do:
    ```
    boolean result;
    ...
    result = true;
    ```


---
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