[jira] [Commented] (CALCITE-771) Use materialization for scan-project-sort query

2019-06-24 Thread Danny Chan (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16871020#comment-16871020
 ] 

Danny Chan commented on CALCITE-771:


Thanks, [~donnyzone], i have left some review comments.

> Use materialization for scan-project-sort query
> ---
>
> Key: CALCITE-771
> URL: https://issues.apache.org/jira/browse/CALCITE-771
> Project: Calcite
>  Issue Type: Bug
>Reporter: Julian Hyde
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> If a materialization is defined for scan-project-sort over another table, 
> then scan-project and scan-project-sort queries should be able to use it.
> For example, given the following schema (in pseudo-DDL):
> {code}
> CREATE TABLE Emp (empid, deptno, gender);
> CREATE MATERIALIZATION I_Emp_Deptno AS
>   SELECT deptno, empid FROM Emp ORDER BY deptno;
> {code}
> Calcite should rewrite the query
> {code}SELECT deptno FROM Emp ORDER BY deptno{code}
> to
> {code}
> Project(deptno)
>   TableScan(table=[I_Emp_Deptno])
> {code}
> Note that no sort is necessary.
> This rewrite is important for using secondary indexes.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CALCITE-771) Use materialization for scan-project-sort query

2019-06-21 Thread Feng Zhu (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16869221#comment-16869221
 ] 

Feng Zhu commented on CALCITE-771:
--

Hi, [~julianhyde], I opened a PR on this feature, do you have time to review?

> Use materialization for scan-project-sort query
> ---
>
> Key: CALCITE-771
> URL: https://issues.apache.org/jira/browse/CALCITE-771
> Project: Calcite
>  Issue Type: Bug
>Reporter: Julian Hyde
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> If a materialization is defined for scan-project-sort over another table, 
> then scan-project and scan-project-sort queries should be able to use it.
> For example, given the following schema (in pseudo-DDL):
> {code}
> CREATE TABLE Emp (empid, deptno, gender);
> CREATE MATERIALIZATION I_Emp_Deptno AS
>   SELECT deptno, empid FROM Emp ORDER BY deptno;
> {code}
> Calcite should rewrite the query
> {code}SELECT deptno FROM Emp ORDER BY deptno{code}
> to
> {code}
> Project(deptno)
>   TableScan(table=[I_Emp_Deptno])
> {code}
> Note that no sort is necessary.
> This rewrite is important for using secondary indexes.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)