提交 4f65ea33 编写于 作者: O obdev 提交者: ob-robot

Partition sort check earlier and more strictly

上级 0866a4b8
......@@ -1762,6 +1762,16 @@ int ObStaticEngineCG::generate_spec(ObLogSort &op, ObSortSpec &spec, const bool
spec.part_cnt_ = op.get_part_cnt();
LOG_TRACE("trace order by", K(spec.all_exprs_.count()), K(spec.all_exprs_));
}
if (OB_SUCC(ret)) {
if (spec.sort_collations_.count() != spec.sort_cmp_funs_.count()
|| (spec.part_cnt_ > 0 && spec.part_cnt_ >= spec.sort_collations_.count())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("part cnt or sort size not meet the expection", K(ret),
K(OB_NOT_NULL(op.get_topn_expr())), K(OB_NOT_NULL(op.get_topk_limit_expr())),
K(spec.enable_encode_sortkey_opt_), K(spec.prefix_pos_), K(spec.is_local_merge_sort_),
K(spec.part_cnt_), K(spec.sort_collations_.count()), K(spec.sort_cmp_funs_.count()));
}
}
}
}
return ret;
......
......@@ -596,12 +596,11 @@ int ObSortOpImpl::init(
} else if (OB_INVALID_ID == tenant_id) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), K(tenant_id));
} else if (OB_ISNULL(sort_collations) || OB_ISNULL(sort_cmp_funs) || OB_ISNULL(eval_ctx)
|| sort_collations->count() != sort_cmp_funs->count() || OB_ISNULL(exec_ctx)
|| part_cnt > sort_collations->count()) {
} else if (OB_ISNULL(sort_collations) || OB_ISNULL(sort_cmp_funs)
|| OB_ISNULL(eval_ctx) || OB_ISNULL(exec_ctx)) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument: argument is null", K(ret), K(tenant_id),
K(sort_collations), K(sort_cmp_funs), K(eval_ctx), K(part_cnt));
LOG_WARN("invalid argument: argument is null", K(ret),
K(tenant_id), K(sort_collations), K(sort_cmp_funs), K(eval_ctx));
} else if (OB_FAIL(comp_.init(sort_collations, sort_cmp_funs,
exec_ctx, enable_encode_sortkey))) {
LOG_WARN("failed to init compare functions", K(ret));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册