Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add support for Long64_t #2023

Merged
merged 4 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions header-only/awkward/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ namespace awkward {
return "int64";
}

/// @brief Returns `int64` string when the primitive type
/// is a 64-bit signed integer.
template <>
const std::string
type_to_name<Long64_t>() {
return "int64";
}

/// @brief Returns `uint8` string when the primitive type
/// is an 8-bit unsigned integer.
template <>
Expand Down
24 changes: 24 additions & 0 deletions tests/test_2023-from-rdataframe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE

import numpy as np # noqa: F401
import pytest

import awkward as ak
import awkward._connect.cling
import awkward._lookup

ROOT = pytest.importorskip("ROOT")


compiler = ROOT.gInterpreter.Declare


def test_rdf_column_of_Long64_t_type():
data_frame = ROOT.RDataFrame(10).Define("x", "(Long64_t)(gRandom->Rndm()*1000.)")
assert data_frame.GetColumnType("x") == "Long64_t"

ak_array = ak.from_rdataframe(
data_frame,
columns="x",
)
assert ak_array.layout.form == ak.forms.NumpyForm("int64")