INSERT SUB FUSION

opfusion support insert ... select
This commit is contained in:
wuchenglin
2023-06-05 14:25:41 +08:00
parent a74b73335e
commit d8178cbb42
18 changed files with 674 additions and 48 deletions

View File

@ -16,6 +16,7 @@
#include "nodes/execnodes.h"
extern TupleTableSlot* SeqNext(SeqScanState* node);
extern SeqScanState* ExecInitSeqScan(SeqScan* node, EState* estate, int eflags);
extern void ExecEndSeqScan(SeqScanState* node);
extern void ExecSeqMarkPos(SeqScanState* node);

View File

@ -72,4 +72,53 @@ private:
InsertFusionLocaleVariable m_c_local;
};
class InsertSubFusion : public OpFusion {
public:
InsertSubFusion(MemoryContext context, CachedPlanSource* psrc, List* plantree_list, ParamListInfo params);
~InsertSubFusion(){};
bool execute(long max_rows, char* completionTag);
void InitLocals(ParamListInfo params);
void InitGlobals();
void InitPlan();
private:
unsigned long ExecInsert(Relation rel, ResultRelInfo* resultRelInfo);
struct VarLoc {
int varNo;
int scanKeyIndx;
};
struct InsertSubFusionGlobalVariable {
int m_targetParamNum;
int m_targetConstNum;
ConstLoc* m_targetConstLoc;
int m_varNum;
VarLoc* m_targetVarLoc;
};
InsertSubFusionGlobalVariable* m_c_global;
struct InsertSubFusionLocaleVariable {
EState* m_estate; /* Top estate*/
Datum* m_curVarValue;
bool* m_curVarIsnull;
Plan* m_plan;
SeqScan* m_ss_plan;
PlanState* m_ps;
SeqScanState* m_sub_ps;
ModifyTableState* m_mt_state;
};
InsertSubFusionLocaleVariable m_c_local;
};
#endif /* SRC_INCLUDE_OPFUSION_OPFUSION_INSERT_H_ */

View File

@ -50,6 +50,7 @@ enum FusionType {
INSERT_FUSION,
UPDATE_FUSION,
DELETE_FUSION,
INSERT_SUB_FUSION,
AGG_INDEX_FUSION,
SORT_INDEX_FUSION,
@ -114,6 +115,7 @@ enum FusionType {
NOBYPASS_VERSION_SCAN_PLAN,
NOBYPASS_PARTITION_TYPE_NOT_SUPPORT,
NOBYPASS_REPLACE_NOT_SUPPORT,
NOBYPASS_INSERT_SUB_FUSION_NOT_SUPPORT_PARTITION_BYPASS,
NOBYPASS_GPC_NOT_SUPPORT_PARTITION_BYPASS
};