cashmand commented on code in PR #3212:
URL: https://github.com/apache/parquet-java/pull/3212#discussion_r2080322307
##########
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:
We could check if fixed metadata is used, although it is a bit messy because
the nested object/array builders would need to bubble the question up to the
root VariantBuilder every time.
I could make it a bit cleaner by changing the builder to store a pointer to
the root builder (possibly itself). I think this is better than the current
approach of storing the parent in the object/array builders, since those
builder actually always want the root builder, not the parent.
--
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]