xy720 opened a new issue #6462: URL: https://github.com/apache/incubator-doris/issues/6462
**To Reproduce** Steps to reproduce the behavior: 1. create table autocar_youjia_app_ubc_log_new ``` CREATE TABLE `autocar_youjia_app_ubc_log_new` ( `event_day` date NOT NULL COMMENT "event_day", `bhv_id` int(11) NOT NULL COMMENT "bhv_id", `bhv_ts` bigint(20) NOT NULL COMMENT "bhv_ts", `bhv_from` varchar(5000) NULL DEFAULT "" COMMENT "", `bhv_page` varchar(128) NULL DEFAULT "" COMMENT "bhv_page", `bhv_type` varchar(128) NULL DEFAULT "" COMMENT "bhv_type", `bhv_source` varchar(128) NULL DEFAULT "" COMMENT "bhv_source", `bhv_value` varchar(512) NULL DEFAULT "" COMMENT "bhv_value", `bhv_dura` varchar(128) NULL DEFAULT "" COMMENT "bhv_dura", `bdapp_params` varchar(10000) NOT NULL COMMENT "bdapp_params", `is_dura` int(11) NOT NULL COMMENT "is_dura", `os` varchar(128) NOT NULL COMMENT "os", `soft_version` varchar(128) NOT NULL COMMENT "soft_version", `cuid` varchar(128) NOT NULL COMMENT "cuid", `item` varchar(65530) NULL DEFAULT "" COMMENT "", `ext` varchar(65530) NULL DEFAULT "" COMMENT "", `event_time` varchar(64) NULL DEFAULT "" COMMENT "event_time", `event_action` varchar(100) NULL DEFAULT "" COMMENT "", `is_spam` varchar(10) NULL DEFAULT "" COMMENT "", `channel` varchar(100) NULL DEFAULT "" COMMENT "", `cfrom` varchar(100) NULL DEFAULT "" COMMENT "", `original_soft_version` varchar(128) NULL DEFAULT "" COMMENT "", `uid` varchar(200) NULL DEFAULT "" COMMENT "", `sid` varchar(500) NULL DEFAULT "" COMMENT "", `logid` varchar(128) NULL COMMENT "", `baiduid` varchar(256) NULL COMMENT "", `ip` varchar(64) NULL COMMENT "", `country` varchar(64) NULL DEFAULT "" COMMENT "", `city` varchar(64) NULL DEFAULT "" COMMENT "", `brand` varchar(128) NULL DEFAULT "" COMMENT "", `device` varchar(128) NULL DEFAULT "" COMMENT "", `event_hour` varchar(64) NULL DEFAULT "" COMMENT "", `event_appid` varchar(128) NOT NULL DEFAULT "" COMMENT "", `event_module` varchar(128) NULL DEFAULT "" COMMENT "", `province` varchar(64) NULL DEFAULT "" COMMENT "" ) ENGINE=OLAP DUPLICATE KEY(`event_day`, `bhv_id`, `bhv_ts`, `bhv_from`, `bhv_page`, `bhv_type`, `bhv_source`, `bhv_value`, `bhv_dura`, `bdapp_params`, `is_dura`, `os`, `soft_version`, `cuid`) COMMENT "OLAP" PARTITION BY RANGE(`event_day`) (PARTITION p20210818 VALUES [('2021-08-18'), ('2021-08-19')), PARTITION p20210819 VALUES [('2021-08-19'), ('2021-08-20'))) DISTRIBUTED BY HASH(`cuid`) BUCKETS 10 PROPERTIES ( "replication_num" = "2", "in_memory" = "false", "storage_format" = "V2" ); ``` 2. create table dwd_youjia_medal_new_incr_day ``` CREATE TABLE `dwd_youjia_medal_new_incr_day` ( `event_day` date NOT NULL COMMENT "event_day", `uid` varchar(128) NULL DEFAULT "" COMMENT "uid", `medal_key` varchar(128) NULL DEFAULT "" COMMENT "勋章", `medal_level` varchar(5000) NULL DEFAULT "" COMMENT "勋章等级", `receive_status` varchar(128) NULL DEFAULT "" COMMENT "状态", `is_del` varchar(128) NULL DEFAULT "" COMMENT "删除状态", `create_time` varchar(128) NULL DEFAULT "" COMMENT "创建时间" ) ENGINE=OLAP DUPLICATE KEY(`event_day`, `uid`, `medal_key`, `medal_level`) COMMENT "OLAP" PARTITION BY RANGE(`event_day`) (PARTITION p202107 VALUES [('2021-07-01'), ('2021-08-01')), PARTITION p202108 VALUES [('2021-08-01'), ('2021-09-01')), PARTITION p202109 VALUES [('2021-09-01'), ('2021-10-01')), PARTITION p202110 VALUES [('2021-10-01'), ('2021-11-01')) DISTRIBUTED BY HASH(`uid`) BUCKETS 32 PROPERTIES ( "replication_num" = "2", "in_memory" = "false", "storage_format" = "V2" ); ``` 3. execute sql ``` SELECT event_day , SUM(if(medal_level = 'continuous_login', cum_medal_user_cnt, 0)) AS continuous_login_cum_user_cnt , SUM(if(medal_level = 'koubei', cum_medal_user_cnt, 0)) AS koubei_cum_user_cnt , SUM(if(medal_level = 'wenda_answer', cum_medal_user_cnt, 0)) AS wenda_answer_cum_user_cnt , SUM(if(medal_level = 'wenda_question', cum_medal_user_cnt, 0)) AS wenda_question_cum_user_cnt , SUM(if(medal_level = 'time', cum_medal_user_cnt, 0)) AS time_cum_user_cnt FROM ( SELECT medal_data.event_day, medal_data.medal_level, COUNT(DISTINCT medal_data.uid) AS medal_user_cnt , COUNT(DISTINCT if(row_rank = 1, medal_data.uid, NULL)) AS medal_first_user_cnt , SUM(COUNT(DISTINCT if(row_rank = 1, medal_data.uid, NULL))) OVER (PARTITION BY medal_level ORDER BY medal_data.event_day) AS cum_medal_user_cnt FROM ( SELECT data_all.event_day, data_all.medal_level, t.uid, t.row_rank FROM ( SELECT event_day, medal_level FROM ( SELECT 1 AS line, event_day FROM dwd_youjia_medal_new_incr_day WHERE event_day BETWEEN '2021-07-16' AND '2021-08-15' GROUP BY event_day ) date_all JOIN ( SELECT 1 AS line, medal_level FROM dwd_youjia_medal_new_incr_day WHERE event_day BETWEEN '2021-07-16' AND '2021-08-15' GROUP BY medal_level ) madel_all ON date_all.line = madel_all.line ) data_all LEFT JOIN ( SELECT 1 AS line, event_day, medal_level, uid, row_number() OVER (PARTITION BY uid, medal_level ORDER BY event_day) AS row_rank FROM dwd_youjia_medal_new_incr_day WHERE event_day BETWEEN '2021-07-16' AND '2021-08-15' AND 1 = 1 AND 1 = 1 AND medal_level NOT IN ('first_login') GROUP BY event_day, uid, medal_level ) t ON t.event_day = data_all.event_day AND t.medal_level = data_all.medal_level ) medal_data LEFT JOIN ( SELECT event_day, uid FROM autocar_youjia_app_ubc_log_new WHERE event_day BETWEEN '2021-07-16' AND '2021-08-15' AND os = '全部' AND bhv_id IN (61, 18, 691) GROUP BY uid, event_day ) ubc_data ON medal_data.uid = ubc_data.uid AND medal_data.event_day = ubc_data.event_day WHERE if('全部' = '全部', 1 = 1, ubc_data.uid IS NOT NULL) GROUP BY medal_data.event_day, medal_data.medal_level ) medal_cum_data GROUP BY event_day LIMIT 0, 5000; ``` **Expected behavior** Successfully execute. **Screenshots** Be coredump: ``` #0 0x0000000001491696 in operator bool (this=<optimized out>) at /home/opt/compiler/gcc-10-r5/include/c++/10.1.0/bits/stl_bvector.h:916 #1 operator* (this=<optimized out>) at /home/opt/compiler/gcc-10-r5/include/c++/10.1.0/bits/stl_bvector.h:348 #2 operator[] (__n=<optimized out>, this=<optimized out>) at /home/opt/compiler/gcc-10-r5/include/c++/10.1.0/bits/stl_bvector.h:918 #3 doris::RowDescriptor::tuple_is_nullable (this=this@entry=0x16943c78, tuple_idx=384727376) at ../src/runtime/descriptors.cpp:358 #4 0x00000000012346d7 in doris::TupleIsNullPredicate::prepare(doris::RuntimeState*, doris::RowDescriptor const&, doris::ExprContext*) () at ../src/exprs/tuple_is_null_predicate.cpp:39 #5 0x000000000120784c in doris::ExprContext::prepare(doris::RuntimeState*, doris::RowDescriptor const&, std::shared_ptr<doris::MemTracker> const&) () at ../src/exprs/expr_context.cpp:61 #6 0x00000000011fda8e in doris::Expr::prepare(std::vector<doris::ExprContext*, std::allocator<doris::ExprContext*> > const&, doris::RuntimeState*, doris::RowDescriptor const&, std::shared_ptr<doris::MemTracker> const&) () at /home/opt/compiler/gcc-10-r5/include/c++/10.1.0/bits/stl_vector.h:1061 #7 0x00000000019d5226 in doris::SortExecExprs::prepare(doris::RuntimeState*, doris::RowDescriptor const&, doris::RowDescriptor const&, std::shared_ptr<doris::MemTracker> const&) () at ../src/exec/sort_exec_exprs.cpp:52 #8 0x0000000001a8405a in doris::SpillSortNode::prepare(doris::RuntimeState*) () at ../src/exec/exec_node.h:179 #9 0x00000000019b0d41 in doris::ExecNode::prepare(doris::RuntimeState*) () at /home/opt/compiler/gcc-10-r5/include/c++/10.1.0/bits/stl_vector.h:1043 #10 0x0000000001ac2dac in doris::AnalyticEvalNode::prepare(doris::RuntimeState*) () at ../src/exec/analytic_eval_node.cpp:142 #11 0x00000000019b0d41 in doris::ExecNode::prepare(doris::RuntimeState*) () at /home/opt/compiler/gcc-10-r5/include/c++/10.1.0/bits/stl_vector.h:1043 #12 0x0000000001a98338 in doris::PartitionedAggregationNode::prepare(doris::RuntimeState*) () at ../src/exec/partitioned_aggregation_node.cc:188 #13 0x000000000154eeba in doris::PlanFragmentExecutor::prepare(doris::TExecPlanFragmentParams const&, doris::QueryFragmentsCtx const*) () at /home/disk4/xuyang/work/baidu/bdg/doris/thirdparty-gcc10/installed/include/boost/smart_ptr/scoped_ptr.hpp:109 #14 0x00000000014c6ebe in doris::FragmentExecState::prepare (this=this@entry=0x16ef8000, params=...) at ../src/runtime/fragment_mgr.cpp:228 #15 0x00000000014caea2 in doris::FragmentMgr::exec_plan_fragment(doris::TExecPlanFragmentParams const&, std::function<void (doris::PlanFragmentExecutor*)>) () at ../src/runtime/fragment_mgr.cpp:606 #16 0x00000000014ccb12 in doris::FragmentMgr::exec_plan_fragment(doris::TExecPlanFragmentParams const&) () at /home/opt/compiler/gcc-10-r5/include/c++/10.1.0/bits/std_function.h:87 #17 0x000000000159409e in doris::PInternalServiceImpl<doris::PBackendService>::_exec_plan_fragment (this=this@entry=0x731f680, ser_request=...) at ../src/runtime/exec_env.h:117 #18 0x000000000159419f in doris::PInternalServiceImpl<doris::PBackendService>::exec_plan_fragment (this=0x731f680, cntl_base=<optimized out>, request=<optimized out>, response=0x161fd660, done=0x169b0c80) at /home/disk4/xuyang/work/baidu/bdg/doris/thirdparty-gcc10/installed/include/google/protobuf/arenastring.h:231 #19 0x000000000217b1b7 in brpc::policy::ProcessHttpRequest(brpc::InputMessageBase*) () at ../src/brpc/policy/http_rpc_protocol.cpp:1484 #20 0x00000000021485d7 in brpc::ProcessInputMessage (void_arg=void_arg@entry=0x1622f210) at ../src/brpc/input_messenger.cpp:135 #21 0x000000000214949e in operator() (last_msg=0x1622f210, this=<synthetic pointer>) at ../src/brpc/input_messenger.cpp:141 #22 ~unique_ptr (this=<synthetic pointer>, __in_chrg=<optimized out>) at /home/opt/compiler/gcc-10-r5/include/c++/10.1.0/bits/unique_ptr.h:360 #23 brpc::InputMessenger::OnNewMessages(brpc::Socket*) () at /home/opt/compiler/gcc-10-r5/include/c++/10.1.0/bits/unique_ptr.h:354 #24 0x00000000021f19fe in brpc::Socket::ProcessEvent(void*) () at ../src/brpc/socket.cpp:1017 #25 0x000000000229a25f in bthread::TaskGroup::task_runner(long) () at ../src/bthread/task_group.cpp:296 #26 0x000000000228b661 in bthread_make_fcontext () at /home/opt/compiler/gcc-10-r5/include/c++/10.1.0/bits/stl_iterator.h:953 ``` **Desktop (please complete the following information):** - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 22] **Smartphone (please complete the following information):** - Device: [e.g. iPhone6] - OS: [e.g. iOS8.1] - Browser [e.g. stock browser, safari] - Version [e.g. 22] **Additional context** Add any other context about the problem here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org