Uploaded image for project: 'Apache Lens (Retired)'
  1. Apache Lens (Retired)
  2. LENS-847

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

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3, 2.4, 2.5
    • 2.4, 2.5
    • driver-jdbc
    • None

    Description

      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 )

      Attachments

        1. LEN-847.patch
          4 kB
          Srikanth Sundarrajan
        2. LEN-847-V1.patch
          4 kB
          Srikanth Sundarrajan

        Issue Links

          Activity

            People

              sriksun Srikanth Sundarrajan
              sriksun Srikanth Sundarrajan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: