-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Field::metadata to HashMap #3086
Comments
I'll pick this up. Edit: Anyone know why the field was Edit 2: I found atleast one reason why arrow-rs/arrow-schema/src/field.rs Lines 65 to 80 in 0139682
|
I am also having difficulty in removing Optional in below function arrow-rs/arrow-schema/src/field.rs Lines 133 to 138 in 0139682
I changed the function as below
and getting lot of compile errors in
|
That sounds like a compiler bug to me, I'd try a clean rebuild and see if it goes away. Regarding Ord, etc... I'm not entirely sure why they are implemented for Field... Perhaps this is something to understand before proceeding with this. Perhaps @alamb has some recollection? |
As I recall the reason it was initially implemented as a BTW if we are going to have all downstream consumers have to change their code, perhaps we can change this to |
What is the purpose of the Option? An empty HashMap doesn't cost anything? |
The Option was most likely purely out of convenience when deserialising to JSON for integration testing. The code was at at ime whenthe metadata was recently introduced (IIRC), so some tests had an empty metadata field in the JSON data while others had nothing. If integration tests continue to pass, I don't see a reason to keep it optional (perhaps there's a serde flag that can be used, not sure). And yes, we used |
I guess I assumed (though have not verified) that having to do |
What's the advantage of using |
I think if we need to keep cmp, it makes sense to continue to use BTreeMap. If you don't need ordering, HashMap is almost always faster. BTreeMap also has some API quirks, like its iterators aren't Send |
I think the |
Agreed, if these are important use cases we should stick with a BTreeMap. I am, however, unclear on the use-case for them |
I have created PR #3091 to remove |
I was wondering if there is a way to determine the impact of removing |
Nothing like a good old-fashioned scream test? i.e. remove them and see if anyone complains 😅 |
I removed
|
Aah yeah, the issue is that we want to provide |
|
|
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Currently Schema::metadata is
HashMap<String, String>
, whereas Field::metadata isOption<BTreeMap<String, String>>
. This is not only inconsistent, but it is unclear why there is an additionalOption
Describe the solution you'd like
I would like to change
Field::metadata
to aHashMap
for consistency with SchemaDescribe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: