Fokko commented on code in PR #3370:
URL: https://github.com/apache/parquet-java/pull/3370#discussion_r2631816434


##########
parquet-column/src/main/java/org/apache/parquet/column/values/dictionary/PlainValuesDictionary.java:
##########
@@ -300,4 +301,46 @@ public int getMaxId() {
       return floatDictionaryContent.length - 1;
     }
   }
+
+  /**
+   * a simple implementation of dictionary for plain encoded boolean values
+   */
+  public static class PlainBooleanDictionary extends PlainValuesDictionary {
+
+    private final boolean[] boolDictionaryContent;
+
+    /**
+     * @param dictionaryPage a dictionary page of encoded boolean values
+     * @throws IOException if there is an exception while decoding the 
dictionary page
+     */
+    public PlainBooleanDictionary(DictionaryPage dictionaryPage) throws 
IOException {
+      super(dictionaryPage);
+      ByteBufferInputStream in = dictionaryPage.getBytes().toInputStream();
+      boolDictionaryContent = new boolean[dictionaryPage.getDictionarySize()];
+      BooleanPlainValuesReader boolReader = new BooleanPlainValuesReader();
+      boolReader.initFromPage(dictionaryPage.getDictionarySize(), in);
+      for (int i = 0; i < boolDictionaryContent.length; i++) {
+        boolDictionaryContent[i] = boolReader.readBoolean();
+      }
+    }
+
+    @Override
+    public boolean decodeToBoolean(int id) {
+      return boolDictionaryContent[id];
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("PlainIntegerDictionary {\n");

Review Comment:
   Copy paste, thanks 👍 😁 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to