Skip to content

Commit

Permalink
Cleanup ORC chunked writer (#13091)
Browse files Browse the repository at this point in the history
This changes the internal variables of ORC chunked writer:
 * Renaming them to have a `_` prefix consistently.
 * Add `const` qualifier to some variables that are writer parameters.
 * Regroup them.

There is not any new implementation added. However, the unused parameter `mr` is removed from its interface thus this is flagged as `breaking` changes.

Closes: 
 * #12973

Authors:
  - Nghia Truong (https://github.com/ttnghia)

Approvers:
  - Karthikeyan (https://github.com/karthikeyann)
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #13091
  • Loading branch information
ttnghia authored Apr 12, 2023
1 parent 50718e6 commit ecadda5
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 161 deletions.
10 changes: 3 additions & 7 deletions cpp/include/cudf/io/detail/orc.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2022, NVIDIA CORPORATION.
* Copyright (c) 2020-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -93,13 +93,11 @@ class writer {
* @param options Settings for controlling writing behavior
* @param mode Option to write at once or in chunks
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource to use for device memory allocation
*/
explicit writer(std::unique_ptr<cudf::io::data_sink> sink,
orc_writer_options const& options,
SingleWriteMode mode,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);
rmm::cuda_stream_view stream);

/**
* @brief Constructor with chunked writer options.
Expand All @@ -108,13 +106,11 @@ class writer {
* @param options Settings for controlling writing behavior
* @param mode Option to write at once or in chunks
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource to use for device memory allocation
*/
explicit writer(std::unique_ptr<cudf::io::data_sink> sink,
chunked_orc_writer_options const& options,
SingleWriteMode mode,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);
rmm::cuda_stream_view stream);

/**
* @brief Destructor explicitly declared to avoid inlining in header
Expand Down
10 changes: 3 additions & 7 deletions cpp/include/cudf/io/orc.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2022, NVIDIA CORPORATION.
* Copyright (c) 2020-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -781,10 +781,8 @@ class orc_writer_options_builder {
* @endcode
*
* @param options Settings for controlling reading behavior
* @param mr Device memory resource to use for device memory allocation
*/
void write_orc(orc_writer_options const& options,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
void write_orc(orc_writer_options const& options);

/**
* @brief Builds settings to use for `write_orc_chunked()`.
Expand Down Expand Up @@ -1137,10 +1135,8 @@ class orc_chunked_writer {
* @brief Constructor with chunked writer options
*
* @param[in] options options used to write table
* @param[in] mr Device memory resource to use for device memory allocation
*/
orc_chunked_writer(chunked_orc_writer_options const& options,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
orc_chunked_writer(chunked_orc_writer_options const& options);

/**
* @brief Writes table to output.
Expand Down
9 changes: 4 additions & 5 deletions cpp/src/io/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ table_with_metadata read_orc(orc_reader_options const& options, rmm::mr::device_
/**
* @copydoc cudf::io::write_orc
*/
void write_orc(orc_writer_options const& options, rmm::mr::device_memory_resource* mr)
void write_orc(orc_writer_options const& options)
{
namespace io_detail = cudf::io::detail;

Expand All @@ -428,24 +428,23 @@ void write_orc(orc_writer_options const& options, rmm::mr::device_memory_resourc
CUDF_EXPECTS(sinks.size() == 1, "Multiple sinks not supported for ORC writing");

auto writer = std::make_unique<detail_orc::writer>(
std::move(sinks[0]), options, io_detail::SingleWriteMode::YES, cudf::get_default_stream(), mr);
std::move(sinks[0]), options, io_detail::SingleWriteMode::YES, cudf::get_default_stream());

writer->write(options.get_table());
}

/**
* @copydoc cudf::io::orc_chunked_writer::orc_chunked_writer
*/
orc_chunked_writer::orc_chunked_writer(chunked_orc_writer_options const& options,
rmm::mr::device_memory_resource* mr)
orc_chunked_writer::orc_chunked_writer(chunked_orc_writer_options const& options)
{
namespace io_detail = cudf::io::detail;

auto sinks = make_datasinks(options.get_sink());
CUDF_EXPECTS(sinks.size() == 1, "Multiple sinks not supported for ORC writing");

writer = std::make_unique<detail_orc::writer>(
std::move(sinks[0]), options, io_detail::SingleWriteMode::NO, cudf::get_default_stream(), mr);
std::move(sinks[0]), options, io_detail::SingleWriteMode::NO, cudf::get_default_stream());
}

/**
Expand Down
Loading

0 comments on commit ecadda5

Please sign in to comment.