| 115 | } |
| 116 | |
| 117 | SpillWriteFile::SpillWriteFile( |
| 118 | uint32_t id, |
| 119 | const std::string& pathPrefix, |
| 120 | const std::string& fileCreateConfig, |
| 121 | const bool spillUringEnabled) |
| 122 | : id_(id), |
| 123 | path_(fmt::format("{}-{}", pathPrefix, ordinalCounter_++)), |
| 124 | spillUringEnabled_(spillUringEnabled) { |
| 125 | if (spillUringEnabled_) { |
| 126 | // TODO: it is better to let memory pool to set the ringSize @Zhongjun |
| 127 | // A smaller number should be set (e.g. 8) when row based spill is enabled |
| 128 | const size_t ringSize = |
| 129 | 64; // should be same with ringDepth in LocalWriteFile |
| 130 | writeBuffers_ = std::make_shared<WriteBuffers>(ringSize); |
| 131 | } |
| 132 | auto fs = filesystems::getFileSystem(path_, nullptr); |
| 133 | #ifdef IO_URING_SUPPORTED |
| 134 | if (spillUringEnabled_) { |
| 135 | file_ = fs->openAsyncFileForWrite( |
| 136 | path_, |
| 137 | filesystems::FileOptions{ |
| 138 | {{filesystems::FileOptions::kFileCreateConfig.toString(), |
| 139 | fileCreateConfig}}, |
| 140 | 0, |
| 141 | nullptr}); |
| 142 | return; |
| 143 | } |
| 144 | #endif |
| 145 | |
| 146 | file_ = fs->openFileForWrite( |
| 147 | path_, |
| 148 | filesystems::FileOptions{ |
| 149 | {{filesystems::FileOptions::kFileCreateConfig.toString(), |
| 150 | fileCreateConfig}}, |
| 151 | 0, |
| 152 | nullptr}); |
| 153 | } |
| 154 | |
| 155 | void SpillWriteFile::finish() { |
| 156 | BOLT_CHECK_NOT_NULL(file_); |
nothing calls this directly
no test coverage detected