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

@ -155,7 +155,8 @@ ObBasicSessionInfo::ObBasicSessionInfo(const uint64_t tenant_id)
last_update_tz_time_(0),
is_client_sessid_support_(false),
use_rich_vector_format_(false),
last_refresh_schema_version_(OB_INVALID_VERSION)
last_refresh_schema_version_(OB_INVALID_VERSION),
force_rich_vector_format_(ForceRichFormatStatus::Disable)
{
thread_data_.reset();
MEMSET(sys_vars_, 0, sizeof(sys_vars_));
@ -443,6 +444,7 @@ void ObBasicSessionInfo::reset(bool skip_sys_var)
last_update_tz_time_ = 0;
is_client_sessid_support_ = false;
use_rich_vector_format_ = true;
force_rich_vector_format_ = ForceRichFormatStatus::Disable;
sess_bt_buff_pos_ = 0;
ATOMIC_SET(&sess_ref_cnt_ , 0);
// 最后再重置所有allocator
@ -4686,6 +4688,7 @@ OB_DEF_DESERIALIZE(ObBasicSessionInfo)
}
}
release_to_pool_ = OB_SUCC(ret);
force_rich_vector_format_ = ForceRichFormatStatus::Disable;
}();
return ret;
}

View File

@ -388,6 +388,13 @@ public:
transaction::ObXATransID xid_;
};
enum class ForceRichFormatStatus
{
Disable = 0,
FORCE_ON,
FORCE_OFF
};
public:
ObBasicSessionInfo(const uint64_t tenant_id);
virtual ~ObBasicSessionInfo();
@ -479,10 +486,33 @@ public:
{
use_rich_vector_format_ = GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_3_0_0
&& sys_vars_cache_.get_enable_rich_vector_format();
force_rich_vector_format_ = ForceRichFormatStatus::Disable;
}
bool use_rich_format() const {
if (force_rich_vector_format_ != ForceRichFormatStatus::Disable) {
return force_rich_vector_format_ == ForceRichFormatStatus::FORCE_ON;
} else {
return use_rich_vector_format_;
}
}
bool initial_use_rich_format() const {
return use_rich_vector_format_;
}
ObBasicSessionInfo::ForceRichFormatStatus get_force_rich_format_status() const
{
return force_rich_vector_format_;
}
void set_force_rich_format(ObBasicSessionInfo::ForceRichFormatStatus status)
{
if (GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_3_0_0) {
force_rich_vector_format_ = status;
} else {
force_rich_vector_format_ = ForceRichFormatStatus::Disable;
}
}
//getters
const common::ObString get_tenant_name() const;
uint64_t get_priv_tenant_id() const { return tenant_id_; }
@ -2297,6 +2327,11 @@ private:
bool is_client_sessid_support_; //client session id support flag
bool use_rich_vector_format_;
int64_t last_refresh_schema_version_;
// rich format specified hint, e.g. `select /*+opt_param('enable_rich_vector_format', 'true')*/ * from t`
// force_rich_vector_format_ == FORCE_ON => use_rich_format() returns true
// force_rich_vector_format_ == FORCE_OFF => use_rich_format() returns false
// otherwise use_rich_format() returns use_rich_vector_format_
ForceRichFormatStatus force_rich_vector_format_;
};