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

    
https://github.com/apache/incubator-carbondata/pull/638#discussion_r105522667
  
    --- Diff: 
core/src/main/java/org/apache/carbondata/core/scan/filter/executer/IncludeFilterExecuterImpl.java
 ---
    @@ -150,12 +138,15 @@ private BitSet 
setFilterdIndexToBitSet(DimensionColumnDataChunk dimensionColumnD
         BitSet bitSet = new BitSet(numerOfRows);
         if (dimensionColumnDataChunk instanceof FixedLengthDimensionDataChunk) 
{
           byte[][] filterValues = dimColumnExecuterInfo.getFilterKeys();
    -      for (int k = 0; k < filterValues.length; k++) {
    -        for (int j = 0; j < numerOfRows; j++) {
    -          if (dimensionColumnDataChunk.compareTo(j, filterValues[k]) == 0) 
{
    -            bitSet.set(j);
    -          }
    +      for (int i = 0; i < numerOfRows; i++) {
    +
    +        int index = CarbonUtil.binarySearch(filterValues, 0, 
filterValues.length,
    --- End diff --
    
    @ravipesala, If put the if clause out of the for clause, it is better?
    
    `  private BitSet setFilterdIndexToBitSet(DimensionColumnDataChunk 
dimensionColumnDataChunk,
          int numerOfRows) {
        BitSet bitSet = new BitSet(numerOfRows);
        if (dimensionColumnDataChunk instanceof FixedLengthDimensionDataChunk) {
          byte[][] filterValues = dimColumnExecuterInfo.getFilterKeys();
    
          if (filterValues.length > 1) {
            for (int i = 0; i < numerOfRows; i++) {
              int index = CarbonUtil.binarySearch(filterValues, 0, 
filterValues.length - 1,
                  dimensionColumnDataChunk.getChunkData(i));
    
              if (index >= 0) {
                bitSet.set(i);
              }
            }
          } else if (filterValues.length == 1) {
            for (int i = 0; i < numerOfRows; i++) {
              if (dimensionColumnDataChunk.compareTo(i, filterValues[0]) == 0) {
                bitSet.set(i);
              }
            }
          }
        }
        return bitSet;
      }`
    



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