From 1f97500756dcd2d72d820fb2736de32e1b0ef0da Mon Sep 17 00:00:00 2001 From: achulkov2 Date: Thu, 30 Jan 2020 19:41:58 +0300 Subject: [PATCH] Address comment --- dbms/src/Dictionaries/PolygonDictionary.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dbms/src/Dictionaries/PolygonDictionary.cpp b/dbms/src/Dictionaries/PolygonDictionary.cpp index c7fa1a4b8a1..e7d4e8a625b 100644 --- a/dbms/src/Dictionaries/PolygonDictionary.cpp +++ b/dbms/src/Dictionaries/PolygonDictionary.cpp @@ -581,10 +581,12 @@ void getPointsReprByArrays(const IColumn * column, std::vectorgetOffsets(); + IColumn::Offset prev_offset = 0; for (size_t i = 0; i < offsets.size(); ++i) { - if (offsets[i] - (i == 0 ? 0 : offsets[i - 1]) != 2) + if (offsets[i] - prev_offset != 2) throw Exception{"All points should be two-dimensional", ErrorCodes::BAD_ARGUMENTS}; + prev_offset = offsets[i]; dest.emplace_back(ptr_coord->getElement(2 * i), ptr_coord->getElement(2 * i + 1)); } }