Copilot commented on code in PR #12549:
URL: https://github.com/apache/gluten/pull/12549#discussion_r3780357143


##########
cpp/core/jni/JniWrapper.cc:
##########
@@ -845,6 +844,15 @@ 
Java_org_apache_gluten_vectorized_LocalPartitionWriterJniWrapper_createPartition
   auto dataFile = jStringToCString(env, dataFileJstr);
   auto localDirs = splitPaths(jStringToCString(env, localDirsJstr));
 
+  // `spark.shuffle.file.buffer` is declared with `bytesConf(ByteUnit.KiB)` on 
the JVM side, matching
+  // Spark's own declaration, so the delivered value is a KiB count. Convert 
it to bytes here, which
+  // is the unit every reader of `shuffleFileBufferSize` uses.
+  auto shuffleFileBufferSize = kDefaultShuffleFileBufferSize;
+  auto& conf = ctx->getConfMap();
+  if (auto it = conf.find(kShuffleFileBufferSize); it != conf.end()) {
+    shuffleFileBufferSize = std::stoll(it->second) * 1024;
+  }

Review Comment:
   `std::stoll(it->second)` can throw (`std::invalid_argument` / 
`std::out_of_range`). If an unexpected value slips into the conf map, throwing 
a C++ exception out of this JNI method risks terminating the JVM. Guard the 
parse and fall back to `kDefaultShuffleFileBufferSize` when parsing fails 
(optionally log).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to