You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by GitBox <gi...@apache.org> on 2019/05/16 06:36:44 UTC

[GitHub] [carbondata] ravipesala commented on a change in pull request #3209: [CARBONDATA-3373] Optimize scenes with in numbers in SQL

ravipesala commented on a change in pull request #3209: [CARBONDATA-3373] Optimize scenes with in numbers in SQL
URL: https://github.com/apache/carbondata/pull/3209#discussion_r284556550
 
 

 ##########
 File path: core/src/main/java/org/apache/carbondata/core/scan/filter/executer/IncludeFilterExecuterImpl.java
 ##########
 @@ -272,29 +273,21 @@ private BitSet getFilteredIndexesForMeasures(ColumnPage columnPage,
     // Get the measure values from the chunk. compare sequentially with the
     // the filter values. The one that matches sets it Bitset.
     BitSet bitSet = new BitSet(rowsInPage);
-    Object[] filterValues = msrColumnExecutorInfo.getFilterKeys();
-
-    SerializableComparator comparator = Comparator.getComparatorByDataTypeForMeasure(msrType);
+    Set filterValuesSet = msrColumnExecutorInfo.getFilterKeysSet();
     BitSet nullBitSet = columnPage.getNullBits();
-    for (int i = 0; i < filterValues.length; i++) {
-      if (filterValues[i] == null) {
-        for (int j = nullBitSet.nextSetBit(0); j >= 0; j = nullBitSet.nextSetBit(j + 1)) {
-          bitSet.set(j);
-        }
-        continue;
-      }
-      for (int startIndex = 0; startIndex < rowsInPage; startIndex++) {
-        if (!nullBitSet.get(startIndex)) {
-          // Check if filterValue[i] matches with measure Values.
-          Object msrValue = DataTypeUtil
-              .getMeasureObjectBasedOnDataType(columnPage, startIndex,
-                  msrType, msrColumnEvaluatorInfo.getMeasure());
-
-          if (comparator.compare(msrValue, filterValues[i]) == 0) {
-            // This is a match.
-            bitSet.set(startIndex);
-          }
+    for (int startIndex = 0; startIndex < rowsInPage; startIndex++) {
+      if (!nullBitSet.get(startIndex)) {
+        // Check if filterValue[i] matches with measure Values.
+        Object msrValue = DataTypeUtil
+            .getMeasureObjectBasedOnDataType(columnPage, startIndex,
+                msrType, msrColumnEvaluatorInfo.getMeasure());
+
+        if (filterValuesSet.contains(msrValue)) {
 
 Review comment:
   I agree with @KanakaKumar current implementation is based on `SerializableComparator ` so it is better to use `TreeSet `  to use `compareTo` instead of 'hashcode' and 'equals' methods. `BigDecimal` behaviour is different for `equal` and `compareTo` methods. So better stick with `TreeSet` to continue the old behaviour rather than changing the behaviour.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services