You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2021/12/09 13:02:20 UTC

[GitHub] [phoenix] richardantal opened a new pull request #1364: PHOENIX-6596 Schema extraction double quotes expressions, resulting i…

richardantal opened a new pull request #1364:
URL: https://github.com/apache/phoenix/pull/1364


   …n un-executabe create statements
   
   Co-authored-by: Istvan Toth <st...@apache.org>


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

To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] richardantal commented on a change in pull request #1364: PHOENIX-6596 Schema extraction double quotes expressions, resulting i…

Posted by GitBox <gi...@apache.org>.
richardantal commented on a change in pull request #1364:
URL: https://github.com/apache/phoenix/pull/1364#discussion_r769535362



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/schema/tool/SchemaExtractionProcessor.java
##########
@@ -135,8 +135,8 @@ private String getIndexedColumnsString(PTable indexPTable, PTable dataPTable, St
         StringBuilder indexedColumnsBuilder = new StringBuilder();
 
         for (PColumn indexedColumn : indexPK) {
-            String indexColumn = extractIndexColumn(indexedColumn.getName().getString(), defaultCF);
-            if(indexColumn.equalsIgnoreCase(MetaDataUtil.VIEW_INDEX_ID_COLUMN_NAME)) {
+            String indexColumn = extractIndexColumn(indexedColumn.getExpressionStr(), defaultCF);
+            if(indexColumn == null || indexColumn.equalsIgnoreCase(MetaDataUtil.VIEW_INDEX_ID_COLUMN_NAME)) {

Review comment:
       And indexedColumn.getExpressionStr() is null when indexedColumn.getName().getString() was equal to MetaDataUtil.VIEW_INDEX_ID_COLUMN_NAME




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

To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] richardantal commented on a change in pull request #1364: PHOENIX-6596 Schema extraction double quotes expressions, resulting i…

Posted by GitBox <gi...@apache.org>.
richardantal commented on a change in pull request #1364:
URL: https://github.com/apache/phoenix/pull/1364#discussion_r769476712



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/schema/tool/SchemaExtractionProcessor.java
##########
@@ -135,8 +135,8 @@ private String getIndexedColumnsString(PTable indexPTable, PTable dataPTable, St
         StringBuilder indexedColumnsBuilder = new StringBuilder();
 
         for (PColumn indexedColumn : indexPK) {
-            String indexColumn = extractIndexColumn(indexedColumn.getName().getString(), defaultCF);
-            if(indexColumn.equalsIgnoreCase(MetaDataUtil.VIEW_INDEX_ID_COLUMN_NAME)) {
+            String indexColumn = extractIndexColumn(indexedColumn.getExpressionStr(), defaultCF);
+            if(indexColumn == null || indexColumn.equalsIgnoreCase(MetaDataUtil.VIEW_INDEX_ID_COLUMN_NAME)) {

Review comment:
       If indexedColumn.getExpressionStr() is null I return null in extractIndexColumn.
           




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

To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] richardantal commented on a change in pull request #1364: PHOENIX-6596 Schema extraction double quotes expressions, resulting i…

Posted by GitBox <gi...@apache.org>.
richardantal commented on a change in pull request #1364:
URL: https://github.com/apache/phoenix/pull/1364#discussion_r768430178



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/schema/tool/SchemaExtractionProcessor.java
##########
@@ -135,8 +135,8 @@ private String getIndexedColumnsString(PTable indexPTable, PTable dataPTable, St
         StringBuilder indexedColumnsBuilder = new StringBuilder();
 
         for (PColumn indexedColumn : indexPK) {
-            String indexColumn = extractIndexColumn(indexedColumn.getName().getString(), defaultCF);
-            if(indexColumn.equalsIgnoreCase(MetaDataUtil.VIEW_INDEX_ID_COLUMN_NAME)) {
+            String indexColumn = extractIndexColumn(indexedColumn.getExpressionStr(), defaultCF);

Review comment:
       We still parse it but indexedColumn.getExpressionStr() is better to parse.
   indexedColumn.getName().getString() returnes 'QUOTED' for quoted string and ('number' * 'currency') for lowercase columns so we would not be able to differentiate them.
   On the other hand  indexedColumn.getExpressionStr() returns these columns as 'QUOTED' and ("number" * "currency")




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

To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] richardantal merged pull request #1364: PHOENIX-6596 Schema extraction double quotes expressions, resulting i…

Posted by GitBox <gi...@apache.org>.
richardantal merged pull request #1364:
URL: https://github.com/apache/phoenix/pull/1364


   


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

To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] gjacoby126 commented on a change in pull request #1364: PHOENIX-6596 Schema extraction double quotes expressions, resulting i…

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on a change in pull request #1364:
URL: https://github.com/apache/phoenix/pull/1364#discussion_r769828723



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/schema/tool/SchemaExtractionProcessor.java
##########
@@ -184,21 +184,39 @@ private String getIndexedColumnsString(PTable indexPTable, PTable dataPTable, St
     }
 
     private String extractIndexColumn(String columnName, String defaultCF) {
+        if (columnName == null) {
+            return null;
+        }
         String [] columnNameSplit = columnName.split(":");
         if(columnNameSplit[0].equals("") || columnNameSplit[0].equalsIgnoreCase(defaultCF) ||
                 (defaultCF.startsWith("L#") && columnNameSplit[0].equalsIgnoreCase(defaultCF.substring(2)))) {
-            return SchemaUtil.formatColumnName(columnNameSplit[1]);
+            return formatColumnOrExpression(columnNameSplit[1]);
         } else {
             if (columnNameSplit.length > 1) {
                 String schema = SchemaUtil.formatSchemaName(columnNameSplit[0]);
                 String name = SchemaUtil.formatColumnName(columnNameSplit[1]);
                 return String.format("%s.%s", schema, name);
             } else {
-                return SchemaUtil.formatColumnName(columnNameSplit[0]);
+                return formatColumnOrExpression(columnNameSplit[0]);
             }
         }
     }
 
+    private String formatColumnOrExpression(String columnOrExpression) {
+        System.out.println("columnOrExpressioncolumnOrExpressioncolumnOrExpression");

Review comment:
       Please remove the System.out.printlns




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

To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org