Richard Calaba created KYLIN-1759:
-------------------------------------

             Summary: SELECT from Sub-Query - SUPPORTED ???
                 Key: KYLIN-1759
                 URL: https://issues.apache.org/jira/browse/KYLIN-1759
             Project: Kylin
          Issue Type: Bug
    Affects Versions: v1.5.2
            Reporter: Richard Calaba


Hello,

I have a question / ask ... does Kylin Query processor supports SELECT from  
sub-query ????

In particular I need somethink like this:


SELECT group_id, AVG(sales)
FROM 
(   SELECT group_id, transaction_id, AVG(sale) as sales
    FROM FACT_TABLE
    WHERE ..... 
    GROUP BY group_id, transaction_id
)
GROUP BY group_id

The reason I need sub-query is that there is one to many relations between 

Example:
 
Group 1, trans_1, customer1, sales=5
Group 1, trans_1, customer2, sales=11
Group 1, trans_2, customer3, sales=10

So Avg sales per Trans_1 is 8 and overall Avg sales over all unique 
transactions is thus 9. Which is what I need.

If I would take only avg across all transactions (within the group) than 
because of non-unique transactions within the group I would get incorrect 8.66.

Is this query from sub-query supported in Kylin ???



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

Reply via email to