Qinrui98 commented on a change in pull request #848:
URL: https://github.com/apache/phoenix/pull/848#discussion_r463285826



##########
File path: 
phoenix-tools/src/it/java/org/apache/phoenix/schema/SchemaExtractionToolIT.java
##########
@@ -210,4 +204,242 @@ public void testCreateViewIndexStatement() throws 
Exception {
             Assert.assertEquals(createIndexStatement.toUpperCase(), 
set.getOutput().toUpperCase());
         }
     }
+
+    @Test
+    public void testSaltedTableStatement() throws Exception {
+        String tableName = generateUniqueName();
+        String schemaName = generateUniqueName();
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+
+        try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
+            String pTableFullName = 
SchemaUtil.getQualifiedTableName(schemaName, tableName);
+            String query = "create table " + pTableFullName +
+                    "(a_integer integer not null CONSTRAINT pk PRIMARY KEY 
(a_integer)) SALT_BUCKETS=16";
+            conn.createStatement().execute(query);
+            conn.commit();
+            String [] args = {"-tb", tableName, "-s", schemaName};
+            SchemaExtractionTool set = new SchemaExtractionTool();
+            
set.setConf(conn.unwrap(PhoenixConnection.class).getQueryServices().getConfiguration());
+            set.run(args);
+            String actualProperties = 
set.getOutput().substring(set.getOutput().lastIndexOf(")")+1);
+            Assert.assertEquals(true, 
actualProperties.contains("SALT_BUCKETS=16"));
+        }
+    }
+
+    @Test
+    public void testCreateTableWithPKConstraint() throws Exception {
+        String tableName = generateUniqueName();
+        String schemaName = generateUniqueName();
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);

Review comment:
       Yes I'll extract the common part into a helper function and avoid 
duplicated code here. 




----------------------------------------------------------------
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:
[email protected]


Reply via email to