Repository navigation
Add Parquet serialization of Tables with pyarrow - #12215
Conversation
There was a problem hiding this comment.
Welcome to Astropy 👋 and congratulations on your first pull request! 🎉
A project member will respond to you as soon as possible; in the meantime, please have a look over the Checklist for Contributed Code and make sure you've addressed as many of the questions there as possible.
If you feel that this pull request has not been responded to in a timely manner, please leave a comment mentioning our software support engineer @embray, or send a message directly to the development mailing list. If the issue is urgent or sensitive in nature (e.g., a security vulnerability) please send an e-mail directly to the private e-mail [email protected].
|
Also needs a change log, please see https://github.com/astropy/astropy/blob/main/docs/changes/README.rst |
|
This looks very nice! Though as I'm less familiar with the I/O interfaces, I'll leave review to @taldcroft (who is on holiday this week, so it may need a bit of patience). In the meantime, the docs failure seems real: Might as well fix that before running all the tests! |
|
I can't figure out what the build failure is for readthedocs https://readthedocs.org/projects/astropy/builds/14857984/ |
|
@erykoff I believe the line is We have RTD set to error on warnings, except for known issues like the Matplotlib ones. |
6d8988b to
463273d
Compare
|
There were some CI errors on example code formatting that were unrelated to this PR. So I rebased to main, hopefully those were known problems that have been fixed since I had originally forked my branch. |
|
Errors are still there. Don’t know what to do about this: |
|
That is not your PR. I’m seeing the same error in one of mine. A recent PR or dependency update must have introduced this issue. Please check back in a day or two and we should have this sorted. |
|
@erykoff - thanks, this is exciting! I'm just back from almost 2 weeks off and have a backlog of stuff to catch up so it might take a little bit to find time for a detailed review. In the meantime, I see there are a lot of code coverage issues noted in the diffs, so you can take the opportunity to clean those up with additional testing. |
|
Ah, thanks for pointing out the coverage. What seems to have happened is that all my tests were skipped. I didn’t realize this because I was focused on the unrelated failing tests. Looking further I see it never got to the “all optional dependencies” tests because of the docstring failure. So once that clears up I believe my coverage will increase considerably. |
|
@erykoff, I think if you rebase now the issue is resolved. |
463273d to
6bb8bec
Compare
|
Thank you so much! And the coverage seems much improved now that the tests are being run. 😄 |
nstarman
left a comment
There was a problem hiding this comment.
Thanks @erykoff for the PR! I'm not familiar with parquet serialization nor pyarrow, so @taldcroft's review will be much more useful :). Here I'm just making some style suggestions.
I'm afraid that applies to me as well but hopefully that won't stop us from getting this PR to a good place. @nstarman you are now the expert on the unified I/O layer, which is a big part of this. |
Co-authored-by: Nathaniel Starkman <[email protected]>
Co-authored-by: Nathaniel Starkman <[email protected]>
Co-authored-by: Nathaniel Starkman <[email protected]>
Co-authored-by: Nathaniel Starkman <[email protected]>
Co-authored-by: Nathaniel Starkman <[email protected]>
4cdfbd2 to
04990de
Compare
|
|
||
| One big advantage of the Parquet files is that each column is stored independently, | ||
| and thus reading a subset of columns is fast and efficient. To find out which | ||
| columns are stored in a table without reading the data, use the ``schema_only=True``:: |
There was a problem hiding this comment.
@taldcroft, I think schema_only might be a useful addition to bring to all table readers, like overwrite is available for all writers. Perhaps a goal for v5.1/2?
There was a problem hiding this comment.
@nstarman - sure, that could be a goal. Another idea on that line would be uniform support for include/exclude names to avoid reading columns that are not needed. The benefit of that will depend a fair bit on the specifics of the reader. E.g. for HDF5 it might help a lot, while for ASCII it is basically not possible in the current framework to not read the other columns before dropping them.
There was a problem hiding this comment.
Even with fits, a row-based format, columnar access is inefficient. But it sometimes is convenient to end up with a table that has only a subset of columns even if the read time and peak memory usage isn't significantly reduced. But with all of these formats, being able to just inspect the schema without reading the table would be useful!
Co-authored-by: Tom Aldcroft <[email protected]>
Description
This PR adds direct Parquet serialization of astropy Tables using pyarrow. Unlike serialization of Tables to Parquet via pandas, this functionality maintains all metadata, descriptions, and units; supports mixins (including Time and SkyCoord columns); and supports masked columns. An advantage of the Parquet format is the columnar access, and this PR allows efficient reading of subsets of columns from the serialized Table, using the proper Table column names (so the user does not have to worry about the deconstruction into components). The parquet reader also offers the option to read just a "schema" header, to obtain all the column, unit, and description information from the Table prior to performing i/o on a specific subset of columns. Finally, pyarrow filters are supported for reading Tables.
Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
Extra CIlabel.no-changelog-entry-neededlabel. If this is a manual backport, use theskip-changelog-checkslabel unless special changelog handling is necessary.astropy-botcheck might be missing; do not let the green checkmark fool you.backport-X.Y.xlabel(s) before merge.