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

ASF GitHub Bot commented on PHOENIX-6454:
-----------------------------------------

gjacoby126 commented on a change in pull request #1233:
URL: https://github.com/apache/phoenix/pull/1233#discussion_r634812788



##########
File path: 
phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaSynthesisProcessor.java
##########
@@ -154,7 +156,24 @@ private CreateTableStatement 
getCreateTableStatement(AddColumnStatement alterSta
         } else {
             newColDef.addAll(oldColDef);
             newColDef.addAll(addStmt.getColumnDefs());
-            newCreateStmt = new CreateTableStatement(createStmt, newColDef);
+            PrimaryKeyConstraint oldPKConstraint = 
createStmt.getPrimaryKeyConstraint();
+            List<ColumnDefInPkConstraint> pkList = new ArrayList<>();
+            for(Pair<ColumnName, SortOrder> entry : 
oldPKConstraint.getColumnNames()) {
+                ColumnDefInPkConstraint cd = new
+                        ColumnDefInPkConstraint(entry.getFirst(), 
entry.getSecond(), oldPKConstraint.isColumnRowTimestamp(entry
+                .getFirst()));
+                pkList.add(cd);
+            }
+            for(ColumnDef cd : addStmt.getColumnDefs()) {

Review comment:
       What if the ALTER tries to add an existing PK column? 

##########
File path: 
phoenix-tools/src/it/java/org/apache/phoenix/schema/SchemaToolSynthesisIT.java
##########
@@ -154,18 +154,19 @@ public void testCreateIndexStatement_dropIndex() throws 
Exception {
     private void runAndVerify(String expected, String baseDDL) throws 
Exception {
         String[] arg = { "-m", "SYNTH", "-d", baseDDL };
         String result = runSchemaTool(null, arg);
+        System.out.println(result);

Review comment:
       Can cut out the println. 




-- 
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]


> Add feature to SchemaTool to get the DDL in specification mode
> --------------------------------------------------------------
>
>                 Key: PHOENIX-6454
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6454
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: Swaroopa Kadam
>            Assignee: Swaroopa Kadam
>            Priority: Major
>             Fix For: 4.17.0, 5.2.0
>
>
> Currently, SchemExtractionTool uses PTable representation to get the 
> effective DDL on the cluster. 
> Rename SchemaExtractionTool to SchemaTool, add a feature that accepts create 
> DDL and alter DDL to give effective DDL without using PTable implementation. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to