From 60df70053dfdca97dd0c603bed5f6e663caafd81 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Tue, 3 Feb 2015 20:39:24 +0300 Subject: [PATCH] dbms: fixed error [#METR-14902]. --- dbms/include/DB/Storages/MergeTree/MergeTreeData.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dbms/include/DB/Storages/MergeTree/MergeTreeData.h b/dbms/include/DB/Storages/MergeTree/MergeTreeData.h index 343de9ee815..cf969d4d3fd 100644 --- a/dbms/include/DB/Storages/MergeTree/MergeTreeData.h +++ b/dbms/include/DB/Storages/MergeTree/MergeTreeData.h @@ -405,8 +405,13 @@ public: { /// Размер - в количестве засечек. if (!size) + { + if (columns.empty()) + throw Exception("No columns in part " + name, ErrorCodes::NO_FILE_IN_DATA_PART); + size = Poco::File(storage.full_path + name + "/" + escapeForFileName(columns.front().name) + ".mrk") .getSize() / MERGE_TREE_MARK_SIZE; + } size_t key_size = storage.sort_descr.size(); index.resize(key_size * size); @@ -456,6 +461,9 @@ public: columns.push_back(column); } + if (columns.empty()) + throw Exception("No columns in part " + name, ErrorCodes::NO_FILE_IN_DATA_PART); + { WriteBufferFromFile out(path + ".tmp", 4096); columns.writeText(out);