Can you please run EXPLAIN PLAN FOR query_statement, and post the plan for your query here? That will help us figure out whether something is wrong with the query planner or something else.
I tried a similar query against file system storage plugin, and did not see the problem you experienced. This seems to indicate that this is a bug in JDBC storage plugin. select T1.n_regionkey as C1, T2.n_regionkey as C2 from cp.`tpch/nation.parquet` T1, cp.`tpch/nation.parquet` T2 where T1.n_nationkey=T2.n_nationkey limit 1; +-----+-----+ | C1 | C2 | +-----+-----+ | 0 | 0 | +-----+-----+ On Wed, Jun 29, 2016 at 8:46 AM, Till Haug <[email protected]> wrote: > > Hi guys > > > My company encountered a critical bug in Apache Drill 1.7.0 (and earlier > versions) and we’re not sure if this is an already known problem. > If there are two columns with the same name in two different tables, there > seems to be a conflict. > > > Example 1: > select t.emp_no as col_one, d.emp_no as col_two > from mysqlaws.employees.titles as t, mysqlaws.employees.dept_manager as d > where t.emp_no = d.emp_no > > > Result 1: > emp_no emp_no0 > 110022 null > 110022 null > 110039 null > … > > > Expected Result 1: > emp_no emp_no0 > 110022 110022 > 110022 110022 > 110039 110039 > … > > > Example 2: > select t.from_date as col_one, d.from_date as col_two > from mysqlaws.employees.titles as t, mysqlaws.employees.dept_manager as d > where t.emp_no = d.emp_no > > > > > Result 2: > col_one col_two > 1985-01-01 null > 1985-01-01 null > 1991-10-01 null > … > > > Expected Result 2: > col_one col_two > 1985-01-01 1985-01-01 > 1991-10-01 1985-01-01 > 1991-10-01 1991-10-01 > … > > > > > In Example 1 there is no rename happening and the col_two is all nulls. > In Example 2 the rename is happening, but the col_two is still all nulls. > > > When we run these queries directly against the databases (both mssql and > mysql) they work as expected. > > > If you’d like to directly reproduce it, feel free to use our server we set up > with the following storage plugin > > > { > "type": "jdbc", > "driver": "com.mysql.jdbc.Driver", > "url": > "jdbc:mysql://vz-test.cbnbj0e1vrwg.eu-central-1.rds.amazonaws.com:8008", > "username": "vz_master", > "password": "vzpassword", > "enabled": false > } > > > Thank you and All the Best > Till > > > Ps: I apologise for submitting this issue first wrongly on the dev mailing > list. > >
