map_agg函数查询结果集 无法使用left join 关联结果集

Viewed 39

当主表五条数据,附表 通过MAP_AGG函数 查询统计结果4条数据,两个结果通过 left join关联,出现 No matching function with signature。

以下为测试SQL

create table test_user_account(
user_id int(8) comment '用户ID',
account_type tinyint(4) comment '账户类型',
account_balance decimal(10,2) comment '账户余额'
) ENGINE=OLAP
DUPLICATE KEY(user_id)
COMMENT '用户账户余额'
DISTRIBUTED BY HASH(user_id) BUCKETS 10
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);

create table test_user(
user_id int(8) comment '用户ID',
user_name varchar(100) comment '用户名称'
) ENGINE=OLAP
DUPLICATE KEY(user_id)
COMMENT '用户表'
DISTRIBUTED BY HASH(user_id) BUCKETS 10
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);

insert into test_user values(1,"张三");
insert into test_user values(2,"李四");
insert into test_user values(3,"王五");
insert into test_user values(4,"赵六");

insert into test_user_account values(1,1,200000);
insert into test_user_account values(1,2,800000);
insert into test_user_account values(2,1,100000);
insert into test_user_account values(3,2,300000);

select x.user_name ,y.agg_value from test_user x
left join (select user_id ,map_agg(account_type,account_balance) as agg_value from test_user_account group by user_id) y
on x.user_id = y.user_id

1 Answers

这个问题新版本已经修复,建议升级到2.1.6
image.png