提交 ab74cf74 编写于 作者: Q qianchanger 提交者: LINGuanRen

Fix window function parallel bug

上级 f0d7d9d6
......@@ -3122,11 +3122,16 @@ int ObAggregateCalcFunc::add_calc(const ObDatum& left_value, const ObDatum& righ
break;
}
case ObNumberTC: {
if (left_value.is_null() && OB_FAIL(clone_number_cell(right_value.get_number(), result_datum, out_allocator))) {
LOG_WARN("fail to clone number cell", K(ret));
} else if (right_value.is_null() &&
OB_FAIL(clone_number_cell(left_value.get_number(), result_datum, out_allocator))) {
LOG_WARN("fail to clone number cell", K(ret));
if (left_value.is_null()) {
if (OB_FAIL(clone_number_cell(right_value.get_number(),
result_datum, out_allocator))) {
LOG_WARN("fail to clone number cell", K(ret));
}
} else if (right_value.is_null()) {
if (OB_FAIL(clone_number_cell(left_value.get_number(),
result_datum, out_allocator))) {
LOG_WARN("fail to clone number cell", K(ret));
}
} else {
char buf_alloc[ObNumber::MAX_CALC_BYTE_LEN];
ObDataBuffer allocator(buf_alloc, ObNumber::MAX_CALC_BYTE_LEN);
......
......@@ -1364,7 +1364,12 @@ int ObWindowFunctionOp::parallel_winbuf_process()
ObDatum& l_datum = new_row->cells()[idx];
const ObDatum& r_datum = row->cells()[idx];
ObDatumCmpFuncType cmp_func = cmp_funcs.at(cmp_index);
if (cmp_func(l_datum, r_datum) < 0) {
// null-last cmp func should ignore null in max calc
if (r_datum.is_null() && !l_datum.is_null()) {
/*do nothing*/
} else if (!r_datum.is_null() && l_datum.is_null()) {
l_datum = r_datum;
} else if (cmp_func(l_datum, r_datum) < 0) {
l_datum = r_datum;
}
cmp_index++;
......@@ -1374,6 +1379,7 @@ int ObWindowFunctionOp::parallel_winbuf_process()
ObDatum& l_datum = new_row->cells()[idx];
const ObDatum& r_datum = row->cells()[idx];
ObDatumCmpFuncType cmp_func = cmp_funcs.at(cmp_index);
// null-last cmp func no need null special calc in min calc
if (cmp_func(l_datum, r_datum) > 0) {
l_datum = r_datum;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册