Skip to content

[Python] Legacy dataset can't roundtrip Int64 with nulls if partitioned #31175

Closed as not planned

Description

@asfimport

If there is partitioning and the column has nulls, Int64 columns may not round trip successfully using the legacy datasets implementation. 

Simple reproduction:

 ```python

import pyarrow as pa
import pyarrow.parquet as pq
import pyarrow.dataset as ds
import tempfile

table = pa.table({
'x': pa.array([None, 7753285016841556620]),
'y': pa.array(['a', 'b'])
})

ds_dir = tempfile.mkdtemp()
pq.write_to_dataset(table, ds_dir, partition_cols=['y'])

table_after = ds.dataset(ds_dir).to_table()
print(table['x'])
print(table_after['x'])
assert table['x'] == table_after['x']


```Java

[
  [
    null,
    7753285016841556620
  ]
]
[
  [
    null
  ],
  [
    7753285016841556992
  ]
]

Reporter: Will Jones / @wjones127

Related issues:

Note: This issue was originally created as ARROW-15725. Please see the migration documentation for further details.

Activity

  1. asfimport commented on May 19, 2022

    @asfimport
    Author

    Antoine Pitrou / @pitrou:
    Very short but likely explanation:

    >>> int(float(7753285016841556620))
    7753285016841556992

    I suspect the legacy partitioning code treats all numeric keys as floating-point for convenience, but this ends up truncating some very large int64 keys. I'm not sure we want to fix it at this point. @jorisvandenbossche

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions