danielcweeks commented on code in PR #12139:
URL: https://github.com/apache/iceberg/pull/12139#discussion_r1941507423


##########
parquet/src/main/java/org/apache/iceberg/parquet/ParquetVariantReaders.java:
##########
@@ -0,0 +1,409 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.parquet;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import org.apache.commons.lang3.stream.Streams;
+import org.apache.iceberg.parquet.ParquetValueReaders.PrimitiveReader;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
+import org.apache.iceberg.relocated.com.google.common.collect.Iterables;
+import org.apache.iceberg.variants.ShreddedObject;
+import org.apache.iceberg.variants.Variant;
+import org.apache.iceberg.variants.VariantMetadata;
+import org.apache.iceberg.variants.VariantObject;
+import org.apache.iceberg.variants.VariantValue;
+import org.apache.iceberg.variants.Variants;
+import org.apache.iceberg.variants.Variants.PhysicalType;
+import org.apache.parquet.column.ColumnDescriptor;
+import org.apache.parquet.column.page.PageReadStore;
+
+public class ParquetVariantReaders {
+  private ParquetVariantReaders() {}
+
+  public interface VariantValueReader extends ParquetValueReader<VariantValue> 
{
+    @Override
+    default VariantValue read(VariantValue reuse) {
+      throw new UnsupportedOperationException("Variants must be read using 
read(VariantMetadata)");
+    }
+
+    /** Reads a variant value */
+    VariantValue read(VariantMetadata metadata);
+  }
+
+  private static final VariantValue MISSING = null;
+
+  @SuppressWarnings("unchecked")
+  public static ParquetValueReader<Variant> variant(
+      ParquetValueReader<?> metadata, ParquetValueReader<?> value) {
+    return new VariantReader(
+        (ParquetValueReader<VariantMetadata>) metadata, (VariantValueReader) 
value);
+  }
+
+  public static ParquetValueReader<VariantMetadata> metadata(ColumnDescriptor 
desc) {
+    return new VariantMetadataReader(desc);
+  }
+
+  public static VariantValueReader serialized(ColumnDescriptor desc) {
+    return new SerializedVariantReader(desc);
+  }
+
+  public static VariantValueReader shredded(
+      int valueDL,

Review Comment:
   why not use fully expanded name? DL isn't exactly clear if you don't already 
know what it's referring to.  Doesn't look like it would affect formatting 
either.



-- 
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