Hello,
Georgi Kodinov a écrit, Le 02.12.2010 15:29:
> #At file:///Users/kgeorge/mysql/work/B57954-5.5-bugteam/ based on
> revid:davi.arnaut@stripped
>
> 3135 Georgi Kodinov 2010-12-02
> Bug #57954: BIT_AND function returns incorrect results
> when semijoin=on
>
> When setting the aggregate function as having no rows to report
> the function no_rows_in_result() was calling Item_sum::reset().
> However this function in addition to cleaning up the aggregate
> value by calling aggregator_clear() was also adding the current
> value to the aggregate value by calling aggregator_add().
> Fixed by making no_rows_in_result() to call aggregator_clear()
> directly.
> Renamed Item_sum::reset to Item_sum::reset_and_add() to
> and added a comment to avoid misinterpretation of what the
> function does.
> === modified file 'sql/item_sum.h'
> --- a/sql/item_sum.h 2010-08-30 07:36:04 +0000
> +++ b/sql/item_sum.h 2010-12-02 14:29:45 +0000
> @@ -396,13 +396,21 @@ public:
About the comment of reset_field():
>
> /*
> Called when new group is started and results are being saved in
> - a temporary table. Similar to reset(), but must also store value in
> - result_field. Like reset() it is supposed to reset start value to
> - default.
> + a temporary table. Similar to reset_and_add(), but must also
> + store value in result_field. Like reset_and_add() it is supposed
> + to reset start value to default.
> This set of methods (reult_field(), reset_field, update_field()) of
> Item_sum is used only if quick_group is not null. Otherwise
> copy_or_same() is used to obtain a copy of this item.
But reset_and_add() not only "resets start value to default", it also
adds the value in its attributes to it.
Does reset_field() also add the value in its attributes to it? If yes
I'd write it in the comment; if no, then it's behaviour is significantly
different from reset_and_add() (not "Like reset_and_add()"), and I'd
write it in the comment.
I trust you'll find some suitable edits. Ok to push.