MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / decodeAggregateFunction

Function decodeAggregateFunction

src/DataTypes/DataTypesBinaryEncoding.cpp:286–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286std::tuple<AggregateFunctionPtr, Array, DataTypes> decodeAggregateFunction(ReadBuffer & buf, size_t & complexity)
287{
288 String function_name;
289 readStringBinary(function_name, buf);
290 size_t num_parameters = 0;
291 readVarUInt(num_parameters, buf);
292 if (num_parameters > MAX_ARRAY_SIZE)
293 throw Exception(ErrorCodes::INCORRECT_DATA, "Too many parameters during AggregateFunction type decoding: {}. Maximum: {}", num_parameters, MAX_ARRAY_SIZE);
294
295 Array parameters;
296 parameters.reserve(num_parameters);
297 for (size_t i = 0; i != num_parameters; ++i)
298 parameters.push_back(decodeField(buf));
299 size_t num_arguments = 0;
300 readVarUInt(num_arguments, buf);
301 if (num_arguments > MAX_ARRAY_SIZE)
302 throw Exception(ErrorCodes::INCORRECT_DATA, "Too many function arguments during AggregateFunction type decoding: {}. Maximum: {}", num_arguments, MAX_ARRAY_SIZE);
303
304 DataTypes arguments_types;
305 arguments_types.reserve(num_arguments);
306 for (size_t i = 0; i != num_arguments; ++i)
307 arguments_types.push_back(decodeDataType(buf, complexity));
308 AggregateFunctionProperties properties;
309 auto action = NullsAction::EMPTY;
310 auto function = AggregateFunctionFactory::instance().get(function_name, action, arguments_types, parameters, properties);
311 return {function, parameters, arguments_types};
312}
313
314template <bool encode_for_hash_calculation>
315void encodeDataTypeImpl(const DataTypePtr & type, WriteBuffer & buf)

Callers 1

decodeDataTypeFunction · 0.85

Calls 7

readStringBinaryFunction · 0.85
decodeFieldFunction · 0.85
decodeDataTypeFunction · 0.85
ExceptionClass · 0.50
reserveMethod · 0.45
push_backMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected