doris icon indicating copy to clipboard operation
doris copied to clipboard

Insert Into 使用join和where时报错

Open fansichao opened this issue 6 years ago • 4 comments

Sql语句如下

insert into nodeid_15759616930091501870 
select col_b8ff236f9c8f5a51e1c7041b11c68378, col_035aa15235d66d9dc704c02de879badb
from (
	select `a`.col_b8ff236f9c8f5a51e1c7041b11c68378, 1 col_035aa15235d66d9dc704c02de879badb
	from nodeid_15759456123033821049 as a 
	left JOIN nodeid_15759456123033821049_tmp as b on b.id=a.id -- and b.id=1
	where b.id=1
) a
  1. 当 join 和 where 同时存在时 ,insert into select 语句会报错, 单独 select xxxx 语句正常执行。
  2. 将 where 语句 转为 and b.id=1 , insert into 语句也会正常执行
  3. 当创建目标表 buckets 为 1/1 时,insert into 语句也会正常执行
   # 目标表默认参数
   TABLE: nodeid_15759759282784611571
   PREAGGREGATION: ON
   partitions=1/1
   rollup: nodeid_15759759282784611571
   buckets=10/10
   cardinality=36
   avgRowSize=685.2222
   numNodes=3
   tuple ids: 4 

上述 insert into 语句执行报错为 all partitions have no load data

fansichao avatar Dec 10 '19 12:12 fansichao

This error means that all data has been filtered becuase of quality. I see that you have left join in your select statement, please check the column type of your destination table is nullable.

And what's your Doris' version? Better to upgrade your Doris, then you will have message about filtered data.

imay avatar Dec 10 '19 13:12 imay

Thank you for your answer.

  1. destination table is not nullable and data_type is correct .
  2. doris version is not lastest. this is download by October 6, 2019 download type : git clone https://github.com/apache/incubator-doris.git

fansichao avatar Dec 10 '19 13:12 fansichao

You can alter your table and change the column to nullable. Then execute the insert statement again to see if it will success. Is this Doris env your production env? If it is not, you can upgrade Doris to latest and test it again.

imay avatar Dec 10 '19 14:12 imay

Thank You. target_table data is null and the target column have change the column to nullable(can receive null val).

My Doris version == 0.10.0 , Doris is not lastest.

Will update Doris . need some time to test.

fansichao avatar Dec 11 '19 00:12 fansichao