TuringLang / TuringLang/DynamicPPL.jl

Merge of two VNTs can drop results when one contains a PartialArray and the other a full Array

Open
#1,245 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

data-structures enhancement
Dominant language
Julia
Stars
286
Forks
41
Avg merge
1d 11h
Merged PRs (30d)
34

Description

julia> vnt1 = @vnt begin x = [1.0, 2.0] end
VarNamedTuple
└─ x => [1.0, 2.0]

julia> vnt2 = @vnt begin
           @template x = zeros(2)
           x[1] = 3.0
       end
VarNamedTuple
└─ x => PartialArray size=(2,) data::Vector{Float64}
        └─ (1,) => 3.0

julia> merge(vnt1, vnt2)
VarNamedTuple
└─ x => PartialArray size=(2,) data::Vector{Float64}
        └─ (1,) => 3.0

It is a bit unintuitive that x[2] is dropped here. This happens because merge can't line the two up: it just thinks "okay, one is a PA and one is an array and they're different things, so I'll just overwrite the first one". I don't really know what the solution to this is.

Contributor guide

Open the contributing guide

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 example with @vnt, PartialArray, full arrays, and merge, then inspect the merge implementation and how these values represent indexed data. Done means merging the shown VNTs preserves both x[1] and x[2], with coverage for the behavior added where the existing merge tests live.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.