apache / apache/arrow

[Python] Bug in pyarrow.Table.rename_columns in win32 when passing dict ?

Open
#47,562 0 comments 1 reaction 0 assignees View on GitHub
Component: Python Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

I have a test case that fails only on Win32 build (works on Linux / Mac). Code that fails:

```python
table = pa.Table.from_pydict(
{
"A": [1, 3, 1],
"B": [2, 4, 2],
}
)
prefix = "col_"
expected = pa.Table.from_pydict(
{
f"{prefix}A": [1, 3, 1],
f"{prefix}B": [2, 4, 2],
}
)
# OK when passing a list to rename_columns
self.assertEqual(
table.rename_columns([f"{prefix}{k}" for k in table.column_names]), expected
)

# KO when passing a dict to rename_columns (only in Windows)
self.assertEqual(
table.rename_columns({k: f"{prefix}{k}" for k in table.column_names}),
expected,
)
```

pyarrow version used is: 18.0.0

### Component(s)

Python

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.