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

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

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



##########
File path: 
phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaSQLUtil.java
##########
@@ -0,0 +1,151 @@
+package org.apache.phoenix.schema;
+
+import com.google.common.collect.ListMultimap;
+import org.apache.hadoop.hbase.util.Pair;
+import org.apache.phoenix.parse.ColumnDef;
+import org.apache.phoenix.parse.ColumnName;
+import org.apache.phoenix.parse.CreateIndexStatement;
+import org.apache.phoenix.parse.CreateTableStatement;
+
+import java.util.List;
+import java.util.Map;
+
+public class SchemaSQLUtil {

Review comment:
       Does this utility class belong in tools? (that is, is it only useful to 
a particular tool or tools?)

##########
File path: 
phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaSQLUtil.java
##########
@@ -0,0 +1,151 @@
+package org.apache.phoenix.schema;
+
+import com.google.common.collect.ListMultimap;
+import org.apache.hadoop.hbase.util.Pair;
+import org.apache.phoenix.parse.ColumnDef;
+import org.apache.phoenix.parse.ColumnName;
+import org.apache.phoenix.parse.CreateIndexStatement;
+import org.apache.phoenix.parse.CreateTableStatement;
+
+import java.util.List;
+import java.util.Map;
+
+public class SchemaSQLUtil {
+
+    protected static String getCreateTableSQL(CreateTableStatement createStmt) 
{
+        if (createStmt == null) {
+            return "";
+        }
+        StringBuffer sb = new StringBuffer()
+                .append("CREATE "+createStmt.getTableType() + " ");
+        if (createStmt.ifNotExists()) {
+            sb.append("IF NOT EXISTS ");
+        }
+        sb.append(createStmt.getTableName()).append("\n")
+                .append(getColumnDefListToString(createStmt))
+                .append("\nCONSTRAINT 
"+createStmt.getPrimaryKeyConstraint().getName()+" PRIMARY KEY")
+                .append(" 
("+createStmt.getPrimaryKeyConstraint().toString()+"))"
+                        .replaceAll(",", ",\n"));
+        if(createStmt.getTableType().equals(PTableType.VIEW)) {

Review comment:
       nit: space between if and (

##########
File path: 
phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaSQLUtil.java
##########
@@ -0,0 +1,151 @@
+package org.apache.phoenix.schema;

Review comment:
       Missing Apache license




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