Skip to content

[Data] from_arrow_refs converts an empty table with one column into an empty table with zero columns #59946

@danking

Description

@danking

What happened + What you expected to happen

I expected the following assertion to succeed but indeed pd.columns contains no columns. Do I misunderstand something about Ray's dataframe model?

import pyarrow as pa
import ray

empty_array = pa.array([], pa.int32())
empty_ref = ray.put(pa.table([empty_array], ["apples"]))
rd = ray.data.from_arrow_refs([empty_ref])
pd = rd.to_pandas()
assert list(pd.columns) == ["apples"], list(pd.columns)

Versions / Dependencies

Ray 2.53.0
Python 3.13.7
uv 0.9.16 (Homebrew 2025-12-06)
# uname -a
Darwin MacBook-Pro.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:55 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6031 arm64

Reproduction script

import pyarrow as pa
import ray

empty_array = pa.array([], pa.int32())
empty_ref = ray.put(pa.table([empty_array], ["apples"]))
rd = ray.data.from_arrow_refs([empty_ref])
pd = rd.to_pandas()
assert list(pd.columns) == ["apples"], list(pd.columns)

Issue Severity

Medium: It is a significant difficulty but I can work around it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that is supposed to be working; but isn'tcommunity-backlogdataRay Data-related issuesquestionJust a question :)stabilitytriageNeeds triage (eg: priority, bug/not-bug, and owning component)usability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions