You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tajo.apache.org by "Hyunsik Choi (JIRA)" <ji...@apache.org> on 2014/08/13 08:32:11 UTC

[jira] [Created] (TAJO-1005) Sort on expression values including aggregation function should be supported.

Hyunsik Choi created TAJO-1005:
----------------------------------

             Summary: Sort on expression values including aggregation function should be supported.
                 Key: TAJO-1005
                 URL: https://issues.apache.org/jira/browse/TAJO-1005
             Project: Tajo
          Issue Type: Improvement
          Components: planner/optimizer
            Reporter: Hyunsik Choi
            Assignee: Hyunsik Choi
             Fix For: 0.9.0


h3. Background
In Tajo, expression evaluation are performed at only three operators, Scan, Join, and Projection. An expression is divided into multiple sub expressions, and then they are placed into proper operators.

h3. Problem

See the following example:
{code}
SELECT sum(x) / 100 as b from lineitem order by b
{code}

Tajo evaluates expressions at three operators: scan, join, and projection. Aggregation functions are evaluated at groupby operator, and expressions including aggregation functions are evaluated at projection operator.

But, sort operator is placed between aggregation function and projection. So, sort operator does not have any opportunity to take the result of some expression including aggregation functions.

h3. Solution
So far, projection operator is only topmost operator of all operators. To solve the above problem, we need to improve the order of operators. Especially, projection operator can be interleaved between all operators.

More specially, we allow projection operator to be inserted between group-by and sort operators. If so, the above problem will be solved.



--
This message was sent by Atlassian JIRA
(v6.2#6252)