Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangfu0 committed Apr 1, 2019
1 parent 04e6cfa commit 6f34c39
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ 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) {
Utils.rethrowException(e);
}
} else {
assert rawValue instanceof byte[];
bytes = (byte[]) rawValue;
}
return getDictId(new ByteArray(bytes), bytes);
}
Expand Down Expand Up @@ -113,8 +113,7 @@ public void index(@Nonnull Object rawValue) {
}

@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.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ 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) {
Utils.rethrowException(e);
}
} else {
assert rawValue instanceof byte[];
bytes = (byte[]) rawValue;
}
return getDictId(new ByteArray(bytes));
}
Expand Down Expand Up @@ -81,8 +82,7 @@ public void index(@Nonnull Object rawValue) {
}

@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.");
}
Expand Down

0 comments on commit 6f34c39

Please sign in to comment.