This is an automated email from the ASF dual-hosted git repository. richardstartin pushed a commit to branch broken-bytesdictionary in repository https://gitbox.apache.org/repos/asf/pinot.git
commit 8fc1bbf79212691c4dbd12092557a4c20bfccb2e Author: Richard Startin <richardstar...@apache.org> AuthorDate: Sun Jan 1 22:56:45 2023 +0000 bytes dictionaries don't work with variable length byte[]s --- .../local/segment/index/readers/ImmutableDictionaryTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/readers/ImmutableDictionaryTest.java b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/readers/ImmutableDictionaryTest.java index 4344e39970..3979455abb 100644 --- a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/readers/ImmutableDictionaryTest.java +++ b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/segment/index/readers/ImmutableDictionaryTest.java @@ -124,7 +124,8 @@ public class ImmutableDictionaryTest { Set<ByteArray> bytesSet = new HashSet<>(); while (bytesSet.size() < NUM_VALUES) { - byte[] bytes = new byte[BYTES_LENGTH]; + // ensure that at least one array with BYTES_LENGTH makes it into the set + byte[] bytes = new byte[bytesSet.isEmpty() ? BYTES_LENGTH : RANDOM.nextInt(BYTES_LENGTH)]; RANDOM.nextBytes(bytes); bytesSet.add(new ByteArray(bytes)); } @@ -411,6 +412,9 @@ public class ImmutableDictionaryTest { private void testBytesDictionary(BaseImmutableDictionary bytesDictionary) { for (int i = 0; i < NUM_VALUES; i++) { + // passes + assertEquals(bytesDictionary.get(i), Arrays.copyOf(_bytesValues[i].getBytes(), BYTES_LENGTH)); + // fails assertEquals(bytesDictionary.get(i), _bytesValues[i].getBytes()); assertEquals(bytesDictionary.getStringValue(i), _bytesValues[i].toHexString()); assertEquals(bytesDictionary.getBytesValue(i), _bytesValues[i].getBytes()); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org