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

[VL] Fix shuffle ignores uncompressed compression configuration #3672

Merged
merged 2 commits into from
Nov 13, 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
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
4 changes: 2 additions & 2 deletions cpp/core/jni/JniWrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,8 @@ JNIEXPORT jlong JNICALL Java_io_glutenproject_vectorized_ShuffleWriterJniWrapper
shuffleWriterOptions.buffer_size = bufferSize;
}

shuffleWriterOptions.compression_type = getCompressionType(env, codecJstr);
if (codecJstr != NULL) {
shuffleWriterOptions.compression_type = getCompressionType(env, codecJstr);
shuffleWriterOptions.codec_backend = getCodecBackend(env, codecBackendJstr);
shuffleWriterOptions.compression_mode = getCompressionMode(env, compressionModeJstr);
}
Comment on lines +788 to 792
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this!

Expand Down 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
Loading