Github user Hexiaoqiao commented on a diff in the pull request: https://github.com/apache/incubator-carbondata/pull/627#discussion_r104614642 --- Diff: core/src/main/java/org/apache/carbondata/scan/filter/executer/IncludeFilterExecuterImpl.java --- @@ -154,24 +154,45 @@ private BitSet setFilterdIndexToBitSetWithColumnIndex( } private BitSet setFilterdIndexToBitSet(DimensionColumnDataChunk dimensionColumnDataChunk, - int numerOfRows) { - BitSet bitSet = new BitSet(numerOfRows); - if (dimensionColumnDataChunk instanceof FixedLengthDimensionDataChunk) { - FixedLengthDimensionDataChunk fixedDimensionChunk = - (FixedLengthDimensionDataChunk) dimensionColumnDataChunk; - byte[][] filterValues = dimColumnExecuterInfo.getFilterKeys(); - for (int k = 0; k < filterValues.length; k++) { - for (int j = 0; j < numerOfRows; j++) { - if (ByteUtil.UnsafeComparer.INSTANCE - .compareTo(fixedDimensionChunk.getCompleteDataChunk(), j * filterValues[k].length, - filterValues[k].length, filterValues[k], 0, filterValues[k].length) == 0) { - bitSet.set(j); - } - } - } - } - return bitSet; - } + int numerOfRows) { + + BitSet bitSet = new BitSet(numerOfRows); + //BitSet bitSet1 = new BitSet(numerOfRows); + + if (dimensionColumnDataChunk instanceof FixedLengthDimensionDataChunk) { + FixedLengthDimensionDataChunk fixedDimensionChunk = + (FixedLengthDimensionDataChunk) dimensionColumnDataChunk; + byte[][] filterValues = dimColumnExecuterInfo.getFilterKeys(); + byte[] dataChunk= fixedDimensionChunk.getCompleteDataChunk(); + + //long start = System.currentTimeMillis(); + for (int k = 0; k < filterValues.length; k++) { + + int[] index = ByteUtil.UnsafeComparer.INSTANCE.binaryRangeSearch(dataChunk, 0, dataChunk.length, filterValues[k]); + for(int i = index[0]; i<=index[1];i++){ + + bitSet.set(i); + } + } + + //below comments code is used to confirm the binary range search is correct --- End diff -- please delete annotation if not used.
--- 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. ---