Srikanth Sundarrajan created LENS-847:
-----------------------------------------

             Summary: Columnar JDBC Rewriter in incorrectly pushing filter 
against wrong alias when fact columns map to a single dimension
                 Key: LENS-847
                 URL: https://issues.apache.org/jira/browse/LENS-847
             Project: Apache Lens
          Issue Type: Bug
          Components: driver-jdbc
    Affects Versions: 2.3
            Reporter: Srikanth Sundarrajan
            Assignee: Srikanth Sundarrajan
             Fix For: 2.5


Columnar JDBC Rewriter in incorrectly pushing filter against wrong alias when 
fact columns map to a single dimension.

Ex:

select fact.time_key, time_dim.day_of_week, location_dim_a.location_name, 
other_location_dim.location_name, sum(fact.dollars_sold) from sales_fact fact 
inner join time_dim time_dim on fact.time_key = time_dim.time_key inner join 
location_dim location_dim_a on fact.location_key = location_dim_a.location_key 
inner join location_dim other_location_dim on fact.other_location_key = 
other_location_dim.location_key where time_dim.time_key between '2013-01-01' 
and '2013-01-31' and location_dim_a.location_key = 'some-loc' group by 
fact.time_key, location_dim_a.location_key, other_location_dim.location_key

is being rewritten to 

select ( sales_fact___fact . time_key ), ( time_dim___time_dim . day_of_week ), 
( location_dim___location_dim_a . location_name ), ( 
location_dim___other_location_dim . location_name ), sum(alias1) from  (select 
sales_fact___fact.time_key, sales_fact___fact.location_key, 
sales_fact___fact.other_location_key,sum(( sales_fact___fact . dollars_sold )) 
as alias1 from sales_fact sales_fact___fact where sales_fact___fact.time_key in 
 (  select time_dim .time_key from time_dim where ( time_dim. time_key ) 
between  '2013-01-01'  and  '2013-01-31'  ) and sales_fact___fact.location_key 
in  (  select location_dim .location_key from location_dim where (( 
location_dim. location_key ) =  'some-loc' ) ) and 
{{sales_fact___fact.other_location_key in  (  select location_dim .location_key 
from location_dim where (( location_dim. location_key ) =  'some-loc' ) )}}  
group by sales_fact___fact.time_key, sales_fact___fact.location_key, 
sales_fact___fact.other_location_key) sales_fact___fact  inner join (select 
time_key,day_of_week from time_dim) time_dim___time_dim on (( sales_fact___fact 
. time_key ) = ( time_dim___time_dim . time_key ))  inner join (select 
location_key,location_name from location_dim) location_dim___location_dim_a on 
(( sales_fact___fact . location_key ) = ( location_dim___location_dim_a . 
location_key ))  inner join (select location_key,location_name from 
location_dim) location_dim___other_location_dim on (( sales_fact___fact . 
other_location_key ) = ( location_dim___other_location_dim . location_key ))  
where (( time_dim___time_dim . time_key ) between  '2013-01-01'  and  
'2013-01-31'  and (( location_dim___location_dim_a . location_key ) =  
'some-loc' )) group by ( sales_fact___fact . time_key ), ( 
location_dim___location_dim_a . location_key ), ( 
location_dim___other_location_dim . location_key )




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to