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


##########
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:
   On the other hand... why do the extra work to check for `is_empty`? The 
`is_sorted` will return a correct result either way.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to