[ https://issues.apache.org/jira/browse/ASTERIXDB-1626?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yingyi Bu closed ASTERIXDB-1626. -------------------------------- Resolution: Fixed Fixed with regression tests. > Multiple global aggregations result in sub-optimal plan > ------------------------------------------------------- > > Key: ASTERIXDB-1626 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-1626 > Project: Apache AsterixDB > Issue Type: Bug > Components: Optimizer > Reporter: Yingyi Bu > Assignee: Yingyi Bu > Labels: soon > > query: > {noformat} > Select count(*), avg(I_ID) > FROM items; > {noformat} > {noformat} > istribute result [%0->$$24] > -- DISTRIBUTE_RESULT |UNPARTITIONED| > exchange > -- ONE_TO_ONE_EXCHANGE |UNPARTITIONED| > project ([$$24]) > -- STREAM_PROJECT |UNPARTITIONED| > assign [$$24] <- [function-call: asterix:closed-record-constructor, > Args:[AString: {$1}, function-call: asterix:sql-count, Args:[%0->$$19], > AString: {$2}, function-call: asterix:sql-avg, Args:[%0->$$23]]] > -- ASSIGN |UNPARTITIONED| > project ([$$19, $$23]) > -- STREAM_PROJECT |UNPARTITIONED| > subplan { > aggregate [$$23] <- [function-call: asterix:listify, > Args:[%0->$$22]] > -- AGGREGATE |UNPARTITIONED| > assign [$$22] <- [function-call: > asterix:field-access-by-name, Args:[%0->$$27, AString: {I_ID}]] > -- ASSIGN |UNPARTITIONED| > assign [$$27] <- [function-call: > asterix:field-access-by-index, Args:[%0->$$12, AInt32: {0}]] > -- ASSIGN |UNPARTITIONED| > unnest $$12 <- function-call: > asterix:scan-collection, Args:[%0->$$15] > -- UNNEST |UNPARTITIONED| > nested tuple source > -- NESTED_TUPLE_SOURCE |UNPARTITIONED| > } > -- SUBPLAN |UNPARTITIONED| > project ([$$19, $$15]) > -- STREAM_PROJECT |UNPARTITIONED| > subplan { > aggregate [$$19] <- [function-call: asterix:listify, > Args:[%0->$$18]] > -- AGGREGATE |UNPARTITIONED| > unnest $$11 <- function-call: > asterix:scan-collection, Args:[%0->$$15] > -- UNNEST |UNPARTITIONED| > nested tuple source > -- NESTED_TUPLE_SOURCE |UNPARTITIONED| > } > -- SUBPLAN |UNPARTITIONED| > assign [$$18] <- [AInt64: {1}] > -- ASSIGN |UNPARTITIONED| > aggregate [$$15] <- [function-call: asterix:listify, > Args:[%0->$$10]] > -- AGGREGATE |UNPARTITIONED| > exchange > -- RANDOM_MERGE_EXCHANGE |PARTITIONED| > project ([$$10]) > -- STREAM_PROJECT |PARTITIONED| > assign [$$10] <- [function-call: > asterix:closed-record-constructor, Args:[AString: {items}, %0->$$7]] > -- ASSIGN |PARTITIONED| > project ([$$7]) > -- STREAM_PROJECT |PARTITIONED| > exchange > -- ONE_TO_ONE_EXCHANGE |PARTITIONED| > data-scan []<-[$$25, $$7, $$26] <- > CouchbaseAnalytics:items > -- DATASOURCE_SCAN |PARTITIONED| > exchange > -- ONE_TO_ONE_EXCHANGE |PARTITIONED| > empty-tuple-source > -- EMPTY_TUPLE_SOURCE |PARTITIONED| > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)