Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/666#discussion_r90699109
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ViewHandler.java
 ---
    @@ -74,36 +74,51 @@ public PhysicalPlan getPlan(SqlNode sqlNode) throws 
ValidationException, RelConv
           final SchemaPlus defaultSchema = context.getNewDefaultSchema();
           final AbstractSchema drillSchema = 
SchemaUtilites.resolveToMutableDrillSchema(defaultSchema, 
createView.getSchemaPath());
     
    -      final String schemaPath = drillSchema.getFullSchemaName();
           final View view = new View(newViewName, viewSql, 
newViewRelNode.getRowType(),
               SchemaUtilites.getSchemaPathAsList(defaultSchema));
     
    -      final Table existingTable = 
SqlHandlerUtil.getTableFromSchema(drillSchema, newViewName);
    +      validateViewCreationPossibility(drillSchema, newViewName, 
createView.getReplace());
    +
    +      final boolean replaced = drillSchema.createView(view);
    +      final String summary = String.format("View '%s' %s successfully in 
'%s' schema",
    +          createView.getName(), replaced ? "replaced" : "created", 
drillSchema.getFullSchemaName());
    +
    +      return DirectPlan.createDirectPlan(context, true, summary);
    +    }
    +
    +    /**
    +     * Validates if view can be created in indicated schema:
    --- End diff --
    
    Same race condition question as above.


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

Reply via email to