You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/12/30 05:26:48 UTC

[GitHub] [arrow] mqy commented on a change in pull request #9025: ARROW-10259: [Rust] Add custom metadata to Field

mqy commented on a change in pull request #9025:
URL: https://github.com/apache/arrow/pull/9025#discussion_r549939736



##########
File path: rust/arrow/src/datatypes.rs
##########
@@ -22,6 +22,7 @@
 //!  * [`Field`](crate::datatypes::Field) to describe one field within a schema.
 //!  * [`DataType`](crate::datatypes::DataType) to describe the type of a field.
 
+use std::collections::BTreeMap;

Review comment:
       Copied from [rust doc std/collections](https://doc.rust-lang.org/std/collections/index.html):
   
   **`Use a HashMap when:**
   
   You want to associate arbitrary keys with an arbitrary value.
   You want a cache.
   You want a map, with no extra functionality.
   
   **Use a BTreeMap when:**
   
   You want a map sorted by its keys.
   You want to be able to get a range of entries on-demand.
   You're interested in what the smallest or largest key-value pair is.
   You want to find the largest or smallest key that is smaller or larger than something.`
   
   The only reason that use `BTreeMap` for `Field` is: don't break the `'Hash`, `PartialOrd`, `Ord`.
   I almost can't image any situation that will sort schemas, unless compare/sort a schema by versions.




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

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