Skip to content

Commit

Permalink
Fix ORC JNI wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
pitrou committed Apr 9, 2020
1 parent d755c2e commit 1c27905
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions cpp/src/jni/orc/jni_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,15 @@ Java_org_apache_arrow_adapter_orc_OrcStripeReaderJniWrapper_getSchema(JNIEnv* en

auto schema = stripe_reader->schema();

std::shared_ptr<arrow::Buffer> out;
auto status =
arrow::ipc::SerializeSchema(*schema, nullptr, arrow::default_memory_pool(), &out);
if (!status.ok()) {
auto maybe_buffer = arrow::ipc::SerializeSchema(*schema, nullptr);
if (!maybe_buffer.ok()) {
return nullptr;
}
auto buffer = *std::move(maybe_buffer);

jbyteArray ret = env->NewByteArray(out->size());
auto src = reinterpret_cast<const jbyte*>(out->data());
env->SetByteArrayRegion(ret, 0, out->size(), src);
jbyteArray ret = env->NewByteArray(buffer->size());
auto src = reinterpret_cast<const jbyte*>(buffer->data());
env->SetByteArrayRegion(ret, 0, buffer->size(), src);
return ret;
}

Expand Down

0 comments on commit 1c27905

Please sign in to comment.