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

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

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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


> Schema extraction double quotes expressions, resulting in un-executabe create 
> statements
> ----------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-6596
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6596
>             Project: Phoenix
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 4.17.0, 5.2.0, 4.16.2, 5.1.3
>            Reporter: Istvan Toth
>            Assignee: Richárd Antal
>            Priority: Major
>
> {noformat}
> create table data (id varchar primary key, number integer,currency 
> decimal(6,2),
> lista varchar[]);
> create index data_index on data (currency*number) INCLUDE (LISTA);
> show create table data_index;
> +-----------------------------------------------------------------------------+
> |                              CREATE STATEMENT                               
> |
> +-----------------------------------------------------------------------------+
> | CREATE INDEX DATA_INDEX ON DATA("(CURRENCY * NUMBER)", ID) INCLUDE (LISTA)  
> |
> +-----------------------------------------------------------------------------+
> {noformat}
> The create statement double quotes the expression, and cannot be executed 
> directly.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to