```
CREATE TABLE smta
(
    `k` Int64,
    `a` AggregateFunction(max, Int64),
    `city` SimpleAggregateFunction(max, LowCardinality(String))
)
ENGINE = SummingMergeTree
ORDER BY k;

insert  into smta(k, city) values (1, 'x');

BaseDaemon: ########################################
BaseDaemon: (version 21.7.1.7020 (official build), build id: F609E0F0A9A1245F3A29AA02CB5A58D597BFA40D) (from thread 2

BaseDaemon: Address: 0x1 Access: read. Address not mapped to object.
BaseDaemon: Stack trace: 0x8d33350 0x10855b5b 0x1085a947 0x1040e6d8 0x1040f628 0x102fbcca 0xfa627b2 0xfa6c46b 0xfa6ca

BaseDaemon: 1. memcpy @ 0x8d33350 in /usr/bin/clickhouse
BaseDaemon: 2. DB::SummingSortedAlgorithm::SummingMergedData::addRowImpl(std::__1::vector<DB::IColumn const*, std::__
BaseDaemon: 3. DB::SummingSortedAlgorithm::merge() @ 0x1085a947 in /usr/bin/clickhouse
BaseDaemon: 4. DB::MergeTreeDataWriter::mergeBlock(DB::Block const&, std::__1::vector<DB::SortColumnDescription, std:
ar> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&

BaseDaemon: 5. DB::MergeTreeDataWriter::writeTempPart(DB::BlockWithPartition&, std::__1::shared_ptr<DB::StorageInMemo

BaseDaemon: 6. DB::MergeTreeBlockOutputStream::write(DB::Block const&) @ 0x102fbcca in /usr/bin/clickhouse
BaseDaemon: 7. DB::PushingToViewsBlockOutputStream::write(DB::Block const&) @ 0xfa627b2 in /usr/bin/clickhouse
BaseDaemon: 8. DB::AddingDefaultBlockOutputStream::write(DB::Block const&) @ 0xfa6c46b in /usr/bin/clickhouse
BaseDaemon: 9. DB::SquashingBlockOutputStream::finalize() @ 0xfa6caec in /usr/bin/clickhouse
BaseDaemon: 10. DB::SquashingBlockOutputStream::writeSuffix() @ 0xfa6cb89 in /usr/bin/clickhouse
BaseDaemon: 11. DB::TCPHandler::processInsertQuery(DB::Settings const&) @ 0x106470ef in /usr/bin/clickhouse
BaseDaemon: 12. DB::TCPHandler::runImpl() @ 0x1063f989 in /usr/bin/clickhouse
BaseDaemon: 13. DB::TCPHandler::run() @ 0x10652679 in /usr/bin/clickhouse
BaseDaemon: 14. Poco::Net::TCPServerConnection::start() @ 0x132f6e2f in /usr/bin/clickhouse
BaseDaemon: 15. Poco::Net::TCPServerDispatcher::run() @ 0x132f88ba in /usr/bin/clickhouse
BaseDaemon: 16. Poco::PooledThread::run() @ 0x1342c3f9 in /usr/bin/clickhouse
BaseDaemon: 17. Poco::ThreadImpl::runnableEntry(void*) @ 0x1342868a in /usr/bin/clickhouse
BaseDaemon: 18. start_thread @ 0x7fa3 in /lib/x86_64-linux-gnu/libpthread-2.28.so
BaseDaemon: 19. clone @ 0xf94cf in /lib/x86_64-linux-gnu/libc-2.28.so
BaseDaemon: Checksum of the binary: 368AF822681E77D6553F41BA8FB4AD91, integrity check passed.

```
#include <Processors/Merges/Algorithms/SummingSortedAlgorithm.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <Columns/ColumnAggregateFunction.h>
#include <Columns/ColumnTuple.h>
#include <Common/AlignedBuffer.h>
#include <Common/Arena.h>
#include <Common/FieldVisitorSum.h>
#include <Common/StringUtils/StringUtils.h>
#include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypeCustomSimpleAggregateFunction.h>
#include <DataTypes/NestedUtils.h>
#include <IO/WriteHelpers.h>
namespace DB
{
namespace ErrorCodes
{
    extern const int LOGICAL_ERROR;
    extern const int CORRUPTED_DATA;
}
SummingSortedAlgorithm::ColumnsDefinition::ColumnsDefinition() = default;