StarRocks / starrocks

The world's fastest open query engine for sub-second analytics both on and off the data lakehouse. With the flexibility to support nearly any scenario, StarRocks provides best-in-class performance for multi-dimensional analytics, real-time analytics, and ad-hoc queries. A Linux Foundation project.
https://starrocks.io
Apache License 2.0
8.91k stars 1.79k forks source link

BE crash when BinaryColumn overflow #5624

Closed wangruin closed 2 years ago

wangruin commented 2 years ago

Steps to reproduce the behavior (Required)

  1. CREATE TABLE lineitem ( l_shipdate date NOT NULL COMMENT "", l_orderkey int(11) NOT NULL COMMENT "", l_linenumber int(11) NOT NULL COMMENT "", l_partkey int(11) NOT NULL COMMENT "", l_suppkey int(11) NOT NULL COMMENT "", l_quantity decimal64(15, 2) NOT NULL COMMENT "", l_extendedprice decimal64(15, 2) NOT NULL COMMENT "", l_discount decimal64(15, 2) NOT NULL COMMENT "", l_tax decimal64(15, 2) NOT NULL COMMENT "", l_returnflag varchar(1) NOT NULL COMMENT "", l_linestatus varchar(1) NOT NULL COMMENT "", l_commitdate date NOT NULL COMMENT "", l_receiptdate date NOT NULL COMMENT "", l_shipinstruct varchar(25) NOT NULL COMMENT "", l_shipmode varchar(10) NOT NULL COMMENT "", l_comment varchar(44) NOT NULL COMMENT "" ) ENGINE=OLAP DUPLICATE KEY(l_shipdate, l_orderkey) COMMENT "OLAP" DISTRIBUTED BY HASH(l_orderkey) BUCKETS 96 PROPERTIES ( "replication_num" = "1", "colocate_with" = "tpch2", "in_memory" = "false", "storage_format" = "DEFAULT", "enable_persistent_index" = "false" );

  2. select count(a.L_ORDERKEY),count(a.L_COMMENT) from (select L_ORDERKEY, L_COMMENT from lineitem order by L_COMMENT asc limit 50000, 100000) as a;

Expected behavior (Required)

Query returns correctly

Real behavior (Required)

terminate called after throwing an instance of 'std::length_error'
  what():  vector::_M_range_insert
*** Aborted at 1651129659 (unix time) try "date -d @1651129659" if you are using GNU date ***
PC: @     0x7f45ec305387 __GI_raise
*** SIGABRT (@0x3e8000053f3) received by PID 21491 (TID 0x7f45566d6700) from PID 21491; stack trace: ***
    @          0x3eaf9d2 google::(anonymous namespace)::FailureSignalHandler()
    @     0x7f45ecdba630 (unknown)
    @     0x7f45ec305387 __GI_raise
    @     0x7f45ec306a78 __GI_abort
    @          0x180640d _ZN9__gnu_cxx27__verbose_terminate_handlerEv.cold
    @          0x586dd46 __cxxabiv1::__terminate()
    @          0x586ddb1 std::terminate()
    @          0x586df04 __cxa_throw
    @          0x1807ff1 std::__throw_length_error()
    @          0x197bb22 std::vector<>::_M_range_insert<>()
    @          0x197efa4 starrocks::vectorized::BinaryColumnBase<>::append()
    @          0x24173c2 starrocks::vectorized::Chunk::append()
    @          0x28201e6 starrocks::pipeline::SortContext::pull_chunk()
    @          0x281d61d starrocks::pipeline::LocalMergeSortSourceOperator::pull_chunk()
    @          0x282b4da starrocks::pipeline::PipelineDriver::process()
    @          0x2822cb2 starrocks::pipeline::GlobalDriverExecutor::_worker_thread()
    @          0x209ebd9 starrocks::ThreadPool::dispatch_thread()
    @          0x209a78a starrocks::Thread::supervise_thread()
    @     0x7f45ecdb2ea5 start_thread
    @     0x7f45ec3cdb0d __clone
    @                0x0 (unknown)

StarRocks version (Required)

murphyatwork commented 2 years ago

It's caused by the BinaryColumn overflow issue during local merge, expected to solved by PR #5347.