Address comment

This commit is contained in:
achulkov2 2020-01-30 19:41:58 +03:00
parent 0482ab8eaa
commit 1f97500756

View File

@ -581,10 +581,12 @@ void getPointsReprByArrays(const IColumn * column, std::vector<IPolygonDictionar
if (!ptr_coord) if (!ptr_coord)
throw Exception{"Expected coordinates to be of type Float64", ErrorCodes::TYPE_MISMATCH}; throw Exception{"Expected coordinates to be of type Float64", ErrorCodes::TYPE_MISMATCH};
const auto & offsets = ptr_points->getOffsets(); const auto & offsets = ptr_points->getOffsets();
IColumn::Offset prev_offset = 0;
for (size_t i = 0; i < offsets.size(); ++i) 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}; 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)); dest.emplace_back(ptr_coord->getElement(2 * i), ptr_coord->getElement(2 * i + 1));
} }
} }