adonis0147 opened a new pull request, #25737: URL: https://github.com/apache/doris/pull/25737
## Proposed changes Issue Number: close #25735 The implementation of `S3FileSystem::create_file_impl` doesn't create a file on S3 file system. ```cpp Status S3FileSystem::create_file_impl(const Path& file, FileWriterPtr* writer, const FileWriterOptions* opts) { GET_KEY(key, file); *writer = std::make_unique<S3FileWriter>( key, std::static_pointer_cast<S3FileSystem>(shared_from_this()), opts); return Status::OK(); } ``` However, the implementation of `LocalFileSystem::create_file_impl` does so. After calling the function `open`, an empty file was created on the local file system. ```cpp Status LocalFileSystem::create_file_impl(const Path& file, FileWriterPtr* writer, const FileWriterOptions* opts) { int fd = ::open(file.c_str(), O_TRUNC | O_WRONLY | O_CREAT | O_CLOEXEC, 0666); if (-1 == fd) { return Status::IOError("failed to open {}: {}", file.native(), errno_to_str()); } *writer = std::make_unique<LocalFileWriter>( file, fd, std::static_pointer_cast<LocalFileSystem>(shared_from_this())); return Status::OK(); } ``` They are inconsistent semantics. Besides, In `DocumentsWriter::writeSegment`, the function calls `directory->createOutput((segmentName + ".frq").c_str())` and `S3FileSystem::create_file_impl` will be called finally. The interface `createOutput` is expected to create a new and empty file in the current directory. Therefore, the implementation is wrong and it makes errors occur when `InvertedIndexColumnWriter` finishes. ``` // Creates a new, empty file in the directory with the given name. // Returns a stream writing this file. virtual IndexOutput* createOutput(const char* name) = 0; ``` ## Further comments If this is a relatively large or complex change, kick off the discussion at [d...@doris.apache.org](mailto:d...@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc... -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org