Commit 9e7495df authored by Sergey Petrunya's avatar Sergey Petrunya

Semi-join fixes: make COST_VECT objects survive add_io(add_io_cnt=0,...

Semi-join fixes: make COST_VECT objects survive add_io(add_io_cnt=0, add_avg_cost=...) calls without
getting NaN in internal fields.
parent 0ce603ab
......@@ -1390,10 +1390,14 @@ class COST_VECT
}
void add_io(double add_io_cnt, double add_avg_cost)
{
double io_count_sum= io_count + add_io_cnt;
avg_io_cost= (io_count * avg_io_cost +
add_io_cnt * add_avg_cost) / io_count_sum;
io_count= io_count_sum;
/* In edge cases add_io_cnt may be zero */
if (add_io_cnt > 0)
{
double io_count_sum= io_count + add_io_cnt;
avg_io_cost= (io_count * avg_io_cost +
add_io_cnt * add_avg_cost) / io_count_sum;
io_count= io_count_sum;
}
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment