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

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

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

    https://github.com/apache/drill/pull/1033#discussion_r152582047
  
    --- Diff: 
exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestViewSupport.java ---
    @@ -311,6 +311,75 @@ public void createViewWhenViewAlreadyExists() throws 
Exception {
         }
       }
     
    +  @Test // DRILL-5952
    +  public void createViewIfNotExistsWhenTableAlreadyExists() throws 
Exception {
    +    final String tableName = generateViewName();
    +
    +    try {
    +      final String tableDef = "SELECT region_id, sales_city FROM 
cp.`region.json` ORDER BY `region_id` LIMIT 2";
    +
    +      test("CREATE TABLE %s.%s as %s", DFS_TMP_SCHEMA, tableName, 
tableDef);
    --- End diff --
    
    There is not need to create table before creating the view just use select 
statement.


> Implement "CREATE TABLE IF NOT EXISTS"
> --------------------------------------
>
>                 Key: DRILL-5952
>                 URL: https://issues.apache.org/jira/browse/DRILL-5952
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: SQL Parser
>    Affects Versions: 1.11.0
>            Reporter: Prasad Nagaraj Subramanya
>            Assignee: Prasad Nagaraj Subramanya
>             Fix For: Future
>
>
> Currently, if a table/view with the same name exists CREATE TABLE fails with 
> VALIDATION ERROR
> Having "IF NOT EXISTS" support for CREATE TABLE will ensure that query 
> succeeds 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to