Merge pull request #72185 from yariks5s/fix_bugs_storageobjectstorage

Small bugs fixes in `StorageObjectStorage`
This commit is contained in:
Yarik Briukhovetskyi 2024-12-04 11:12:43 +00:00 committed by GitHub
commit d93dff37f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 4 deletions

View File

@ -42,7 +42,7 @@ namespace ErrorCodes
extern const int LOGICAL_ERROR;
}
String StorageObjectStorage::getPathSample(StorageInMemoryMetadata metadata, ContextPtr context)
String StorageObjectStorage::getPathSample(ContextPtr context)
{
auto query_settings = configuration->getQuerySettings(context);
/// We don't want to throw an exception if there are no files with specified path.
@ -60,7 +60,7 @@ String StorageObjectStorage::getPathSample(StorageInMemoryMetadata metadata, Con
local_distributed_processing,
context,
{}, // predicate
metadata.getColumns().getAll(), // virtual_columns
{}, // virtual_columns
nullptr, // read_keys
{} // file_progress_callback
);
@ -121,7 +121,7 @@ StorageObjectStorage::StorageObjectStorage(
metadata.setComment(comment);
if (sample_path.empty() && context->getSettingsRef()[Setting::use_hive_partitioning])
sample_path = getPathSample(metadata, context);
sample_path = getPathSample(context);
setVirtuals(VirtualColumnUtils::getVirtualsForFileLikeStorage(metadata.columns, context, sample_path, format_settings));
setInMemoryMetadata(metadata);

View File

@ -123,7 +123,7 @@ public:
const ContextPtr & context);
protected:
String getPathSample(StorageInMemoryMetadata metadata, ContextPtr context);
String getPathSample(ContextPtr context);
static std::unique_ptr<ReadBufferIterator> createReadBufferIterator(
const ObjectStoragePtr & object_storage,

View File

@ -757,6 +757,7 @@ StorageObjectStorage::ObjectInfoPtr StorageObjectStorageSource::KeysIterator::ne
auto metadata = object_storage->tryGetObjectMetadata(key);
if (!metadata)
continue;
object_metadata = *metadata;
}
else
object_metadata = object_storage->getObjectMetadata(key);

View File

@ -0,0 +1,2 @@
21 Str21
22 Str22

View File

@ -0,0 +1,9 @@
-- Tags: no-fasttest
SELECT * FROM s3(
'http://localhost:11111/test/03036_json_archive.zip :: example11.jsonl',
JSONEachRow,
'id UInt32, data String'
)
ORDER BY tuple(*)
SETTINGS s3_ignore_file_doesnt_exist=1, use_cache_for_count_from_files=0;