namhnguyen / asterixdb

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

error on query using distinct #736

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Reproduction:
==============

Either of the two queries below generate an error: 
Note that the queries are equivalent - just trying different ways.

Way 1:
=========
for $page_views in dataset page_views
group by $g := $page_views.user with $page_views
  return {
"name": $g,
 "count": count(for $t in $page_views
distinct by $t.action return $t.timespent)
};

Attempting to construct a nested plan with 3 operator descriptors. Currently, 
nested plans can only consist in linear pipelines of Asterix micro operators. 
[AlgebricksException]

Way 2:
=========

for $t in dataset page_views
distinct by $t.action, $t.name
 group by $group := $t.user with $t
  return {
  "name": $group,
  "count": count(for $y in $t return $y)
};

PushAggregateIntoGroupbyRule: could not find UNNEST [IllegalStateException]

Original issue reported on code.google.com by ker...@gmail.com on 18 Mar 2014 at 9:04

GoogleCodeExporter commented 9 years ago
Take a look at issue 51 and issue 185. In the past we have seen similar 
Exception.

Original comment by khfaraaz82 on 18 Mar 2014 at 9:18

GoogleCodeExporter commented 9 years ago
As a workaround, the equivalent query using a tmp file below.

insert into dataset tmp(
for $t in dataset page_views
distinct by $t.action, $t.name
return $t
);

for $t in dataset tmp
group by $g := $t.user with $t
  return {
  "name": $g,
  "count": count($t)
};

Original comment by ker...@gmail.com on 18 Mar 2014 at 11:09

GoogleCodeExporter commented 9 years ago
Pigmix blocker - issue is aggregation related.

Original comment by ker...@gmail.com on 17 Nov 2014 at 2:30

GoogleCodeExporter commented 9 years ago

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