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
......@@ -1389,12 +1389,16 @@ class COST_VECT
cpu_cost += cost->cpu_cost;
}
void add_io(double add_io_cnt, double add_avg_cost)
{
/* 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;
}
}
/*
To be used when we go from old single value-based cost calculations to
......
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