You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Yingyi Bu (JIRA)" <ji...@apache.org> on 2016/10/05 23:21:21 UTC

[jira] [Resolved] (ASTERIXDB-1677) Query with aggregate functions in with and where clause doesn't return result

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

Yingyi Bu resolved ASTERIXDB-1677.
----------------------------------
    Resolution: Duplicate

> Query with aggregate functions in with and where clause doesn't return result
> -----------------------------------------------------------------------------
>
>                 Key: ASTERIXDB-1677
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1677
>             Project: Apache AsterixDB
>          Issue Type: Bug
>         Environment: Master branch with latest commit c21de4d89a06726851ea9a54
>            Reporter: Vignesh Raghunathan
>
> To reproduce the issue, run the following sql++ statements:
> {code}
> drop dataverse tpcds if exists;
> create dataverse tpcds;
> use tpcds;
> create type tpcds.store_returns_type as
>  closed {
>   sr_customer_sk : int64,
>   sr_fee : double?
> }
> create dataset store_returns (store_returns_type) primary key sr_customer_sk;
> with customer_total_return as
> (select sr_customer_sk as ctr_customer_sk
> ,sum(sr_fee) as ctr_total_return
> from store_returns
> group by sr_customer_sk)
> select  ctr_customer_sk
> from customer_total_return ctr1
> where ctr1.ctr_total_return > (
>     select value (avg(ctr2.ctr_total_return)*1.2)
>     from customer_total_return ctr2
>     where ctr1.ctr_store_sk = ctr2.ctr_store_sk)[0]
> limit 1;
> {code}



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