reformat source code
according to code styles, 'AccessModifierOffset' should be -2.
This commit is contained in:
@ -34,14 +34,14 @@ class ObRawExprFactory;
|
||||
class ObSQLSessionInfo;
|
||||
|
||||
class ObConstraintProcess {
|
||||
public:
|
||||
public:
|
||||
ObConstraintProcess(common::ObIAllocator& allocator, ObRawExprFactory* expr_factory, ObSQLSessionInfo* session_info)
|
||||
: allocator_(allocator), expr_factory_(expr_factory), session_info_(session_info)
|
||||
{}
|
||||
|
||||
int after_transform(ObDMLStmt*& stmt, share::schema::ObSchemaGetterGuard& schema_guard);
|
||||
|
||||
private:
|
||||
private:
|
||||
int resolve_related_part_exprs(const ObRawExpr* expr, ObDMLStmt*& stmt,
|
||||
const share::schema::ObTableSchema& table_schema, common::ObIArray<ObRawExpr*>& related_part_exprs);
|
||||
int resolve_constraint_column_expr(ObResolverParams& params, uint64_t table_id, ObDMLStmt*& stmt,
|
||||
@ -49,7 +49,7 @@ class ObConstraintProcess {
|
||||
int resolve_constraint_column_expr(ObResolverParams& params, uint64_t table_id, ObDMLStmt*& stmt,
|
||||
const common::ObString& expr_str, ObRawExpr*& expr, bool& is_success);
|
||||
|
||||
private:
|
||||
private:
|
||||
common::ObIAllocator& allocator_;
|
||||
ObRawExprFactory* expr_factory_;
|
||||
ObSQLSessionInfo* session_info_;
|
||||
|
||||
@ -41,7 +41,7 @@ struct EqualSetKey {
|
||||
TO_STRING_KV(K_(expr));
|
||||
};
|
||||
class ObEqualAnalysis {
|
||||
public:
|
||||
public:
|
||||
explicit ObEqualAnalysis();
|
||||
|
||||
virtual ~ObEqualAnalysis();
|
||||
@ -64,11 +64,11 @@ class ObEqualAnalysis {
|
||||
static int compute_equal_set(ObIAllocator* allocator, const ObIArray<ObRawExpr*>& eset_conditions,
|
||||
const EqualSets& input_equal_sets, EqualSets& output_equal_sets);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
// types and constants
|
||||
typedef common::hash::ObHashMap<EqualSetKey, int64_t, common::hash::NoPthreadDefendMode> ColumnSet;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObEqualAnalysis);
|
||||
// function members
|
||||
@ -81,7 +81,7 @@ class ObEqualAnalysis {
|
||||
int check_whether_can_be_merged(
|
||||
const ObExprEqualSet& equal_set, const ObExprEqualSet& another_set, bool& can_be) const;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
// data members
|
||||
common::ObArenaAllocator equal_set_alloc_;
|
||||
ColumnSet column_set_;
|
||||
|
||||
@ -24,9 +24,9 @@ template <typename COLUMN_INFO = const void*, typename CONST_INFO = const void*>
|
||||
class ObEqualSet : public common::ObDLinkBase<ObEqualSet<COLUMN_INFO, CONST_INFO> > {
|
||||
typedef typename common::hash::ObIteratableHashMap<int64_t, COLUMN_INFO>::const_iterator_t ColIter;
|
||||
|
||||
public:
|
||||
public:
|
||||
struct ColumnIterator {
|
||||
public:
|
||||
public:
|
||||
ColumnIterator();
|
||||
ColumnIterator(const ObEqualSet* equal_set, const ColIter& col_iter);
|
||||
~ColumnIterator();
|
||||
@ -41,12 +41,12 @@ class ObEqualSet : public common::ObDLinkBase<ObEqualSet<COLUMN_INFO, CONST_INFO
|
||||
int64_t get_expr_idx() const;
|
||||
const COLUMN_INFO& get_expr_info() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
const ObEqualSet* equal_set_;
|
||||
ColIter col_iter_;
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
ObEqualSet();
|
||||
virtual ~ObEqualSet();
|
||||
|
||||
@ -84,18 +84,18 @@ class ObEqualSet : public common::ObDLinkBase<ObEqualSet<COLUMN_INFO, CONST_INFO
|
||||
}
|
||||
TO_STRING_KV(N_COLUMN, exprs_, N_CONST, constants_);
|
||||
|
||||
private:
|
||||
private:
|
||||
// types and constants
|
||||
static const int64_t COMMON_CONST_NUM = 64;
|
||||
typedef common::ObSEArray<CONST_INFO, COMMON_CONST_NUM, common::ModulePageAllocator, true> Constants;
|
||||
typedef common::hash::ObIteratableHashMap<int64_t, COLUMN_INFO> Expressions;
|
||||
|
||||
private:
|
||||
private:
|
||||
// disallow copy
|
||||
ObEqualSet(const ObEqualSet& other);
|
||||
ObEqualSet& operator=(const ObEqualSet& other);
|
||||
// function members
|
||||
private:
|
||||
private:
|
||||
// data members
|
||||
Expressions exprs_;
|
||||
common::ObBitSet<common::OB_ROW_MAX_COLUMNS_COUNT> flags_; // column flag
|
||||
|
||||
@ -22,14 +22,14 @@ namespace oceanbase {
|
||||
namespace sql {
|
||||
|
||||
class ObExpandAggregateUtils {
|
||||
public:
|
||||
public:
|
||||
static int expand_aggr_expr(ObDMLStmt* stmt, ObTransformerCtx* ctx, bool& trans_happened);
|
||||
|
||||
static int expand_window_aggr_expr(ObDMLStmt* stmt, ObTransformerCtx* ctx, bool& trans_happened);
|
||||
|
||||
static int add_linear_inter_expr(ObDMLStmt* stmt, ObTransformerCtx* ctx, bool& trans_happened);
|
||||
|
||||
private:
|
||||
private:
|
||||
static int add_linear_inter_expr(ObTransformerCtx* ctx, ObAggFunRawExpr* aggr_expr);
|
||||
static bool is_medain_percentile_aggr_type(const ObItemType aggr_type)
|
||||
{
|
||||
|
||||
@ -29,7 +29,7 @@ enum ObKeyPartType { T_NORMAL_KEY = 0, T_LIKE_KEY };
|
||||
class ObKeyPartId {
|
||||
OB_UNIS_VERSION(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
ObKeyPartId(uint64_t data_table_id = common::OB_INVALID_ID, uint64_t column_id = common::OB_INVALID_ID)
|
||||
: table_id_(data_table_id), column_id_(column_id)
|
||||
{}
|
||||
@ -60,7 +60,7 @@ class ObKeyPartId {
|
||||
class ObKeyPartPos {
|
||||
OB_UNIS_VERSION(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
ObKeyPartPos(common::ObIAllocator& alloc, int64_t offset = -1)
|
||||
: offset_(offset), column_type_(alloc), enum_set_values_()
|
||||
{}
|
||||
@ -122,7 +122,7 @@ struct ObLikeKeyPart {
|
||||
class ObKeyPart : public common::ObDLinkBase<ObKeyPart> {
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
ObKeyPart(common::ObIAllocator& allocator, uint64_t data_table_id = common::OB_INVALID_ID,
|
||||
uint64_t column_id = common::OB_INVALID_ID, int32_t offset = -1)
|
||||
: allocator_(allocator),
|
||||
@ -300,10 +300,10 @@ class ObKeyPart : public common::ObDLinkBase<ObKeyPart> {
|
||||
ObKeyPart* cut_general_or_next();
|
||||
DECLARE_TO_STRING;
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObKeyPart);
|
||||
|
||||
public:
|
||||
public:
|
||||
common::ObIAllocator& allocator_;
|
||||
ObKeyPartId id_;
|
||||
ObKeyPartPos pos_;
|
||||
|
||||
@ -21,7 +21,7 @@ class ObPredicateDeduce {
|
||||
|
||||
enum Type { GT = 1 << 0, GE = 1 << 1, EQ = 1 << 2 };
|
||||
|
||||
public:
|
||||
public:
|
||||
ObPredicateDeduce(ObDMLStmt& stmt) : stmt_(stmt)
|
||||
{}
|
||||
|
||||
@ -53,7 +53,7 @@ class ObPredicateDeduce {
|
||||
expr.has_flag(CNT_SEQ_EXPR) || expr.has_flag(CNT_STATE_FUNC) || expr.has_flag(CNT_USER_VARIABLE);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
int init();
|
||||
|
||||
int deduce(ObIArray<uint8_t>& graph);
|
||||
@ -187,7 +187,7 @@ class ObPredicateDeduce {
|
||||
|
||||
int check_index_part_cond(ObTransformerCtx& ctx, ObRawExpr* left_expr, ObRawExpr* right_expr, bool& is_valid);
|
||||
|
||||
private:
|
||||
private:
|
||||
/// the compare meta used by all exprs in the graph
|
||||
ObObjMeta cmp_type_;
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ typedef common::ObIArray<ColumnItem> ColumnIArray;
|
||||
class ObQueryRange : public ObQueryRangeProvider {
|
||||
OB_UNIS_VERSION(4);
|
||||
|
||||
private:
|
||||
private:
|
||||
struct ObRangeExprItem {
|
||||
const ObRawExpr* cur_expr_;
|
||||
common::ObSEArray<int64_t, 16> cur_pos_;
|
||||
@ -73,7 +73,7 @@ class ObQueryRange : public ObQueryRangeProvider {
|
||||
const ParamsIArray* params_;
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
enum ObQueryRangeState {
|
||||
NEED_INIT = 0,
|
||||
NEED_TARGET_CND,
|
||||
@ -138,7 +138,7 @@ class ObQueryRange : public ObQueryRangeProvider {
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
private:
|
||||
struct ObSearchState {
|
||||
ObSearchState(common::ObIAllocator& allocator)
|
||||
: start_(NULL),
|
||||
@ -223,7 +223,7 @@ class ObQueryRange : public ObQueryRangeProvider {
|
||||
bool is_precise_get_;
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
ObQueryRange();
|
||||
explicit ObQueryRange(common::ObIAllocator& alloc);
|
||||
virtual ~ObQueryRange();
|
||||
@ -327,7 +327,7 @@ class ObQueryRange : public ObQueryRangeProvider {
|
||||
int get_param_value(common::ObObj& val, const ParamsIArray& params) const;
|
||||
DECLARE_TO_STRING;
|
||||
|
||||
private:
|
||||
private:
|
||||
// @brief this function to initialize query range context
|
||||
// @param range_columns[in], columns group with the range order
|
||||
// @return if success, return OB_SUCCESS
|
||||
@ -449,12 +449,12 @@ class ObQueryRange : public ObQueryRangeProvider {
|
||||
int cast_like_obj_if_needed(const ObObj& string_obj, ObObj& buf_obj, const ObObj*& obj_ptr, ObKeyPart& out_key_part,
|
||||
const ObDataTypeCastParams& dtc_params);
|
||||
|
||||
private:
|
||||
private:
|
||||
static const int64_t COMMON_KEY_PART_NUM = 256;
|
||||
static const int64_t RANGE_BUCKET_SIZE = 1000;
|
||||
typedef common::ObObjStore<ObKeyPart*, common::ObIAllocator&> KeyPartStore;
|
||||
|
||||
private:
|
||||
private:
|
||||
ObRangeGraph table_graph_;
|
||||
ObQueryRangeState state_;
|
||||
int64_t column_count_;
|
||||
|
||||
@ -29,7 +29,7 @@ typedef common::ObSEArray<bool, 2, common::ModulePageAllocator, true> ObGetMetho
|
||||
typedef common::ObSEArray<ColumnItem, 16, common::ModulePageAllocator, true> ColumnArray;
|
||||
|
||||
class ObQueryRangeProvider {
|
||||
public:
|
||||
public:
|
||||
virtual int get_tablet_ranges(
|
||||
ObQueryRangeArray& ranges, ObGetMethodArray& get_methods, const common::ObDataTypeCastParams& dtc_params) = 0;
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ struct ObStmtCompareContext : ObExprEqualCheckContext {
|
||||
};
|
||||
|
||||
class ObStmtComparer {
|
||||
public:
|
||||
public:
|
||||
static int compute_stmt_overlap(ObDMLStmt* first, ObDMLStmt* second, ObStmtMapInfo& map_info);
|
||||
|
||||
static int check_stmt_containment(
|
||||
|
||||
@ -21,7 +21,7 @@ namespace sql {
|
||||
class ObUpdateStmt;
|
||||
|
||||
class ObTransformAggrSubquery : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
ObTransformAggrSubquery(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
virtual ~ObTransformAggrSubquery()
|
||||
@ -29,7 +29,7 @@ class ObTransformAggrSubquery : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
enum PullupFlag { USE_OUTER_JOIN = 1, ADD_CASE_WHEN_EXPR = 2, JOIN_FIRST = 4, AGGR_FIRST = 8 };
|
||||
|
||||
/**
|
||||
@ -160,7 +160,7 @@ class ObTransformAggrSubquery : public ObTransformRule {
|
||||
int extract_no_rewrite_select_exprs(ObDMLStmt*& stmt);
|
||||
int extract_no_rewrite_expr(ObRawExpr* expr);
|
||||
|
||||
private:
|
||||
private:
|
||||
common::ObSEArray<ObRawExpr*, 8, common::ModulePageAllocator, true> no_rewrite_exprs_;
|
||||
};
|
||||
|
||||
|
||||
@ -40,13 +40,13 @@ class ObAggFunRawExpr;
|
||||
class SelectItem;
|
||||
|
||||
class ObTransformAggregate : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
explicit ObTransformAggregate(ObTransformerCtx* ctx);
|
||||
virtual ~ObTransformAggregate();
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
const static char* SUBQUERY_COL_ALIAS;
|
||||
|
||||
int is_valid_column_aggregate(ObSelectStmt* stmt, ObAggFunRawExpr*& aggr_expr, bool& is_valid);
|
||||
@ -92,7 +92,7 @@ class ObTransformAggregate : public ObTransformRule {
|
||||
int is_min_max_const(ObSelectStmt* stmt, ObRawExpr* expr, bool& is_with_const);
|
||||
int is_not_const(ObSelectStmt* stmt, ObRawExpr* expr, bool& is_current_level);
|
||||
|
||||
private:
|
||||
private:
|
||||
int is_valid_select_list(const ObSelectStmt& stmt, const ObRawExpr*& aggr_expr, bool& is_valid);
|
||||
int64_t idx_aggr_column_;
|
||||
bool is_column_aggregate_;
|
||||
|
||||
@ -22,13 +22,13 @@ class ObQueryRefRawExpr;
|
||||
class ObSelectStmt;
|
||||
|
||||
class ObTransformAnyAll : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
explicit ObTransformAnyAll(ObTransformerCtx* ctx);
|
||||
virtual ~ObTransformAnyAll();
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
int transform_any_all(ObDMLStmt* stmt, bool& trans_happened);
|
||||
|
||||
int try_transform_any_all(ObDMLStmt* stmt, ObRawExpr*& expr, bool& trans_happened);
|
||||
|
||||
@ -20,7 +20,7 @@ namespace oceanbase {
|
||||
namespace sql {
|
||||
|
||||
class ObTransformEliminateOuterJoin : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
explicit ObTransformEliminateOuterJoin(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
|
||||
@ -30,7 +30,7 @@ class ObTransformEliminateOuterJoin : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
int eliminate_outer_join(common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened);
|
||||
|
||||
int recursive_eliminate_outer_join_in_table_item(ObDMLStmt* stmt, TableItem* cur_table_item,
|
||||
|
||||
@ -21,7 +21,7 @@ namespace oceanbase {
|
||||
namespace sql {
|
||||
|
||||
class ObTransformFullOuterJoin : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
explicit ObTransformFullOuterJoin(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
virtual ~ObTransformFullOuterJoin()
|
||||
@ -30,7 +30,7 @@ class ObTransformFullOuterJoin : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
virtual bool need_rewrite(const common::ObIArray<ObParentDMLStmt>& parent_stmts, const ObDMLStmt& stmt) override;
|
||||
|
||||
int transform_full_outer_join(ObDMLStmt*& stmt, bool& trans_happened);
|
||||
|
||||
@ -25,7 +25,7 @@ namespace sql {
|
||||
* [2] Eager Aggregation and Lazy Aggregation
|
||||
*/
|
||||
class ObTransformGroupByPlacement : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
ObTransformGroupByPlacement(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
|
||||
@ -35,10 +35,10 @@ class ObTransformGroupByPlacement : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
virtual int adjust_transform_types(uint64_t& transform_types) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
struct PullupHelper {
|
||||
PullupHelper()
|
||||
: parent_table_(NULL),
|
||||
@ -188,7 +188,7 @@ class ObTransformGroupByPlacement : public ObTransformRule {
|
||||
|
||||
int wrap_case_when(ObSelectStmt& child_stmt, ObRawExpr* not_null_column, ObRawExpr*& expr);
|
||||
|
||||
private:
|
||||
private:
|
||||
// help functions
|
||||
int64_t get_count_sum_num(const ObIArray<ObRawExpr*>& exprs)
|
||||
{
|
||||
|
||||
@ -44,7 +44,7 @@ class ObTransformJoinElimination : public ObTransformRule {
|
||||
ObSEArray<bool, 16> bitmap_;
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit ObTransformJoinElimination(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
|
||||
@ -54,7 +54,7 @@ class ObTransformJoinElimination : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
int eliminate_join_self_foreign_key(ObDMLStmt* stmt, bool& trans_happened);
|
||||
|
||||
int eliminate_join_in_from_base_table(ObDMLStmt* stmt, bool& trans_happened);
|
||||
|
||||
@ -34,7 +34,7 @@ struct MVDesc {
|
||||
};
|
||||
|
||||
class ObTransformMaterializedView : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
explicit ObTransformMaterializedView(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
virtual ~ObTransformMaterializedView()
|
||||
@ -42,7 +42,7 @@ class ObTransformMaterializedView : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
uint64_t get_real_tid(uint64_t tid, ObSelectStmt& stmt);
|
||||
int is_col_in_mv(uint64_t tid, uint64_t cid, MVDesc mv_desc, bool& result);
|
||||
int is_all_column_covered(ObSelectStmt& stmt, MVDesc mv_desc, const JoinTableIdPair& idp, bool& result);
|
||||
@ -67,7 +67,7 @@ class ObTransformMaterializedView : public ObTransformRule {
|
||||
int get_join_tid_cid(
|
||||
uint64_t tid, uint64_t cid, uint64_t& out_tid, uint64_t& out_cid, const share::schema::ObTableSchema& mv_schema);
|
||||
|
||||
private:
|
||||
private:
|
||||
};
|
||||
|
||||
} // namespace sql
|
||||
|
||||
@ -25,7 +25,7 @@ class ObTransformOrExpansion : public ObTransformRule {
|
||||
static const int64_t MAX_TIMES_FOR_OR_EXPANSION;
|
||||
typedef ObBitSet<8> ColumnBitSet;
|
||||
|
||||
public:
|
||||
public:
|
||||
ObTransformOrExpansion(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::PRE_ORDER), try_times_(0)
|
||||
{}
|
||||
virtual ~ObTransformOrExpansion()
|
||||
@ -33,10 +33,10 @@ class ObTransformOrExpansion : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
virtual int adjust_transform_types(uint64_t& transform_types) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
int check_stmt_validity(ObDMLStmt& stmt, bool& is_valid);
|
||||
|
||||
int check_select_expr_validity(ObSelectStmt& stmt, bool& is_valid);
|
||||
@ -84,7 +84,7 @@ class ObTransformOrExpansion : public ObTransformRule {
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ObTransformOrExpansion);
|
||||
|
||||
private:
|
||||
private:
|
||||
int64_t try_times_;
|
||||
};
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ class ObIAllocator;
|
||||
namespace sql {
|
||||
class ObRawExpr;
|
||||
class ObTransformOuterJoinLimitPushDown : public ObTransformRule {
|
||||
private:
|
||||
private:
|
||||
struct OjLimitPushDownHelper {
|
||||
OjLimitPushDownHelper()
|
||||
: select_stmt_(NULL),
|
||||
@ -51,7 +51,7 @@ class ObTransformOuterJoinLimitPushDown : public ObTransformRule {
|
||||
K_(is_limit_only), K_(need_create_view));
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit ObTransformOuterJoinLimitPushDown(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::PRE_ORDER)
|
||||
{}
|
||||
|
||||
@ -61,7 +61,7 @@ class ObTransformOuterJoinLimitPushDown : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
int check_stmt_validity(ObDMLStmt* stmt, OjLimitPushDownHelper& helper, bool& is_valid);
|
||||
|
||||
int do_transform(OjLimitPushDownHelper& helper);
|
||||
|
||||
@ -20,7 +20,7 @@ namespace oceanbase {
|
||||
namespace sql {
|
||||
|
||||
class ObTransformPostProcess : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
ObTransformPostProcess(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
|
||||
@ -29,7 +29,7 @@ class ObTransformPostProcess : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
int extract_calculable_expr(ObDMLStmt*& stmt, bool& trans_happened);
|
||||
|
||||
int transform_for_hierarchical_query(ObDMLStmt* stmt, bool& trans_happened);
|
||||
|
||||
@ -37,7 +37,7 @@ struct MVDesc {
|
||||
};
|
||||
|
||||
class ObTransformPreProcess : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
explicit ObTransformPreProcess(ObTransformerCtx* ctx)
|
||||
: ObTransformRule(ctx, TransMethod::POST_ORDER), mock_table_set_(), origin_table_set_()
|
||||
{}
|
||||
@ -50,7 +50,7 @@ class ObTransformPreProcess : public ObTransformRule {
|
||||
static int transform_expr(
|
||||
ObRawExprFactory& expr_factory, const ObSQLSessionInfo& session, ObRawExpr*& expr, bool& trans_happened);
|
||||
|
||||
private:
|
||||
private:
|
||||
// used for transform in expr to or exprs
|
||||
struct DistinctObjMeta {
|
||||
ObObjType obj_type_;
|
||||
@ -237,7 +237,7 @@ class ObTransformPreProcess : public ObTransformRule {
|
||||
int extract_replace_expr_from_select_expr(
|
||||
ObRawExpr* expr, ObSelectStmt* select_stmt, ObIArray<ObRawExpr*>& old_exprs);
|
||||
|
||||
private:
|
||||
private:
|
||||
ObRelIds mock_table_set_;
|
||||
ObRelIds origin_table_set_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ObTransformPreProcess);
|
||||
|
||||
@ -19,7 +19,7 @@ namespace oceanbase {
|
||||
namespace sql {
|
||||
class ObInsertStmt;
|
||||
class ObTransformPredicateMoveAround : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
ObTransformPredicateMoveAround(ObTransformerCtx* ctx);
|
||||
|
||||
virtual ~ObTransformPredicateMoveAround();
|
||||
@ -27,7 +27,7 @@ class ObTransformPredicateMoveAround : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
virtual bool need_rewrite(const common::ObIArray<ObParentDMLStmt>& parent_stmts, const ObDMLStmt& stmt);
|
||||
|
||||
int pullup_predicates(ObDMLStmt* stmt, ObIArray<int64_t>& select_list, ObIArray<ObRawExpr*>& properties);
|
||||
@ -127,7 +127,7 @@ class ObTransformPredicateMoveAround : public ObTransformRule {
|
||||
|
||||
int print_debug_info(const char* str, ObDMLStmt* stmt, ObIArray<ObRawExpr*>& preds);
|
||||
|
||||
private:
|
||||
private:
|
||||
typedef ObSEArray<ObRawExpr*, 4> PullupPreds;
|
||||
ObArenaAllocator allocator_;
|
||||
hash::ObHashMap<uint64_t, int64_t> stmt_map_;
|
||||
|
||||
@ -20,7 +20,7 @@ namespace oceanbase {
|
||||
namespace sql {
|
||||
|
||||
class ObTransformProjectPruning : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
explicit ObTransformProjectPruning(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::PRE_ORDER)
|
||||
{}
|
||||
virtual ~ObTransformProjectPruning()
|
||||
@ -28,7 +28,7 @@ class ObTransformProjectPruning : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
int project_pruning(const uint64_t table_id, ObSelectStmt& child_stmt, ObDMLStmt& upper_stmt, bool& trans_happened);
|
||||
|
||||
int is_const_expr(ObRawExpr* expr, bool& is_const);
|
||||
@ -36,7 +36,7 @@ class ObTransformProjectPruning : public ObTransformRule {
|
||||
int check_transform_validity(const ObSelectStmt& stmt, bool& is_valid);
|
||||
int check_need_remove(ObSelectStmt* stmt, const int64_t idx, bool& need_remove);
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObTransformProjectPruning);
|
||||
};
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ class ObIAllocator;
|
||||
namespace sql {
|
||||
class ObRawExpr;
|
||||
class ObTransformQueryPushDown : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
explicit ObTransformQueryPushDown(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
virtual ~ObTransformQueryPushDown()
|
||||
@ -34,7 +34,7 @@ class ObTransformQueryPushDown : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
int check_transform_validity(ObSelectStmt* select_stmt, ObSelectStmt* view_stmt, bool& can_transform,
|
||||
bool& need_distinct, bool& transform_having, common::ObIArray<int64_t>& select_offset,
|
||||
common::ObIArray<SelectItem>& const_select_items);
|
||||
|
||||
@ -128,7 +128,7 @@ struct ObParentDMLStmt {
|
||||
};
|
||||
|
||||
class ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
static constexpr const double COST_BASE_TRANSFORM_THRESHOLD = 0.999;
|
||||
static const int64_t TRANSFORMER_DEFAULT_MAX_RECURSIVE_LEVEL = 150;
|
||||
static const uint64_t ALL_TRANSFORM_RULES = TRANSFORM_TYPE_COUNT_PLUS_ONE - 1;
|
||||
@ -173,7 +173,7 @@ class ObTransformRule {
|
||||
return transformer_type_;
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
/*
|
||||
* This function tries to recursively transform all statements including its child statements
|
||||
* By default, there are two options, pre-order transformation and post-order transformation
|
||||
@ -203,7 +203,7 @@ class ObTransformRule {
|
||||
*/
|
||||
virtual int adjust_transform_types(uint64_t& transform_types);
|
||||
|
||||
private:
|
||||
private:
|
||||
// pre-order transformation
|
||||
int transform_pre_order(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, const int64_t current_level, ObDMLStmt*& stmt);
|
||||
@ -228,14 +228,14 @@ class ObTransformRule {
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ObTransformRule);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
ObTransformerCtx* ctx_;
|
||||
TransMethod transform_method_;
|
||||
uint64_t transformer_type_;
|
||||
bool trans_happened_;
|
||||
bool cost_based_trans_tried_;
|
||||
|
||||
private:
|
||||
private:
|
||||
double stmt_cost_;
|
||||
};
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ namespace oceanbase {
|
||||
namespace sql {
|
||||
|
||||
class ObTransformSemiToInner : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
ObTransformSemiToInner(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
virtual ~ObTransformSemiToInner()
|
||||
@ -28,7 +28,7 @@ class ObTransformSemiToInner : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
int transform_semi_to_inner(ObDMLStmt* root_stmt, ObDMLStmt* stmt, const SemiInfo* pre_semi_info,
|
||||
ObDMLStmt*& trans_stmt, bool& need_check_cost, bool& trans_happened);
|
||||
|
||||
@ -71,7 +71,7 @@ class ObTransformSemiToInner : public ObTransformRule {
|
||||
|
||||
int check_stmt_limit_validity(const ObSelectStmt* select_stmt, bool& is_valid, bool& need_add_const_constraint);
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObTransformSemiToInner);
|
||||
};
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ class ObExprCtx;
|
||||
|
||||
namespace sql {
|
||||
class ObTransformSetOp : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
explicit ObTransformSetOp(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::PRE_ORDER)
|
||||
{}
|
||||
virtual ~ObTransformSetOp()
|
||||
@ -32,7 +32,7 @@ class ObTransformSetOp : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
int add_limit_order_distinct_for_union(
|
||||
const common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened);
|
||||
int remove_order_by_for_set(ObDMLStmt*& stmt, bool& trans_happened);
|
||||
@ -49,7 +49,7 @@ class ObTransformSetOp : public ObTransformRule {
|
||||
int add_limit_order_for_union(const common::ObIArray<ObParentDMLStmt>& parent_stmts, ObSelectStmt*& stmt);
|
||||
int check_can_pre_push(ObSelectStmt* stmt, ObSelectStmt* upper_stmt, bool& can_push);
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObTransformSetOp);
|
||||
};
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ class JoinedTable;
|
||||
namespace sql {
|
||||
class ObPhysicalPlan;
|
||||
class ObTransformSimplify : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
explicit ObTransformSimplify(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
virtual ~ObTransformSimplify()
|
||||
@ -34,7 +34,7 @@ class ObTransformSimplify : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
int having_filter_can_be_pushed_down(
|
||||
const ObRawExpr* having_filter, const ObSelectStmt& select_stmt, const bool has_rownum, bool& can_be);
|
||||
int replace_is_null_condition(ObDMLStmt* stmt, bool& trans_happened);
|
||||
@ -164,7 +164,7 @@ class ObTransformSimplify : public ObTransformRule {
|
||||
int create_view_with_left_table(ObDMLStmt* stmt, JoinedTable* joined_table);
|
||||
int push_down_on_condition(ObDMLStmt* stmt, JoinedTable* join_table, ObIArray<ObRawExpr*>& conds);
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObTransformSimplify);
|
||||
};
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ namespace oceanbase {
|
||||
namespace sql {
|
||||
|
||||
class ObTransformSubqueryCoalesce : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
ObTransformSubqueryCoalesce(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
virtual ~ObTransformSubqueryCoalesce()
|
||||
@ -29,10 +29,10 @@ class ObTransformSubqueryCoalesce : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
int adjust_transform_types(uint64_t& transform_types);
|
||||
|
||||
private:
|
||||
private:
|
||||
enum TransformFlag { DEFAULT, EXISTS_NOT_EXISTS, ANY_ALL };
|
||||
struct TransformParam {
|
||||
ObRawExpr* exists_expr_;
|
||||
@ -83,7 +83,7 @@ class ObTransformSubqueryCoalesce : public ObTransformRule {
|
||||
int get_same_classify_exprs(ObIArray<ObRawExpr*>& validity_exprs, ObIArray<ObRawExpr*>& same_classify_exprs,
|
||||
ObItemType ctype, ObExprInfoFlag flag);
|
||||
|
||||
private:
|
||||
private:
|
||||
ObQueryRefRawExpr* get_exists_query_expr(ObRawExpr* expr);
|
||||
|
||||
ObQueryRefRawExpr* get_any_all_query_expr(ObRawExpr* expr);
|
||||
|
||||
@ -43,7 +43,7 @@ enum CheckStmtUniqueFlags {
|
||||
};
|
||||
|
||||
class ObTransformUtils {
|
||||
private:
|
||||
private:
|
||||
struct UniqueCheckInfo {
|
||||
UniqueCheckInfo()
|
||||
{}
|
||||
@ -60,7 +60,7 @@ class ObTransformUtils {
|
||||
int assign(const UniqueCheckInfo& other);
|
||||
void reset();
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(UniqueCheckInfo);
|
||||
};
|
||||
struct UniqueCheckHelper {
|
||||
@ -76,11 +76,11 @@ class ObTransformUtils {
|
||||
ObSchemaChecker* schema_checker_;
|
||||
ObSQLSessionInfo* session_info_;
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(UniqueCheckHelper);
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
static int is_correlated_expr(const ObRawExpr* expr, int32_t correlated_level, bool& is_correlated);
|
||||
|
||||
static int is_direct_correlated_expr(const ObRawExpr* expr, int32_t correlated_level, bool& is_direct_correlated);
|
||||
@ -734,7 +734,7 @@ class ObTransformUtils {
|
||||
|
||||
static int replace_with_groupby_exprs(ObSelectStmt* select_stmt, ObRawExpr*& expr);
|
||||
|
||||
private:
|
||||
private:
|
||||
static int create_select_item_for_subquery(
|
||||
ObSelectStmt& stmt, ObSelectStmt*& child_stmt, ObIAllocator& alloc, ObIArray<ObRawExpr*>& query_ref_exprs);
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ namespace sql {
|
||||
class ObDelUpdStmt;
|
||||
|
||||
class ObTransformViewMerge : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
ObTransformViewMerge(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER), for_post_process_(false)
|
||||
{}
|
||||
virtual ~ObTransformViewMerge()
|
||||
@ -42,7 +42,7 @@ class ObTransformViewMerge : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
struct ViewMergeHelper {
|
||||
ViewMergeHelper()
|
||||
: parent_table(NULL),
|
||||
|
||||
@ -20,7 +20,7 @@ namespace oceanbase {
|
||||
namespace sql {
|
||||
|
||||
class ObWhereSubQueryPullup : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
ObWhereSubQueryPullup(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
virtual ~ObWhereSubQueryPullup()
|
||||
@ -37,7 +37,7 @@ class ObWhereSubQueryPullup : public ObTransformRule {
|
||||
return allocator;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
struct TransformParam {
|
||||
TransformParam()
|
||||
: op_(NULL),
|
||||
@ -219,7 +219,7 @@ class ObWhereSubQueryPullup : public ObTransformRule {
|
||||
int add_limit_for_exists_subquery(ObDMLStmt* stmt, bool& trans_happened);
|
||||
int recursive_add_limit_for_exists_expr(ObRawExpr* expr, bool& trans_happened);
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObWhereSubQueryPullup);
|
||||
};
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ namespace oceanbase {
|
||||
namespace sql {
|
||||
|
||||
class ObTransformWinGroupBy : public ObTransformRule {
|
||||
private:
|
||||
private:
|
||||
struct WinGroupByHelper {
|
||||
WinGroupByHelper()
|
||||
: transformed_stmt_(NULL),
|
||||
@ -66,7 +66,7 @@ class ObTransformWinGroupBy : public ObTransformRule {
|
||||
K_(outer_old_exprs), K_(outer_new_exprs));
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit ObTransformWinGroupBy(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
|
||||
@ -76,7 +76,7 @@ class ObTransformWinGroupBy : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
int do_win_groupby_transform(WinGroupByHelper& helper);
|
||||
int adjust_inner_stmt(WinGroupByHelper& helper);
|
||||
int adjust_outer_stmt(WinGroupByHelper& helper);
|
||||
|
||||
@ -21,7 +21,7 @@ namespace oceanbase {
|
||||
namespace sql {
|
||||
struct ObStmtMapInfo;
|
||||
class ObTransformWinMagic : public ObTransformRule {
|
||||
public:
|
||||
public:
|
||||
ObTransformWinMagic(ObTransformerCtx* ctx) : ObTransformRule(ctx, TransMethod::POST_ORDER)
|
||||
{}
|
||||
|
||||
@ -31,10 +31,10 @@ class ObTransformWinMagic : public ObTransformRule {
|
||||
virtual int transform_one_stmt(
|
||||
common::ObIArray<ObParentDMLStmt>& parent_stmts, ObDMLStmt*& stmt, bool& trans_happened) override;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
virtual int adjust_transform_types(uint64_t& transform_types) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
int check_subquery_validity(ObDMLStmt* stmt, ObQueryRefRawExpr* query_ref, ObStmtMapInfo& map_info, bool& is_valid);
|
||||
|
||||
int check_aggr_expr_validity(ObSelectStmt& subquery, bool& is_valid);
|
||||
|
||||
@ -46,7 +46,7 @@ class ObTransformerImpl {
|
||||
static const int64_t DEFAULT_ITERATION_COUNT = 10;
|
||||
static const int64_t MAX_RULE_COUNT = 64;
|
||||
|
||||
public:
|
||||
public:
|
||||
ObTransformerImpl(ObTransformerCtx* ctx)
|
||||
: ctx_(ctx), needed_transform_types_(0), max_iteration_count_(ObTransformerImpl::DEFAULT_ITERATION_COUNT)
|
||||
{
|
||||
@ -132,12 +132,12 @@ class ObTransformerImpl {
|
||||
return ctx_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
int collect_trans_stat(const ObTransformRule& rule);
|
||||
|
||||
void print_trans_stat();
|
||||
|
||||
private:
|
||||
private:
|
||||
ObTransformerCtx* ctx_;
|
||||
uint64_t needed_transform_types_;
|
||||
int64_t max_iteration_count_;
|
||||
|
||||
Reference in New Issue
Block a user