friendlymatthew commented on code in PR #7833:
URL: https://github.com/apache/arrow-rs/pull/7833#discussion_r2176125328


##########
parquet-variant/src/builder.rs:
##########
@@ -233,29 +233,38 @@ impl ValueBuffer {
 
 #[derive(Default)]
 struct MetadataBuilder {
-    field_name_to_id: BTreeMap<String, u32>,
-    field_names: Vec<String>,
+    // Field names -- field_ids are assigned in insert order
+    field_names: IndexSet<String>,
 }
 
 impl MetadataBuilder {
+    /// Pre-populates the list of field names
+    fn from_field_names(field_name: &[&str]) -> Self {
+        Self {
+            field_names: IndexSet::from_iter(field_name.iter().map(|f| 
f.to_string())),
+        }
+    }
+
+    /// Checks whether field names by insertion order is lexicographically 
sorted
+    fn is_sorted(&self) -> bool {
+        !self.field_names.is_empty() && self.field_names.iter().is_sorted()

Review Comment:
   If there are no field names in the variant, we'll mark it as not sorted. 
   
   The spec leaves this pretty ambiguous..



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

Reply via email to