namhnguyen / asterixdb

Automatically exported from code.google.com/p/asterixdb
0 stars 0 forks source link

group-by + aggregation query isn't optimized #810

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The following query:

for $page_views in dataset page_views
let $ts :=$page_views.timestamp
group by $group_key := $page_views.user with $ts
 let $morning := for $m in $ts where ($m<43200) return $m
 let $afternoon := for $a in $ts where ($a>=43200) return $a
return {
 "name": $group_key,
 "count_mornings": count ($morning),
 "count_afternoons": count ($afternoon)

is doing a group-by query and a count of the items in the groups. In the plan, 
there should be a local aggregation within a first-group-by (SORT_GROUP_BY)
then a hash by the group-key and a second group-by (PRE_CLUSTERED_GROUP)
instead it returns a plan where the entire objects are hashed like if the user 
asked for the groups themselves rather than their aggregation.

Original issue reported on code.google.com by ker...@gmail.com on 17 Oct 2014 at 9:34

GoogleCodeExporter commented 9 years ago

Original comment by buyingyi@gmail.com on 25 Oct 2014 at 7:50

GoogleCodeExporter commented 9 years ago
Keren, can you attach a sample dataset of page_views to this issue?

Original comment by buyingyi@gmail.com on 28 Oct 2014 at 11:28

GoogleCodeExporter commented 9 years ago

Original comment by buyingyi@gmail.com on 29 Oct 2014 at 4:51

GoogleCodeExporter commented 9 years ago
Please find attached a sample of ten rows. 

Original comment by ker...@gmail.com on 29 Oct 2014 at 11:50

Attachments:

GoogleCodeExporter commented 9 years ago
hyracks: yingyi/asterix_fix
asterixdb: yingyi/asterix_test

Original comment by buyingyi@gmail.com on 18 Nov 2014 at 12:32

GoogleCodeExporter commented 9 years ago
Issue 749 has been merged into this issue.

Original comment by buyingyi@gmail.com on 18 Nov 2014 at 7:59

GoogleCodeExporter commented 9 years ago
Issue 755 has been merged into this issue.

Original comment by buyingyi@gmail.com on 18 Nov 2014 at 8:00

GoogleCodeExporter commented 9 years ago

Original comment by buyingyi@gmail.com on 26 Nov 2014 at 11:22