Update src/AggregateFunctions/AggregateFunctionSumMap.cpp

Co-Authored-By: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com>
This commit is contained in:
Ildus Kurbangaliev 2020-04-16 17:42:19 +02:00
parent 6244270809
commit fcacca68d7

View File

@ -56,6 +56,9 @@ SumMapArgs parseArguments(const std::string & name, const DataTypes & arguments)
if (arguments.size() == 1)
{
// sumMap is a transitive function, so it can be stored in SimpleAggregateFunction columns.
// There is a caveat: it must support sumMap(sumMap(...)), e.g. it must be able to accept its
// own output as an input. This is why we also support Tuple(keys, values) as an argument.
const auto * tuple_type = checkAndGetDataType<DataTypeTuple>(arguments[0].get());
if (!tuple_type)
throw Exception("When function " + name + " gets one argument it must be a tuple",