phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [phoenix] yanxinyi commented on a change in pull request #445: PHOENIX-2787 support IF EXISTS for ALTER TABLE SET options
Date Wed, 06 Mar 2019 20:15:20 GMT
yanxinyi commented on a change in pull request #445: PHOENIX-2787 support IF EXISTS for ALTER
TABLE SET options
URL: https://github.com/apache/phoenix/pull/445#discussion_r263116337
 
 

 ##########
 File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
 ##########
 @@ -1352,7 +1352,34 @@ private void assertSequenceNumber(String schemaName, String tableName,
long expe
             assertFalse(rs.next());
         }
     }
-    
+
+    @Test
+    public void testAlterTableIfExistsThenOption() throws Exception {
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
+        conn.setAutoCommit(false);
+        String ddl = "CREATE TABLE FOO (A VARCHAR  PRIMARY KEY, B VARCHAR)";
+        createTestTable(getUrl(), ddl);
+
+        // testing ALTER TABLE ADD WITH IF EXISTS SET OPTION
+        try {
+            conn.createStatement().execute("ALTER TABLE FOO ADD C VARCHAR IF EXISTS" +
+                    "  SET DISABLE_WAL = true");
+        } catch (SQLException e){
+            assertEquals(SQLExceptionCode.MISSING_TOKEN.getErrorCode(), e.getErrorCode());
 
 Review comment:
   @vincentpoon Thank you so much for reviewing my pr.
   Currently, Phoenix implementation doesn't support the `set` keyword with options at the
end.
   For instance, `ALTER TABLE NAME ADD COLNAME TYPE` + `OPTIONS` is supported, but `SET OPTIONS`
is not. This is an open question. Do you want me to support this new grammar? If we want to
support this as well, I can create a new jira and support this.
   
   This jira supports `ALTER TABLE NAME **IF EXISTS**` + `SET OPTIONS`. Correct me if I miss
anything here, thanks! :) 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message