swaroopak commented on a change in pull request #889:
URL: https://github.com/apache/phoenix/pull/889#discussion_r492429804



##########
File path: 
phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaExtractionProcessor.java
##########
@@ -203,6 +203,9 @@ protected String extractCreateViewDDL(PTable table) throws 
SQLException {
     private String generateCreateViewDDL(String columnInfoString, String 
baseTableFullName,
             String whereClause, String pSchemaName, String pTableName) {
         String viewFullName = SchemaUtil.getQualifiedTableName(pSchemaName, 
pTableName);
+        if(Character.isDigit(pTableName.charAt(0))) {

Review comment:
       I think not, this is mainly for parsing. For Internals of phoenix, 
function should ignore quotes around the name.

##########
File path: 
phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaExtractionProcessor.java
##########
@@ -203,6 +203,9 @@ protected String extractCreateViewDDL(PTable table) throws 
SQLException {
     private String generateCreateViewDDL(String columnInfoString, String 
baseTableFullName,
             String whereClause, String pSchemaName, String pTableName) {
         String viewFullName = SchemaUtil.getQualifiedTableName(pSchemaName, 
pTableName);
+        if(Character.isDigit(pTableName.charAt(0))) {

Review comment:
       Makes sense! Let me correct it. 

##########
File path: 
phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaExtractionProcessor.java
##########
@@ -203,6 +203,9 @@ protected String extractCreateViewDDL(PTable table) throws 
SQLException {
     private String generateCreateViewDDL(String columnInfoString, String 
baseTableFullName,
             String whereClause, String pSchemaName, String pTableName) {
         String viewFullName = SchemaUtil.getQualifiedTableName(pSchemaName, 
pTableName);
+        if(Character.isDigit(pTableName.charAt(0))) {

Review comment:
       Makes sense! However,  [a-zA-Z_0-9-.] these are the only acceptable 
characters in the name.

##########
File path: 
phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaExtractionProcessor.java
##########
@@ -202,12 +202,20 @@ protected String extractCreateViewDDL(PTable table) 
throws SQLException {
 
     private String generateCreateViewDDL(String columnInfoString, String 
baseTableFullName,
             String whereClause, String pSchemaName, String pTableName) {
-        String viewFullName = SchemaUtil.getQualifiedTableName(pSchemaName, 
pTableName);
+        String viewFullName = getPTableFullName(pSchemaName, pTableName);
         StringBuilder outputBuilder = new 
StringBuilder(String.format(CREATE_VIEW, viewFullName,
                 columnInfoString, baseTableFullName, whereClause));
         return outputBuilder.toString();
     }
 
+    private String getPTableFullName(String pSchemaName, String pTableName) {

Review comment:
       This is not needed in for internals for phoenix. 

##########
File path: 
phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaExtractionProcessor.java
##########
@@ -202,12 +202,20 @@ protected String extractCreateViewDDL(PTable table) 
throws SQLException {
 
     private String generateCreateViewDDL(String columnInfoString, String 
baseTableFullName,
             String whereClause, String pSchemaName, String pTableName) {
-        String viewFullName = SchemaUtil.getQualifiedTableName(pSchemaName, 
pTableName);
+        String viewFullName = getPTableFullName(pSchemaName, pTableName);
         StringBuilder outputBuilder = new 
StringBuilder(String.format(CREATE_VIEW, viewFullName,
                 columnInfoString, baseTableFullName, whereClause));
         return outputBuilder.toString();
     }
 
+    private String getPTableFullName(String pSchemaName, String pTableName) {

Review comment:
       This is not needed in for internals of phoenix. 

##########
File path: 
phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaExtractionProcessor.java
##########
@@ -202,12 +202,20 @@ protected String extractCreateViewDDL(PTable table) 
throws SQLException {
 
     private String generateCreateViewDDL(String columnInfoString, String 
baseTableFullName,
             String whereClause, String pSchemaName, String pTableName) {
-        String viewFullName = SchemaUtil.getQualifiedTableName(pSchemaName, 
pTableName);
+        String viewFullName = getPTableFullName(pSchemaName, pTableName);
         StringBuilder outputBuilder = new 
StringBuilder(String.format(CREATE_VIEW, viewFullName,
                 columnInfoString, baseTableFullName, whereClause));
         return outputBuilder.toString();
     }
 
+    private String getPTableFullName(String pSchemaName, String pTableName) {

Review comment:
       This is not needed in internals of phoenix.
   
   

##########
File path: 
phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaExtractionProcessor.java
##########
@@ -326,8 +334,13 @@ private String convertPropertiesToString() {
                 if (optionBuilder.length() != 0) {
                     optionBuilder.append(", ");
                 }
-                key = 
columnFamilyName.equals(QueryConstants.DEFAULT_COLUMN_FAMILY)? key : 
String.format("\"%s\".%s", columnFamilyName, key);
-                optionBuilder.append(key+"="+value);
+                key = 
columnFamilyName.equals(QueryConstants.DEFAULT_COLUMN_FAMILY)?
+                        key : String.format("\"%s\".%s", columnFamilyName, 
key);
+                if(!Character.isDigit(value.charAt(0)) &&

Review comment:
       added a comment.

##########
File path: 
phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaExtractionProcessor.java
##########
@@ -326,8 +327,15 @@ private String convertPropertiesToString() {
                 if (optionBuilder.length() != 0) {
                     optionBuilder.append(", ");
                 }
-                key = 
columnFamilyName.equals(QueryConstants.DEFAULT_COLUMN_FAMILY)? key : 
String.format("\"%s\".%s", columnFamilyName, key);
-                optionBuilder.append(key+"="+value);
+                key = 
columnFamilyName.equals(QueryConstants.DEFAULT_COLUMN_FAMILY)?
+                        key : String.format("\"%s\".%s", columnFamilyName, 
key);
+                // properties value that corresponds to a number will not need 
single quotes around it

Review comment:
       That makes sense, I changed it.




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