Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BugFix] fix invalid expression usage
regression introduced in #44588 expr_context(...) ``` // Copy expr to prevent two ExprContexts from owning the same Expr, which will cause the same Expr to be // closed twice. // - The ExprContext in the `original _opts.conjunct_ctxs_ptr` will own an Expr and all its children. // - The newly created ExprContext here will also own this Expr. auto* new_expr = Expr::copy(obj_pool, root_expr); new_expr_ctx = obj_pool->add(new ExprContext(new_expr)); RETURN_IF_ERROR(new_expr_ctx->prepare(state)); RETURN_IF_ERROR(new_expr_ctx->open(state)); ``` create copy of root_expr as new_expr and new ExprContext pupulate ExprContext._fn_contexts and update VectorizedFunctionCallExpr._fn_context_index inside new_expr after return from function we do call of get_predicate_value with new_expr_ctx + root_expr inside root_expr we can have incorrect VectorizedFunctionCallExpr._fn_context_index, because indexes apply for another context as result later we have errors @ 0x16c18359 google::LogMessageFatal::~LogMessageFatal() @ 0x104f7c96 starrocks::ExprContext::fn_context(int) @ 0x105b4c11 starrocks::VectorizedFunctionCallExpr::evaluate_checked(starrocks::ExprContext*, starrocks::Chunk*) @ 0x103a737a starrocks::VectorizedCastToStringExpr<(starrocks::LogicalType)51, false>::evaluate_checked(starrocks::ExprContext*, starrocks::Chunk*) ``` FunctionContext* fn_context(int i) { DCHECK_GE(i, 0); DCHECK_LT(i, _fn_contexts.size()); return _fn_contexts[i]; } ``` for our case _fn_context_index = 3 and _fn_contexts.size() = 2 after fix we will use proper updated expressions with correct expression context Signed-off-by: Aliaksei Dziomin <[email protected]>
- Loading branch information