diff --git a/cpp/core/shuffle/LocalPartitionWriter.cc b/cpp/core/shuffle/LocalPartitionWriter.cc index 6692097986c2..183b688f7ccf 100644 --- a/cpp/core/shuffle/LocalPartitionWriter.cc +++ b/cpp/core/shuffle/LocalPartitionWriter.cc @@ -387,7 +387,11 @@ std::string LocalPartitionWriter::nextSpilledFileDir() { arrow::Result> LocalPartitionWriter::openFile(const std::string& file) { std::shared_ptr fout; - ARROW_ASSIGN_OR_RAISE(fout, arrow::io::FileOutputStream::Open(file)); + auto fd = open(file.c_str(), O_WRONLY | O_CREAT | O_TRUNC); + // Set the shuffle file permissions to 0644 to keep it consistent with the permissions of + // the built-in shuffler manager in Spark. + fchmod(fd, 0644); + ARROW_ASSIGN_OR_RAISE(fout, arrow::io::FileOutputStream::Open(fd)); if (options_.bufferedWrite) { // The `shuffleFileBufferSize` bytes is a temporary allocation and will be freed with file close. // Use default memory pool and count treat the memory as executor memory overhead to avoid unnecessary spill.