Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Aug 13, 2024
1 parent 3595744 commit dac8a77
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/awkward/contents/indexedoptionarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from awkward._layout import maybe_posaxis
from awkward._meta.indexedoptionmeta import IndexedOptionMeta
from awkward._nplikes.array_like import ArrayLike
from awkward._nplikes.cupy import Cupy
from awkward._nplikes.numpy import Numpy
from awkward._nplikes.numpy_like import IndexType, NumpyMetadata
from awkward._nplikes.placeholder import PlaceholderArray
Expand Down
8 changes: 6 additions & 2 deletions src/awkward/contents/recordarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,8 +1102,12 @@ def _to_arrow(
)

def _to_cudf(self, cudf: Any, mask: Content | None, length: int):
children = tuple(c._to_cudf(cudf, mask=None, length=length) for c in self.contents)
dt = cudf.core.dtypes.StructDtype({field: c.dtype for field, c in zip(self.fields, children)})
children = tuple(
c._to_cudf(cudf, mask=None, length=length) for c in self.contents
)
dt = cudf.core.dtypes.StructDtype(
{field: c.dtype for field, c in zip(self.fields, children)}
)
m = mask._to_cudf(cudf, None, length) if mask else None
return cudf.core.column.struct.StructColumn(
data=None,
Expand Down
12 changes: 9 additions & 3 deletions tests-cuda/test_3051_to_cuda.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
from __future__ import annotations

import pytest

import awkward as ak
Expand All @@ -15,10 +16,15 @@ def test_jagged():


def test_nested():
arr = ak.Array([{"a": 0, "b": 1., "c": {"d": 0}}, {"a": 1, "b": 0., "c": {"d": 1}}])
arr = ak.Array(
[{"a": 0, "b": 1.0, "c": {"d": 0}}, {"a": 1, "b": 0.0, "c": {"d": 1}}]
)
out = ak.to_cudf(arr)
assert isinstance(out, cudf.Series)
assert out.to_arrow().tolist() == [{"a": 0, "b": 1., "c": {"d": 0}}, {"a": 1, "b": 0., "c": {"d": 1}}]
assert out.to_arrow().tolist() == [
{"a": 0, "b": 1.0, "c": {"d": 0}},
{"a": 1, "b": 0.0, "c": {"d": 1}},
]


def test_null():
Expand Down

0 comments on commit dac8a77

Please sign in to comment.