|
[
Permalink
| « Hide
]
Adriano dos Santos Fernandes added a comment - 07/Jan/11 09:47 AM
Full test case, please.
I can reproduce it easily with any table containing the date field. It seems that the problem lies somewhere inside the SortAggregate handling, i.e. the internal sorting supporting the DISTINCT clause. Six subsequent SORT_get() calls return the same value and only then switch to another one.
I confirm that the problem is not with LIST but with any aggregate function. COUNT(DISTINCT) returns 42 instead of 7.
I'm testing 2.5.0. This is my test which ran ok:
SQL> show table tasks; DATE_OF_TASK DATE Nullable SQL> select * from tasks; DATE_OF_TASK ============ 2011-01-07 2011-01-07 2011-01-07 2011-01-06 2011-01-06 2011-01-06 2011-01-08 2011-01-08 2011-01-08 SQL> select count(distinct date_of_task) from tasks; COUNT ============ 3 SQL> select CON> list(distinct case extract(weekday from date_of_task) when 0 then 'Sun' when 1 then 'Mon' when 2 then 'Tue' when 3 then 'Wed' when 4 then 'Thu' when 5 then 'Fri' when 6 then 'Sat' end) CON> from tasks where date_of_task is not null; LIST ================= 0:1 ============================================================================== LIST: Fri,Sat,Thu ============================================================================== I have found the reason of the failure, already testing.
I was testing with a rather big table (millions of rows). And this is a real regression, v2.1 has the correct code.
The problem was that MOVE_CLEAR() zapped only first part of the sort key, as asb_length was not rounded up. Prior versions used ROUNDUP_LONG for both SORT_init() and SORT_put(), but v2.5 missed that rounding where SORT_put() is called.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||