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

ASF subversion and git services commented on ASTERIXDB-1897:
------------------------------------------------------------

Commit bf1aea2acdc094aa34626e15679eaacf7b5a28de in asterixdb's branch 
refs/heads/master from [~buyingyi]
[ https://git-wip-us.apache.org/repos/asf?p=asterixdb.git;h=bf1aea2 ]

[ASTERIXDB-1897][COMP][RT] Fix complex group-by.

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Fix type computer for numeric aggregations;
- Fix error reporting for SubplanRuntimeFactory;
- Add a negative test query.

Change-Id: Iebb393820a8edd0c54d80248b2a33c77d4f6fd7b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1923
Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>


> NPE in complex group-by query
> -----------------------------
>
>                 Key: ASTERIXDB-1897
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1897
>             Project: Apache AsterixDB
>          Issue Type: Bug
>            Reporter: Yingyi Bu
>            Assignee: Yingyi Bu
>
> The DDLs and query are as follows:
> {noformat}
> DROP DATAVERSE gby IF EXISTS;
> CREATE DATAVERSE gby;
> USE gby;
> CREATE TYPE PolicyType AS {
>     id: UUID
> }
> CREATE DATASET policies(PolicyType) PRIMARY KEY id AUTOGENERATED;
> INSERT INTO policies
> (
>   [ {
>     "policyno": "C123",
>     "state": "CA",
>     "zipcode": "96008",
>     "make": "Honda",
>     "accidents": [
>           {
>             "year": "2015",
>             "cost": 5000
>           },
>           {
>             "year": "2016",
>             "cost": 8000
>           },
>           {
>             "year": "2016",
>             "cost": 6000
>           }
>     ]
>   },
>   {
>     "policyno": "C124",
>     "state": "CA",
>     "zipcode": "96853",
>     "make": "Ford",
>     "accidents": [
>           {
>             "year": "2015",
>             "cost": 5000
>           },
>           {
>             "year": "2015",
>             "cost": 8000
>           },
>           {
>             "year": "2016",
>             "cost": 6000
>           }
>     ]
>   },
>   {
>     "policyno": "A123",
>     "state": "AZ",
>     "zipcode": "86008",
>     "make": "Honda",
>     "accidents": [
>         {
>           "year": "2015",
>           "cost": 5000
>         },
>         {
>           "year": "2016",
>           "cost": 8000
>         },
>         {
>           "year": "2016",
>           "cost": 6000
>         }
>     ]
>   },
>   {
>     "policyno": "A124",
>     "state": "AZ",
>     "zipcode": "86853",
>     "make": "Ford",
>     "accidents": [
>         {
>           "year": "2015",
>           "cost": 5000
>         },
>         {
>           "year": "2016",
>           "cost": 8000
>         },
>         {
>           "year": "2016",
>           "cost": 6000
>         }
>     ]
>   },
>   {
>     "policyno": "U123",
>     "state": "UT",
>     "zipcode": "66008",
>     "make": "Honda",
>     "accidents": [
>         {
>           "year": "2015",
>           "cost": 5000
>         },
>         {
>           "year": "2016",
>           "cost": 8000
>         },
>         {
>           "year": "2016",
>           "cost": 6000
>         }
>     ]
>   },
>   {
>     "policyno": "U124",
>     "state": "UT",
>     "zipcode": "66853",
>     "make": "Ford",
>     "accidents": [ ]
>   },
>   {
>     "policyno": "U125",
>     "state": "UT",
>     "zipcode": "66853",
>     "make": "Ford"
>   } ]
> );
> FROM policies p
> GROUP BY state GROUP AS g
> SELECT state,
>        (
>          FROM g
>          SELECT VALUE SUM(
>                   (
>                     FROM g.p.accidents a
>                     WHERE a.year = "2016"
>                     SELECT VALUE COUNT(*)
>                    )[0]
>                 )
>        )[0]  / (COUNT(*) * 1.0 ) AS risk
> ORDER BY risk DESC
> LIMIT 5;
> {noformat}



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

Reply via email to