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]