apache / apache/arrow

[Python] discrepancy of of schema and schema.metadata if second same-name key is byte-encoded

Open
#32,870 0 comments 0 reactions 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

```python

schema = pa.schema(
[('col1', pa.int8())],
metadata={
'key': 'key provided as string',
b'key': 'key provided as bytes'
}
)
print(schema)
# col1: int8
# -- schema metadata --
# key: 'key provided as string'
# key: 'key provided as bytes'
print(schema.metadata)
# {b'key': b'key provided as string'}
```

**Reporter**: [Chris](https://issues.apache.org/jira/browse/ARROW-17626)
#### Original Issue Attachments:
- [pa_bug.py](https://issues.apache.org/jira/secure/attachment/13048995/pa_bug.py)

**Note**: *This issue was originally created as [ARROW-17626](https://issues.apache.org/jira/browse/ARROW-17626). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

Contributor guide

Open the contributing guide

Research direction

Start with the attached pa_bug.py reproducer and the pa.schema entry point. Compare how mixed string and byte keys are represented in the printed schema and in schema.metadata, then identify the expected consistent behavior. Done means the discrepancy is resolved and the reproducer is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.