cashmand commented on code in PR #3212:
URL: https://github.com/apache/parquet-java/pull/3212#discussion_r2080355070


##########
parquet-variant/src/main/java/org/apache/parquet/variant/VariantBuilder.java:
##########
@@ -101,6 +132,32 @@ public Variant build() {
     return new Variant(Arrays.copyOfRange(writeBuffer, 0, writePos), metadata);
   }
 
+  // This is used in the shredded reader to check if anything has been written 
to the Variant since the last call.
+  // Tracking in the reader code is a bit awkward, but maybe better than 
polluting this interface.
+  int getWritePos() {
+    return writePos;
+  }
+
+  /**
+   * @return the constructed Variant value binary, without metadata.
+   */
+  public byte[] valueWithoutMetadata() {
+    return Arrays.copyOfRange(writeBuffer, 0, writePos);
+  }
+
+  /**
+   * Directly append a Variant value. Its keys must already be in the metadata
+   * dictionary.
+   */
+  void shallowAppendVariant(Binary value) {

Review Comment:
   I switched to storing a `rootBuilder` field in VariantBuilder instead of a 
parent in each child, so that I can add this check. I think it's a mild 
improvement regardless of this check, but let me know what you think: 
https://github.com/apache/parquet-java/pull/3212/commits/dffa73c2114b75a873031b319e2202ad6900a3d9.
 cc @gene-db 



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