asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yingyi Bu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ASTERIXDB-1580) Subquery in having clause throws ArrayIndexOutOfBoundsException
Date Mon, 22 Aug 2016 18:28:20 GMT

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

Yingyi Bu commented on ASTERIXDB-1580:
--------------------------------------

Vignesh,

In your query:

{noformat}
select  a.ca_state state, count(a) cnt
 from customer_address a
     ,customer c
     ,store_sales s
     ,date_dim d
     ,item i
 where  a.ca_address_sk = c.c_current_addr_sk
 	and c.c_customer_sk = s.ss_customer_sk
 	and s.ss_sold_date_sk = d.d_date_sk
 	and s.ss_item_sk = i.i_item_sk
 group by a.ca_state group as stategrp
 having coll_count((select value a from stategrp)) >= 10
 order by cnt
 limit 100;
{noformat}

After the group by, the subquery
{noformat}
(select value a from stategrp)
{noformat}

is a syntatic sugar of
{noformat}
(select value (select value g2.a from stategrp g2) from stategrp g1)
{noformat}

Basically, after grouping, "a" is a syntatic sugar of "(select value g.a from stategrp g)",
except a is referred inside a SQL-92 aggregate function symbol.




> Subquery in having clause throws ArrayIndexOutOfBoundsException
> ---------------------------------------------------------------
>
>                 Key: ASTERIXDB-1580
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1580
>             Project: Apache AsterixDB
>          Issue Type: Bug
>            Reporter: Vignesh Raghunathan
>            Assignee: Yingyi Bu
>         Attachments: logs.zip
>
>
> The following sqlpp query throws an ArrayIndexOutOfBoundsException
> {code}
> use tpcds;
> select  a.ca_state state, count(a) cnt
>  from customer_address a
>      ,customer c
>      ,store_sales s
>      ,date_dim d
>      ,item i
>  where  a.ca_address_sk = c.c_current_addr_sk
>  	and c.c_customer_sk = s.ss_customer_sk
>  	and s.ss_sold_date_sk = d.d_date_sk
>  	and s.ss_item_sk = i.i_item_sk
>  group by a.ca_state group as stategrp
>  having coll_count((select value a from stategrp)) >= 10
>  order by cnt
>  limit 100;
> {code}
> tpcdsq6.zip contains the schema and data for the datasets used in the query



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

Mime
View raw message