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


##########
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:
   Seems fine. Especially since sortedness only matters if there are enough 
field names that binary search beats linear search (which usually starts around 
10-20 entries).



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