carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mayunSaicmotor <...@git.apache.org>
Subject [GitHub] incubator-carbondata pull request #638: [Carbondata 748] use binary search i...
Date Fri, 10 Mar 2017 15:42:43 GMT
Github user mayunSaicmotor commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/638#discussion_r105422550
  
    --- 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 --
    
    does the below is OK?
    
      private BitSet setFilterdIndexToBitSet(DimensionColumnDataChunk dimensionColumnDataChunk,
          int numerOfRows) {
        BitSet bitSet = new BitSet(numerOfRows);
        if (dimensionColumnDataChunk instanceof FixedLengthDimensionDataChunk) {
          byte[][] filterValues = dimColumnExecuterInfo.getFilterKeys();
          for (int i = 0; i < numerOfRows; i++) {
    
            if (filterValues.length > 1) {
              int index = CarbonUtil.binarySearch(filterValues, 0, filterValues.length - 1,
                  dimensionColumnDataChunk.getChunkData(i));
    
              if (index >= 0) {
                bitSet.set(i);
              }
            } else if (filterValues.length == 1) {
              if (dimensionColumnDataChunk.compareTo(i, filterValues[0]) == 0) {
                bitSet.set(i);
              }
            } else {
              break;
            }
    
          }
        }
        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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message