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

Make kudo table constructor public. #2601

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Changes from all 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
18 changes: 15 additions & 3 deletions src/main/java/com/nvidia/spark/rapids/jni/kudo/KudoTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,28 @@
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Objects;
import java.util.Optional;

import static com.nvidia.spark.rapids.jni.kudo.KudoSerializer.readerFrom;
import static java.util.Objects.requireNonNull;

/**
* Serialized table in kudo format, including a {{@link KudoTableHeader}} and a {@link HostMemoryBuffer} for serialized
* data.
*/
public class KudoTable implements AutoCloseable {
private final KudoTableHeader header;
private final HostMemoryBuffer buffer;

KudoTable(KudoTableHeader header, HostMemoryBuffer buffer) {
/**
* Create a kudo table.
*
* @param header kudo table header
* @param buffer host memory buffer for the table data. KudoTable will take ownership of this buffer, so don't close
* it after passing it to this constructor.
*/
public KudoTable(KudoTableHeader header, HostMemoryBuffer buffer) {
requireNonNull(header, "Header must not be null");
this.header = header;
this.buffer = buffer;
}
Expand All @@ -44,7 +56,7 @@ public class KudoTable implements AutoCloseable {
* @throws IOException if an I/O error occurs
*/
public static Optional<KudoTable> from(InputStream in) throws IOException {
Objects.requireNonNull(in, "Input stream must not be null");
requireNonNull(in, "Input stream must not be null");

DataInputStream din = readerFrom(in);
return KudoTableHeader.readFrom(din).map(header -> {
Expand Down
Loading