SQL查询报错

Viewed 62

doris版本:doris-1.2.6-rc03

第一条sql:

select
		d1 as gc,
		bitmap_count(bitmap_union(to_bitmap(e.did))) as mc
	from
		sensors_events_dma as e lateral view explode_outer(split_by_string(brand_name_s, '_$_')) t2 as d1
	where
		event = 'OrderPayForBuyer'
		and event_time >= '2023-09-16 00:00:00'
		and event_time <= '2024-07-12 15:46:54'
	group by
		1

第二条sql:

select
	*
from
	(
	select
		d1 as gc,
		bitmap_count(bitmap_union(to_bitmap(e.did))) as mc
	from
		sensors_events_dma as e lateral view explode_outer(split_by_string(brand_name_s, '_$_')) t2 as d1
	where
		event = 'OrderPayForBuyer'
		and event_time >= '2023-09-16 00:00:00'
		and event_time <= '2024-07-12 15:46:54'
	group by
		1) as tt
where
	gc = '索菲亚'

执行第一个sql,没问题,查询结果为,但是执行第二个sql报错,报错信息:Unexpected exception: Predicate:d1 = '索菲亚' can't be assigned to some PlanNode.

第二个SQL就是在第一个SQL外面加了一层,麻烦看看是什么问题

2 Answers

麻烦提供一下表结构和数据,另外看一下执行sql报错的时候fe.log的具体报错

建表语句

create table sensor_test (
did bigint,
brand_name_s varchar(255)
)
DISTRIBUTED BY HASH(did) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2",
"disable_auto_compaction" = "false"
);

测试数据

insert into sensor_test (did,brand_name_s) values (100,'索菲亚_$_欧派');

SQL

select
	*
from
	(
	select
		d1 as gc,
		bitmap_count(bitmap_union(to_bitmap(e.did))) as mc
	from
		sensor_test as e lateral view explode_outer(split_by_string(brand_name_s, '_$_')) t2 as d1
	group by
		1) as tt
where
	gc = '索菲亚';

FE错误日志

image.png