Github user JamesRTaylor commented on a diff in the pull request: https://github.com/apache/phoenix/pull/34#discussion_r22993260 --- 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 -- We should be able to invert a function expression (any expression in the ON list for an index definition)
--- 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. ---