Skip to content

RNTuple variant fields repeat the first cluster's values when reading several clusters #1815

Closed

Description

@ariostas

🤖 AI text below 🤖

When an RNTuple has a variant (union) field and more than one cluster, reading all entries returns the first cluster's values again for each later cluster. The values are written correctly: reading from the start of the second cluster returns the right data.

import awkward as ak
import uproot

with uproot.recreate("var.root") as f:
    f["n"] = {"x": ak.Array([[1], "a"]), "y": [1, 2]}
    f["n"].extend({"x": ak.Array([[4], "b"]), "y": [3, 4]})

n = uproot.open("var.root")["n"]
print(n.arrays().tolist())
# [{'x': [1], 'y': 1}, {'x': 'a', 'y': 2}, {'x': [1], 'y': 3}, {'x': 'a', 'y': 4}]
# expected x: [1], 'a', [4], 'b'

print(n.arrays(entry_start=2).x.tolist())
# [[4], 'b']  (correct)

The non-variant field y reads correctly across both clusters, so the problem seems specific to how variant fields are put together when a read spans several clusters. The cause is probably the switch (tag/index) column, e.g. indices that are per-cluster not being offset when clusters are concatenated.

Found with main (5993d2a) and awkward 2.11.0, while reviewing #1812.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions