-
Notifications
You must be signed in to change notification settings - Fork 921
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Java Parquet reads via multiple host buffers (#17673)
Adds a custom cuio datasource that can provide file data via multiple host memory buffers. This allows data that arrives from multiple threads in multiple buffers to be read directly rather than requiring the buffers to be concatenated into a single host memory buffer before reading. Authors: - Jason Lowe (https://github.com/jlowe) Approvers: - Alessandro Bellina (https://github.com/abellina) - Robert (Bobby) Evans (https://github.com/revans2) URL: #17673
- Loading branch information
Showing
8 changed files
with
390 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (c) 2025, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#pragma once | ||
|
||
#include "jni_utils.hpp" | ||
|
||
#include <cudf/io/datasource.hpp> | ||
|
||
#include <vector> | ||
|
||
namespace cudf { | ||
namespace jni { | ||
|
||
/** | ||
* @brief A custom datasource providing data from an array of host memory buffers. | ||
*/ | ||
class multi_host_buffer_source : public cudf::io::datasource { | ||
std::vector<uint8_t const*> addrs_; | ||
std::vector<size_t> offsets_; | ||
|
||
size_t locate_offset_index(size_t offset); | ||
|
||
public: | ||
explicit multi_host_buffer_source(native_jlongArray const& addrs_sizes); | ||
std::unique_ptr<buffer> host_read(size_t offset, size_t size) override; | ||
size_t host_read(size_t offset, size_t size, uint8_t* dst) override; | ||
bool supports_device_read() const override { return true; } | ||
bool is_device_read_preferred(size_t size) const override { return true; } | ||
std::unique_ptr<buffer> device_read(size_t offset, | ||
size_t size, | ||
rmm::cuda_stream_view stream) override; | ||
size_t device_read(size_t offset, | ||
size_t size, | ||
uint8_t* dst, | ||
rmm::cuda_stream_view stream) override; | ||
std::future<size_t> device_read_async(size_t offset, | ||
size_t size, | ||
uint8_t* dst, | ||
rmm::cuda_stream_view stream) override; | ||
size_t size() const override { return offsets_.back(); } | ||
}; | ||
|
||
} // namespace jni | ||
} // namespace cudf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.