Skip to content

Commit

Permalink
Make kudo table constructor public. (#2601)
Browse files Browse the repository at this point in the history
* Make kudo table constructor public

* Add comments for class KudoTable

Signed-off-by: liurenjie1024 <[email protected]>

---------

Signed-off-by: liurenjie1024 <[email protected]>
  • Loading branch information
liurenjie1024 authored Nov 18, 2024
1 parent 2a13022 commit 96ff348
Showing 1 changed file with 15 additions and 3 deletions.
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

0 comments on commit 96ff348

Please sign in to comment.