[ https://issues.apache.org/jira/browse/ASTERIXDB-1727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15638111#comment-15638111 ]
Taewoo Kim commented on ASTERIXDB-1727: --------------------------------------- During the optimization, the given group-by logical operator contains two aggregates in the subplan. Based on the hash hint, the physical operator for this logical group-by is set as EXTERNAL_GROUP_BY. However, we don't support multiple aggregates in the EXTERNAL_GROUP_BY yet. So, we need to set PRE_CLUSTERED_GROUP_BY instead of EXTERNAL_GROUP_BY. In short, this query with hash hint by will ignore the hash hint. > Adding grouping hint breaks the query > ------------------------------------- > > Key: ASTERIXDB-1727 > URL: https://issues.apache.org/jira/browse/ASTERIXDB-1727 > Project: Apache AsterixDB > Issue Type: Bug > Reporter: Pouria > Assignee: Taewoo Kim > > The following query works fine with no hint. Adding a hint to use hash-based > group-by breaks it with the following error: > {noformat} > Variable $$43 could not be found in any input schema. [AlgebricksException] > {noformat} > Here is the query: > {noformat} > let $customer := {{ {"cid" : 1}, {"cid" : 2} }} > let $orders := {{ > {"oid": 100, > "ocid" : 1, > "priority" : 10, > "class" : "A", > "items" : [{"price" : 1000}, { "price" : 2000}] > }, > {"oid": 200, > "ocid" : 2, > "priority" : 20, > "class" : "A", > "items" : [{"price" : 2000}, {"price" : 3000}] > } > }} > for $c in $customer > for $o in $orders > where > $c.cid = $o.ocid > for $i in $o.items > /*+ hash*/ > group by $o_orderid := $o.oid, $o_class := $o.class, $o_priority := > $o.priority > with $i > let $price := sum ( > for $t in $i > return > $t.price > ) > order by $price desc, $o_class > return { > "o_orderkey": $o_orderid, > "price": $price, > "o_class": $o_class, > "o_priority": $o_priority > } > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)