Skip to content

fix: transient attrs should not be written to parquet#4209

Merged
ianna merged 4 commits into
scikit-hep:mainfrom
ikrommyd:fix-transient-attrs-parquet
Jul 20, 2026
Merged

fix: transient attrs should not be written to parquet#4209
ianna merged 4 commits into
scikit-hep:mainfrom
ikrommyd:fix-transient-attrs-parquet

Conversation

@ikrommyd

@ikrommyd ikrommyd commented Jul 20, 2026

Copy link
Copy Markdown
Member

#4079 introduced attrs serialization to parquet. However, transient attrs should not be serialized. Users are seeing errors writing root files loaded with coffea to disk. This fails with awkward 2.10.0

from coffea.nanoevents import NanoEventsFactory
import awkward as ak

file = "foo.root"
events = NanoEventsFactory.from_root(
file, treepath="Events").events()
ak.to_parquet(events.Jet.pt, "pt.parquet")

with

TypeError: Object of type NanoEventsFactory is not JSON serializable
when serializing dict item '@events_factory'

This error occurred while calling

    ak.to_parquet(
        <Array [[89.9, 41, ..., 16.6, 16], ...] type='146910 * var * float3...'>
        'pt.parquet'
    )

A patch release is needed ASAP as users cannot write to parquet in all analysis frameworks if they use awkward 2.10.0.

Signed-off-by: Iason Krommydas <iason.krom@gmail.com>
@ikrommyd ikrommyd changed the title fix: transient attrs should be written to parquet fix: transient attrs should not be written to parquet Jul 20, 2026
@github-actions github-actions Bot added the type/fix PR title type: fix (set automatically) label Jul 20, 2026
ianna
ianna previously approved these changes Jul 20, 2026

@ianna ianna left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general we almost certainly do not want to save transient attributes to Parquet.

@ianna
ianna enabled auto-merge (squash) July 20, 2026 15:48
ariostas
ariostas previously approved these changes Jul 20, 2026

@ariostas ariostas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @ikrommyd!

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.97%. Comparing base (d24404d) to head (b356fd8).

Additional details and impacted files
Files with missing lines Coverage Δ
src/awkward/operations/ak_from_parquet.py 94.01% <100.00%> (ø)
src/awkward/operations/ak_to_parquet.py 68.21% <100.00%> (+0.42%) ⬆️

@ianna ianna added the pr-next-release Required for the next release label Jul 20, 2026
@TaiSakuma

Copy link
Copy Markdown
Member

Can we manually start the integration test when this is merged?

@ikrommyd

Copy link
Copy Markdown
Member Author

The integration tests did not catch this. A user did

auto-merge was automatically disabled July 20, 2026 16:04

Head branch was pushed to by a user without write access

@TaiSakuma

Copy link
Copy Markdown
Member

I see. Can we still run the integration test? I'll make a release from a commit that passes the nightly tests.

@ikrommyd
ikrommyd dismissed stale reviews from ariostas and ianna via 4e5016e July 20, 2026 16:04
@ikrommyd

Copy link
Copy Markdown
Member Author

Claude noticed that table.schema.metadata can be None so I fixed that too here just in case

Comment thread src/awkward/operations/ak_to_parquet.py Outdated
Comment thread src/awkward/operations/ak_to_parquet.py Outdated
Comment thread src/awkward/operations/ak_from_parquet.py
Comment thread src/awkward/operations/ak_from_parquet.py

@ianna ianna left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ikrommyd - great! All looks good. I'll enable auto-merge so that it makes in to a release asap.

@ianna
ianna enabled auto-merge (squash) July 20, 2026 16:37
@ikrommyd

ikrommyd commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

I plan to make a follow-up which has nothing to do with the fix to enable attrs writing when one uses to_parquet_row_groups too. In that case the attrs willk be picked up from the first array in the same way the schema is created from the first array

@ikrommyd

ikrommyd commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

I see. Can we still run the integration test? I'll make a release from a commit that passes the nightly tests.

@TaiSakuma I did not notice this and yes the answer is we can. A CI can always be started manually.

@TaiSakuma

Copy link
Copy Markdown
Member

@ikrommyd - That is great. Can we run it when this is merged? Or should #4210 be released together?

@ikrommyd

ikrommyd commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

I mean I don't really care. The release can be tomorrow. #4210 is also ready and just needs a rebase after this one is merged. So if you want to put it in too that's cool. The bottleneck is the GPU CI here.

@ianna
ianna merged commit dec5d75 into scikit-hep:main Jul 20, 2026
38 checks passed
@github-actions

Copy link
Copy Markdown

The documentation preview is ready to be viewed at http://preview.awkward-array.org.s3-website.us-east-1.amazonaws.com/PR4209

@ikrommyd
ikrommyd deleted the fix-transient-attrs-parquet branch July 20, 2026 19:02
@ikrommyd

Copy link
Copy Markdown
Member Author

https://github.com/scikit-hep/integration-tests/actions/runs/29772491297 @TaiSakuma so either review and merge the other PR or don't. I'm fine either way. It just fits adding it now as it deals with parquet attrs.

@TaiSakuma

Copy link
Copy Markdown
Member

I confirmed this passed the nightly integration test and the two nightly property tests (all manually started).
This is in v2.11.0.

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

Labels

pr-next-release Required for the next release type/fix PR title type: fix (set automatically)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants