From 13a05adcb919831867b7c409fd966f817d4c49c4 Mon Sep 17 00:00:00 2001 From: avogar Date: Tue, 21 Jun 2022 17:34:08 +0000 Subject: [PATCH] Some fixes --- src/Storages/Cache/SchemaCache.h | 4 ++-- src/Storages/HDFS/StorageHDFS.cpp | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Storages/Cache/SchemaCache.h b/src/Storages/Cache/SchemaCache.h index 21217c6dd44..ada43bfc870 100644 --- a/src/Storages/Cache/SchemaCache.h +++ b/src/Storages/Cache/SchemaCache.h @@ -84,8 +84,8 @@ public: if (schema_info.ttl) { - /// Current value in cache is valid and we can resume it's TTL bu updating it's expiration time. - /// We will extract current value from the expiration queue, modify it and insert back to the queue.. + /// Current value in cache is valid and we can resume it's TTL by updating it's expiration time. + /// We will extract current value from the expiration queue, modify it and insert back to the queue. time_t now = std::time(nullptr); auto jt = expiration_queue.find({schema_info.valid_until, key}); auto node = expiration_queue.extract(jt); diff --git a/src/Storages/HDFS/StorageHDFS.cpp b/src/Storages/HDFS/StorageHDFS.cpp index 0000758f8cc..fd7be3bc91a 100644 --- a/src/Storages/HDFS/StorageHDFS.cpp +++ b/src/Storages/HDFS/StorageHDFS.cpp @@ -208,7 +208,11 @@ ColumnsDescription StorageHDFS::getTableStructureFromData( std::make_unique(uri_without_path, *it++, ctx->getGlobalContext()->getConfigRef()), compression); }; - auto columns = readSchemaFromFormat(format, std::nullopt, read_buffer_iterator, paths.size() > 1, ctx); + ColumnsDescription columns; + if (columns_from_cache) + columns = *columns_from_cache; + else + columns = readSchemaFromFormat(format, std::nullopt, read_buffer_iterator, paths.size() > 1, ctx); if (ctx->getSettingsRef().use_cache_for_hdfs_schema_inference) addColumnsToCache(paths, columns, ctx);