rdblue commented on code in PR #3221:
URL: https://github.com/apache/parquet-java/pull/3221#discussion_r2155706277


##########
parquet-variant/src/main/java/org/apache/parquet/variant/VariantValueWriter.java:
##########
@@ -0,0 +1,310 @@
+/*
+ * 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.parquet.variant;
+
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import org.apache.parquet.io.api.Binary;
+import org.apache.parquet.io.api.RecordConsumer;
+import org.apache.parquet.schema.GroupType;
+import org.apache.parquet.schema.LogicalTypeAnnotation;
+import org.apache.parquet.schema.PrimitiveType;
+import org.apache.parquet.schema.Type;
+
+/**
+ * Class to write Variant values to a shredded schema.
+ */
+public class VariantValueWriter {
+  // We store a reference to the metdata so that we can lazily build 
metadataMap if needed.
+  // It could be relatively expensive to build, and if everything shreds 
perfectly, we won't need it.

Review Comment:
   If I understand correctly, you're saying that this is avoiding 
_deserializing_ the object's metadata. The metadata may need to be read into a 
map in order to re-encode the residual object. I think that makes sense.
   
   The residual object is a strict subset of the original object's fields (just 
the remaining unshredded ones) so the residual's fields will be in the same 
order as the original and will use the same IDs because the metadata doesn't 
change. But the API for actually building the residual object uses the field 
names rather than static IDs. So you can either build the residual with the 
normal API or you could have a special case in the builder where the caller is 
responsible for supplying the IDs instead of names. I wouldn't bother with that 
optimization in this version.



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