rdblue commented on code in PR #3221:
URL: https://github.com/apache/parquet-java/pull/3221#discussion_r2130615441
##########
parquet-variant/src/main/java/org/apache/parquet/variant/VariantUtil.java:
##########
@@ -848,4 +848,73 @@ static HashMap<String, Integer> getMetadataMap(ByteBuffer
metadata) {
}
return result;
}
+
+ /**
+ * Computes the actual size (in bytes) of the Variant value at
`value[pos...]`
+ * @param value The Variant value
+ * @return The size (in bytes) of the Variant value
+ */
+ public static int valueSize(ByteBuffer value) {
+ int pos = value.position();
+ checkIndex(pos, value.limit());
+ int basicType = value.get(pos) & BASIC_TYPE_MASK;
+ int typeInfo = (value.get(pos) >> BASIC_TYPE_BITS) & PRIMITIVE_TYPE_MASK;
+ switch (basicType) {
Review Comment:
The logic in this function look correct to me. It may be helpful to note in
a comment that the size includes the header byte.
--
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]