You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2014/12/15 08:46:13 UTC

[jira] [Updated] (CALCITE-254) Propagate RelCollation on aliased columns in JoinRule.

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

Julian Hyde updated CALCITE-254:
--------------------------------
    Description: 
Consider this query:

SELECT *
FROM emp JOIN dept ON emp.deptno = dept.deptno
ORDER BY dept.deptno;

If table emp is sorted on emp.deptno (for example, table emp has index on emp.deptno, or table emp comes from a subquery which sorts on emp.deptno),  the join predicate emp.deptno = dept.deptno indicates the two columns are aliased columns in terms of ordering.  If JoinRule keep track of the RelCollation trait for the aliased columns, the query essentially become as following

SELECT *
FROM emp JOIN dept ON emp.deptno = dept.deptno
ORDER BY emp.deptno;

The ORDER BY should not require a SortRel, since the input table emp is sorted on emp.depno.

Currently, optiq framework does not recognize the aliased columns from join = predicates, and may introduce redundant sort to the plan.

This issue is relevant to issue ([#41|https://github.com/JulianHyde/optiq/issues/41] | [CALCITE-41|https://issues.apache.org/jira/browse/CALCITE-41]) 
https://github.com/julianhyde/optiq/issues/41



---------------- Imported from GitHub ----------------
Url: https://github.com/julianhyde/optiq/issues/254
Created by: [jinfengni|https://github.com/jinfengni]
Labels: 
Created at: Thu Apr 17 22:53:46 CEST 2014
State: open


  was:
Consider this query:

SELECT *
FROM emp JOIN dept ON emp.deptno = dept.deptno
ORDER BY dept.deptno;

If table emp is sorted on emp.deptno (for example, table emp has index on emp.deptno, or table emp comes from a subquery which sorts on emp.deptno),  the join predicate emp.deptno = dept.deptno indicates the two columns are aliased columns in terms of ordering.  If JoinRule keep track of the RelCollation trait for the aliased columns, the query essentially become as following

SELECT *
FROM emp JOIN dept ON emp.deptno = dept.deptno
ORDER BY emp.deptno;

The ORDER BY should not require a SortRel, since the input table emp is sorted on emp.depno.

Currently, optiq framework does not recognize the aliased columns from join = predicates, and may introduce redundant sort to the plan.

This issue is relevant to issue ([#41|https://github.com/JulianHyde/optiq/issues/41] | [FLINK-41|https://issues.apache.org/jira/browse/OPTIQ-41]) 
https://github.com/julianhyde/optiq/issues/41



---------------- Imported from GitHub ----------------
Url: https://github.com/julianhyde/optiq/issues/254
Created by: [jinfengni|https://github.com/jinfengni]
Labels: 
Created at: Thu Apr 17 22:53:46 CEST 2014
State: open



> Propagate RelCollation on aliased columns in JoinRule.
> ------------------------------------------------------
>
>                 Key: CALCITE-254
>                 URL: https://issues.apache.org/jira/browse/CALCITE-254
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: GitHub Import
>              Labels: github-import
>
> Consider this query:
> SELECT *
> FROM emp JOIN dept ON emp.deptno = dept.deptno
> ORDER BY dept.deptno;
> If table emp is sorted on emp.deptno (for example, table emp has index on emp.deptno, or table emp comes from a subquery which sorts on emp.deptno),  the join predicate emp.deptno = dept.deptno indicates the two columns are aliased columns in terms of ordering.  If JoinRule keep track of the RelCollation trait for the aliased columns, the query essentially become as following
> SELECT *
> FROM emp JOIN dept ON emp.deptno = dept.deptno
> ORDER BY emp.deptno;
> The ORDER BY should not require a SortRel, since the input table emp is sorted on emp.depno.
> Currently, optiq framework does not recognize the aliased columns from join = predicates, and may introduce redundant sort to the plan.
> This issue is relevant to issue ([#41|https://github.com/JulianHyde/optiq/issues/41] | [CALCITE-41|https://issues.apache.org/jira/browse/CALCITE-41]) 
> https://github.com/julianhyde/optiq/issues/41
> ---------------- Imported from GitHub ----------------
> Url: https://github.com/julianhyde/optiq/issues/254
> Created by: [jinfengni|https://github.com/jinfengni]
> Labels: 
> Created at: Thu Apr 17 22:53:46 CEST 2014
> State: open



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