apache / drill

Apache Drill is a distributed MPP query layer for self describing data
https://drill.apache.org/
Apache License 2.0
1.93k stars 982 forks source link

apache drill failed to execute SQL such as ' table1 left join table2 on condition 1 or condition 2' #2781

Open fengqiyuqingpingzhimo opened 1 year ago

fengqiyuqingpingzhimo commented 1 year ago

Execute the following sql (although it may not make sense): SELECT aa.employee_id FROM cp.employee.json aa left join cp.employee.json bb on aa.employee_id=bb.employee_id or aa.employee_id=bb.position_id ;

6

I got the results:

7 I tried to modify the corresponding parameters 'planner.enable_nljoin_for_scalar_only', but it still didn't work.

cgivre commented 1 year ago

I'm not sure what you're trying to do with this query, but I found that rewriting it like this worked:

 SELECT aa.employee_id 
 FROM cp.`employee.json` aa , 
 cp.`employee.json` bb
 WHERE aa.employee_id=bb.employee_id or aa.employee_id=bb.position_id
fengqiyuqingpingzhimo commented 1 year ago

I'm not sure what you're trying to do with this query, but I found that rewriting it like this worked:

 SELECT aa.employee_id 
 FROM cp.`employee.json` aa , 
 cp.`employee.json` bb
 WHERE aa.employee_id=bb.employee_id or aa.employee_id=bb.position_id

Thank you very much for your answer,But when I switched to MySQL, I encountered another problem,I created two storage configurations that point to the same MySQL(name is bb and zz),There is no problem when I use the same storage, such as SQL:

select * from bb.eladmin.table1 a, bb.eladmin.table2 b where a.id =b.id or a.name=b.name

However, when I use two storage systems, the sql is as follows:

select * from bb.eladmin.table1 a, zz.eladmin.table2 b where a.id =b.id or a.name=b.name

It still reports errors,Let me set the option 'planner.enable_nljoin_for_scalar_only' to false and try again,This is why? aaa