MCPcopy Create free account
hub / github.com/ByConity/ByConity / updateBaseFilePathIfDistributedOutput

Method updateBaseFilePathIfDistributedOutput

src/IO/OutfileCommon.cpp:77–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77void OutfileTarget::updateBaseFilePathIfDistributedOutput()
78{
79 if (context->getSettingsRef().enable_distributed_output)
80 {
81 /// each worker have to use different file name if concurrent writing
82 auto file_prefix = getIPOrFQDNOrHostName() + "_" + std::to_string(context->getTCPPort()) + "_";
83 std::replace(file_prefix.begin(), file_prefix.end(), ':', '-');
84
85 Poco::Path file_path(request_uri);
86 if (file_path.isFile())
87 {
88 String directory_path = request_uri.substr(0, request_uri.find_last_of('/'));
89 converted_uri = std::filesystem::path(directory_path) / (file_prefix + file_path.getFileName());
90 }
91 else
92 {
93 converted_uri = std::filesystem::path(request_uri) / file_prefix;
94 }
95 }
96 else
97 {
98 converted_uri = request_uri;
99 }
100}
101
102OutfileTarget::OutfileTarget(
103 ContextMutablePtr context_, std::string uri_, std::string format_, std::string compression_method_str_, int compression_level_)

Callers

nothing calls this directly

Calls 6

to_stringFunction · 0.50
getTCPPortMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
isFileMethod · 0.45
getFileNameMethod · 0.45

Tested by

no test coverage detected