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

Use HostMemoryAllocator in ParquetFooter #1377

Merged
merged 3 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/main/cpp/src/NativeParquetJni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ JNIEXPORT jlong JNICALL Java_com_nvidia_spark_rapids_jni_ParquetFooter_getNumCol
}

JNIEXPORT jobject JNICALL Java_com_nvidia_spark_rapids_jni_ParquetFooter_serializeThriftFile(
JNIEnv* env, jclass, jlong handle)
JNIEnv* env, jclass, jlong handle, jobject host_memory_allocator)
{
CUDF_FUNC_RANGE();
try {
Expand All @@ -798,7 +798,7 @@ JNIEXPORT jobject JNICALL Java_com_nvidia_spark_rapids_jni_ParquetFooter_seriali
transportOut->getBuffer(&buf_ptr, &buf_size);

// 12 extra is for the MAGIC thrift_footer length MAGIC
jobject ret = cudf::jni::allocate_host_buffer(env, buf_size + 12, false);
jobject ret = cudf::jni::allocate_host_buffer(env, buf_size + 12, false, host_memory_allocator);
uint8_t* ret_addr = reinterpret_cast<uint8_t*>(cudf::jni::get_host_buffer_address(env, ret));
ret_addr[0] = 'P';
ret_addr[1] = 'A';
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/com/nvidia/spark/rapids/jni/ParquetFooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ private ParquetFooter(long handle) {
* footer file. This will include the MAGIC PAR1 at the beginning and end and also the
* length of the footer just before the PAR1 at the end.
*/
public HostMemoryBuffer serializeThriftFile(HostMemoryAllocator hostMemoryAllocator) {
return serializeThriftFile(nativeHandle, hostMemoryAllocator);
}

public HostMemoryBuffer serializeThriftFile() {
return serializeThriftFile(nativeHandle);
return serializeThriftFile(DefaultHostMemoryAllocator.get());
}

/**
Expand Down Expand Up @@ -232,5 +236,6 @@ private static native long readAndFilter(long address, long length,

private static native int getNumColumns(long nativeHandle);

private static native HostMemoryBuffer serializeThriftFile(long nativeHandle);
private static native HostMemoryBuffer serializeThriftFile(long nativeHandle,
HostMemoryAllocator hostMemoryAllocator);
}