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

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


The following commit(s) were added to refs/heads/hex_string_for_byte_array by 
this push:
     new eac1351  Address comments
eac1351 is described below

commit eac135187c8ed61bc4df8ba24a8fc18130f5d9b0
Author: Xiang Fu <[email protected]>
AuthorDate: Mon Apr 1 10:32:31 2019 -0700

    Address comments
---
 .../impl/dictionary/BytesOffHeapMutableDictionary.java        | 11 +++++------
 .../impl/dictionary/BytesOnHeapMutableDictionary.java         |  8 ++++----
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git 
a/pinot-core/src/main/java/org/apache/pinot/core/realtime/impl/dictionary/BytesOffHeapMutableDictionary.java
 
b/pinot-core/src/main/java/org/apache/pinot/core/realtime/impl/dictionary/BytesOffHeapMutableDictionary.java
index 16ca1ce..5220749 100644
--- 
a/pinot-core/src/main/java/org/apache/pinot/core/realtime/impl/dictionary/BytesOffHeapMutableDictionary.java
+++ 
b/pinot-core/src/main/java/org/apache/pinot/core/realtime/impl/dictionary/BytesOffHeapMutableDictionary.java
@@ -51,15 +51,16 @@ public class BytesOffHeapMutableDictionary extends 
BaseOffHeapMutableDictionary
   public BytesOffHeapMutableDictionary(int estimatedCardinality, int 
maxOverflowHashSize,
       PinotDataBufferMemoryManager memoryManager, String allocationContext, 
int avgLength) {
     super(estimatedCardinality, maxOverflowHashSize, memoryManager, 
allocationContext);
-    _byteStore = new MutableOffHeapByteArrayStore(memoryManager, 
allocationContext,
-        estimatedCardinality, avgLength);
+    _byteStore = new MutableOffHeapByteArrayStore(memoryManager, 
allocationContext, estimatedCardinality, avgLength);
   }
 
   @Override
   public int indexOf(Object rawValue) {
     byte[] bytes = null;
     // Convert hex string to byte[].
-    if (rawValue instanceof String) {
+    if (rawValue instanceof byte[]) {
+      bytes = (byte[]) rawValue;
+    } else if (rawValue instanceof String) {
       try {
         bytes = Hex.decodeHex(((String) rawValue).toCharArray());
       } catch (DecoderException e) {
@@ -67,7 +68,6 @@ public class BytesOffHeapMutableDictionary extends 
BaseOffHeapMutableDictionary
       }
     } else {
       assert rawValue instanceof byte[];
-      bytes = (byte[]) rawValue;
     }
     return getDictId(new ByteArray(bytes), bytes);
   }
@@ -113,8 +113,7 @@ public class BytesOffHeapMutableDictionary extends 
BaseOffHeapMutableDictionary
   }
 
   @Override
-  public boolean inRange(@Nonnull String lower, @Nonnull String upper, int 
dictIdToCompare,
-      boolean includeLower,
+  public boolean inRange(@Nonnull String lower, @Nonnull String upper, int 
dictIdToCompare, boolean includeLower,
       boolean includeUpper) {
     throw new UnsupportedOperationException("In-range not supported for Bytes 
data type.");
   }
diff --git 
a/pinot-core/src/main/java/org/apache/pinot/core/realtime/impl/dictionary/BytesOnHeapMutableDictionary.java
 
b/pinot-core/src/main/java/org/apache/pinot/core/realtime/impl/dictionary/BytesOnHeapMutableDictionary.java
index 91f51b2..37236c3 100644
--- 
a/pinot-core/src/main/java/org/apache/pinot/core/realtime/impl/dictionary/BytesOnHeapMutableDictionary.java
+++ 
b/pinot-core/src/main/java/org/apache/pinot/core/realtime/impl/dictionary/BytesOnHeapMutableDictionary.java
@@ -38,7 +38,9 @@ public class BytesOnHeapMutableDictionary extends 
BaseOnHeapMutableDictionary {
   public int indexOf(Object rawValue) {
     byte[] bytes = null;
     // Convert hex string to byte[].
-    if (rawValue instanceof String) {
+    if (rawValue instanceof byte[]) {
+      bytes = (byte[]) rawValue;
+    } else if (rawValue instanceof String) {
       try {
         bytes = Hex.decodeHex(((String) rawValue).toCharArray());
       } catch (DecoderException e) {
@@ -46,7 +48,6 @@ public class BytesOnHeapMutableDictionary extends 
BaseOnHeapMutableDictionary {
       }
     } else {
       assert rawValue instanceof byte[];
-      bytes = (byte[]) rawValue;
     }
     return getDictId(new ByteArray(bytes));
   }
@@ -81,8 +82,7 @@ public class BytesOnHeapMutableDictionary extends 
BaseOnHeapMutableDictionary {
   }
 
   @Override
-  public boolean inRange(@Nonnull String lower, @Nonnull String upper, int 
dictIdToCompare,
-      boolean includeLower,
+  public boolean inRange(@Nonnull String lower, @Nonnull String upper, int 
dictIdToCompare, boolean includeLower,
       boolean includeUpper) {
     throw new UnsupportedOperationException("In-range not supported for Bytes 
data type.");
   }


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

Reply via email to