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:26 GMT
Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/666#discussion_r90697836
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java
---
    @@ -242,4 +244,40 @@ private RexNode composeDisjunction(final RexBuilder rexBuilder, List<RexNode>
co
         return node;
       }
     
    +  /**
    +   * Gets schema path defined in create table statement.
    +   * If temporary table and schema is not indicated,
    +   * set default temporary workspace.
    +   *
    +   * @param sqlCreateTable create table call
    +   * @return table schema path
    +   */
    +  private List<String> getSchemaPath(SqlCreateTable sqlCreateTable) {
    +    List<String> indicatedSchemaPath = sqlCreateTable.getSchemaPath();
    +    if (sqlCreateTable.isTemporary() && indicatedSchemaPath.size() == 0) {
    +      indicatedSchemaPath = Lists.newArrayList();
    +      indicatedSchemaPath.add(context.getConfig().getString(ExecConstants.DEFAULT_TEMPORARY_WORKSPACE));
    +    }
    +    return indicatedSchemaPath;
    +  }
    +
    +  /**
    +   * Checks if any object (persistent table / temporary table / view)
    +   * with the same name as table to be created exists in indicated schema.
    +   *
    +   * @param drillSchema schema where table will be created
    +   * @param tableName table name
    +   * @throws UserException if duplicate is found
    +   */
    +  private void checkDuplicatedObjectExistence(AbstractSchema drillSchema, String tableName)
{
    --- End diff --
    
    We check for a duplicated table here. The plan will soon execute. But, two such plans
might run in parallel. Do we do another check at the time we try to create the table to catch
the case race conditions in which the table was created between this check and actual run?



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