Do not report ERROR when sample rate equals 100
This commit is contained in:
@ -39,30 +39,17 @@ enum ObPlanCachePolicy
|
||||
OB_USE_PLAN_CACHE_DEFAULT,//use plan cache
|
||||
};
|
||||
|
||||
struct ObAllocOpHint
|
||||
struct ObMonitorHint
|
||||
{
|
||||
ObAllocOpHint() : id_(0), flags_(0), alloc_level_(INVALID_LEVEL) {}
|
||||
~ ObAllocOpHint() = default;
|
||||
void reset();
|
||||
int assign(const ObAllocOpHint& other);
|
||||
ObMonitorHint(): id_(0), flags_(0) {};
|
||||
~ObMonitorHint() = default;
|
||||
|
||||
static const uint8_t OB_MONITOR_TRACING = 0x1 << 1;
|
||||
static const uint8_t OB_MONITOR_STAT = 0x1 << 2;
|
||||
static const uint8_t OB_MATERIAL = 0x1 << 3;
|
||||
static const int8_t OB_MONITOR_TRACING = 0x1 << 1;
|
||||
static const int8_t OB_MONITOR_STAT = 0x1 << 2;
|
||||
|
||||
enum AllocLevel
|
||||
{
|
||||
INVALID_LEVEL = 0,
|
||||
OB_ALL,
|
||||
OB_DFO,
|
||||
OB_ENUMERATE
|
||||
};
|
||||
|
||||
// Target op id in original plan tree. Material or monitor op will be inserted above target op.
|
||||
uint64_t id_;
|
||||
uint64_t flags_;
|
||||
AllocLevel alloc_level_;
|
||||
TO_STRING_KV(K_(id), K_(flags), K_(alloc_level));
|
||||
TO_STRING_KV(K_(id), K_(flags));
|
||||
};
|
||||
|
||||
struct ObDopHint
|
||||
@ -104,11 +91,7 @@ struct ObOptParamHint
|
||||
DEF(USE_PART_SORT_MGB,) \
|
||||
DEF(USE_DEFAULT_OPT_STAT,) \
|
||||
DEF(ENABLE_IN_RANGE_OPTIMIZATION,) \
|
||||
DEF(XSOLAPI_GENERATE_WITH_CLAUSE,) \
|
||||
DEF(COMPACT_SORT_LEVEL,) \
|
||||
DEF(WORKAREA_SIZE_POLICY,) \
|
||||
DEF(ENABLE_RICH_VECTOR_FORMAT,) \
|
||||
DEF(_ENABLE_STORAGE_CARDINALITY_ESTIMATION,) \
|
||||
DEF(XSOLAPI_GENERATE_WITH_CLAUSE,) \
|
||||
|
||||
DECLARE_ENUM(OptParamType, opt_param, OPT_PARAM_TYPE_DEF, static);
|
||||
|
||||
@ -126,7 +109,6 @@ 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_;
|
||||
@ -140,21 +122,12 @@ struct ObGlobalHint {
|
||||
void reset();
|
||||
int assign(const ObGlobalHint &other);
|
||||
|
||||
// optimizer version define, move defines below to other file later
|
||||
#define COMPAT_VERSION_4_0 (oceanbase::common::cal_version(4, 0, 0, 0))
|
||||
#define COMPAT_VERSION_4_2_1 (oceanbase::common::cal_version(4, 2, 1, 0))
|
||||
//#define COMPAT_VERSION_4_2_1_BP3 (oceanbase::common::cal_version(4, 2, 1, 3))
|
||||
#define COMPAT_VERSION_4_2_1_BP4 (oceanbase::common::cal_version(4, 2, 1, 4))
|
||||
#define COMPAT_VERSION_4_2_2 (oceanbase::common::cal_version(4, 2, 2, 0))
|
||||
#define COMPAT_VERSION_4_3_0 (oceanbase::common::cal_version(4, 3, 0, 0))
|
||||
#define LASTED_COMPAT_VERSION COMPAT_VERSION_4_3_0
|
||||
static bool is_valid_opt_features_version(uint64_t version)
|
||||
{ return COMPAT_VERSION_4_0 <= version && LASTED_COMPAT_VERSION >= version; }
|
||||
|
||||
static const common::ObConsistencyLevel UNSET_CONSISTENCY = common::INVALID_CONSISTENCY;
|
||||
static const int64_t UNSET_QUERY_TIMEOUT = -1;
|
||||
static const int64_t UNSET_MAX_CONCURRENT = -1;
|
||||
static const uint64_t UNSET_OPT_FEATURES_VERSION = 0;
|
||||
static const uint64_t MIN_OUTLINE_ENABLE_VERSION = CLUSTER_VERSION_4_0_0_0;
|
||||
static const uint64_t CURRENT_OUTLINE_ENABLE_VERSION = CLUSTER_VERSION_4_0_0_0;
|
||||
static const int64_t DEFAULT_PARALLEL = 1;
|
||||
static const int64_t UNSET_PARALLEL = 0;
|
||||
static const int64_t SET_ENABLE_AUTO_DOP = -1;
|
||||
@ -162,9 +135,9 @@ struct ObGlobalHint {
|
||||
static const int64_t UNSET_DYNAMIC_SAMPLING = -1;
|
||||
|
||||
int merge_global_hint(const ObGlobalHint &other);
|
||||
int merge_monitor_hints(const ObIArray<ObMonitorHint> &monitoring_ids);
|
||||
int merge_dop_hint(uint64_t dfo, uint64_t dop);
|
||||
int merge_dop_hint(const ObIArray<ObDopHint> &dop_hints);
|
||||
int merge_alloc_op_hints(const ObIArray<ObAllocOpHint> &alloc_op_hints);
|
||||
void merge_query_timeout_hint(int64_t hint_time);
|
||||
void reset_query_timeout_hint() { query_timeout_ = -1; }
|
||||
void merge_dblink_info_hint(int64_t tx_id, int64_t tm_sessid);
|
||||
@ -183,7 +156,7 @@ struct ObGlobalHint {
|
||||
|
||||
bool has_hint_exclude_concurrent() const;
|
||||
int print_global_hint(PlanText &plan_text) const;
|
||||
int print_alloc_op_hints(PlanText &plan_text) const;
|
||||
int print_monitoring_hints(PlanText &plan_text) const;
|
||||
|
||||
ObPDMLOption get_pdml_option() const { return pdml_option_; }
|
||||
ObParamOption get_param_option() const { return param_option_; }
|
||||
@ -196,6 +169,8 @@ struct ObGlobalHint {
|
||||
bool enable_manual_dop() const { return SET_ENABLE_MANUAL_DOP == parallel_; }
|
||||
bool is_topk_specified() const { return topk_precision_ > 0 || sharding_minimum_row_count_ > 0; }
|
||||
bool has_valid_opt_features_version() const { return is_valid_opt_features_version(opt_features_version_); }
|
||||
static bool is_valid_opt_features_version(uint64_t version)
|
||||
{ return MIN_OUTLINE_ENABLE_VERSION <= version && CLUSTER_CURRENT_VERSION >= version; }
|
||||
bool disable_query_transform() const { return disable_transform_; }
|
||||
bool disable_cost_based_transform() const { return disable_cost_based_transform_; }
|
||||
inline bool has_dbms_stats_hint() const { return has_dbms_stats_hint_; }
|
||||
@ -250,7 +225,7 @@ struct ObGlobalHint {
|
||||
K_(monitor),
|
||||
K_(pdml_option),
|
||||
K_(param_option),
|
||||
K_(alloc_op_hints),
|
||||
K_(monitoring_ids),
|
||||
K_(dops),
|
||||
K_(opt_features_version),
|
||||
K_(disable_transform),
|
||||
@ -260,8 +235,7 @@ struct ObGlobalHint {
|
||||
K_(ob_ddl_schema_versions),
|
||||
K_(osg_hint),
|
||||
K_(has_dbms_stats_hint),
|
||||
K_(dynamic_sampling),
|
||||
K_(alloc_op_hints));
|
||||
K_(dynamic_sampling));
|
||||
|
||||
int64_t frozen_version_;
|
||||
int64_t topk_precision_;
|
||||
@ -280,6 +254,7 @@ struct ObGlobalHint {
|
||||
bool monitor_;
|
||||
ObPDMLOption pdml_option_;
|
||||
ObParamOption param_option_;
|
||||
common::ObSArray<ObMonitorHint> monitoring_ids_;
|
||||
common::ObSArray<ObDopHint> dops_;
|
||||
uint64_t opt_features_version_;
|
||||
bool disable_transform_;
|
||||
@ -291,7 +266,6 @@ struct ObGlobalHint {
|
||||
bool has_dbms_stats_hint_;
|
||||
bool flashback_read_tx_uncommitted_;
|
||||
int64_t dynamic_sampling_;
|
||||
common::ObSArray<ObAllocOpHint> alloc_op_hints_;
|
||||
};
|
||||
|
||||
// used in physical plan
|
||||
@ -388,20 +362,6 @@ struct ObLeadingTable {
|
||||
ObLeadingTable *right_table_;
|
||||
};
|
||||
|
||||
struct QbNameList {
|
||||
int assign(const QbNameList& other);
|
||||
bool has_qb_name(const ObDMLStmt *stmt) const;
|
||||
bool has_qb_name(const ObString &qb_name) const;
|
||||
bool is_equal(const ObIArray<ObSelectStmt*> &stmts) const;
|
||||
bool is_equal(const ObIArray<ObString> &qb_name_list) const;
|
||||
bool is_subset(const ObIArray<ObSelectStmt*> &stmts) const;
|
||||
bool is_subset(const ObIArray<ObString> &qb_name_list) const;
|
||||
bool empty() const { return qb_names_.empty(); }
|
||||
int print_qb_names(PlanText &plan_text, const bool print_quote) const;
|
||||
TO_STRING_KV(K_(qb_names));
|
||||
common::ObSEArray<ObString, 4, common::ModulePageAllocator, true> qb_names_;
|
||||
};
|
||||
|
||||
class ObHint
|
||||
{
|
||||
public:
|
||||
@ -433,10 +393,6 @@ public:
|
||||
|
||||
static const int64_t MAX_EXPR_STR_LENGTH_IN_HINT = 1024;
|
||||
|
||||
// basic/generated table: size = 1
|
||||
// joined table: size > 1
|
||||
typedef ObSEArray<ObTableInHint, 4> TablesInHint;
|
||||
|
||||
ObHint(ObItemType hint_type = T_INVALID)
|
||||
: hint_class_(HINT_INVALID_CLASS),
|
||||
qb_name_(),
|
||||
@ -474,7 +430,6 @@ public:
|
||||
int add_tables(ObIArray<ObTableInHint> &tables, ObIArray<ObTableInHint*> &tables_ptr);
|
||||
static int get_expr_str_in_hint(ObIAllocator &allocator, const ObRawExpr &expr, ObString &str);
|
||||
static bool is_expr_match_str(const ObRawExpr &expr, const ObString &str);
|
||||
static int print_table_list(const ObIArray<TablesInHint> &table_list, PlanText &plan_text);
|
||||
bool is_transform_outline_hint() const { return is_transform_hint() && (is_enable_hint() || is_materialize_hint()); };
|
||||
bool is_transform_hint() const { return hint_class_ >= HINT_TRANSFORM && hint_class_ < HINT_OPTIMIZE; }
|
||||
bool is_view_merge_hint() const { return HINT_VIEW_MERGE == hint_class_; }
|
||||
@ -498,8 +453,7 @@ public:
|
||||
bool is_table_parallel_hint() const { return HINT_TABLE_PARALLEL == hint_class_; }
|
||||
bool is_join_filter_hint() const { return HINT_JOIN_FILTER == hint_class_; }
|
||||
bool is_project_prune_hint() const { return T_PROJECT_PRUNE == hint_type_; }
|
||||
bool is_table_dynamic_sampling_hint() const { return T_TABLE_DYNAMIC_SAMPLING == hint_type_; }
|
||||
bool is_pq_subquery_hint() const { return T_PQ_SUBQUERY == hint_type_; }
|
||||
bool is_table_dynamic_sampling_hint() const { return HINT_TABLE_DYNAMIC_SAMPLING == hint_class_; }
|
||||
|
||||
VIRTUAL_TO_STRING_KV("hint_type", get_type_name(hint_type_),
|
||||
K_(hint_class), K_(qb_name),
|
||||
@ -601,28 +555,30 @@ class ObCountToExistsHint : public ObTransHint
|
||||
public:
|
||||
ObCountToExistsHint(ObItemType hint_type)
|
||||
: ObTransHint(hint_type),
|
||||
qb_names_()
|
||||
qb_name_list_()
|
||||
{
|
||||
set_hint_class(HINT_COUNT_TO_EXISTS);
|
||||
}
|
||||
int assign(const ObCountToExistsHint &other);
|
||||
virtual ~ObCountToExistsHint() {}
|
||||
virtual int print_hint_desc(PlanText &plan_text) const override
|
||||
{ return qb_names_.print_qb_names(plan_text, false); }
|
||||
common::ObIArray<ObString> & get_qb_names() { return qb_names_.qb_names_; }
|
||||
const common::ObIArray<ObString> & get_qb_names() const { return qb_names_.qb_names_; }
|
||||
bool enable_count_to_exists(const ObString &qb_name) const
|
||||
{ return is_enable_hint() && (qb_names_.has_qb_name(qb_name) || qb_names_.empty()); }
|
||||
virtual int print_hint_desc(PlanText &plan_text) const override;
|
||||
common::ObIArray<ObString> & get_qb_name_list() { return qb_name_list_; }
|
||||
const common::ObIArray<ObString> & get_qb_name_list() const { return qb_name_list_; }
|
||||
bool enable_count_to_exists(const ObString &qb_name) const;
|
||||
|
||||
INHERIT_TO_STRING_KV("ObHint", ObHint, K_(qb_names));
|
||||
INHERIT_TO_STRING_KV("ObHint", ObHint, K_(qb_name_list));
|
||||
|
||||
private:
|
||||
QbNameList qb_names_;
|
||||
common::ObSEArray<ObString, 4, common::ModulePageAllocator, true> qb_name_list_;
|
||||
};
|
||||
|
||||
class ObLeftToAntiHint : public ObTransHint
|
||||
{
|
||||
public:
|
||||
// basic/generated table: size = 1
|
||||
// joined table: size > 1
|
||||
typedef ObSEArray<ObTableInHint, 4> single_or_joined_table;
|
||||
|
||||
ObLeftToAntiHint(ObItemType hint_type)
|
||||
: ObTransHint(hint_type),
|
||||
table_list_()
|
||||
@ -632,20 +588,24 @@ public:
|
||||
int assign(const ObLeftToAntiHint &other);
|
||||
virtual ~ObLeftToAntiHint() {}
|
||||
|
||||
virtual int print_hint_desc(PlanText &plan_text) const override { return ObHint::print_table_list(table_list_, plan_text); }
|
||||
virtual int print_hint_desc(PlanText &plan_text) const override;
|
||||
virtual int get_all_table_in_hint(ObIArray<ObTableInHint*> &all_tables) override;
|
||||
common::ObIArray<TablesInHint> & get_tb_name_list() { return table_list_; }
|
||||
const common::ObIArray<TablesInHint> & get_tb_name_list() const { return table_list_; }
|
||||
common::ObIArray<single_or_joined_table> & get_tb_name_list() { return table_list_; }
|
||||
const common::ObIArray<single_or_joined_table> & get_tb_name_list() const { return table_list_; }
|
||||
bool enable_left_to_anti(ObCollationType cs_type, const TableItem &table) const;
|
||||
|
||||
INHERIT_TO_STRING_KV("ObHint", ObHint, K_(table_list));
|
||||
|
||||
private:
|
||||
common::ObSEArray<TablesInHint, 4, common::ModulePageAllocator, true> table_list_;
|
||||
common::ObSEArray<single_or_joined_table, 4, common::ModulePageAllocator, true> table_list_;
|
||||
};
|
||||
class ObEliminateJoinHint : public ObTransHint
|
||||
{
|
||||
public:
|
||||
// basic/generated table: size = 1
|
||||
// joined table: size > 1
|
||||
typedef ObSEArray<ObTableInHint, 4> single_or_joined_table;
|
||||
|
||||
ObEliminateJoinHint(ObItemType hint_type)
|
||||
: ObTransHint(hint_type),
|
||||
table_list_()
|
||||
@ -655,21 +615,25 @@ public:
|
||||
int assign(const ObEliminateJoinHint &other);
|
||||
virtual ~ObEliminateJoinHint() {}
|
||||
|
||||
virtual int print_hint_desc(PlanText &plan_text) const override { return ObHint::print_table_list(table_list_, plan_text); }
|
||||
virtual int print_hint_desc(PlanText &plan_text) const override;
|
||||
virtual int get_all_table_in_hint(ObIArray<ObTableInHint*> &all_tables) override;
|
||||
common::ObIArray<TablesInHint> & get_tb_name_list() { return table_list_; }
|
||||
const common::ObIArray<TablesInHint> & get_tb_name_list() const { return table_list_; }
|
||||
common::ObIArray<single_or_joined_table> & get_tb_name_list() { return table_list_; }
|
||||
const common::ObIArray<single_or_joined_table> & get_tb_name_list() const { return table_list_; }
|
||||
bool enable_eliminate_join(ObCollationType cs_type, const TableItem &table) const;
|
||||
|
||||
INHERIT_TO_STRING_KV("ObHint", ObHint, K_(table_list));
|
||||
|
||||
private:
|
||||
common::ObSEArray<TablesInHint, 4, common::ModulePageAllocator, true> table_list_;
|
||||
common::ObSEArray<single_or_joined_table, 4, common::ModulePageAllocator, true> table_list_;
|
||||
};
|
||||
|
||||
class ObGroupByPlacementHint : public ObTransHint
|
||||
{
|
||||
public:
|
||||
// basic/generated table: size = 1
|
||||
// joined table: size > 1
|
||||
typedef ObSEArray<ObTableInHint, 4> single_or_joined_table;
|
||||
|
||||
ObGroupByPlacementHint(ObItemType hint_type)
|
||||
: ObTransHint(hint_type),
|
||||
table_list_()
|
||||
@ -679,17 +643,17 @@ public:
|
||||
int assign(const ObGroupByPlacementHint &other);
|
||||
virtual ~ObGroupByPlacementHint() {}
|
||||
|
||||
virtual int print_hint_desc(PlanText &plan_text) const override { return ObHint::print_table_list(table_list_, plan_text); }
|
||||
virtual int print_hint_desc(PlanText &plan_text) const override;
|
||||
virtual int get_all_table_in_hint(ObIArray<ObTableInHint*> &all_tables) override;
|
||||
common::ObIArray<TablesInHint> & get_tb_name_list() { return table_list_; }
|
||||
const common::ObIArray<TablesInHint> & get_tb_name_list() const { return table_list_; }
|
||||
common::ObIArray<single_or_joined_table> & get_tb_name_list() { return table_list_; }
|
||||
const common::ObIArray<single_or_joined_table> & get_tb_name_list() const { return table_list_; }
|
||||
bool enable_groupby_placement(ObCollationType cs_type, const TableItem &table) const;
|
||||
bool enable_groupby_placement(ObCollationType cs_type, const ObIArray<TableItem *> &tables) const;
|
||||
|
||||
INHERIT_TO_STRING_KV("ObHint", ObHint, K_(table_list));
|
||||
|
||||
private:
|
||||
common::ObSEArray<TablesInHint, 4, common::ModulePageAllocator, true> table_list_;
|
||||
common::ObSEArray<single_or_joined_table, 4, common::ModulePageAllocator, true> table_list_;
|
||||
};
|
||||
class ObWinMagicHint : public ObTransHint
|
||||
{
|
||||
@ -715,6 +679,20 @@ private:
|
||||
common::ObSEArray<ObTableInHint, 4, common::ModulePageAllocator, true> table_list_;
|
||||
};
|
||||
|
||||
|
||||
struct QbNameList {
|
||||
int assign(const QbNameList& other);
|
||||
bool has_qb_name(const ObDMLStmt *stmt) const;
|
||||
bool has_qb_name(const ObString &qb_name) const;
|
||||
bool is_equal(const ObIArray<ObSelectStmt*> &stmts) const;
|
||||
bool is_equal(const ObIArray<ObString> &qb_name_list) const;
|
||||
bool is_subset(const ObIArray<ObSelectStmt*> &stmts) const;
|
||||
bool is_subset(const ObIArray<ObString> &qb_name_list) const;
|
||||
bool empty() const { return qb_names_.empty(); }
|
||||
TO_STRING_KV(K_(qb_names));
|
||||
common::ObSEArray<ObString, 4, common::ModulePageAllocator, true> qb_names_;
|
||||
};
|
||||
|
||||
class ObMaterializeHint : public ObTransHint
|
||||
{
|
||||
public:
|
||||
@ -939,29 +917,6 @@ private:
|
||||
common::ObString left_branch_; // qb_name for first branch of set, used for union distinct / intersect
|
||||
};
|
||||
|
||||
class ObPQSubqueryHint : public ObOptHint
|
||||
{
|
||||
public:
|
||||
ObPQSubqueryHint(ObItemType hint_type = T_PQ_SUBQUERY)
|
||||
: ObOptHint(hint_type),
|
||||
dist_algo_(DistAlgo::DIST_INVALID_METHOD),
|
||||
sub_qb_names_()
|
||||
{}
|
||||
int assign(const ObPQSubqueryHint &other);
|
||||
virtual ~ObPQSubqueryHint() {}
|
||||
virtual int print_hint_desc(PlanText &plan_text) const override;
|
||||
DistAlgo get_dist_algo() const { return dist_algo_; }
|
||||
void set_dist_algo(DistAlgo dist_algo) { dist_algo_ = dist_algo; }
|
||||
common::ObIArray<ObString> &get_sub_qb_names() { return sub_qb_names_.qb_names_; }
|
||||
const common::ObIArray<ObString> &get_sub_qb_names() const { return sub_qb_names_.qb_names_; }
|
||||
bool is_match_subplans(const ObIArray<ObString> &qb_names) const { return sub_qb_names_.is_equal(qb_names); }
|
||||
|
||||
INHERIT_TO_STRING_KV("ObHint", ObHint, K_(dist_algo), K_(sub_qb_names));
|
||||
private:
|
||||
DistAlgo dist_algo_;
|
||||
QbNameList sub_qb_names_;
|
||||
};
|
||||
|
||||
class ObJoinOrderHint : public ObOptHint {
|
||||
public:
|
||||
ObJoinOrderHint(ObItemType hint_type = T_LEADING)
|
||||
@ -1005,8 +960,7 @@ public:
|
||||
common::ObSEArray<int64_t, 2, common::ModulePageAllocator, true> win_func_idxs_;
|
||||
bool use_hash_sort_; // use hash sort for none/hash dist method
|
||||
bool is_push_down_; // push down window function for hash dist method
|
||||
bool use_topn_sort_; // use part topn sort for none/hash dist method
|
||||
TO_STRING_KV(K_(algo), K_(win_func_idxs), K_(use_hash_sort), K_(is_push_down), K_(use_topn_sort));
|
||||
TO_STRING_KV(K_(algo), K_(win_func_idxs), K_(use_hash_sort), K_(is_push_down));
|
||||
};
|
||||
|
||||
const ObIArray<WinDistOption> &get_win_dist_options() const { return win_dist_options_; }
|
||||
@ -1015,13 +969,11 @@ public:
|
||||
const ObIArray<ObWinFunRawExpr*> &cur_win_funcs,
|
||||
const WinDistAlgo algo,
|
||||
const bool is_push_down,
|
||||
const bool use_hash_sort,
|
||||
const bool use_topn_sort);
|
||||
const bool use_hash_sort);
|
||||
int add_win_dist_option(const ObIArray<int64_t> &win_func_idxs,
|
||||
const WinDistAlgo algo,
|
||||
const bool is_push_down,
|
||||
const bool use_hash_sort,
|
||||
const bool use_topn_sort);
|
||||
const bool use_hash_sort);
|
||||
static const char* get_dist_algo_str(WinDistAlgo dist_algo);
|
||||
|
||||
virtual int print_hint_desc(PlanText &plan_text) const override;
|
||||
|
||||
Reference in New Issue
Block a user