[ 
https://issues.apache.org/jira/browse/DRILL-4956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15761368#comment-15761368
 ] 

ASF GitHub Bot commented on DRILL-4956:
---------------------------------------

Github user arina-ielchiieva commented on a diff in the pull request:

    https://github.com/apache/drill/pull/666#discussion_r91707161
  
    --- 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:
    +     * checks if object (persistent / temporary table) with the same exists
    +     * in indicated schema, or if view exists but replace flag is not set.
    +     *
    +     * @param drillSchema schema where views will be created
    +     * @param viewName view name
    +     * @param replaceView replace view if exists
    +     * @throws UserException if views can be created in indicated schema
    +     */
    +    private void validateViewCreationPossibility(AbstractSchema 
drillSchema, String viewName, boolean replaceView) {
    --- End diff --
    
    No, there is no concept of temporary views.


> Temporary tables support
> ------------------------
>
>                 Key: DRILL-4956
>                 URL: https://issues.apache.org/jira/browse/DRILL-4956
>             Project: Apache Drill
>          Issue Type: Improvement
>    Affects Versions: 1.8.0
>            Reporter: Arina Ielchiieva
>            Assignee: Arina Ielchiieva
>              Labels: doc-impacting
>             Fix For: Future
>
>
> Link to design doc - 
> https://docs.google.com/document/d/1gSRo_w6q2WR5fPx7SsQ5IaVmJXJ6xCOJfYGyqpVOC-g/edit



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to