Skip to content

Add read_parquet_metadata libcudf API - #13663

Merged
rapids-bot[bot] merged 11 commits into
NVIDIA:branch-23.08from
karthikeyann:fea-parquet_metadata
Jul 27, 2023
Merged

rapids-bot[bot] merged 11 commits into
NVIDIA:branch-23.08from
karthikeyann:fea-parquet_metadata

Conversation

@karthikeyann

@karthikeyann karthikeyann commented Jul 5, 2023 •

Copy link
Copy Markdown
Contributor

Description

Closes #11675
Adds read_parquet_metadata to libcudf.
The metadata has following information

  • schema - (type, name, children)
  • num_rows
  • num_rowgroups
  • key-value string metadata in file footer

To Reviewers: Request for adding more information in metadata. Refer #11214

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@karthikeyann karthikeyann added feature request New feature or request 3 - Ready for Review Ready for review by team libcudf Affects libcudf (C++/CUDA) code. cuIO cuIO issue 4 - Needs cuIO Reviewer non-breaking Non-breaking change labels Jul 5, 2023
@karthikeyann karthikeyann self-assigned this Jul 5, 2023
@karthikeyann
karthikeyann requested review from a team as code owners July 5, 2023 18:05
@karthikeyann karthikeyann changed the title Add parquet_metadata libcudf API Add read_parquet_metadata libcudf API Jul 5, 2023
@github-actions github-actions Bot added the conda label Jul 5, 2023
@GregoryKimball

Copy link
Copy Markdown
Contributor

Hello @etseidl would you please share your thoughts on this first PQ metadata function?

@vuule vuule left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks pretty good! I really like the extent in which aggregate_reader_metadata was used.
Some minor suggestions.

Comment thread cpp/tests/io/parquet_test.cpp Resolved
Comment thread cpp/tests/io/parquet_test.cpp Resolved
Comment thread cpp/src/io/parquet/reader_impl.cpp Resolved
Comment thread cpp/src/io/parquet/reader_impl.cpp Resolved
Comment thread cpp/include/cudf/io/detail/parquet.hpp Outdated
* @return parquet_metadata with parquet schema, number of rows, number of row groups and key-value
* metadata.
*/
parquet_metadata read_parquet_metadata(std::vector<std::unique_ptr<datasource>>&& sources);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we want to make read_parquet_metadata uncallable with l-values (as it is now)? We don't really have to move from the sources, IMO const& is fine here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Replaced with const-ref.

@etseidl

etseidl commented Jul 7, 2023

Copy link
Copy Markdown
Contributor

Hello @etseidl would you please share your thoughts on this first PQ metadata function?

It's good for what it is, but for my purposes I'd need something more akin to returning the entire aggregate_reader_metadata. That's a bit much to expect, though, esp since I can just generate my own with thrift. 😄

@karthikeyann

karthikeyann commented Jul 10, 2023 •

Copy link
Copy Markdown
Contributor Author

akin to returning the entire aggregate_reader_metadata.

@etseidl
do you need aggregate_reader_metadata's public methods or access to FileMetaData of each source?
https://github.com/rapidsai/cudf/blob/964925a146dcdc12c57ae05dc467112d2df53579/cpp/src/io/parquet/parquet.hpp#L281

@vuule

vuule commented Jul 10, 2023

Copy link
Copy Markdown
Contributor

Looking at #11214, sounds like we'd want to add information about each row group. I'm fine with this being in a separate PR.

@karthikeyann
karthikeyann requested a review from vuule July 20, 2023 17:26

@vuule vuule left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great, just need to iron out the get_key_value_metadata overload set.

Thank you for addressing previous comments!

Comment thread cpp/include/cudf/io/detail/parquet.hpp Resolved
@karthikeyann
karthikeyann requested a review from vuule July 21, 2023 17:17
@karthikeyann
karthikeyann requested a review from a team July 25, 2023 16:25
Comment thread cpp/src/io/parquet/reader_impl.cpp Outdated
return _current_read_chunk < _chunk_read_info.size();
}

static parquet_column_schema walk_schema(aggregate_reader_metadata const* mt, int idx)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use an anonymous namespace instead?

Comment thread cpp/src/io/parquet/reader_impl.cpp Outdated
}

namespace {
static parquet_column_schema walk_schema(aggregate_reader_metadata const* mt, int idx)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
static parquet_column_schema walk_schema(aggregate_reader_metadata const* mt, int idx)
parquet_column_schema walk_schema(aggregate_reader_metadata const* mt, int idx)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

why not static?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As far as I can tell, it's not a member function of a class, so there is no static internal state you are relying on.

static on free functions prevents leakage across multiple TUs, but using an anonymous namespace provides the same benefit and is more in line with other libcudf code.

What were your reasons for using static, if it's something different?

@karthikeyann
karthikeyann requested a review from divyegala July 26, 2023 17:24
@karthikeyann karthikeyann added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 3 - Ready for Review Ready for review by team 4 - Needs cuIO Reviewer labels Jul 26, 2023
@karthikeyann karthikeyann changed the title Add read_parquet_metadata libcudf API Add read_parquet_metadata libcudf API Jul 26, 2023
@karthikeyann karthikeyann changed the title Add read_parquet_metadata libcudf API Add read_parquet_metadata libcudf API Jul 26, 2023
@karthikeyann

Copy link
Copy Markdown
Contributor Author

/merge

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

Labels

5 - Ready to Merge Testing and reviews complete, ready to merge cuIO cuIO issue feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEA] read_orc_metadata and read_parquet_metadata in libcudf

7 participants