Github user JamesRTaylor commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/34#discussion_r23278448
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/compile/PostIndexDDLCompiler.java 
---
    @@ -85,6 +90,36 @@ public MutationPlan compile(final PTable indexTable) 
throws SQLException {
                     }
                 }
             }
    +        
    +        // Add the index columns that are expressions
    +        List<PColumn> indexPKColumns = indexTable.getPKColumns();
    +        int nIndexPKColumns = indexTable.getPKColumns().size();
    +        isSalted = indexTable.getBucketNum() != null;
    +        isMultiTenant = connection.getTenantId() != null && 
indexTable.isMultiTenant();
    +        posOffset = (isSalted ? 1 : 0) + (isMultiTenant ? 1 : 0);
    +        for (int i = posOffset; i < nIndexPKColumns; i++) {
    +            PColumn col = indexPKColumns.get(i);
    +            if (!IndexUtil.isIndexColumn(col)) {
    +                continue;
    +            }
    +           // Translate to the data table column name
    +            String indexColumnName = col.getName().getString();
    +            String dataFamilyName = 
IndexUtil.getDataColumnFamilyName(indexColumnName);
    +            String dataColumnName = 
IndexUtil.getDataColumnName(indexColumnName);
    +            try {
    +                   if (dataFamilyName.equals("")) {
    +                           dataTable.getColumn(dataColumnName);
    +                   }
    +                   else {
    +                           
dataTable.getColumnFamily(dataFamilyName).getColumn(dataColumnName);
    +                   }
    +            } catch (ColumnNotFoundException e) {
    --- End diff --
    
    A nice-to-have would be to not need this catch. If col.getExpressionStr() 
by default could evaluate to what is calculated above, that would be ideal.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to