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

FIX-#6855: Make sure read_parquet works with integer columns for pyarrow engine #6874

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions modin/core/io/column_stores/parquet_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,14 @@ def build_query_compiler(cls, dataset, columns, index_columns, **kwargs):
row_lengths = [part.length() for part in remote_parts.T[0]]
else:
row_lengths = None

if (
dataset.pandas_metadata
and "column_indexes" in dataset.pandas_metadata
and dataset.pandas_metadata["column_indexes"][0]["numpy_type"] == "int64"
):
columns = pandas.Index(columns).astype("int64").to_list()

frame = cls.frame_cls(
remote_parts,
index,
Expand Down
11 changes: 11 additions & 0 deletions modin/pandas/test/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -2034,6 +2034,17 @@ def test_read_parquet_5767(self, tmp_path, engine):
# both Modin and pandas read column "b" as a category
df_equals(test_df, read_df.astype("int64"))

def test_read_parquet_6855(self, tmp_path, engine):
if engine == "fastparquet":
pytest.skip("integer columns aren't supported")
test_df = pandas.DataFrame(np.random.rand(10**2, 10))
path = tmp_path / "data"
path.mkdir()
file_name = "issue6855.parquet"
test_df.to_parquet(path / file_name, engine=engine)
read_df = pd.read_parquet(path / file_name, engine=engine)
df_equals(test_df, read_df)

def test_read_parquet_s3_with_column_partitioning(
self, s3_resource, engine, s3_storage_options
):
Expand Down