【已记录】Doris 2.1.0使用json_set出错

Viewed 70
  1. 错误信息

QL 错误 [1105] [HY000]: errCode = 2, detailMessage = (172.18.36.153)[INTERNAL_ERROR]Function json_set get failed, expr is VectorizedFnCall[json_set](arguments=txt, String, String, String,return=Nullable(String)) and return type is Nullable(String).

  1. 使用语句
drop table if exists test.test;
create table test.test (
 `id` varchar
,`txt` varchar
)
DUPLICATE KEY(`id`)
DISTRIBUTED BY HASH(`txt`) BUCKETS 1
;

insert into test.test(id,txt)
values('11','{"a":"11"}');

select * from test.test;

-- 官方文档样例
-- select json_set('{"k": 1}', "$.j", 2);

select 
 id
,txt
,json_set(txt, "$.a", "111") xxx
from test.test a 
;


2 Answers

============信息补充============
转为json一样报错

select 
 id
,json_set(cast(txt as json), "$.a", "111") s
from test.test a 
;

建表时数据类型为json一样出错

drop table if exists test.test;
create table test.test (
 `id` varchar
,`txt` json
)
DUPLICATE KEY(`id`)
DISTRIBUTED BY HASH(`txt`) BUCKETS 1
;

insert into test.test(id,txt)
values('11','{"a":"11"}');

select * 
from test.test;

select 
 id
,json_set(txt, "$.a", "111") s
from test.test a 
;

SQL 错误 [1105] [HY000]: errCode = 2, detailMessage = (172.18.36.154)[INTERNAL_ERROR]Function json_set get failed, expr is VectorizedFnCall[json_set](arguments=(CAST txt(Nullable(JSONB)) TO Nullable(String)), String, String, String,return=Nullable(String)) and return type is Nullable(String).

【问题状态】处理中
【问题处理】已经记录,后续有新的进展,我会及时同步到论坛