[FEAT MERGE] impl vectorization 2.0

Co-authored-by: Naynahs <cfzy002@126.com>
Co-authored-by: hwx65 <1780011298@qq.com>
Co-authored-by: oceanoverflow <oceanoverflow@gmail.com>
This commit is contained in:
obdev
2023-12-22 03:43:19 +00:00
committed by ob-robot
parent 1178245448
commit b6773084c6
592 changed files with 358124 additions and 303288 deletions

View File

@ -24,6 +24,7 @@
#include "sql/engine/px/ob_px_basic_info.h"
#include "sql/engine/ob_io_event_observer.h"
#include "sql/ob_sql_define.h"
#include "sql/engine/ob_batch_rows.h"
#include "share/diagnosis/ob_sql_plan_monitor_node_list.h"
#include "share/schema/ob_schema_struct.h"
#include "share/schema/ob_trigger_info.h"
@ -165,30 +166,6 @@ struct ObBatchRescanCtl
TO_STRING_KV(K_(cur_idx), K_(params), K_(param_version));
};
// operator return batch rows description
struct ObBatchRows
{
ObBatchRows() : skip_(NULL), size_(0), end_(false) {}
DECLARE_TO_STRING;
int copy(const ObBatchRows *src)
{
int ret = common::OB_SUCCESS;
size_ = src->size_;
end_ = src->end_;
// TODO qubin.qb: use shallow copy instead
skip_->deep_copy(*(src->skip_), size_);
return ret;
}
// bit vector for filtered rows
ObBitVector *skip_;
// batch size
int64_t size_;
// iterate end
bool end_;
};
// Adapt get_next_batch() to the old style get_next_row() interface.
// (return OB_ITER_END for iterate end)
class ObBatchRowIter
@ -367,6 +344,7 @@ public:
int64_t plan_depth_;
int64_t max_batch_size_;
bool need_check_output_datum_;
bool use_rich_format_;
private:
DISALLOW_COPY_AND_ASSIGN(ObOpSpec);
@ -400,8 +378,6 @@ public:
int set_children_pointer(ObOperator **children, uint32_t child_cnt);
int set_child(const uint32_t idx, ObOperator *child);
int get_real_child(ObOperator *&child, const int32_t child_idx);
int init();
// open operator, cascading open child operators.
@ -476,6 +452,8 @@ public:
// clear evaluated flag of current datum (ObEvalCtx::batch_idx_) of batch.
inline void clear_datum_eval_flag();
void reset_output_format();
// check execution status: timeout, session kill, interrupted ..
int check_status();
// check execution status every CHECK_STATUS_TRY_TIMES tries.
@ -510,10 +488,11 @@ protected:
// Calc buffer does not reset internally, you need to reset it appropriately.
int filter(const common::ObIArray<ObExpr *> &exprs, bool &filtered);
int filter_batch_rows(const ObExprPtrIArray &exprs,
ObBitVector &skip,
const int64_t bsize,
bool &all_filtered);
int filter_rows(const ObExprPtrIArray &exprs,
ObBitVector &skip,
const int64_t bsize,
bool &all_filtered,
bool &all_active);
int startup_filter(bool &filtered) { return filter(spec_.startup_filters_, filtered); }
int filter_row(bool &filtered) { return filter(spec_.filters_, filtered); }
@ -527,9 +506,10 @@ protected:
inline void reset_batchrows()
{
if (brs_.size_ > 0) {
brs_.skip_->reset(brs_.size_);
brs_.reset_skip(brs_.size_);
brs_.size_ = 0;
}
brs_.all_rows_active_ = false;
}
inline int get_next_row_vectorizely();
inline int get_next_batch_with_onlyone_row()
@ -561,7 +541,19 @@ protected:
}
return ret;
}
private:
int filter_batch_rows(const ObExprPtrIArray &exprs,
ObBitVector &skip,
const int64_t bsize,
bool &all_filtered,
bool &all_active);
int filter_vector_rows(const ObExprPtrIArray &exprs,
ObBitVector &skip,
const int64_t bsize,
bool &all_filtered,
bool &all_active);
int convert_vector_format();
// for sql plan monitor
int try_register_rt_monitor_node(int64_t rows);
int try_deregister_rt_monitor_node();