
https://s3.amazonaws.com/clickhouse-test-reports/36171/f7b329ee57bd6ddc758e3de4a07ae33af989124e/fuzzer_astfuzzerubsan,actions//report.html
```
../src/Common/assert_cast.h:50:12: runtime error: downcast of address 0x7f7ca4004220 which does not point to an object of type 'const DB::ColumnNullable'
0x7f7ca4004220: note: object is of type 'DB::ColumnConst'
 00 00 00 00  b0 19 c4 0a 00 00 00 00  01 00 00 00 00 00 00 00  e0 63 23 a0 7c 7f 00 00  01 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'DB::ColumnConst'
2022.06.24 00:44:49.000150 [ 397 ] {} <Trace> AsynchronousMetrics: MemoryTracking: was 786.19 MiB, peak 788.19 MiB, will set to 796.76 MiB (RSS), difference: 10.58 MiB
    #0 0x242f2b6b in DB::ColumnNullable const& assert_cast<DB::ColumnNullable const&, DB::IColumn const&>(DB::IColumn const&) build_docker/../src/Common/assert_cast.h:50:12
    #1 0x242f2b6b in DB::ColumnNullable::compareAtImpl(unsigned long, unsigned long, DB::IColumn const&, int, Collator const*) const build_docker/../src/Columns/ColumnNullable.cpp:317:43
    #2 0x254bcb70 in DB::(anonymous namespace)::compareWithThreshold(std::__1::vector<DB::IColumn const*, std::__1::allocator<DB::IColumn const*> > const&, unsigned long, std::__1::vector<COW<DB::IColumn>::immutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::immutable_ptr<DB::IColumn> > > const&, DB::SortDescription const&) build_docker/../src/Processors/Transforms/PartialSortingTransform.cpp:74:73
    #3 0x254bba4a in DB::PartialSortingTransform::transform(DB::Chunk&) build_docker/../src/Processors/Transforms/PartialSortingTransform.cpp:157:13
    #4 0x1d43caea in DB::ISimpleTransform::transform(DB::Chunk&, DB::Chunk&) build_docker/../src/Processors/ISimpleTransform.h:32:9
    #5 0x250e3590 in DB::ISimpleTransform::work() build_docker/../src/Processors/ISimpleTransform.cpp:89:9
    #6 0x2510a97f in DB::executeJob(DB::ExecutingGraph::Node*, DB::ReadProgressCallback*) build_docker/../src/Processors/Executors/ExecutionThreadContext.cpp:47:26
    #7 0x2510a556 in DB::ExecutionThreadContext::executeTask() build_docker/../src/Processors/Executors/ExecutionThreadContext.cpp:86:9
    #8 0x250fcb32 in DB::PipelineExecutor::executeStepImpl(unsigned long, std::__1::atomic<bool>*) build_docker/../src/Processors/Executors/PipelineExecutor.cpp:222:26
    #9 0x250fc4e3 in DB::PipelineExecutor::executeSingleThread(unsigned long) build_docker/../src/Processors/Executors/PipelineExecutor.cpp:187:5
    #10 0x250fc4e3 in DB::PipelineExecutor::executeImpl(unsigned long) build_docker/../src/Processors/Executors/PipelineExecutor.cpp:331:9
    #11 0x250fc089 in DB::PipelineExecutor::execute(unsigned long) build_docker/../src/Processors/Executors/PipelineExecutor.cpp:88:9
    #12 0x2510f182 in DB::threadFunction(DB::PullingAsyncPipelineExecutor::Data&, std::__1::shared_ptr<DB::ThreadGroupStatus>, unsigned long) build_docker/../src/Processors/Executors/PullingAsyncPipelineExecutor.cpp:79:24
    #13 0x2510f0e1 in DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0::operator()() const build_docker/../src/Processors/Executors/PullingAsyncPipelineExecutor.cpp:107:13
    #14 0x2510f0e1 in decltype(static_cast<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&>(fp)()) std::__1::__invoke_constexpr<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&) build_docker/../contrib/libcxx/include/type_traits:3648:23
    #15 0x2510ef9a in decltype(auto) std::__1::__apply_tuple_impl<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&, std::__1::__tuple_indices<>) build_docker/../contrib/libcxx/include/tuple:1595:1
    #16 0x2510ef9a in decltype(auto) std::__1::apply<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&) build_docker/../contrib/libcxx/include/tuple:1604:1
    #17 0x2510ef9a in ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()::operator()() build_docker/../src/Common/ThreadPool.h:188:13
    #18 0x2510ef9a in decltype(static_cast<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(fp)()) std::__1::__invoke<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&) build_docker/../contrib/libcxx/include/type_traits:3640:23
    #19 0xff2aa20 in std::__1::__function::__policy_func<void ()>::operator()() const build_docker/../contrib/libcxx/include/__functional/function.h:843:16
    #20 0xff2aa20 in std::__1::function<void ()>::operator()() const build_docker/../contrib/libcxx/include/__functional/function.h:1184:12
    #21 0xff2aa20 in ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) build_docker/../src/Common/ThreadPool.cpp:281:17
    #22 0xff2d5e1 in void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()::operator()() const build_docker/../src/Common/ThreadPool.cpp:143:73
    #23 0xff2d5e1 in decltype(static_cast<void>(fp)()) std::__1::__invoke<void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&) build_docker/../contrib/libcxx/include/type_traits:3640:23
    #24 0xff2d5e1 in void std::__1::__thread_execute<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'()>(std::__1::tuple<void, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>&, std::__1::__tuple_indices<>) build_docker/../contrib/libcxx/include/thread:282:5
    #25 0xff2d5e1 in 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*) build_docker/../contrib/libcxx/include/thread:293:5
    #26 0x7f7e2c1fe608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
    #27 0x7f7e2c123132 in __clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/Common/assert_cast.h:50:12 in 
2022.06.24 00:44:49.696666 [ 114 ] {} <Trace> BaseDaemon: Received signal -3
2022.06.24 00:44:49.697091 [ 428 ] {} <Fatal> BaseDaemon: ########################################
2022.06.24 00:44:49.697199 [ 428 ] {} <Fatal> BaseDaemon: (version 22.7.1.1, build id: 1676B9CB06093897) (from thread 411) (query_id: e0ce4034-e820-41f4-b995-23087965ec08) (query: SELECT * FROM (SELECT * FROM (SELECT 0 AS a, toNullable(number) AS b, toString(number) AS c FROM numbers(1000000.)) ORDER BY a DESC, b DESC, c ASC LIMIT 1500) LIMIT 10) Received signal Unknown signal (-3)
2022.06.24 00:44:49.697232 [ 428 ] {} <Fatal> BaseDaemon: Sanitizer trap.
2022.06.24 00:44:49.697280 [ 428 ] {} <Fatal> BaseDaemon: Stack trace: 0xfe784e3 0x100e7d11 0xfe2ae86 0xfe3fa8d 0x242f2b6c 0x254bcb71 0x254bba4b 0x1d43caeb 0x250e3591 0x2510a980 0x2510a557 0x250fcb33 0x250fc4e4 0x250fc08a 0x2510f183 0x2510f0e2 0x2510ef9b 0xff2aa21 0xff2d5e2 0x7f7e2c1fe609 0x7f7e2c123133
2022.06.24 00:44:49.706415 [ 428 ] {} <Fatal> BaseDaemon: 0.1. inlined from ./build_docker/../src/Common/StackTrace.cpp:305: StackTrace::tryCapture()
2022.06.24 00:44:49.706450 [ 428 ] {} <Fatal> BaseDaemon: 0. ../src/Common/StackTrace.cpp:266: StackTrace::StackTrace() @ 0xfe784e3 in /workspace/clickhouse
2022.06.24 00:44:49.722487 [ 428 ] {} <Fatal> BaseDaemon: 1. ./build_docker/../src/Daemon/BaseDaemon.cpp:0: sanitizerDeathCallback() @ 0x100e7d11 in /workspace/clickhouse
2022.06.24 00:44:50.000109 [ 397 ] {} <Trace> AsynchronousMetrics: MemoryTracking: was 796.76 MiB, peak 796.76 MiB, will set to 875.25 MiB (RSS), difference: 78.49 MiB
2022.06.24 00:44:50.628688 [ 428 ] {} <Fatal> BaseDaemon: 2. __sanitizer::Die() @ 0xfe2ae86 in /workspace/clickhouse
2022.06.24 00:44:51.000108 [ 397 ] {} <Trace> AsynchronousMetrics: MemoryTracking: was 875.25 MiB, peak 875.25 MiB, will set to 1.19 GiB (RSS), difference: 338.25 MiB
2022.06.24 00:44:51.000145 [ 397 ] {} <Debug> MemoryTracker: Current memory usage (total): 1.19 GiB.
2022.06.24 00:44:51.518815 [ 428 ] {} <Fatal> BaseDaemon: 3. ? @ 0xfe3fa8d in /workspace/clickhouse
2022.06.24 00:44:51.531085 [ 428 ] {} <Fatal> BaseDaemon: 4.1. inlined from ./build_docker/../src/Common/assert_cast.h:0: DB::ColumnNullable const& assert_cast<DB::ColumnNullable const&, DB::IColumn const&>(DB::IColumn const&)
2022.06.24 00:44:51.531131 [ 428 ] {} <Fatal> BaseDaemon: 4. ../src/Columns/ColumnNullable.cpp:317: DB::ColumnNullable::compareAtImpl(unsigned long, unsigned long, DB::IColumn const&, int, Collator const*) const @ 0x242f2b6c in /workspace/clickhouse
2022.06.24 00:44:51.549196 [ 428 ] {} <Fatal> BaseDaemon: 5. ./build_docker/../src/Processors/Transforms/PartialSortingTransform.cpp:0: DB::(anonymous namespace)::compareWithThreshold(std::__1::vector<DB::IColumn const*, std::__1::allocator<DB::IColumn const*> > const&, unsigned long, std::__1::vector<COW<DB::IColumn>::immutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::immutable_ptr<DB::IColumn> > > const&, DB::SortDescription const&) @ 0x254bcb71 in /workspace/clickhouse
2022.06.24 00:44:51.564524 [ 428 ] {} <Fatal> BaseDaemon: 6. ./build_docker/../src/Processors/Transforms/PartialSortingTransform.cpp:156: DB::PartialSortingTransform::transform(DB::Chunk&) @ 0x254bba4b in /workspace/clickhouse
2022.06.24 00:44:51.580101 [ 428 ] {} <Fatal> BaseDaemon: 7. ./build_docker/../src/Processors/ISimpleTransform.h:33: DB::ISimpleTransform::transform(DB::Chunk&, DB::Chunk&) @ 0x1d43caeb in /workspace/clickhouse
2022.06.24 00:44:51.591796 [ 428 ] {} <Fatal> BaseDaemon: 8. ./build_docker/../src/Processors/ISimpleTransform.cpp:99: DB::ISimpleTransform::work() @ 0x250e3591 in /workspace/clickhouse
2022.06.24 00:44:51.599182 [ 428 ] {} <Fatal> BaseDaemon: 9. ./build_docker/../src/Processors/Executors/ExecutionThreadContext.cpp:50: DB::executeJob(DB::ExecutingGraph::Node*, DB::ReadProgressCallback*) @ 0x2510a980 in /workspace/clickhouse
2022.06.24 00:44:51.605811 [ 428 ] {} <Fatal> BaseDaemon: 10. ./build_docker/../src/Processors/Executors/ExecutionThreadContext.cpp:87: DB::ExecutionThreadContext::executeTask() @ 0x2510a557 in /workspace/clickhouse
2022.06.24 00:44:51.620511 [ 428 ] {} <Fatal> BaseDaemon: 11. ./build_docker/../src/Processors/Executors/PipelineExecutor.cpp:222: DB::PipelineExecutor::executeStepImpl(unsigned long, std::__1::atomic<bool>*) @ 0x250fcb33 in /workspace/clickhouse
2022.06.24 00:44:51.633345 [ 428 ] {} <Fatal> BaseDaemon: 12. ./build_docker/../src/Processors/Executors/PipelineExecutor.cpp:333: DB::PipelineExecutor::executeImpl(unsigned long) @ 0x250fc4e4 in /workspace/clickhouse
2022.06.24 00:44:51.647674 [ 428 ] {} <Fatal> BaseDaemon: 13.1. inlined from ./build_docker/../contrib/libcxx/include/__memory/unique_ptr.h:284: std::__1::unique_ptr<DB::ExecutingGraph, std::__1::default_delete<DB::ExecutingGraph> >::operator->() const
2022.06.24 00:44:51.647719 [ 428 ] {} <Fatal> BaseDaemon: 13. ../src/Processors/Executors/PipelineExecutor.cpp:91: DB::PipelineExecutor::execute(unsigned long) @ 0x250fc08a in /workspace/clickhouse
2022.06.24 00:44:51.662334 [ 428 ] {} <Fatal> BaseDaemon: 14. ./build_docker/../src/Processors/Executors/PullingAsyncPipelineExecutor.cpp:0: DB::threadFunction(DB::PullingAsyncPipelineExecutor::Data&, std::__1::shared_ptr<DB::ThreadGroupStatus>, unsigned long) @ 0x2510f183 in /workspace/clickhouse
2022.06.24 00:44:51.676850 [ 428 ] {} <Fatal> BaseDaemon: 15. ./build_docker/../contrib/libcxx/include/type_traits:3648: decltype(static_cast<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&>(fp)()) std::__1::__invoke_constexpr<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&) @ 0x2510f0e2 in /workspace/clickhouse
2022.06.24 00:44:51.691297 [ 428 ] {} <Fatal> BaseDaemon: 16.1. inlined from ./build_docker/../contrib/libcxx/include/tuple:0: operator()
2022.06.24 00:44:51.691330 [ 428 ] {} <Fatal> BaseDaemon: 16. ../contrib/libcxx/include/type_traits:3640: decltype(static_cast<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(fp)()) std::__1::__invoke<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&) @ 0x2510ef9b in /workspace/clickhouse
2022.06.24 00:44:51.701042 [ 428 ] {} <Fatal> BaseDaemon: 17.1. inlined from ./build_docker/../contrib/libcxx/include/__functional/function.h:1157: std::__1::function<void ()>::operator=(std::nullptr_t)
2022.06.24 00:44:51.701073 [ 428 ] {} <Fatal> BaseDaemon: 17. ../src/Common/ThreadPool.cpp:284: ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0xff2aa21 in /workspace/clickhouse
2022.06.24 00:44:51.712213 [ 428 ] {} <Fatal> BaseDaemon: 18. ./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*) @ 0xff2d5e2 in /workspace/clickhouse
2022.06.24 00:44:51.712243 [ 428 ] {} <Fatal> BaseDaemon: 19. ? @ 0x7f7e2c1fe609 in ?
2022.06.24 00:44:51.712265 [ 428 ] {} <Fatal> BaseDaemon: 20. __clone @ 0x7f7e2c123133 in ?
```
const std::string & name,
    const DataTypes & arguments,
    const Array & params,
    const Settings *)
{
    assertNoParameters(name, params);
    if (arguments.size() < 2)
        throw Exception(
            "Aggregate function " + name + " requires two or more arguments",
            ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
    for (const auto & argument : arguments)
    {
        if (!WhichDataType(argument).isUInt8())
            throw Exception(
                "All the arguments of aggregate function " + name + " should be UInt8",
                ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
    }
    return std::make_shared<AggregateFunctionCategoricalIV>(arguments, params);
}
}
void registerAggregateFunctionCategoricalIV(AggregateFunctionFactory & factory)
{
    AggregateFunctionProperties properties = { .returns_default_when_only_null = true };
    factory.registerFunction("categoricalInformationValue", { createAggregateFunctionCategoricalIV, properties });
}
}