Stamatis Zampetakis created CALCITE-6461:
--------------------------------------------

             Summary: Metadata provider for determining if columns originate 
from aggregate functions
                 Key: CALCITE-6461
                 URL: https://issues.apache.org/jira/browse/CALCITE-6461
             Project: Calcite
          Issue Type: Improvement
          Components: core
            Reporter: Stamatis Zampetakis
            Assignee: Stamatis Zampetakis


Add a new metadata provider for determining whether a set of columns originates 
from aggregate functions.

In Apache Hive, we have a use-case where we need to determine if the columns in 
the result of a query originate from aggregate functions. Along with other 
things, it is used for deciding when to materialize common table expressions.

{code:sql}
SELECT job, SUM(sal) as total 
FROM emp 
GROUP BY job
{code}

For the query above, the new metadata provider should return:
* false when the input is column 0 (job)
* true when the input is column 1 (total)
* false when the input is columns {0,1}

The proposed metadata provider presents some similarities with {{ColumnOrigin}} 
and {{ExpressionLineage}} but the latter cannot be easily extended to provide 
this information.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to