Batchsize auto downgrade for lob/longtext/mediumtext type
This commit is contained in:
@ -100,7 +100,8 @@ int ObStaticEngineExprCG::detect_batch_size(const ObRawExprUniqueSet &exprs,
|
||||
int64_t MAX_ROWSIZE = 65535;
|
||||
int64_t MIN_ROWSIZE = 2;
|
||||
const common::ObIArray<ObRawExpr *> &raw_exprs = exprs.get_expr_array();
|
||||
if (can_execute_vectorizely(raw_exprs)) {
|
||||
auto size = get_expr_execute_size(raw_exprs);
|
||||
if (size == ObExprBatchSize::full) {
|
||||
if (config_maxrows) {
|
||||
batch_size = config_maxrows;
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < raw_exprs.count(); i++) {
|
||||
@ -141,8 +142,10 @@ int ObStaticEngineExprCG::detect_batch_size(const ObRawExprUniqueSet &exprs,
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (size == ObExprBatchSize::small) {
|
||||
batch_size = static_cast<int64_t>(ObExprBatchSize::small); //
|
||||
} else {
|
||||
batch_size = 1;
|
||||
batch_size = static_cast<int64_t>(ObExprBatchSize::one);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -1391,28 +1394,30 @@ int ObStaticEngineExprCG::get_vectorized_exprs(
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ObStaticEngineExprCG::can_execute_vectorizely(
|
||||
ObStaticEngineExprCG::ObExprBatchSize ObStaticEngineExprCG::get_expr_execute_size(
|
||||
const common::ObIArray<ObRawExpr *> &raw_exprs)
|
||||
{
|
||||
bool can_exprs_execute_vectorizely = true;
|
||||
ObExprBatchSize size = ObExprBatchSize::full;
|
||||
bool has_udf_expr = false;
|
||||
bool has_usr_var_expr = false;
|
||||
bool has_wrapper_inner_expr = false;
|
||||
for (int64_t i = 0; (can_exprs_execute_vectorizely) && i < raw_exprs.count();
|
||||
i++) {
|
||||
for (int64_t i = 0; i < raw_exprs.count(); i++) {
|
||||
ObItemType type = raw_exprs.at(i)->get_expr_type();
|
||||
if (T_OP_GET_USER_VAR == type) {
|
||||
has_usr_var_expr = true;
|
||||
} else if (T_FUN_UDF == type) {
|
||||
has_udf_expr = true;
|
||||
if (!(static_cast<ObUDFRawExpr*>(raw_exprs.at(i))->is_deterministic())) {
|
||||
can_exprs_execute_vectorizely = false;
|
||||
size = ObExprBatchSize::one;
|
||||
break;
|
||||
}
|
||||
} else if (T_FUN_SYS_WRAPPER_INNER == type) {
|
||||
can_exprs_execute_vectorizely = false;
|
||||
size = ObExprBatchSize::one;
|
||||
break;
|
||||
} else if (T_REF_QUERY == type) {
|
||||
if (static_cast<ObQueryRefRawExpr*>(raw_exprs.at(i))->is_cursor()) {
|
||||
can_exprs_execute_vectorizely = false;
|
||||
size = ObExprBatchSize::one;
|
||||
break;
|
||||
}
|
||||
}
|
||||
LOG_DEBUG("check expr type", K(type), KPC(raw_exprs.at(i)));
|
||||
@ -1436,13 +1441,19 @@ bool ObStaticEngineExprCG::can_execute_vectorizely(
|
||||
//
|
||||
// Execute UDF f1() vectorizely would set @b='abc' within a batch and leave
|
||||
// NO chance to disaply @b=1
|
||||
if (can_exprs_execute_vectorizely) {
|
||||
can_exprs_execute_vectorizely = !(has_udf_expr & has_usr_var_expr);
|
||||
if (has_udf_expr & has_usr_var_expr) {
|
||||
size = ObExprBatchSize::one;
|
||||
break;
|
||||
}
|
||||
if (is_large_data(raw_exprs.at(i)->get_data_type())) {
|
||||
// 1. batchsize should be scale down when longtext/mediumtext/lob shows up
|
||||
// 2. keep searching
|
||||
size = ObExprBatchSize::small;
|
||||
}
|
||||
|
||||
}
|
||||
LOG_TRACE("can_execute_vectorizely",
|
||||
K(can_exprs_execute_vectorizely));
|
||||
return can_exprs_execute_vectorizely;
|
||||
LOG_TRACE("can_execute_vectorizely", K(size));
|
||||
return size;
|
||||
}
|
||||
int ObStaticEngineExprCG::divide_probably_local_exprs(common::ObIArray<ObRawExpr *> &exprs)
|
||||
{
|
||||
|
||||
@ -383,9 +383,23 @@ private:
|
||||
bool is_vectorized_expr(const ObRawExpr *raw_expr) const;
|
||||
int compute_max_batch_size(const ObRawExpr *raw_expr);
|
||||
|
||||
enum class ObExprBatchSize {
|
||||
one = 1,
|
||||
small = 8,
|
||||
full = 65535
|
||||
};
|
||||
// Certain exprs can NOT be executed vectorizely. Check the exps within this
|
||||
// routine
|
||||
bool can_execute_vectorizely(const common::ObIArray<ObRawExpr *> &raw_exprs);
|
||||
ObExprBatchSize
|
||||
get_expr_execute_size(const common::ObIArray<ObRawExpr *> &raw_exprs);
|
||||
inline bool is_large_data(ObObjType type) {
|
||||
bool b_large_data = false;
|
||||
if (type == ObLongTextType || type == ObMediumTextType ||
|
||||
type == ObLobType) {
|
||||
b_large_data = true;
|
||||
}
|
||||
return b_large_data;
|
||||
}
|
||||
|
||||
// get the frame idx of param frames and datum index (in frame) by index of param store.
|
||||
void get_param_frame_idx(const int64_t idx, int64_t &frame_idx, int64_t &datum_idx);
|
||||
|
||||
Reference in New Issue
Block a user