Change ObArray to ExprFixedArray about connect by spec exprs

This commit is contained in:
obdev
2023-05-22 12:41:37 +00:00
committed by ob-robot
parent 0beeb5cfa7
commit 4a04df81c6
4 changed files with 16 additions and 11 deletions

View File

@ -4154,6 +4154,10 @@ int ObStaticEngineCG::construct_hash_elements_for_connect_by(ObLogJoin &op, ObNL
} else if (OB_ISNULL(left_op = op.get_child(0)) || OB_ISNULL(right_op = op.get_child(1))) { } else if (OB_ISNULL(left_op = op.get_child(0)) || OB_ISNULL(right_op = op.get_child(1))) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("child op is null", K(ret)); LOG_WARN("child op is null", K(ret));
} else if (OB_FAIL(spec.hash_key_exprs_.init(op.get_other_join_conditions().count()))) {
LOG_WARN("failed to init hash key exprs", K(ret));
} else if (OB_FAIL(spec.hash_probe_exprs_.init(op.get_other_join_conditions().count()))) {
LOG_WARN("failed to init hash probe exprs", K(ret));
} else { } else {
const ObRelIds &left_table_set = left_op->get_table_set(); const ObRelIds &left_table_set = left_op->get_table_set();
const ObRelIds &right_table_set = right_op->get_table_set(); const ObRelIds &right_table_set = right_op->get_table_set();

View File

@ -602,17 +602,18 @@ void ObConnectByOpPump::ConnectByHashTable::reverse_bucket_cells()
} }
} }
int ObConnectByOpPump::calc_hash_value(const ObArray<ObExpr *> &hash_exprs, uint64_t &hash_value) int ObConnectByOpPump::calc_hash_value(const ExprFixedArray &exprs, uint64_t &hash_value)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
ObDatum *datum = NULL; ObDatum *datum = NULL;
hash_value = 0; hash_value = 0;
if (OB_ISNULL(eval_ctx_)) { const ObIArray<ObExpr*> *hash_exprs = &exprs;
if (OB_ISNULL(hash_exprs) || OB_ISNULL(eval_ctx_)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("eval ctx is null", K(ret)); LOG_WARN("eval ctx is null", K(ret));
} }
for (int64_t i = 0; OB_SUCC(ret) && i < hash_exprs.count(); i++) { for (int64_t i = 0; OB_SUCC(ret) && i < hash_exprs->count(); i++) {
ObExpr *hash_expr = hash_exprs.at(i); ObExpr *hash_expr = hash_exprs->at(i);
if (OB_ISNULL(hash_expr)) { if (OB_ISNULL(hash_expr)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("hash probe expr is null", K(ret)); LOG_WARN("hash probe expr is null", K(ret));
@ -650,7 +651,7 @@ int ObConnectByOpPump::build_hash_table(ObIAllocator &alloc)
hash_table_.all_cells_->reuse(); hash_table_.all_cells_->reuse();
} }
HashTableCell **bucket_end_cell = NULL; HashTableCell **bucket_end_cell = NULL;
const ObArray<ObExpr *> &hash_key_exprs = const ExprFixedArray &hash_key_exprs =
(static_cast<const ObNLConnectBySpec &>(connect_by_->get_spec())).hash_key_exprs_; (static_cast<const ObNLConnectBySpec &>(connect_by_->get_spec())).hash_key_exprs_;
if (OB_FAIL(ret)) { if (OB_FAIL(ret)) {
} else if (OB_UNLIKELY(0 == hash_key_exprs.count()) || OB_ISNULL(eval_ctx_)) { } else if (OB_UNLIKELY(0 == hash_key_exprs.count()) || OB_ISNULL(eval_ctx_)) {
@ -731,7 +732,7 @@ int ObConnectByOpPump::build_hash_table(ObIAllocator &alloc)
} }
int ObConnectByOpPump::RowFetcher::init(ObConnectByOpPump &connect_by_pump, int ObConnectByOpPump::RowFetcher::init(ObConnectByOpPump &connect_by_pump,
const ObArray<ObExpr *> &hash_probe_exprs) const ExprFixedArray &hash_probe_exprs)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
use_hash_ = false; use_hash_ = false;

View File

@ -165,7 +165,7 @@ private:
ObChunkDatumStore::Iterator *iterator_; ObChunkDatumStore::Iterator *iterator_;
HashTableCell *tuple_; HashTableCell *tuple_;
bool use_hash_; // tuple is valid if use_hash_ bool use_hash_; // tuple is valid if use_hash_
int init(ObConnectByOpPump &connect_by_pump, const ObArray<ObExpr *> &hash_probe_exprs); int init(ObConnectByOpPump &connect_by_pump, const ExprFixedArray &hash_probe_exprs);
int get_next_row(const ObChunkDatumStore::StoredRow *&row); int get_next_row(const ObChunkDatumStore::StoredRow *&row);
int get_next_row(const ObIArray<ObExpr *> &exprs, ObEvalCtx &eval_ctx); int get_next_row(const ObIArray<ObExpr *> &exprs, ObEvalCtx &eval_ctx);
}; };
@ -289,7 +289,7 @@ public:
int get_top_pump_node(PumpNode *&node); int get_top_pump_node(PumpNode *&node);
int get_sys_path(uint64_t sys_connect_by_path_id, ObString &parent_path); int get_sys_path(uint64_t sys_connect_by_path_id, ObString &parent_path);
int concat_sys_path(uint64_t sys_connect_by_path_id, const ObString &cur_path); int concat_sys_path(uint64_t sys_connect_by_path_id, const ObString &cur_path);
int calc_hash_value(const ObArray<ObExpr *> &hash_exprs, uint64_t &hash_value); int calc_hash_value(const ExprFixedArray &exprs, uint64_t &hash_value);
int build_hash_table(ObIAllocator &alloc); int build_hash_table(ObIAllocator &alloc);
private: private:

View File

@ -121,10 +121,10 @@ class ObNLConnectBySpec : public ObNLConnectBySpecBase
{ {
OB_UNIS_VERSION_V(1); OB_UNIS_VERSION_V(1);
public: public:
common::ObArray<ObExpr *> hash_key_exprs_; ExprFixedArray hash_key_exprs_;
common::ObArray<ObExpr *> hash_probe_exprs_; ExprFixedArray hash_probe_exprs_;
ObNLConnectBySpec(common::ObIAllocator &alloc, const ObPhyOperatorType type) ObNLConnectBySpec(common::ObIAllocator &alloc, const ObPhyOperatorType type)
: ObNLConnectBySpecBase(alloc, type), hash_key_exprs_(), hash_probe_exprs_() : ObNLConnectBySpecBase(alloc, type), hash_key_exprs_(alloc), hash_probe_exprs_(alloc)
{} {}
}; };