You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ri...@apache.org on 2023/01/01 22:57:02 UTC

[pinot] 01/01: bytes dictionaries don't work with variable length byte[]s

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 8ad3adb0f31179ec426ca8b77685708c398ee03e
Author: Richard Startin <ri...@apache.org>
AuthorDate: Sun Jan 1 22:56:45 2023 +0000

    bytes dictionaries don't work with variable length byte[]s
---
 .../segment/local/segment/index/readers/ImmutableDictionaryTest.java   | 3 ++-
 1 file changed, 2 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..bc00057eae 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));
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org