Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use indexmap to preserve insertion order of python arrays #82

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

kylebarron
Copy link
Owner

@kylebarron kylebarron commented Jul 30, 2024

Originally this test failed:

def test_table_from_pydict():
    mapping = {"a": pa.array([1, 2, 3, 4]), "b": pa.array(["a", "b", "c", "d"])}
    arro3_table = Table.from_pydict(mapping)
    pa_table = pa.Table.from_pydict(mapping)
    assert pa.table(arro3_table) == pa_table

because the rust table was inferred as having column b first, and column a second. Since Python dicts are ordered, we should use an IndexMap wherever order matters (at least in from_pydict) to ensure we get the same behavior as pyarrow.

@kylebarron kylebarron enabled auto-merge (squash) July 30, 2024 05:41
@kylebarron kylebarron merged commit d0709bb into main Jul 30, 2024
3 checks passed
@kylebarron kylebarron deleted the kyle/indexmap-insertion-order branch July 30, 2024 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant