Possible BUG related to views


#1

Hi,

i am facing a weird problem while querying a view containing joins; i i launch a query on view using a filed of the latest table joined without a filter i get the expected results, but when i apply a filter i get a columns of the first table instead the one i asked.

e.g. using the flights 1987-2008 database and the airports as a lookup:

create view v_test_f_a as select f.c1_Year,f.c2_Month,f.DepDelay,f.ArrDelay,f.Distance,a.state as dep_state from flights f join airports a on a.iata=f.Origin;

with subsequent query the result is correct
select dep_state,count() from v_test_f_a group by dep_state;
mapdql> select dep_state,count(
) from v_test_f_a group by dep_state;
MS|254801
TX|13862144
CO|3732056
[cut]
VI|87384
GU|14796
54 rows returned.

using a filter teh result isnt correct
select dep_state,count() from v_test_f_a where distance>100 group by dep_state;
select dep_state,count(
) from v_test_f_a where distance>100 group by dep_state;
1|3942746
2|3967307
3|3951764
[cut]
30|3648457
31|2282955
31 rows returned.

it’s taking dayofmonth of the flight table.

If i add another table in the view, the result using fileds from the second table are the ones expected but using fileds from the third tables are not and so on (tested max with 4 tables)

i think it’s a bug related to view and not to join because if i dont use the view but i write a query contaning joins and filters the results are correct

mapdql> select a.state as dep_state,count(*)
…> from flights f join airports a on a.iata=f.Origin
…> where distance>100
…> group by dep_state;
MS|253745
TX|13684403
CO|3579267
[cut]
VI|51644
GU|12877
54 rows returned.

Do you have the same problems of it’s a bug related to my installation? ( ima using this version MapD Server Version: 3.1.1-20170626-45a6fa8
)


#2

Hi,

This is a known bug and the next release should address this.

regards