add expr and item_type placeholder for real-time materialized view and materialized view rewrite

This commit is contained in:
chimyue
2024-03-13 13:50:40 +00:00
committed by ob-robot
parent fa714cea6d
commit e732d6bf5c
7 changed files with 25 additions and 3 deletions

View File

@ -1076,4 +1076,5 @@
#define N_INNER_DECODE_LIKE "inner_decode_like" #define N_INNER_DECODE_LIKE "inner_decode_like"
#define N_EXTRACT_CERT_EXPIRED_TIME "extract_cert_expired_time" #define N_EXTRACT_CERT_EXPIRED_TIME "extract_cert_expired_time"
#define N_INNER_ROW_CMP_VALUE "inner_row_cmp_value" #define N_INNER_ROW_CMP_VALUE "inner_row_cmp_value"
#define N_SYS_LAST_REFRESH_SCN "last_refresh_scn"
#endif //OCEANBASE_LIB_OB_NAME_DEF_H_ #endif //OCEANBASE_LIB_OB_NAME_DEF_H_

View File

@ -875,6 +875,7 @@ typedef enum ObItemType
T_FUN_SYS_GTID_SUBTRACT = 2013, T_FUN_SYS_GTID_SUBTRACT = 2013,
T_FUN_SYS_WAIT_FOR_EXECUTED_GTID_SET = 2014, T_FUN_SYS_WAIT_FOR_EXECUTED_GTID_SET = 2014,
T_FUN_SYS_WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS = 2015, T_FUN_SYS_WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS = 2015,
T_FUN_SYS_LAST_REFRESH_SCN = 2016,
T_MAX_OP = 3000, T_MAX_OP = 3000,
@ -2428,6 +2429,9 @@ typedef enum ObItemType
T_PARALLEL_DAS_DML, T_PARALLEL_DAS_DML,
T_DISABLE_PARALLEL_DAS_DML, T_DISABLE_PARALLEL_DAS_DML,
T_ENABLE_LOB_PREFETCH, T_ENABLE_LOB_PREFETCH,
T_MV_OPTIONS,
T_MV_REWRITE,
T_MV_NO_REWRITE,
T_MAX //Attention: add a new type before T_MAX T_MAX //Attention: add a new type before T_MAX
} ObItemType; } ObItemType;

View File

@ -1131,6 +1131,7 @@ static ObExpr::EvalFunc g_expr_eval_functions[] = {
NULL, // ObExprGTIDSubtract::eval_subtract, /* 687 */ NULL, // ObExprGTIDSubtract::eval_subtract, /* 687 */
NULL, // ObExprWaitForExecutedGTIDSet::eval_wait_for_executed_gtid_set, /* 688 */ NULL, // ObExprWaitForExecutedGTIDSet::eval_wait_for_executed_gtid_set, /* 688 */
NULL, // ObExprWaitUntilSQLThreadAfterGTIDs::eval_wait_until_sql_thread_after_gtids /* 689 */ NULL, // ObExprWaitUntilSQLThreadAfterGTIDs::eval_wait_until_sql_thread_after_gtids /* 689 */
NULL, // ObExprLastRefreshScn::eval_last_refresh_scn /* 690 */
}; };
static ObExpr::EvalBatchFunc g_expr_eval_batch_functions[] = { static ObExpr::EvalBatchFunc g_expr_eval_batch_functions[] = {

View File

@ -137,7 +137,8 @@ ObPhysicalPlan::ObPhysicalPlan(MemoryContext &mem_context /* = CURRENT_CONTEXT *
subschema_ctx_(allocator_), subschema_ctx_(allocator_),
disable_auto_memory_mgr_(false), disable_auto_memory_mgr_(false),
all_local_session_vars_(&allocator_), all_local_session_vars_(&allocator_),
udf_has_dml_stmt_(false) udf_has_dml_stmt_(false),
mview_ids_(&allocator_)
{ {
} }
@ -236,6 +237,7 @@ void ObPhysicalPlan::reset()
subschema_ctx_.reset(); subschema_ctx_.reset();
all_local_session_vars_.reset(); all_local_session_vars_.reset();
udf_has_dml_stmt_ = false; udf_has_dml_stmt_ = false;
mview_ids_.reset();
} }
void ObPhysicalPlan::destroy() void ObPhysicalPlan::destroy()
@ -797,7 +799,8 @@ OB_SERIALIZE_MEMBER(ObPhysicalPlan,
use_rich_format_, use_rich_format_,
disable_auto_memory_mgr_, disable_auto_memory_mgr_,
udf_has_dml_stmt_, udf_has_dml_stmt_,
stat_.format_sql_id_); stat_.format_sql_id_,
mview_ids_);
int ObPhysicalPlan::set_table_locations(const ObTablePartitionInfoArray &infos, int ObPhysicalPlan::set_table_locations(const ObTablePartitionInfoArray &infos,
ObSchemaGetterGuard &schema_guard) ObSchemaGetterGuard &schema_guard)

View File

@ -681,6 +681,8 @@ private:
public: public:
bool udf_has_dml_stmt_; bool udf_has_dml_stmt_;
private:
common::ObFixedArray<uint64_t, common::ObIAllocator> mview_ids_;
}; };
inline void ObPhysicalPlan::set_affected_last_insert_id(bool affected_last_insert_id) inline void ObPhysicalPlan::set_affected_last_insert_id(bool affected_last_insert_id)

View File

@ -114,7 +114,9 @@ ObPhysicalPlanCtx::ObPhysicalPlanCtx(common::ObIAllocator &allocator)
spm_ts_timeout_us_(0), spm_ts_timeout_us_(0),
subschema_ctx_(allocator_), subschema_ctx_(allocator_),
enable_rich_format_(false), enable_rich_format_(false),
all_local_session_vars_(allocator) all_local_session_vars_(allocator),
mview_ids_(allocator),
last_refresh_scns_(allocator)
{ {
} }
@ -759,6 +761,8 @@ OB_DEF_SERIALIZE(ObPhysicalPlanCtx)
for (int64_t i = 0; OB_SUCC(ret) && i < all_local_session_vars_.count(); ++i) { for (int64_t i = 0; OB_SUCC(ret) && i < all_local_session_vars_.count(); ++i) {
OB_UNIS_ENCODE(*all_local_session_vars_.at(i)); OB_UNIS_ENCODE(*all_local_session_vars_.at(i));
} }
OB_UNIS_ENCODE(mview_ids_);
OB_UNIS_ENCODE(last_refresh_scns_);
return ret; return ret;
} }
@ -854,6 +858,8 @@ OB_DEF_SERIALIZE_SIZE(ObPhysicalPlanCtx)
for (int64_t i = 0; i < all_local_session_vars_.count(); ++i) { for (int64_t i = 0; i < all_local_session_vars_.count(); ++i) {
OB_UNIS_ADD_LEN(*all_local_session_vars_.at(i)); OB_UNIS_ADD_LEN(*all_local_session_vars_.at(i));
} }
OB_UNIS_ADD_LEN(mview_ids_);
OB_UNIS_ADD_LEN(last_refresh_scns_);
return len; return len;
} }
@ -977,6 +983,8 @@ OB_DEF_DESERIALIZE(ObPhysicalPlanCtx)
LOG_WARN("failed to deserialize param store", K(ret)); LOG_WARN("failed to deserialize param store", K(ret));
} }
} }
OB_UNIS_DECODE(mview_ids_);
OB_UNIS_DECODE(last_refresh_scns_);
return ret; return ret;
} }

View File

@ -607,6 +607,9 @@ private:
bool enable_rich_format_; bool enable_rich_format_;
// for dependant exprs of generated columns // for dependant exprs of generated columns
common::ObFixedArray<ObLocalSessionVar *, common::ObIAllocator> all_local_session_vars_; common::ObFixedArray<ObLocalSessionVar *, common::ObIAllocator> all_local_session_vars_;
// for last_refresh_scn expr to get last_refresh_scn for rt mview used in query
common::ObFixedArray<uint64_t, common::ObIAllocator> mview_ids_;
common::ObFixedArray<uint64_t, common::ObIAllocator> last_refresh_scns_;
}; };
} }