drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prasadns14 <...@git.apache.org>
Subject [GitHub] drill pull request #1033: DRILL-5952: Implement "CREATE TABLE IF NOT EXISTS"
Date Fri, 24 Nov 2017 05:49:04 GMT
Github user prasadns14 commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1033#discussion_r152900954
  
    --- Diff: exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestCTAS.java ---
    @@ -254,6 +255,66 @@ public void createTableWithCustomUmask() throws Exception {
         }
       }
     
    +  @Test // DRILL-5952
    +  public void testCreateTableIfNotExistsWhenTableWithSameNameAlreadyExists() throws Exception{
    +    final String newTblName = "createTableIfNotExistsWhenATableWithSameNameAlreadyExists";
    +
    +    try {
    +      String ctasQuery = String.format("CREATE TABLE %s.%s AS SELECT * from cp.`region.json`",
DFS_TMP_SCHEMA, newTblName);
    +
    +      test(ctasQuery);
    +
    +      ctasQuery =
    +        String.format("CREATE TABLE IF NOT EXISTS %s.%s AS SELECT * FROM cp.`employee.json`",
DFS_TMP_SCHEMA, newTblName);
    +
    +      testBuilder()
    +        .sqlQuery(ctasQuery)
    +        .unOrdered()
    +        .baselineColumns("ok", "summary")
    +        .baselineValues(false, String.format("A table or view with given name [%s] already
exists in schema [%s]", newTblName, DFS_TMP_SCHEMA))
    +        .go();
    +    } finally {
    +      test(String.format("DROP TABLE IF EXISTS %s.%s", DFS_TMP_SCHEMA, newTblName));
    --- End diff --
    
    Done


---

Mime
View raw message