From 9e9b33ebe5b9d2b38932e0ad71513e7bf7851897 Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Fri, 22 Jun 2018 16:37:35 +0300 Subject: [PATCH] Fix deserialization indexes for additional keys in DataTypeWithDictionary. --- dbms/src/DataTypes/DataTypeWithDictionary.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dbms/src/DataTypes/DataTypeWithDictionary.cpp b/dbms/src/DataTypes/DataTypeWithDictionary.cpp index 0ec0c355e9f..9a692cb508d 100644 --- a/dbms/src/DataTypes/DataTypeWithDictionary.cpp +++ b/dbms/src/DataTypes/DataTypeWithDictionary.cpp @@ -354,12 +354,11 @@ namespace MutableColumnPtr mapIndexWithOverflow(PaddedPODArray & index, size_t max_val) { HashMap hash_map; - HashMap hash_map_with_overflow; for (auto val : index) { - auto & map = val < max_val ? hash_map : hash_map_with_overflow; - map.insert({val, map.size()}); + if (val < max_val) + hash_map.insert({val, hash_map.size()}); } auto index_map_col = ColumnVector::create(); @@ -371,7 +370,7 @@ namespace for (auto & val : index) val = val < max_val ? hash_map[val] - : hash_map_with_overflow[val] + hash_map.size(); + : val - max_val + hash_map.size(); return index_map_col; }