[ 
https://issues.apache.org/jira/browse/OPTIQ-410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Hyde updated OPTIQ-410:
------------------------------
    Description: 
If a lattice has a materialized tile on say columns (x, y, z), allow that tile 
to be used to evaluate a query on say ( x ) or (y, z). Implementation would 
require an extra aggregation to roll up from (x, y, z) to the actual column set 
(y, z).

Measures would need to be present in the materialization, and be able to be 
rolled up; for instance, count(a) is rolled up from a partial result p using 
sum(p). Min, max and sum roll up using themselves.

You can also compute aggregate functions on grouping columns, for example min( 
x ), and expressions of aggregate functions.

Given the a lattice with a single initially materialized tile,

{code:javascript}
{
  auto: false,
  defaultMeasures: [ {
    agg: 'count'
  } ],
  tiles: [ {
    dimensions: [ 'the_year', ['t', 'quarter'] ],
    measures: [ {
      agg: 'sum',
      args: 'unit_sales'
    }, {
      agg: 'sum',
      args: 'store_sales'
    }, {
      agg: 'count'
    } ]
  } ]
}
{code}

Optiq can satisfy the following query from that tile:

{code:sql}
select t."the_year",
  count(*) as c,
  min("quarter") as q,
  sum("unit_sales") * 10 as us
from "foodmart"."sales_fact_1997" as s
join "foodmart"."time_by_day" as t using ("time_id")
group by t."the_year"
{code}

Note that it rolls up from (the_year, quarter) to (the_year), rolls up count( * 
) using sum, rolls up sum(unit_sales), and computes min(quarter) from a column 
(quarter) that is a dimension, not a measure, of the tile. And it automatically 
matches the tables joined in the query to the 5 joined tables in the SQL 
definition of the lattice (not shown above).

  was:
If a lattice has a materialized tile on say columns (x, y, z), allow that tile 
to be used to evaluate a query on say ( x ) or (y, z). Implementation would 
require an extra aggregation to roll up from (x, y, z) to the actual column set 
(y, z).

Measures would need to be present in the materialization, and be able to be 
rolled up; for instance, count(a) is rolled up from a partial result p using 
sum(p). Min, max and sum roll up using themselves.

You can also compute aggregate functions on grouping columns, for example min( 
x ), and expressions of aggregate functions.

Given the a lattice with a single initially materialized tile,

{code:javascript}
{
  auto: false,
  defaultMeasures: [ {
    agg: 'count'
  } ],
  tiles: [ {
    dimensions: [ 'the_year', ['t', 'quarter'] ],
    measures: [ {
      agg: 'sum',
      args: 'unit_sales'
    }, {
      agg: 'sum',
      args: 'store_sales'
    }, {
      agg: 'count'
    } ]
  } ]
}
{code}

Optiq can satisfy the following query from that tile:

{code:sql}
select t."the_year",
  count(*) as c,
  min("quarter") as q,
  sum("unit_sales") * 10 as us
from "foodmart"."sales_fact_1997" as s
join "foodmart"."time_by_day" as t using ("time_id")
group by t."the_year"
{code}

Note that it rolls up from (the_year, quarter) to (the_year), rolls up count(*) 
using sum, rolls up sum(unit_sales), and computes min(quarter) from a column 
(quarter) that is a dimension, not a measure, of the tile. And it automatically 
matches the tables joined in the query to the 5 joined tables in the SQL 
definition of the lattice (not shown above).


> Allow lattice tiles to satisfy a query by rolling up
> ----------------------------------------------------
>
>                 Key: OPTIQ-410
>                 URL: https://issues.apache.org/jira/browse/OPTIQ-410
>             Project: Optiq
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>
> If a lattice has a materialized tile on say columns (x, y, z), allow that 
> tile to be used to evaluate a query on say ( x ) or (y, z). Implementation 
> would require an extra aggregation to roll up from (x, y, z) to the actual 
> column set (y, z).
> Measures would need to be present in the materialization, and be able to be 
> rolled up; for instance, count(a) is rolled up from a partial result p using 
> sum(p). Min, max and sum roll up using themselves.
> You can also compute aggregate functions on grouping columns, for example 
> min( x ), and expressions of aggregate functions.
> Given the a lattice with a single initially materialized tile,
> {code:javascript}
> {
>   auto: false,
>   defaultMeasures: [ {
>     agg: 'count'
>   } ],
>   tiles: [ {
>     dimensions: [ 'the_year', ['t', 'quarter'] ],
>     measures: [ {
>       agg: 'sum',
>       args: 'unit_sales'
>     }, {
>       agg: 'sum',
>       args: 'store_sales'
>     }, {
>       agg: 'count'
>     } ]
>   } ]
> }
> {code}
> Optiq can satisfy the following query from that tile:
> {code:sql}
> select t."the_year",
>   count(*) as c,
>   min("quarter") as q,
>   sum("unit_sales") * 10 as us
> from "foodmart"."sales_fact_1997" as s
> join "foodmart"."time_by_day" as t using ("time_id")
> group by t."the_year"
> {code}
> Note that it rolls up from (the_year, quarter) to (the_year), rolls up count( 
> * ) using sum, rolls up sum(unit_sales), and computes min(quarter) from a 
> column (quarter) that is a dimension, not a measure, of the tile. And it 
> automatically matches the tables joined in the query to the 5 joined tables 
> in the SQL definition of the lattice (not shown above).



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

Reply via email to