使用了explode_json_array_string 函数,进行子查询行时报错 (doris 版本信息:2.0.15) #42970
Unanswered
jinyang12050
asked this question in
Q&A
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
报错内容:
1105 - errCode = 2, detailMessage = Unexpected exception: Predicate:CAST(
object_array_example11.skill_test_0
AS varchar(65533)) = '21' can't be assigned to some PlanNode.doris 版本信息:2.0.15
explain 优化器为 set enable_fallback_to_original_planner = true; 老优化器 (试了关闭老优化器,同样报错,内容不同)
建表语句:
CREATE TABLE
events_test
(st_data_id
varchar(128) NOT NULL COMMENT '数据主键',st_date_part
date NULL COMMENT '日期分区字段',st_event_name
varchar(50) NULL COMMENT '事件名称',st_user_id
varchar(50) NULL COMMENT '用户唯一 ID',st_role_id
varchar(50) NULL COMMENT '角色 ID',st_event_time
decimal(20,3) NULL COMMENT '事件毫秒级时间戳',st_event_datetime
datetime NULL COMMENT '事件秒级时间',st_pk_id
varchar(50) NULL COMMENT '数据唯一ID',object_array_example11
json NULL) ENGINE=OLAP
UNIQUE KEY(
st_data_id
,st_date_part
,st_event_name
,st_user_id
,st_role_id
)PARTITION BY RANGE(
st_date_part
)(PARTITION p20241101 VALUES [('2024-11-01'), ('2024-11-02')),
PARTITION p20241102 VALUES [('2024-11-02'), ('2024-11-03')))
DISTRIBUTED BY HASH(
st_event_name
,st_user_id
,st_role_id
,st_data_id
) BUCKETS 1PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Etc/UTC",
"dynamic_partition.start" = "-2147483648",
"dynamic_partition.end" = "2",
"dynamic_partition.prefix" = "p",
"dynamic_partition.replication_allocation" = "tag.location.default: 1",
"dynamic_partition.buckets" = "1",
"dynamic_partition.create_history_partition" = "true",
"dynamic_partition.history_partition_num" = "30",
"dynamic_partition.hot_partition_num" = "0",
"dynamic_partition.reserved_history_periods" = "NULL",
"dynamic_partition.storage_policy" = "",
"storage_medium" = "hdd",
"storage_format" = "V2",
"compression" = "ZSTD",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false",
"enable_mow_light_delete" = "false"
);
插入查询数据:
INSERT INTO
events_test
(st_data_id
,st_date_part
,st_event_name
,st_user_id
,st_role_id
,st_event_time
,st_event_datetime
,st_pk_id
,object_array_example11
) VALUES ('12', '2024-10-24', 'updatestrongobjectgroup1', 'cf899933-d211-4224-9fe3-9e232a8adee8', 'role1003116', 1729737759656.000, '2024-10-24 02:42:39', '79a4f57c-6a57-421c-8d43-1d641007b518', '[{"skill_test":["1","2","3"],"skill_name":"技能1","skill_level":"11"},{"skill_name":"技能2","skill_level":"11","skill_test":["11","21","31"]},{"test1":123},{"test2":[{"k2":2,"k3":3,"k1":1}]}]');执行查询语句:
select
st_pk_id
from
(
select COALESCE
( DATE_FORMAT( CONVERT_TZ( FROM_UNIXTIME( events_test.st_event_time / 1000 ), '+00:00', '+00:00' ), '%Y-%m-%d' ), '(空)' ) as
日期
,cast(
object_array_example11.skill_test_0
as varchar)arr_col
,COALESCE ( events_test.
st_pk_id
, '(空)' ) asst_pk_id
from
events_test lateral view explode_json_array_string (
json_extract( events_test.
object_array_example11
, '$.skill_test' )) expload_view_0 asobject_array_example11.skill_test_0
where
events_test.st_event_name = 'updatestrongobjectgroup1'
group by
COALESCE ( DATE_FORMAT( CONVERT_TZ( FROM_UNIXTIME( events_test.st_event_time / 1000 ), '+00:00', '+00:00' ), '%Y-%m-%d' ), '(空)' ),
object_array_example11.skill_test_0
,events_test.
st_pk_id
) events
where
arr_col
= '21'报错信息:
1105 - errCode = 2, detailMessage = Unexpected exception: Predicate:CAST(
object_array_example11.skill_test_0
AS varchar(65533)) = '21' can't be assigned to some PlanNode.上述子查询部分可以正常执行,外层嵌套where 时出错,怀疑优化器处理时存在问题
Beta Was this translation helpful? Give feedback.
All reactions