This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 6eb8e79  Fixing type casting issue for BYTES type values during 
realtime segment persistence (#3992)
6eb8e79 is described below

commit 6eb8e7976499b43a5588e26c194e09d48ebca232
Author: Xiang Fu <[email protected]>
AuthorDate: Wed Mar 20 13:28:37 2019 -0700

    Fixing type casting issue for BYTES type values during realtime segment 
persistence (#3992)
---
 .../converter/stats/RealtimeColumnStatistics.java    | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git 
a/pinot-core/src/main/java/org/apache/pinot/core/realtime/converter/stats/RealtimeColumnStatistics.java
 
b/pinot-core/src/main/java/org/apache/pinot/core/realtime/converter/stats/RealtimeColumnStatistics.java
index 714a0a9..860d569 100644
--- 
a/pinot-core/src/main/java/org/apache/pinot/core/realtime/converter/stats/RealtimeColumnStatistics.java
+++ 
b/pinot-core/src/main/java/org/apache/pinot/core/realtime/converter/stats/RealtimeColumnStatistics.java
@@ -22,6 +22,7 @@ import java.util.HashSet;
 import java.util.Set;
 import org.apache.pinot.common.config.ColumnPartitionConfig;
 import org.apache.pinot.common.data.FieldSpec;
+import org.apache.pinot.common.utils.primitive.ByteArray;
 import org.apache.pinot.core.common.Block;
 import org.apache.pinot.core.common.BlockMultiValIterator;
 import org.apache.pinot.core.data.partition.PartitionFunction;
@@ -150,17 +151,24 @@ public class RealtimeColumnStatistics implements 
ColumnStatistics {
 
     int docIdIndex = _sortedDocIdIterationOrder != null ? 
_sortedDocIdIterationOrder[0] : 0;
     int dictionaryId = singleValueReader.getInt(docIdIndex);
-    Comparable previousValue = (Comparable) 
_dictionaryReader.get(dictionaryId);
+    Object previousValue = _dictionaryReader.get(dictionaryId);
     for (int i = 1; i < blockLength; i++) {
       docIdIndex = _sortedDocIdIterationOrder != null ? 
_sortedDocIdIterationOrder[i] : i;
       dictionaryId = singleValueReader.getInt(docIdIndex);
-      Comparable currentValue = (Comparable) 
_dictionaryReader.get(dictionaryId);
+      Object currentValue = _dictionaryReader.get(dictionaryId);
       // If previousValue is greater than currentValue
-      if (0 < previousValue.compareTo(currentValue)) {
-        return false;
-      } else {
-        previousValue = currentValue;
+      switch (_block.getMetadata().getDataType().getStoredType()) {
+        case BYTES:
+          if (0 < ByteArray.compare((byte[]) previousValue, (byte[]) 
currentValue)) {
+            return false;
+          }
+          break;
+        default:
+          if (0 < ((Comparable) previousValue).compareTo(currentValue)) {
+            return false;
+          }
       }
+      previousValue = currentValue;
     }
 
     return true;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to