Odd bug with duplicate column names: maybe in Presto driver, maybe generic to re:dash

41 views
Skip to first unread message

Lance N.

unread,
Jan 16, 2016, 10:27:40 PM1/16/16
to re:dash users
I'm on version 0.8.1+b1110, the AWS AMI you so kindly supplied.

Given this query:
select a.db, a.tab, b.tab, a.partition_date, b.partition_date
from (select * from hive.lance.counts_pd where tab not like 'tmp_%') a 
left join 
 (select * from hive.lance.counts_pd where tab like 'tmp_%') b
on a.db = b.db and concat('tmp_', a.tab) = b.tab and a.partition_date = b.partition_date
where a.partition_date is not null and b.partition_date is null

The point is to find rows where there is a 'a.tab=x' field but no 'b.tab=tmp_x' field. 
This works in Presto. 

          db           |                 tab                  | tab  | partition_date | partition_date 
-----------------------+--------------------------------------+------+----------------+----------------
 district_analytics_v2 | agg_registered_group                 | NULL | 2016-01-14     | NULL  

When I run it in re:dash, the results have the correct contents in the a.db' field, but the other fields are all null. 

          db           |                 tab                  | tab  | partition_date | partition_date 
-----------------------+--------------------------------------+------+----------------+----------------
 district_analytics_v2 | null                 | null | null     | null  

If I give an alias for "b.tab", the a.tab column has the correct values. 
If I give an alias for "b.partition_date", the a.partition_date column has the correct values.

So, if two successive columns have the same name, the first will show the value from the second? 


Arik Fraimovich

unread,
Jan 17, 2016, 3:13:33 PM1/17/16
to Lance N., re:dash users
It's an issue that was addressed in some of the query runners (like Postgres or MySQL), but the fix wasn't applied to all of them.

For the Hive query runner, I think that lines 103-111 need to be replaces with a call to fetch_columns. I could fix it myself, but I don't have Hive setup to test it with.

--
You received this message because you are subscribed to the Google Groups "re:dash users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redash-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages