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

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

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

ASTERIXDB-1897: fix MoveFreeVariableOperatorOutOfSubplanRule.

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


> 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.3.15#6346)

Reply via email to