Skip to content

Commit

Permalink
fix reader
Browse files Browse the repository at this point in the history
  • Loading branch information
marin-ma committed Nov 13, 2023
1 parent 3b85462 commit c62b5f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
17 changes: 7 additions & 10 deletions cpp/core/jni/JniCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,15 @@ static inline arrow::Compression::type getCompressionType(JNIEnv* env, jstring c
if (codecJstr == NULL) {
return arrow::Compression::UNCOMPRESSED;
}
auto codecU = env->GetStringUTFChars(codecJstr, JNI_FALSE);
auto codec = env->GetStringUTFChars(codecJstr, JNI_FALSE);

std::string codecL;
std::transform(codecU, codecU + std::strlen(codecU), std::back_inserter(codecL), ::tolower);
// Convert codec string into lowercase.
std::string codecLower;
std::transform(codec, codec + std::strlen(codec), std::back_inserter(codecLower), ::tolower);
GLUTEN_ASSIGN_OR_THROW(auto compressionType, arrow::util::Codec::GetCompressionType(codecLower));

GLUTEN_ASSIGN_OR_THROW(auto compression_type, arrow::util::Codec::GetCompressionType(codecL));

if (compression_type == arrow::Compression::LZ4) {
compression_type = arrow::Compression::LZ4_FRAME;
}
env->ReleaseStringUTFChars(codecJstr, codecU);
return compression_type;
env->ReleaseStringUTFChars(codecJstr, codec);
return compressionType;
}

static inline gluten::CodecBackend getCodecBackend(JNIEnv* env, jstring codecJstr) {
Expand Down
2 changes: 1 addition & 1 deletion cpp/core/jni/JniWrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -991,8 +991,8 @@ JNIEXPORT jlong JNICALL Java_io_glutenproject_vectorized_ShuffleReaderJniWrapper
ShuffleReaderOptions options = ShuffleReaderOptions::defaults();
options.ipc_read_options.memory_pool = pool;
options.ipc_read_options.use_threads = false;
options.compression_type = getCompressionType(env, compressionType);
if (compressionType != nullptr) {
options.compression_type = getCompressionType(env, compressionType);
options.codec_backend = getCodecBackend(env, compressionBackend);
}
std::shared_ptr<arrow::Schema> schema =
Expand Down

0 comments on commit c62b5f7

Please sign in to comment.