Skip to content

Commit

Permalink
Prevent setting chunk paths if not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
devavret committed Dec 9, 2021
1 parent 8c2927d commit 200d1b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions cpp/include/cudf/io/parquet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ class parquet_writer_options {
* @param partitions Partitions of input table in {start_row, num_rows} pairs. If specified, must
* be same size as number of sinks in sink_info
*/
void set_partitions(std::vector<partition_info> const& partitions)
void set_partitions(std::vector<partition_info> partitions)
{
CUDF_EXPECTS(partitions.size() == _sink.num_sinks,
"Mismatch between number of sinks and number of partitions");
Expand Down Expand Up @@ -602,7 +602,7 @@ class parquet_writer_options_builder {
{
CUDF_EXPECTS(partitions.size() == options._sink.num_sinks,
"Mismatch between number of sinks and number of partitions");
options._partitions = std::move(partitions);
options.set_partitions(std::move(partitions));
return *this;
}

Expand Down Expand Up @@ -664,12 +664,11 @@ class parquet_writer_options_builder {
* data sinks
* @return this for chaining.
*/
parquet_writer_options_builder& column_chunks_file_paths(
std::vector<std::string> const& file_paths)
parquet_writer_options_builder& column_chunks_file_paths(std::vector<std::string> file_paths)
{
CUDF_EXPECTS(file_paths.size() == options._sink.num_sinks,
"Mismatch between number of sinks and number of chunk paths to set");
options._column_chunks_file_paths = file_paths;
options.set_column_chunks_file_paths(std::move(file_paths));
return *this;
}

Expand Down Expand Up @@ -956,7 +955,7 @@ class chunked_parquet_writer_options_builder {
{
CUDF_EXPECTS(metadata.size() == options._sink.num_sinks,
"Mismatch between number of sinks and number of metadata maps");
options._user_data = std::move(metadata);
options.set_key_value_metadata(std::move(metadata));
return *this;
}

Expand Down
6 changes: 3 additions & 3 deletions python/cudf/cudf/_lib/parquet.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,6 @@ cpdef write_parquet(
cdef unique_ptr[vector[uint8_t]] out_metadata_c
cdef vector[string] c_column_chunks_file_paths
cdef bool _int96_timestamps = int96_timestamps
if metadata_file_path is not None:
c_column_chunks_file_paths.push_back(str.encode(metadata_file_path))

# Perform write
cdef parquet_writer_options args = move(
Expand All @@ -347,10 +345,12 @@ cpdef write_parquet(
.key_value_metadata(move(user_data))
.compression(comp_type)
.stats_level(stat_freq)
.column_chunks_file_paths(c_column_chunks_file_paths)
.int96_timestamps(_int96_timestamps)
.build()
)
if metadata_file_path is not None:
c_column_chunks_file_paths.push_back(str.encode(metadata_file_path))
args.set_column_chunks_file_paths(move(c_column_chunks_file_paths))
if row_group_size_bytes is not None:
args.set_row_group_size_bytes(row_group_size_bytes)
if row_group_size_rows is not None:
Expand Down

0 comments on commit 200d1b0

Please sign in to comment.