Skip to content

Wrong interatction of FromNumpy and Snapshot #20291

@martinfoell

Description

@martinfoell

Check duplicate issues.

  • Checked for duplicates

Description

Taking a Snapshot of a dataframe with FromNumpy only works if a new column is created using Define where all the Numpy arrays passed to FromNumpy are used as inputs to the new column. Performing a Snapshot of the dataframe directly, without creating a new column, or creating a new column that does not use all the dataframe columns as inputs results in a segmentation fault. The python script in the reproducer illustrates the three cases described above.

Reproducer

import ROOT
import numpy

x, y = numpy.array([1, 2, 3]), numpy.array([4, 5, 6])
df = ROOT.RDF.FromNumpy({"x": x, "y": y})
 
# Uncomment one of the lines below to test the three different cases from the description

df.Define("z", "x + y").Snapshot("tree", "file.root") # this works
# df.Define("z", "2 * x").Snapshot("tree", "file.root") # gives a segmentation violation
# df.Snapshot("tree", "file.root") # gives a segmentation violation

ROOT version

Any

Installation method

Any

Operating system

Any

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions