sdf-jkl commented on code in PR #11961:
URL: https://github.com/apache/arrow-rs/pull/11961#discussion_r4413119590
##########
parquet-variant/src/variant/metadata.rs:
##########
@@ -32,9 +32,13 @@ pub(crate) struct VariantMetadataHeader {
offset_size: OffsetSizeBytes,
}
-// According to the spec this is currently always = 1, and so we store this
const for validation
-// purposes and to make that visible.
-const CORRECT_VERSION_VALUE: u8 = 1;
+/// The version of the Variant specification implemented by this crate.
+///
+/// The spec currently defines only version 1. It appears in two places on
+/// disk: the 4-bit version field of every metadata header, and the
+/// `specification_version` of the Parquet `VARIANT` logical type annotation.
+/// Both must carry this value.
+pub const VARIANT_SPEC_VERSION: u8 = 1;
Review Comment:
`WritableMetadataBuilder::finish` still writes `0x01`, and
`EMPTY_VARIANT_METADATA_BYTES` still starts with a literal `1`.
Suggested changes:
```diff
diff --git a/parquet-variant/src/builder/metadata.rs
b/parquet-variant/src/builder/metadata.rs
--- a/parquet-variant/src/builder/metadata.rs
+++ b/parquet-variant/src/builder/metadata.rs
@@ -23,1 +23,1 @@
-use crate::{VariantMetadata, int_size};
+use crate::{VARIANT_SPEC_VERSION, VariantMetadata, int_size};
@@ -231,1 +231,3 @@
- metadata_buffer.push(0x01 | ((is_sorted as u8) << 4) |
((offset_size - 1) << 6));
+ metadata_buffer.push(
+ VARIANT_SPEC_VERSION | ((is_sorted as u8) << 4) | ((offset_size
- 1) << 6),
+ );
diff --git a/parquet-variant/src/variant/metadata.rs
b/parquet-variant/src/variant/metadata.rs
--- a/parquet-variant/src/variant/metadata.rs
+++ b/parquet-variant/src/variant/metadata.rs
@@ -162,1 +162,1 @@
-pub const EMPTY_VARIANT_METADATA_BYTES: &[u8] = &[1, 0, 0];
+pub const EMPTY_VARIANT_METADATA_BYTES: &[u8] = &[VARIANT_SPEC_VERSION, 0,
0];
```
--
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]