【已解决】函数multi_distinct_count 使用异常

Viewed 97

DORIS-2.1.5

问题描述:
大家好,在以下场景使用multi_distinct_count函数时遇到invalid slot id的报错;

测试代码:
with test1 as(
select 'aaaaa1' sid, '张1' cname,200.05 cost union all
select 'abbbba1' sid, '张2' cname, 5000.05 cost union all
select 'aasss1' sid, '张1' cname, 2000.05 cost union all
select 'dddaaa1' sid, '张2' cname, 1200.05 cost
)
select a.cname,a.qty,b.cost
from
(select cname,multi_distinct_count(sid)qty from test1 a group by cname)a
join
(select cname,sum(cost)cost from test1 a group by cname) b
on a.cname=b.cname ;

错误信息:
Error executing query:
SQL Error [1105] [HY000]: errCode = 2, detailMessage = [INTERNAL_ERROR]VSlotRef have invalid slot id: 1, desc: tuple_desc_map: [Tuple(id=5 slots=[Slot(id=11 type=VARCHAR col=-1, colname=, nullable=0), Slot(id=12 type=VARCHAR col=-1, colname=, nullable=0)] has_varlen_slots=1)] tuple_id_map: [-1, -1, -1, -1, -1, 0] tuple_is_nullable: [0] , slot_desc: Slot(id=1 type=VARCHAR col=-1, colname=, nullable=0), desc_tbl: tuples:
Tuple(id=11 slots=[Slot(id=25 type=VARCHAR col=-1, colname=, nullable=0), Slot(id=26 type=BIGINT col=-1, colname=, nullable=0), Slot(id=27 type=DECIMAL128(38, 2) col=-1, colname=, nullable=1)] has_varlen_slots=1)
Tuple(id=10 slots=[Slot(id=21 type=VARCHAR col=-1, colname=, nullable=0), Slot(id=22 type=BIGINT col=-1, colname=, nullable=0), Slot(id=23 type=VARCHAR col=-1, colname=, nullable=1), Slot(id=24 type=DECIMAL128(38, 2) col=-1, colname=, nullable=1)] has_varlen_slots=1)

其他补充:
with之后使用1个子查询进行multi_distinct_count时,可以正常查询,join多一个查询后才会报错;

1 Answers

【问题状态】已处理
【问题处理】2.1.6版本已fix,可以等2.1.6 release发布后升级解决:https://github.com/apache/doris/pull/38871
【临时方案】新老优化器兼容差异导致,可以先会话级关闭新优化器处理:

set enable_nereids_planner =false;