ClickHouse: argMaxSimpleState((1,1)) crash

Does it reproduce on recent release? Yes.

How to reproduce Clickhouse version 21.4.6395 (master), 21.3.4.25

SELECT argMaxSimpleState((1, 1))

Query id: 41a50d5e-15f1-4fa7-8171-d1767b061a1d

2021.03.31 02:16:36.523853 [ 4038 ] <Fatal> BaseDaemon: ########################################
2021.03.31 02:16:36.523912 [ 4038 ] <Fatal> BaseDaemon: (version 21.4.1.6395 (official build), build id: E16FB8B53E687D53215B76D44CF690AF09D9EB98) (from thread 3982) (query_id: 41a50d5e-15f1-4fa7-8171-d1767b061a1d) Received signal Segmentation fault (11)
2021.03.31 02:16:36.523942 [ 4038 ] <Fatal> BaseDaemon: Address: 0x10 Access: read. Address not mapped to object.
2021.03.31 02:16:36.523956 [ 4038 ] <Fatal> BaseDaemon: Stack trace: 0x92d7ca8 0xa40b5e7 0xf5458f1 0xf547118 0x101ad4d6 0x101aab8b 0x100041cd 0x10000e81 0xfffedf6 0x1000c262 0x88d833f 0x88dbdd3 0x7f269aab4609 0x7f269a9db293
2021.03.31 02:16:36.523997 [ 4038 ] <Fatal> BaseDaemon: 1. DB::AggregateFunctionArgMinMax<DB::AggregateFunctionArgMinMaxData<DB::SingleValueDataFixed<char8_t>, DB::AggregateFunctionMaxData<DB::SingleValueDataFixed<char8_t> > > >::add(char*, DB::IColumn const**, unsigned long, DB::Arena*) const @ 0x92d7ca8 in /usr/bin/clickhouse
2021.03.31 02:16:36.524015 [ 4038 ] <Fatal> BaseDaemon: 2. DB::IAggregateFunctionHelper<DB::AggregateFunctionSimpleState>::addBatchSinglePlace(unsigned long, char*, DB::IColumn const**, DB::Arena*, long) const @ 0xa40b5e7 in /usr/bin/clickhouse
2021.03.31 02:16:36.524032 [ 4038 ] <Fatal> BaseDaemon: 3. DB::Aggregator::executeWithoutKeyImpl(char*&, unsigned long, DB::Aggregator::AggregateFunctionInstruction*, DB::Arena*) @ 0xf5458f1 in /usr/bin/clickhouse
2021.03.31 02:16:36.524050 [ 4038 ] <Fatal> BaseDaemon: 4. DB::Aggregator::executeOnBlock(std::__1::vector<COW<DB::IColumn>::immutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::immutable_ptr<DB::IColumn> > >, unsigned long, DB::AggregatedDataVariants&, std::__1::vector<DB::IColumn const*, std::__1::allocator<DB::IColumn const*> >&, std::__1::vector<std::__1::vector<DB::IColumn const*, std::__1::allocator<DB::IColumn const*> >, std::__1::allocator<std::__1::vector<DB::IColumn const*, std::__1::allocator<DB::IColumn const*> > > >&, bool&) @ 0xf547118 in /usr/bin/clickhouse
2021.03.31 02:16:36.524066 [ 4038 ] <Fatal> BaseDaemon: 5. DB::AggregatingTransform::consume(DB::Chunk) @ 0x101ad4d6 in /usr/bin/clickhouse
2021.03.31 02:16:36.524076 [ 4038 ] <Fatal> BaseDaemon: 6. DB::AggregatingTransform::work() @ 0x101aab8b in /usr/bin/clickhouse
2021.03.31 02:16:36.524089 [ 4038 ] <Fatal> BaseDaemon: 7. ? @ 0x100041cd in /usr/bin/clickhouse
2021.03.31 02:16:36.524106 [ 4038 ] <Fatal> BaseDaemon: 8. DB::PipelineExecutor::executeStepImpl(unsigned long, unsigned long, std::__1::atomic<bool>*) @ 0x10000e81 in /usr/bin/clickhouse
2021.03.31 02:16:36.524123 [ 4038 ] <Fatal> BaseDaemon: 9. DB::PipelineExecutor::executeImpl(unsigned long) @ 0xfffedf6 in /usr/bin/clickhouse
2021.03.31 02:16:36.524140 [ 4038 ] <Fatal> BaseDaemon: 10. ? @ 0x1000c262 in /usr/bin/clickhouse
2021.03.31 02:16:36.524157 [ 4038 ] <Fatal> BaseDaemon: 11. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0x88d833f in /usr/bin/clickhouse
2021.03.31 02:16:36.524166 [ 4038 ] <Fatal> BaseDaemon: 12. ? @ 0x88dbdd3 in /usr/bin/clickhouse
2021.03.31 02:16:36.524179 [ 4038 ] <Fatal> BaseDaemon: 13. start_thread @ 0x9609 in /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
2021.03.31 02:16:36.524192 [ 4038 ] <Fatal> BaseDaemon: 14. __clone @ 0x122293 in /usr/lib/x86_64-linux-gnu/libc-2.31.so
2021.03.31 02:16:36.614300 [ 4038 ] <Fatal> BaseDaemon: Checksum of the binary: F918A5FF180DBD3250D9DE08083C1DDA, integrity check passed.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (15 by maintainers)

Most upvoted comments

WITH
    max((number, rand())) AS mx,
    argMax(rand(), number) AS arg,
    argMax((rand(), number)) AS arg_tuple
SELECT arg
FROM numbers(1000000000)

Query id: 1d764dc2-0542-491d-8a6d-09aeec60e37d

┌────────arg─┐
│ 3762245095 │
└────────────┘

1 rows in set. Elapsed: 1.545 sec. Processed 1.00 billion rows, 8.00 GB (647.30 million rows/s., 5.18 GB/s.)

WITH
    max((number, rand())) AS mx,
    argMax(rand(), number) AS arg,
    argMax((rand(), number)) AS arg_tuple
SELECT arg_tuple
FROM numbers(1000000000)

Query id: 23fb54cc-a628-4696-ba85-9e2b44d1d515

┌─arg_tuple──────────────┐
│ (3503270733,999999999) │
└────────────────────────┘

1 rows in set. Elapsed: 1.568 sec. Processed 1.00 billion rows, 8.00 GB (637.80 million rows/s., 5.10 GB/s.)

WITH
    max((number, rand())) AS mx,
    argMax(rand(), number) AS arg,
    argMax((rand(), number)) AS arg_tuple
SELECT mx
FROM numbers(1000000000)

Query id: e6d7f855-753f-4073-afd0-a900bb63c21a

┌─mx─────────────────────┐
│ (999999999,2712516406) │
└────────────────────────┘

1 rows in set. Elapsed: 116.562 sec. Processed 1.00 billion rows, 8.00 GB (8.58 million rows/s., 68.64 MB/s.)

SELECT argMax(((number, rand()), number))
FROM numbers(1000000000)

Query id: 958e8ff3-3ef8-4fae-9e4f-6f5f6d7d2060

┌─argMax(tuple(tuple(number, rand()), number))─┐
│ ((999999999,206382673),999999999)            │
└──────────────────────────────────────────────┘

1 rows in set. Elapsed: 71.488 sec. Processed 1.00 billion rows, 8.00 GB (13.99 million rows/s., 111.91 MB/s.)

max is super slow with tuples.