You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Mu Kong (JIRA)" <ji...@apache.org> on 2017/08/30 05:19:00 UTC

[jira] [Comment Edited] (KYLIN-2820) Query can't read window function's result from subquery

    [ https://issues.apache.org/jira/browse/KYLIN-2820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16146623#comment-16146623 ] 

Mu Kong edited comment on KYLIN-2820 at 8/30/17 5:18 AM:
---------------------------------------------------------

[~yimingliu]
Thanks for your prompt response.
I reproduced this issue by querying against the sample cube like the follows:

{code:sql}
select t.first_seller_id as first_seller_id_test, count(*) from (
select first_value(seller_id) over (partition by buyer_id) as first_seller_id 
from db_name.kylin_sales
) 
as t group by t.first_seller_id;
{code}

This ended with one record with an empty string as the first_seller_id_test.
The same query ends up with 998 rows if I ran it in hive.


was (Author: visualskyrim):
[~yimingliu]
Thanks for your prompt response.
I reproduced his issue by querying against the sample cube like the follows:

{code:sql}
select t.first_seller_id as first_seller_id_test, count(*) from (
select first_value(seller_id) over (partition by buyer_id) as first_seller_id 
from db_name.kylin_sales
) 
as t group by t.first_seller_id;
{code}

This ended with one record with an empty string as the first_seller_id_test.
The same query ends up with 998 rows if I ran it in hive.

> Query can't read window function's result from subquery
> -------------------------------------------------------
>
>                 Key: KYLIN-2820
>                 URL: https://issues.apache.org/jira/browse/KYLIN-2820
>             Project: Kylin
>          Issue Type: Bug
>    Affects Versions: v2.1.0
>            Reporter: Mu Kong
>
> I executed a query like the follows:
> {code:sql}
> select first_page_name, count(*) as page_name_count from
> (
> select first_value(page_name) over(partition by session_id) as first_page_name from some_db.some_table
> ) group by first_page_name;
> {code}
> This query resulted in one single record with an empty string as the first_page_name, and a big number as the page_name_count.
> However, when I ran the subquery without the outer query, it resulted in multiple records with different first_page_name, which proved the query above was wrong.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)