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

Ildar Absalyamov closed ASTERIXDB-1229.
---------------------------------------
    Resolution: Fixed

> RemoveRedundantListifyRule does not consider expressions other then 
> variableReferences
> --------------------------------------------------------------------------------------
>
>                 Key: ASTERIXDB-1229
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1229
>             Project: Apache AsterixDB
>          Issue Type: Bug
>          Components: Optimizer
>            Reporter: Ildar Absalyamov
>            Assignee: Ildar Absalyamov
>
> Consider the ddl:
> {noformat}
> drop dataverse test if exists;
> create dataverse test
> use dataverse test
> create type listType as {
>   "id": int64,
>   "list": [int64]
> }
> create dataset listDS(listType) primary key id
> insert into dataset listDS({"id":1, "list":[1,2,3]})
> {noformat}
> The following two queries, being semantically the same produce different 
> plans:
> {noformat}
> for $x in dataset listDS
> return  avg(for $y in $x.list
>  return $y)
> {noformat}
> {noformat}
> for $x in dataset listDS
> return  avg($x.list)
> {noformat}
> The former query produces a subplan, but if get incorrectly optimized by 
> RemoveRedundantListifyRule since the argument of scan-collection is an 
> expression, rather then a variable:
> {noformat}
> distribute result [%0->$$3] -- |UNPARTITIONED|
>   project ([$$3]) -- |UNPARTITIONED|
>     assign [$$3] <- [function-call: asterix:avg, Args:[%0->$$5]] -- 
> |UNPARTITIONED|
>       subplan {
>                 aggregate [$$5] <- [function-call: asterix:listify, 
> Args:[%0->$$1]] -- |UNPARTITIONED|
>                   unnest $$1 <- function-call: asterix:scan-collection, 
> Args:[function-call: asterix:field-access-by-name, Args:[%0->$$0, AString: 
> {list}]] -- |UNPARTITIONED|
>                     nested tuple source -- |UNPARTITIONED|
>              } -- |UNPARTITIONED|
>         data-scan []<-[$$6, $$0] <- test:listDS -- |UNPARTITIONED|
>           empty-tuple-source -- |UNPARTITIONED|
> {noformat}



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

Reply via email to