fix lead window function bug

This commit is contained in:
wangt1xiuyi 2024-03-11 11:15:05 +00:00 committed by ob-robot
parent a9d4d23935
commit 7f6a80c189

View File

@ -702,6 +702,16 @@ int ObWindowFunctionOp::NonAggrCellLeadOrLag::eval(RowsReader &row_reader,
LOG_WARN("invalid param", K(ret));
} else if (OB_FAIL(params.at(j)->eval(op_.eval_ctx_, result))) {
LOG_WARN("fail to calc result row", K(ret));
} else if (j == DEFAULT_VALUE && !result->is_null()) {
char *buf = NULL;
int64_t buf_size = result->get_deep_copy_size();
int64_t pos = 0;
if (OB_ISNULL(buf = wf_info_.expr_->get_str_res_mem(op_.eval_ctx_, buf_size))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("failed to alloc", K(buf), K(ret));
} else if (OB_FAIL(lead_lag_params[j].deep_copy(*result, buf, buf_size, pos))) {
LOG_WARN("failed to deep copy datum", K(ret));
}
} else {
lead_lag_params[j] = *result;
is_lead_lag_offset_used |= (j == OFFSET);