https://s3.amazonaws.com/clickhouse-test-reports/0/66e677b307558eec0fa18444dca828983c5d3093/fuzzer_astfuzzerubsan//report.html

```
2022.08.25 13:46:47.095221 [ 212 ] {477e3605-187f-4cad-9574-998bde09e74f} <Debug> executeQuery: (from [::ffff:127.0.0.1]:37656) SELECT 0, sum(number) AS val FROM numbers(1048576) GROUP BY GROUPING SETS (('1025'), (number)) ORDER BY '0.2147483646' ASC, (number, number % 2, val) DESC SETTINGS group_by_use_nulls = 1 (stage: Complete)
2022.08.25 13:46:47.095336 [ 212 ] {477e3605-187f-4cad-9574-998bde09e74f} <Trace> ContextAccess (default): Access granted: CREATE TEMPORARY TABLE ON *.*
2022.08.25 13:46:47.095758 [ 212 ] {477e3605-187f-4cad-9574-998bde09e74f} <Trace> InterpreterSelectQuery: FetchColumns -> Complete
2022.08.25 13:46:47.098240 [ 449 ] {477e3605-187f-4cad-9574-998bde09e74f} <Trace> AggregatingTransform: Aggregating
2022.08.25 13:46:47.098243 [ 448 ] {477e3605-187f-4cad-9574-998bde09e74f} <Trace> AggregatingTransform: Aggregating
2022.08.25 13:46:47.098269 [ 449 ] {477e3605-187f-4cad-9574-998bde09e74f} <Trace> Aggregator: Aggregation method: without_key
2022.08.25 13:46:47.098288 [ 448 ] {477e3605-187f-4cad-9574-998bde09e74f} <Trace> Aggregator: Aggregation method: key64
2022.08.25 13:46:47.098957 [ 449 ] {477e3605-187f-4cad-9574-998bde09e74f} <Debug> AggregatingTransform: Aggregated. 1048576 to 1 rows (from 8.00 MiB) in 0.003004867 sec. (348959205.183 rows/sec., 2.60 GiB/sec.)
2022.08.25 13:46:47.098979 [ 449 ] {477e3605-187f-4cad-9574-998bde09e74f} <Trace> Aggregator: Merging aggregated data
2022.08.25 13:46:47.098995 [ 449 ] {477e3605-187f-4cad-9574-998bde09e74f} <Trace> Aggregator: Statistics updated for key=7339891029760931553: new sum_of_sizes=1, median_size=1
2022.08.25 13:46:47.238693 [ 448 ] {477e3605-187f-4cad-9574-998bde09e74f} <Debug> AggregatingTransform: Aggregated. 1048576 to 1048576 rows (from 8.00 MiB) in 0.142719459 sec. (7347113.052 rows/sec., 56.05 MiB/sec.)
2022.08.25 13:46:47.238730 [ 448 ] {477e3605-187f-4cad-9574-998bde09e74f} <Trace> Aggregator: Merging aggregated data
2022.08.25 13:46:47.238749 [ 448 ] {477e3605-187f-4cad-9574-998bde09e74f} <Trace> Aggregator: Statistics updated for key=7339891029760931553: new sum_of_sizes=1048576, median_size=1048576
2022.08.25 13:46:47.607124 [ 448 ] {477e3605-187f-4cad-9574-998bde09e74f} <Debug> DiskLocal: Reserving 36.00 MiB on disk `_tmp_default`, having unreserved 83.77 GiB.
2022.08.25 13:46:47.607259 [ 448 ] {477e3605-187f-4cad-9574-998bde09e74f} <Information> MergeSortingTransform: Sorting and writing part of data into temporary file ./tmp/tmp126mkaaaa
2022.08.25 13:46:47.607367 [ 448 ] {477e3605-187f-4cad-9574-998bde09e74f} <Information> MergeSortingTransform: There are 1 temporary sorted parts to merge.
2022.08.25 13:46:47.643680 [ 449 ] {477e3605-187f-4cad-9574-998bde09e74f} <Fatal> : Logical error: 'Bad cast from type DB::ColumnNullable to DB::ColumnVector<unsigned long>'.
2022.08.25 13:48:59.940799 [ 212 ] {477e3605-187f-4cad-9574-998bde09e74f} <Information> TCPHandler: Query was cancelled.
2022.08.25 13:48:59.941136 [ 450 ] {} <Fatal> BaseDaemon: (version 22.9.1.1 (official build), build id: C0F734BC13E32605) (from thread 449) (query_id: 477e3605-187f-4cad-9574-998bde09e74f) (query: SELECT 0, sum(number) AS val FROM numbers(1048576) GROUP BY GROUPING SETS (('1025'), (number)) ORDER BY '0.2147483646' ASC, (number, number % 2, val) DESC SETTINGS group_by_use_nulls = 1) Received signal Aborted (6)


2022.08.25 13:46:47.643680 [ 449 ] {477e3605-187f-4cad-9574-998bde09e74f} <Fatal> : Logical error: 'Bad cast from type DB::ColumnNullable to DB::ColumnVector<unsigned long>'.
2022.08.25 13:48:59.940978 [ 450 ] {} <Fatal> BaseDaemon: ########################################
2022.08.25 13:48:59.941136 [ 450 ] {} <Fatal> BaseDaemon: (version 22.9.1.1 (official build), build id: C0F734BC13E32605) (from thread 449) (query_id: 477e3605-187f-4cad-9574-998bde09e74f) (query: SELECT 0, sum(number) AS val FROM numbers(1048576) GROUP BY GROUPING SETS (('1025'), (number)) ORDER BY '0.2147483646' ASC, (number, number % 2, val) DESC SETTINGS group_by_use_nulls = 1) Received signal Aborted (6)
2022.08.25 13:48:59.941289 [ 450 ] {} <Fatal> BaseDaemon: 
2022.08.25 13:48:59.941472 [ 450 ] {} <Fatal> BaseDaemon: Stack trace: 0x7f133f91100b 0x7f133f8f0859 0x1027d5e3 0x1027d88f 0x18c7e484 0x24b072d8 0x24ae8454 0x24b460e8 0x26fc4986 0x26fc41f3 0x273fef0f 0x26fd6ae5 0x270054a5 0x27004fcb 0x26ff505b 0x26ff6660 0x26ff6546 0x10348272 0x1034aec3 0x7f133fac8609 0x7f133f9ed133
2022.08.25 13:48:59.941691 [ 450 ] {} <Fatal> BaseDaemon: 3. raise in ?
2022.08.25 13:48:59.941932 [ 450 ] {} <Fatal> BaseDaemon: 4. abort in ?
2022.08.25 13:48:59.969995 [ 450 ] {} <Fatal> BaseDaemon: 5. ./build_docker/../src/Common/Exception.cpp:47: DB::abortOnFailedAssertion(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in /workspace/clickhouse
2022.08.25 13:48:59.993479 [ 450 ] {} <Fatal> BaseDaemon: 6. ./build_docker/../src/Common/Exception.cpp:70: DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) in /workspace/clickhouse
2022.08.25 13:49:00.968140 [ 450 ] {} <Fatal> BaseDaemon: 7. DB::ColumnVector<unsigned long> const& typeid_cast<DB::ColumnVector<unsigned long> const&, DB::IColumn const>(DB::IColumn const&) in /workspace/clickhouse
2022.08.25 13:49:00.981626 [ 450 ] {} <Fatal> BaseDaemon: 8. ./build_docker/../src/DataTypes/Serializations/SerializationNumber.cpp:137: DB::SerializationNumber<unsigned long>::serializeBinaryBulk(DB::IColumn const&, DB::WriteBuffer&, unsigned long, unsigned long) const in /workspace/clickhouse
2022.08.25 13:49:00.987036 [ 450 ] {} <Fatal> BaseDaemon: 9.1. inlined from ./build_docker/../contrib/libcxx/include/vector:1594: std::__1::vector<DB::ISerialization::Substream, std::__1::allocator<DB::ISerialization::Substream> >::pop_back()
2022.08.25 13:49:00.987062 [ 450 ] {} <Fatal> BaseDaemon: 9. ../src/DataTypes/Serializations/SerializationNamed.cpp:55: DB::SerializationNamed::serializeBinaryBulkWithMultipleStreams(DB::IColumn const&, unsigned long, unsigned long, DB::ISerialization::SerializeBinaryBulkSettings&, std::__1::shared_ptr<DB::ISerialization::SerializeBinaryBulkState>&) const in /workspace/clickhouse
2022.08.25 13:49:00.997745 [ 450 ] {} <Fatal> BaseDaemon: 10. ./build_docker/../src/DataTypes/Serializations/SerializationTuple.cpp:0: DB::SerializationTuple::serializeBinaryBulkWithMultipleStreams(DB::IColumn const&, unsigned long, unsigned long, DB::ISerialization::SerializeBinaryBulkSettings&, std::__1::shared_ptr<DB::ISerialization::SerializeBinaryBulkState>&) const in /workspace/clickhouse
2022.08.25 13:49:01.008365 [ 450 ] {} <Fatal> BaseDaemon: 11. ./build_docker/../src/Formats/NativeWriter.cpp:64: DB::writeData(DB::ISerialization const&, COW<DB::IColumn>::immutable_ptr<DB::IColumn> const&, DB::WriteBuffer&, unsigned long, unsigned long) in /workspace/clickhouse
2022.08.25 13:49:01.017867 [ 450 ] {} <Fatal> BaseDaemon: 12. ./build_docker/../src/Formats/NativeWriter.cpp:166: DB::NativeWriter::write(DB::Block const&) in /workspace/clickhouse
2022.08.25 13:49:01.050545 [ 450 ] {} <Fatal> BaseDaemon: 13. ./build_docker/../src/Processors/Transforms/MergeSortingTransform.cpp:0: DB::BufferingToFileTransform::consume(DB::Chunk) in /workspace/clickhouse
2022.08.25 13:49:01.062069 [ 450 ] {} <Fatal> BaseDaemon: 14.1. inlined from ./build_docker/../src/Processors/Chunk.h:32: ~Chunk
2022.08.25 13:49:01.062096 [ 450 ] {} <Fatal> BaseDaemon: 14. ../src/Processors/IAccumulatingTransform.cpp:97: DB::IAccumulatingTransform::work() in /workspace/clickhouse
2022.08.25 13:49:01.069074 [ 450 ] {} <Fatal> BaseDaemon: 15. ./build_docker/../src/Processors/Executors/ExecutionThreadContext.cpp:50: DB::executeJob(DB::ExecutingGraph::Node*, DB::ReadProgressCallback*) in /workspace/clickhouse
2022.08.25 13:49:01.075486 [ 450 ] {} <Fatal> BaseDaemon: 16. ./build_docker/../src/Processors/Executors/ExecutionThreadContext.cpp:93: DB::ExecutionThreadContext::executeTask() in /workspace/clickhouse
2022.08.25 13:49:01.090797 [ 450 ] {} <Fatal> BaseDaemon: 17. ./build_docker/../src/Processors/Executors/PipelineExecutor.cpp:228: DB::PipelineExecutor::executeStepImpl(unsigned long, std::__1::atomic<bool>*) in /workspace/clickhouse
2022.08.25 13:49:01.107881 [ 450 ] {} <Fatal> BaseDaemon: 18. ./build_docker/../contrib/libcxx/include/type_traits:3648: decltype(static_cast<DB::PipelineExecutor::spawnThreads()::$_0&>(fp)()) std::__1::__invoke_constexpr<DB::PipelineExecutor::spawnThreads()::$_0&>(DB::PipelineExecutor::spawnThreads()::$_0&) in /workspace/clickhouse
2022.08.25 13:49:01.124948 [ 450 ] {} <Fatal> BaseDaemon: 19.1. inlined from ./build_docker/../contrib/libcxx/include/tuple:0: operator()
2022.08.25 13:49:01.124973 [ 450 ] {} <Fatal> BaseDaemon: 19. ../contrib/libcxx/include/type_traits:3640: decltype(static_cast<DB::PipelineExecutor::spawnThreads()::$_0>(fp)()) std::__1::__invoke<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PipelineExecutor::spawnThreads()::$_0>(DB::PipelineExecutor::spawnThreads()::$_0&&)::'lambda'()&>(DB::PipelineExecutor::spawnThreads()::$_0&&) in /workspace/clickhouse
2022.08.25 13:49:01.134093 [ 450 ] {} <Fatal> BaseDaemon: 20.1. inlined from ./build_docker/../contrib/libcxx/include/__functional/function.h:1157: std::__1::function<void ()>::operator=(std::nullptr_t)
2022.08.25 13:49:01.134114 [ 450 ] {} <Fatal> BaseDaemon: 20. ../src/Common/ThreadPool.cpp:284: ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) in /workspace/clickhouse
2022.08.25 13:49:01.144858 [ 450 ] {} <Fatal> BaseDaemon: 21. ./build_docker/../src/Common/ThreadPool.cpp:0: void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()> >(void*) in /workspace/clickhouse
2022.08.25 13:49:01.144881 [ 450 ] {} <Fatal> BaseDaemon: 22. ? in ?
2022.08.25 13:49:01.144930 [ 450 ] {} <Fatal> BaseDaemon: 23. __clone in ?
2022.08.25 13:49:01.457050 [ 450 ] {} <Fatal> BaseDaemon: Integrity check of the executable successfully passed (checksum: DBD24847576AE046A0B2EF4B7FE55D76)

```

});
            aggregating_in_order = collector.detachProcessors(0);
        }
        finalizing = collector.detachProcessors(2);
        return;
    }
    
    if (pipeline.getNumStreams() > 1)
    {
        
        if (!storage_has_evenly_distributed_read)
            pipeline.resize(pipeline.getNumStreams(), true, true);
        auto many_data = std::make_shared<ManyAggregatedData>(pipeline.getNumStreams());
        size_t counter = 0;
        pipeline.addSimpleTransform([&](const Block & header)
        {
            return std::make_shared<AggregatingTransform>(header, transform_params, many_data, counter++, merge_threads, temporary_data_merge_threads);
        });
        
        pipeline.resize(should_produce_results_in_order_of_bucket_number ? 1 : params.max_threads, true );
        aggregating = collector.detachProcessors(0);
    }
    else
    {
        pipeline.addSimpleTransform([&](const Block & header) { return std::make_shared<AggregatingTransform>(header, transform_params); });
        pipeline.resize(should_produce_results_in_order_of_bucket_number ? 1 : params.max_threads, false );
        aggregating = collector.detachProcessors(0);
    }
}
void AggregatingStep::describeActions(FormatSettings & settings) const