[ARRAY] fix nested expr vector header assign

This commit is contained in:
helloamateur 2024-10-18 10:14:17 +00:00 committed by ob-robot
parent c67ffdd3c7
commit 0446a2136b
6 changed files with 35 additions and 25 deletions

View File

@ -1131,6 +1131,30 @@ int ObExpr::nested_cast_to_uniform(const int64_t size, ObEvalCtx &ctx, const ObB
return ret;
}
int ObExpr::assign_nested_vector(const ObExpr &other, ObEvalCtx &ctx)
{
int ret = OB_SUCCESS;
if (!is_nested_expr() || !other.is_nested_expr()) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("Unexpected expr type", K(ret));
} else if (attrs_cnt_ != other.attrs_cnt_) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("Unexpected expr type", K(ret), K(attrs_cnt_), K(other.attrs_cnt_ ));
}
for (uint32_t i = 0; OB_SUCC(ret) && i < attrs_cnt_; ++i) {
VectorHeader &to_attr_vec_header = attrs_[i]->get_vector_header(ctx);
VectorHeader &from_attr_vec_header = other.attrs_[i]->get_vector_header(ctx);
if (is_uniform_format(from_attr_vec_header.format_)
|| is_uniform_format(to_attr_vec_header.format_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("Unexpected format type", K(ret), K(from_attr_vec_header.format_), K(to_attr_vec_header.format_));
} else {
to_attr_vec_header = from_attr_vec_header;
}
}
return ret;
}
int VectorHeader::init_uniform_const_vector(VecValueTypeClass vec_value_tc,
ObDatum *datum,
ObEvalInfo *eval_info)

View File

@ -752,6 +752,7 @@ public:
void reset_attrs_datums(ObEvalCtx &ctx) const;
OB_INLINE bool is_nested_expr() const { return attrs_cnt_ > 0; }
int assign_nested_vector(const ObExpr &other, ObEvalCtx &ctx);
OB_INLINE void set_all_not_null(ObEvalCtx &ctx, const int64_t size) {

View File

@ -293,6 +293,9 @@ int ObHashSetVecOp::convert_vector(const common::ObIArray<ObExpr*> &src_exprs,
OZ(to->init_vector(eval_ctx_, VEC_UNIFORM, child_brs->size_));
} else {
to_vec_header = from_vec_header;
if (from->is_nested_expr()) {
OZ(to->assign_nested_vector(*from, eval_ctx_));
}
}
// init eval info
if (OB_SUCC(ret)) {

View File

@ -142,30 +142,6 @@ int ObSubPlanScanOp::next_batch(const int64_t max_row_cnt)
return ret;
}
int ObSubPlanScanOp::nested_next_vector(ObExpr &from, ObExpr &to)
{
int ret = OB_SUCCESS;
if (!from.is_nested_expr() || !to.is_nested_expr()) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("Unexpected expr type", K(ret));
} else if (from.attrs_cnt_ != to.attrs_cnt_) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("Unexpected expr type", K(ret), K(from.attrs_cnt_), K(to.attrs_cnt_ ));
}
for (uint32_t i = 0; OB_SUCC(ret) && i < from.attrs_cnt_; ++i) {
VectorHeader &from_attr_vec_header = from.attrs_[i]->get_vector_header(eval_ctx_);
VectorHeader &to_attr_vec_header = to.attrs_[i]->get_vector_header(eval_ctx_);
if (is_uniform_format(from_attr_vec_header.format_)
|| is_uniform_format(to_attr_vec_header.format_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("Unexpected format type", K(ret), K(from_attr_vec_header.format_), K(to_attr_vec_header.format_));
} else {
to_attr_vec_header = from_attr_vec_header;
}
}
return ret;
}
int ObSubPlanScanOp::next_vector(const int64_t max_row_cnt)
{
int ret = OB_SUCCESS;
@ -206,7 +182,7 @@ int ObSubPlanScanOp::next_vector(const int64_t max_row_cnt)
} else {
to_vec_header = from_vec_header;
if (from->is_nested_expr()) {
OZ(nested_next_vector(*from, *to));
OZ(to->assign_nested_vector(*from, eval_ctx_));
}
}
// init eval info

View File

@ -662,6 +662,9 @@ int ObOrcTableRowIterator::get_next_rows(int64_t &count, int64_t capacity)
}
} else {
to_vec_header = from_vec_header;
if (from->is_nested_expr()) {
OZ(to->assign_nested_vector(*from, eval_ctx));
}
}
column_exprs_.at(i)->set_evaluated_projected(eval_ctx);
}

View File

@ -1401,6 +1401,9 @@ int ObParquetTableRowIterator::get_next_rows(int64_t &count, int64_t capacity)
OZ(to->init_vector(eval_ctx, VEC_UNIFORM, read_count));
} else {
to_vec_header = from_vec_header;
if (from->is_nested_expr()) {
OZ(to->assign_nested_vector(*from, eval_ctx));
}
}
column_exprs_.at(i)->set_evaluated_projected(eval_ctx);
}