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

Use default value for decimal precision in parquet writer when not specified #9963

Merged
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion cpp/benchmarks/io/parquet/parquet_reader_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ void BM_parq_read_varying_input(benchmark::State& state)
auto const view = tbl->view();

cuio_source_sink_pair source_sink(source_type);
auto table_meta = cudf::io::table_input_metadata(view);
if (state.range(0) == int32_t(type_group_id::FIXED_POINT)) {
// Precision is required for decimal columns but the value doesn't affect the performance
for (auto& col_meta : table_meta.column_metadata) {
col_meta.set_decimal_precision(10);
}
}
cudf_io::parquet_writer_options write_opts =
cudf_io::parquet_writer_options::builder(source_sink.make_sink_info(), view)
.metadata(&table_meta)
.compression(compression);
cudf_io::write_parquet(write_opts);

Expand Down Expand Up @@ -101,8 +109,17 @@ void BM_parq_read_varying_options(benchmark::State& state)
auto const view = tbl->view();

std::vector<char> parquet_data;
auto table_meta = cudf::io::table_input_metadata(view);
// Precision is required for decimal columns but the value doesn't affect the performance
for (cudf::size_type c = 0; c < view.num_columns(); ++c) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for (cudf::size_type c = 0; c < view.num_columns(); ++c) {
for (auto c = 0; c < view.num_columns(); ++c) {

This might read easier.

if (cudf::is_fixed_point(view.column(c).type())) {
table_meta.column_metadata[c].set_decimal_precision(10);
}
}

cudf_io::parquet_writer_options options =
cudf_io::parquet_writer_options::builder(cudf_io::sink_info{&parquet_data}, view);
cudf_io::parquet_writer_options::builder(cudf_io::sink_info{&parquet_data}, view)
.metadata(&table_meta);
cudf_io::write_parquet(options);

auto const cols_to_read = select_column_names(get_col_names(parquet_data), col_sel);
Expand Down