rdblue commented on code in PR #12512:
URL: https://github.com/apache/iceberg/pull/12512#discussion_r2060849017


##########
parquet/src/main/java/org/apache/iceberg/parquet/ParquetVariantReaders.java:
##########
@@ -332,6 +341,57 @@ public void setPageSource(PageReadStore pageStore) {
     }
   }
 
+  private static class ArrayReader implements VariantValueReader {
+    private final int definitionLevel;
+    private final int repetitionLevel;
+    private final VariantValueReader reader;
+    private final TripleIterator<?> column;
+    private final List<TripleIterator<?>> children;
+
+    protected ArrayReader(int definitionLevel, int repetitionLevel, 
VariantValueReader reader) {
+      this.definitionLevel = definitionLevel;
+      this.repetitionLevel = repetitionLevel;
+      this.reader = reader;
+      this.column = reader.column();
+      this.children = reader.columns();
+    }
+
+    @Override
+    public void setPageSource(PageReadStore pageStore) {
+      reader.setPageSource(pageStore);
+    }
+
+    @Override
+    public ValueArray read(VariantMetadata metadata) {
+      ValueArray arr = Variants.array();
+      do {
+        if (column.currentDefinitionLevel() > definitionLevel) {
+          arr.add(reader.read(metadata));

Review Comment:
   I think this is where you need to fix the incorrect test case. This should 
be:
   
   ```java
   VariantValue value = reader.read(metadata);
   arr.add(value != null ? value : Variants.ofNull());
   ```



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to