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


##########
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) {
+    onAppend();
+    int size = value.length();
+    checkCapacity(size);
+    byte[] buf = value.getBytes();

Review Comment:
   Better to get a byte buffer here so that this doesn't result in 2 copies.



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