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

    https://github.com/apache/phoenix/pull/34#discussion_r23275593
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java ---
    @@ -388,23 +426,21 @@ private IndexMaintainer(PTable dataTable, PTable 
index) {
                     } 
                 }
                 BitSet descIndexColumnBitSet = 
rowKeyMetaData.getDescIndexColumnBitSet();
    -            int j = 0;
    -            Iterator<ColumnReference> iterator = indexedColumns.iterator();
    +            Iterator<Expression> expressionIterator = 
indexedExpressions.iterator();
                 for (int i = 0; i < nIndexedColumns; i++) {
                     PDataType dataColumnType;
                     boolean isNullable = true;
                     boolean isDataColumnInverted = false;
                     SortOrder dataSortOrder = SortOrder.getDefault();
    -                if (dataPkPosition[i] == -1) {
    -                    dataColumnType = indexedColumnTypes.get(j);
    -                    ImmutableBytesPtr value = 
valueGetter.getLatestValue(iterator.next());
    -                    if (value == null) {
    -                        ptr.set(ByteUtil.EMPTY_BYTE_ARRAY);
    -                    } else {
    -                        ptr.set(value.copyBytesIfNecessary());
    -                    }
    -                    j++;
    -               } else {
    +                if (dataPkPosition[i] == EXPRESSION_NOT_PRESENT) {
    +                   Expression expression = expressionIterator.next();
    +                   dataColumnType = expression.getDataType();
    +                   // expressions are stored using default sort order
    --- End diff --
    
    I fixed this so that we the sort order is used correctly for expressions. I 
will add a test for this as well.


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