Skip to content

Commit cae7cbf

Browse files
committed
Better function name
1 parent eaa436a commit cae7cbf

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Storages/HDFS/StorageHDFS.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ class HDFSSink : public SinkToStorage
873873

874874
namespace
875875
{
876-
std::optional<String> checkFileExistsAndCreateNewKeyIfNeeded(const ContextPtr & context, const String & uri, size_t sequence_number)
876+
std::optional<String> checkAndGetNewFileOnInsertIfNeeded(const ContextPtr & context, const String & uri, size_t sequence_number)
877877
{
878878
const auto [path_from_uri, uri_without_path] = getPathFromUriAndUriWithoutPath(uri);
879879

@@ -928,7 +928,7 @@ class PartitionedHDFSSink : public PartitionedSink
928928
{
929929
auto path = PartitionedSink::replaceWildcards(uri, partition_id);
930930
PartitionedSink::validatePartitionKey(path, true);
931-
if (auto new_path = checkFileExistsAndCreateNewKeyIfNeeded(context, path, 1))
931+
if (auto new_path = checkAndGetNewFileOnInsertIfNeeded(context, path, 1))
932932
path = *new_path;
933933
return std::make_shared<HDFSSink>(path, format, sample_block, context, compression_method);
934934
}
@@ -1114,7 +1114,7 @@ SinkToStoragePtr StorageHDFS::write(const ASTPtr & query, const StorageMetadataP
11141114
if (is_path_with_globs)
11151115
throw Exception(ErrorCodes::DATABASE_ACCESS_DENIED, "URI '{}' contains globs, so the table is in readonly mode", uris.back());
11161116

1117-
if (auto new_uri = checkFileExistsAndCreateNewKeyIfNeeded(context_, uris.front(), uris.size()))
1117+
if (auto new_uri = checkAndGetNewFileOnInsertIfNeeded(context_, uris.front(), uris.size()))
11181118
{
11191119
uris.push_back(*new_uri);
11201120
current_uri = *new_uri;

src/Storages/StorageAzureBlob.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ class StorageAzureBlobSink : public SinkToStorage
635635

636636
namespace
637637
{
638-
std::optional<String> checkFileExistsAndCreateNewKeyIfNeeded(const ContextPtr & context, AzureObjectStorage * object_storage, const String & path, size_t sequence_number)
638+
std::optional<String> checkAndGetNewFileOnInsertIfNeeded(const ContextPtr & context, AzureObjectStorage * object_storage, const String & path, size_t sequence_number)
639639
{
640640
if (context->getSettingsRef().azure_truncate_on_insert || !object_storage->exists(StoredObject(path)))
641641
return std::nullopt;
@@ -689,7 +689,7 @@ class PartitionedStorageAzureBlobSink : public PartitionedSink, WithContext
689689
{
690690
auto partition_key = replaceWildcards(blob, partition_id);
691691
validateKey(partition_key);
692-
if (auto new_path = checkFileExistsAndCreateNewKeyIfNeeded(getContext(), object_storage, partition_key, 1))
692+
if (auto new_path = checkAndGetNewFileOnInsertIfNeeded(getContext(), object_storage, partition_key, 1))
693693
partition_key = *new_path;
694694

695695
return std::make_shared<StorageAzureBlobSink>(
@@ -894,7 +894,7 @@ SinkToStoragePtr StorageAzureBlob::write(const ASTPtr & query, const StorageMeta
894894
throw Exception(ErrorCodes::DATABASE_ACCESS_DENIED,
895895
"AzureBlobStorage key '{}' contains globs, so the table is in readonly mode", configuration.blob_path);
896896

897-
if (auto new_path = checkFileExistsAndCreateNewKeyIfNeeded(local_context, object_storage.get(), path, configuration.blobs_paths.size()))
897+
if (auto new_path = checkAndGetNewFileOnInsertIfNeeded(local_context, object_storage.get(), path, configuration.blobs_paths.size()))
898898
{
899899
configuration.blobs_paths.push_back(*new_path);
900900
path = *new_path;

src/Storages/StorageS3.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ class StorageS3Sink : public SinkToStorage
957957

958958
namespace
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

Comments
 (0)