steveloughran commented on code in PR #3481:
URL: https://github.com/apache/parquet-java/pull/3481#discussion_r3250544871


##########
parquet-variant/src/main/java/org/apache/parquet/variant/Variant.java:
##########
@@ -67,6 +87,26 @@ public Variant(ByteBuffer value, ByteBuffer metadata) {
           "Unsupported variant metadata version: %d",
           metadata.get(metadata.position()) & VariantUtil.VERSION_MASK));
     }
+
+    // Pre-compute dictionary size for lazy metadata cache allocation.
+    int pos = this.metadata.position();
+    int metaOffsetSize = ((this.metadata.get(pos) >> 6) & 0x3) + 1;
+    if (this.metadata.remaining() > 1) {
+      this.dictSize = VariantUtil.readUnsigned(this.metadata, pos + 1, 
metaOffsetSize);
+    } else {
+      this.dictSize = 0;

Review Comment:
   some tests do create empty variants, it is needed



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