Github user ajantha-bhat commented on a diff in the pull request: https://github.com/apache/carbondata/pull/2784#discussion_r221261712 --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/chunk/store/ColumnPageWrapper.java --- @@ -302,8 +311,19 @@ public boolean isExplicitSorted() { @Override public int compareTo(int rowId, byte[] compareValue) { - byte[] chunkData = this.getChunkData((int) rowId); - return ByteUtil.UnsafeComparer.INSTANCE.compareTo(chunkData, compareValue); + // rowId is the inverted index, but the null bitset is based on actual data + int nullBitSetRowId = rowId; + if (isExplicitSorted()) { + nullBitSetRowId = getInvertedReverseIndex(rowId); + } + byte[] nullBitSet = getNullBitSet(nullBitSetRowId, columnPage.getColumnSpec().getColumnType()); --- End diff -- because this rowId is not the original rowId. Hence it is required.
---