@@ -957,7 +957,7 @@ class StorageS3Sink : public SinkToStorage
957957
958958namespace
959959{
960- std::optional<String> checkFileExistsAndCreateNewKeyIfNeeded (const ContextPtr & context, const StorageS3::Configuration & configuration, const String & key, size_t sequence_number)
960+ std::optional<String> checkAndGetNewFileOnInsertIfNeeded (const ContextPtr & context, const StorageS3::Configuration & configuration, const String & key, size_t sequence_number)
961961 {
962962 if (context->getSettingsRef ().s3_truncate_on_insert || !S3::objectExists (*configuration.client , configuration.url .bucket , key, configuration.url .version_id , configuration.request_settings ))
963963 return std::nullopt ;
@@ -1018,7 +1018,7 @@ class PartitionedStorageS3Sink : public PartitionedSink, WithContext
10181018 auto partition_key = replaceWildcards (key, partition_id);
10191019 validateKey (partition_key);
10201020
1021- if (auto new_key = checkFileExistsAndCreateNewKeyIfNeeded (getContext (), configuration, partition_key, /* sequence_number */ 1 ))
1021+ if (auto new_key = checkAndGetNewFileOnInsertIfNeeded (getContext (), configuration, partition_key, /* sequence_number */ 1 ))
10221022 partition_key = *new_key;
10231023
10241024 return std::make_shared<StorageS3Sink>(
@@ -1309,7 +1309,7 @@ SinkToStoragePtr StorageS3::write(const ASTPtr & query, const StorageMetadataPtr
13091309 throw Exception (ErrorCodes::DATABASE_ACCESS_DENIED,
13101310 " S3 key '{}' contains globs, so the table is in readonly mode" , query_configuration.url .key );
13111311
1312- if (auto new_key = checkFileExistsAndCreateNewKeyIfNeeded (local_context, configuration, query_configuration.keys .front (), query_configuration.keys .size ()))
1312+ if (auto new_key = checkAndGetNewFileOnInsertIfNeeded (local_context, configuration, query_configuration.keys .front (), query_configuration.keys .size ()))
13131313 {
13141314 query_configuration.keys .push_back (*new_key);
13151315 configuration.keys .push_back (*new_key);
0 commit comments