Skip to content

Commit

Permalink
fix: add support for Long64_t (#2023)
Browse files Browse the repository at this point in the history
* fix: add test

* test: column of a Long64_t type

* test: check form of an output ak array

* fix: specialize type_to_name
  • Loading branch information
ianna authored Dec 21, 2022
1 parent b83d9dc commit 5c5b81e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
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")

0 comments on commit 5c5b81e

Please sign in to comment.