Merge pull request #71889 from yariks5s/fix_insert_hive_partititoning

Fixes for hive partitioning while reading
This commit is contained in:
Yarik Briukhovetskyi 2024-11-19 16:51:47 +00:00 committed by GitHub
commit 98f7681497
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,6 +47,7 @@ String StorageObjectStorage::getPathSample(StorageInMemoryMetadata metadata, Con
auto query_settings = configuration->getQuerySettings(context);
/// We don't want to throw an exception if there are no files with specified path.
query_settings.throw_on_zero_files_match = false;
query_settings.ignore_non_existent_file = true;
bool local_distributed_processing = distributed_processing;
if (context->getSettingsRef()[Setting::use_hive_partitioning])
@ -64,6 +65,9 @@ String StorageObjectStorage::getPathSample(StorageInMemoryMetadata metadata, Con
{} // file_progress_callback
);
if (!configuration->isArchive() && !configuration->isPathWithGlobs() && !local_distributed_processing)
return configuration->getPath();
if (auto file = file_iterator->next(0))
return file->getPath();
return "";