Skip to content

add support for writing parquet files#642

Merged
haimasree merged 6 commits intokipoi:masterfrom
Hoeze:parquet_support
Feb 10, 2022
Merged

add support for writing parquet files#642
haimasree merged 6 commits intokipoi:masterfrom
Hoeze:parquet_support

Conversation

@Hoeze
Copy link
Member

@Hoeze Hoeze commented Feb 10, 2022

This PR adds support for writing parquet files.
In particular, it adds two additional parquet writer implementations:

  • ParquetFileBatchWriter: Writes to a single parquet file and depends on PyArrow.
  • ParquetDirBatchWriter: Writes a directory of parquet files using pandas.to_parquet(). Supports both PyArrow and fastparquet. This implementation is predestined for multi-processing / asynchronous writing since no file-locking is necessary for it. Nevertheless, I'm not sure yet how Kipoi would take advantage of that.

My very long-term goal is that we directly provide schemas as Arrow schemas to be able to pass them around cross-language without any kind of conversion/serialization:
https://arrow.apache.org/docs/python/api/datatypes.html
This PR is the first step in that direction.
Future work:

@Hoeze Hoeze requested a review from haimasree February 10, 2022 15:08
Copy link
Contributor

@haimasree haimasree left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! Very cool! Try with adding pyarrow. Once the tests pass I will merge to master

chunk_size = 10000

# optional import of pyarrow
import pyarrow as pa
Copy link
Contributor

@haimasree haimasree Feb 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So CI is telling me that pyarrow is not installed. I dont see it in any dev-requirements-py*. yml either. Perhaps try adding pyarrow in kipoi setup.py?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exact error is ModuleNotFoundError: No module named 'pyarrow'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Yes, I have to add it as an optional dependency 👍

@haimasree
Copy link
Contributor

I will merge this and remove the coverall for now. I will check tomorrow why the REPO token is not working anymore.

@haimasree haimasree merged commit e1b3d66 into kipoi:master Feb 10, 2022
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.

2 participants