Skip to content

Commit

Permalink
Remove superfluous use of std::vector for std::future (#16829)
Browse files Browse the repository at this point in the history
This PR addresses #16888 , where a superfluous use of `std::vector` should be removed.

closes #16888

Authors:
  - Tianyu Liu (https://github.com/kingcrimsontianyu)
  - Vukasin Milovanovic (https://github.com/vuule)
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - Vukasin Milovanovic (https://github.com/vuule)

URL: #16829
  • Loading branch information
kingcrimsontianyu authored Sep 27, 2024
1 parent 1f25d7a commit 4018d31
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
4 changes: 2 additions & 2 deletions cpp/src/io/parquet/reader_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ class reader::impl {
*
* Does not decompress the chunk data.
*
* @return pair of boolean indicating if compressed chunks were found and a vector of futures for
* @return pair of boolean indicating if compressed chunks were found and a future for
* read completion
*/
std::pair<bool, std::vector<std::future<void>>> read_column_chunks();
std::pair<bool, std::future<void>> read_column_chunks();

/**
* @brief Read compressed data and page information for the current pass.
Expand Down
26 changes: 11 additions & 15 deletions cpp/src/io/parquet/reader_impl_preprocess.cu
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ void reader::impl::allocate_level_decode_space()
}
}

std::pair<bool, std::vector<std::future<void>>> reader::impl::read_column_chunks()
std::pair<bool, std::future<void>> reader::impl::read_column_chunks()
{
auto const& row_groups_info = _pass_itm_data->row_groups;

Expand All @@ -989,7 +989,6 @@ std::pair<bool, std::vector<std::future<void>>> reader::impl::read_column_chunks
// TODO: make this respect the pass-wide skip_rows/num_rows instead of the file-wide
// skip_rows/num_rows
// auto remaining_rows = num_rows;
std::vector<std::future<void>> read_chunk_tasks;
size_type chunk_count = 0;
for (auto const& rg : row_groups_info) {
auto const& row_group = _metadata->get_row_group(rg.index, rg.source_index);
Expand Down Expand Up @@ -1018,16 +1017,15 @@ std::pair<bool, std::vector<std::future<void>>> reader::impl::read_column_chunks
}

// Read compressed chunk data to device memory
read_chunk_tasks.push_back(read_column_chunks_async(_sources,
raw_page_data,
chunks,
0,
chunks.size(),
column_chunk_offsets,
chunk_source_map,
_stream));

return {total_decompressed_size > 0, std::move(read_chunk_tasks)};
return {total_decompressed_size > 0,
read_column_chunks_async(_sources,
raw_page_data,
chunks,
0,
chunks.size(),
column_chunk_offsets,
chunk_source_map,
_stream)};
}

void reader::impl::read_compressed_data()
Expand All @@ -1042,9 +1040,7 @@ void reader::impl::read_compressed_data()
auto const [has_compressed_data, read_chunks_tasks] = read_column_chunks();
pass.has_compressed_data = has_compressed_data;

for (auto& task : read_chunks_tasks) {
task.wait();
}
read_chunks_tasks.wait();

// Process dataset chunk pages into output columns
auto const total_pages = _has_page_index ? count_page_headers_with_pgidx(chunks, _stream)
Expand Down

0 comments on commit 4018d31

Please sign in to comment.