br1ghtyang / asterixdb

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

A query trying to make order in elements of each group in "group by" statement produces an exception #565

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Run the following query:
for $i in (
for $a in [["c",1.32],["b",3.22],["d",4.84],["a",7.79]]
for $b in [["c",1.32],["b",3.22],["d",4.84],["a",7.79]]
where $a[1] < $b[1]
group by $g := $a with $b
    let $b2:=
         for $j in $b
         order by $j[1]
      return $j
return [$g, $b2])
order by $i[0][1]
return $i

What is the expected output? What do you see instead?

What I expected to have is:
[ [ "c", 1.32d ], [ [ "b", 3.22d ], [ "d", 4.84d ], [ "a", 7.79d ] ] ]
[ [ "b", 3.22d ], [ [ "d", 4.84d ], [ "a", 7.79d ] ] ]
[ [ "d", 4.84d ], [ [ "a", 7.79d ] ] ]

But I got an error as follows:
Field value has type tag ANY, but it should have a concrete type. 
[AsterixException]

When I remove the "let $b2:= ...." part, this query produces a right result 
which is not ordered in group as follows:
[ [ "c", 1.32d ], [ [ "a", 7.79d ], [ "d", 4.84d ], [ "b", 3.22d ] ] ]
[ [ "b", 3.22d ], [ [ "d", 4.84d ], [ "a", 7.79d ] ] ]
[ [ "d", 4.84d ], [ [ "a", 7.79d ] ] ]

Original issue reported on code.google.com by jimah...@gmail.com on 12 Jul 2013 at 12:18