StarRocks / starrocks

StarRocks, a Linux Foundation project, is a next-generation sub-second MPP OLAP database for full analytics scenarios, including multi-dimensional analytics, real-time analytics, and ad-hoc queries.
https://starrocks.io
Apache License 2.0
8.67k stars 1.75k forks source link

[Bug] BE crash when using ARRAY_MAP and ARRAY_GENERATE #49730

Closed luohaha closed 1 month ago

luohaha commented 1 month ago

Steps to reproduce the behavior (Required)

  1. CREATE TABLE
    CREATE TABLE B
    (
    id INT NOT NULL COMMENT "",
    data_array ARRAY<STRING> NULL COMMENT ""
    ) ENGINE=OLAP
    PRIMARY KEY(`id`)
    DISTRIBUTED BY HASH(`id`) BUCKETS 1
    PROPERTIES (
    "replication_num" = "1"
    );
  2. INSERT INTO
    INSERT INTO B (id, data_array)
    VALUES 
    (1, ARRAY_MAP(
    x -> CAST(x AS STRING), 
    ARRAY_GENERATE(1, 1000)
    )),
    (2, ARRAY_MAP(
    x -> CAST(x AS STRING), 
    ARRAY_GENERATE(1, 1000)
    )),
    (3, ARRAY_MAP(
    x -> CAST(x AS STRING), 
    ARRAY_GENERATE(1, 1000)
    )),
    (4, ARRAY_MAP(
    x -> CAST(x AS STRING), 
    ARRAY_GENERATE(1, 1000)
    )),
    (5, ARRAY_MAP(
    x -> CAST(x AS STRING), 
    ARRAY_GENERATE(1, 1000)
    ));

Expected behavior (Required)

Success

Real behavior (Required)

Be crash:

*** Aborted at 1723503069 (unix time) try "date -d @1723503069" if you are using GNU date ***
PC: @          0x51c5d75 starrocks::ArrayMapExpr::evaluate_checked()
*** SIGSEGV (@0x0) received by PID 2861 (TID 0x7f855594b700) from PID 0; stack trace: ***
    @          0x6bb1782 google::(anonymous namespace)::FailureSignalHandler()
    @     0x7f85d378f630 (unknown)
    @          0x51c5d75 starrocks::ArrayMapExpr::evaluate_checked()
    @          0x4890e03 starrocks::ExprContext::evaluate()
    @          0x489114f starrocks::ExprContext::evaluate()
    @          0x3a9254c starrocks::pipeline::UnionConstSourceOperator::pull_chunk()
    @          0x3a43d1d starrocks::pipeline::PipelineDriver::process()
    @          0x3a35c7e starrocks::pipeline::GlobalDriverExecutor::_worker_thread()
    @          0x305182c starrocks::ThreadPool::dispatch_thread()
    @          0x304b4aa starrocks::Thread::supervise_thread()
    @     0x7f85d3787ea5 start_thread
    @     0x7f85d2b88b0d __clone
    @                0x0 (unknown)

StarRocks version (Required)

chenminghua8 commented 1 month ago

The "starrocks::ArrayMapExpr::evaluate_checked(ExprContext context, Chunk chunk)" method does not handle the case where "chunk" is null. @silverbullet233 Are you already working on this task? If not, can you assign it to me?

before-Sunrise commented 1 month ago

The "starrocks::ArrayMapExpr::evaluate_checked(ExprContext context, Chunk chunk)" method does not handle the case where "chunk" is null. @silverbullet233 Are you already working on this task? If not, can you assign it to me?

this is not only ArrayMapExpr but also other expr can not handler nullptr, so I will handle it in other place. If you are willing to contribute, can pick some other interesting issues

chenminghua8 commented 1 month ago

ok