Add query hint: enable_rich_vector_format

This commit is contained in:
obdev
2024-02-09 17:47:22 +00:00
committed by ob-robot
parent 59fa4e7f0c
commit 1d31b939ec
9 changed files with 116 additions and 6 deletions

View File

@ -780,6 +780,11 @@ bool ObOptParamHint::is_param_val_valid(const OptParamType param_type, const ObO
is_valid = val.is_varchar() && (0 == val.get_varchar().case_compare("MANULE"));
break;
}
case ENABLE_RICH_VECTOR_FORMAT: {
is_valid = val.is_varchar() && (0 == val.get_varchar().case_compare("true")
|| 0 == val.get_varchar().case_compare("false"));
break;
}
default:
LOG_TRACE("invalid opt param val", K(param_type), K(val));
break;
@ -877,6 +882,19 @@ int ObOptParamHint::has_opt_param(const OptParamType param_type, bool &has_hint)
return ret;
}
int ObOptParamHint::check_and_get_bool_opt_param(const OptParamType param_type, bool &has_opt_param_v,
bool &val) const
{
int ret = OB_SUCCESS;
has_opt_param_v = false, val = false;
if (OB_FAIL(has_opt_param(param_type, has_opt_param_v))) {
LOG_WARN("check opt param failed", K(ret));
} else if (OB_FAIL(has_enable_opt_param(param_type, val))) {
LOG_WARN("get opt param value failed", K(ret));
}
return ret;
}
void ObOptParamHint::reset()
{
param_types_.reuse();

View File

@ -107,6 +107,7 @@ struct ObOptParamHint
DEF(XSOLAPI_GENERATE_WITH_CLAUSE,) \
DEF(COMPACT_SORT_LEVEL,) \
DEF(WORKAREA_SIZE_POLICY,) \
DEF(ENABLE_RICH_VECTOR_FORMAT,) \
DECLARE_ENUM(OptParamType, opt_param, OPT_PARAM_TYPE_DEF, static);
@ -124,6 +125,7 @@ struct ObOptParamHint
int get_integer_opt_param(const OptParamType param_type, int64_t &val) const;
int has_opt_param(const OptParamType param_type, bool &has_hint) const;
bool empty() const { return param_types_.empty(); }
int check_and_get_bool_opt_param(const OptParamType param_type, bool &has_opt_param, bool &val) const;
void reset();
TO_STRING_KV(K_(param_types), K_(param_vals));
common::ObSEArray<OptParamType, 1, common::ModulePageAllocator, true> param_types_;

View File

@ -1248,6 +1248,21 @@ int ObResolver::resolve(IsPrepared if_prepared, const ParseNode &parse_tree, ObS
params_.query_ctx_->is_contain_select_for_update_ = is_contain_select_for_update;
params_.query_ctx_->has_dml_write_stmt_ = dml_stmt->is_dml_write_stmt();
}
if (OB_SUCC(ret)) {
bool has_rich_format_hint = false;
bool enable_rich_format = false;
ObOptParamHint &opt_hint = params_.query_ctx_->query_hint_.global_hint_.opt_params_;
if (OB_FAIL(opt_hint.check_and_get_bool_opt_param(ObOptParamHint::ENABLE_RICH_VECTOR_FORMAT,
has_rich_format_hint,
enable_rich_format))) {
LOG_WARN("check and get bool opt param failed", K(ret));
} else if (has_rich_format_hint) {
params_.session_info_->set_force_rich_format(
enable_rich_format ? ObBasicSessionInfo::ForceRichFormatStatus::FORCE_ON :
ObBasicSessionInfo::ForceRichFormatStatus::FORCE_OFF);
}
}
}
if (OB_SUCC(ret)) {
stmt::StmtType stmt_type = stmt->get_stmt_type();