JuliaCollections / JuliaCollections/DataStructures.jl

Merge on DefaultOrderedDicts should call the ordered merge function

Open
#758 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Julia
Stars
745
Forks
261
PR merge metrics
No merged PRs in 30d

Description

julia> d = DefaultOrderedDict{String, Vector{UInt16}}(Vector{UInt16});

julia> d2 = DefaultOrderedDict{String, Vector{UInt16}}(Vector{UInt16});

julia> @which merge(d, d2)
merge(d::AbstractDict, others::AbstractDict...) in Base at abstractdict.jl:311

julia> @which merge(OrderedDict(d), OrderedDict(d2))
merge(d::OrderedDict, others::AbstractDict...) in OrderedCollections at /home/tlnagy/.julia/packages/OrderedCollections/PRayh/src/ordered_dict.jl:466

Because the regular dict merge function is called the order is lost when merging two DefaultOrderedDicts.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the two DefaultOrderedDict examples and inspect the merge dispatch shown by @which. Compare it with the OrderedDict merge implementation in ordered_dict.jl; done means merging DefaultOrderedDicts preserves their order instead of using the regular dict merge.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.