PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/nbtree.h"
#include "executor/execdebug.h"
#include "executor/nodeMergejoin.h"
#include "miscadmin.h"
#include "utils/lsyscache.h"
Go to the source code of this file.
Data Structures | |
struct | MergeJoinClauseData |
Macros | |
#define | EXEC_MJ_INITIALIZE_OUTER 1 |
#define | EXEC_MJ_INITIALIZE_INNER 2 |
#define | EXEC_MJ_JOINTUPLES 3 |
#define | EXEC_MJ_NEXTOUTER 4 |
#define | EXEC_MJ_TESTOUTER 5 |
#define | EXEC_MJ_NEXTINNER 6 |
#define | EXEC_MJ_SKIP_TEST 7 |
#define | EXEC_MJ_SKIPOUTER_ADVANCE 8 |
#define | EXEC_MJ_SKIPINNER_ADVANCE 9 |
#define | EXEC_MJ_ENDOUTER 10 |
#define | EXEC_MJ_ENDINNER 11 |
#define | MarkInnerTuple(innerTupleSlot, mergestate) ExecCopySlot((mergestate)->mj_MarkedTupleSlot, (innerTupleSlot)) |
Typedefs | |
typedef struct MergeJoinClauseData | MergeJoinClauseData |
Enumerations | |
enum | MJEvalResult { MJEVAL_MATCHABLE , MJEVAL_NONMATCHABLE , MJEVAL_ENDOFJOIN } |
Functions | |
static MergeJoinClause | MJExamineQuals (List *mergeclauses, Oid *mergefamilies, Oid *mergecollations, int *mergestrategies, bool *mergenullsfirst, PlanState *parent) |
static MJEvalResult | MJEvalOuterValues (MergeJoinState *mergestate) |
static MJEvalResult | MJEvalInnerValues (MergeJoinState *mergestate, TupleTableSlot *innerslot) |
static int | MJCompare (MergeJoinState *mergestate) |
static TupleTableSlot * | MJFillOuter (MergeJoinState *node) |
static TupleTableSlot * | MJFillInner (MergeJoinState *node) |
static bool | check_constant_qual (List *qual, bool *is_const_false) |
static TupleTableSlot * | ExecMergeJoin (PlanState *pstate) |
MergeJoinState * | ExecInitMergeJoin (MergeJoin *node, EState *estate, int eflags) |
void | ExecEndMergeJoin (MergeJoinState *node) |
void | ExecReScanMergeJoin (MergeJoinState *node) |
#define EXEC_MJ_ENDINNER 11 |
Definition at line 115 of file nodeMergejoin.c.
#define EXEC_MJ_ENDOUTER 10 |
Definition at line 114 of file nodeMergejoin.c.
#define EXEC_MJ_INITIALIZE_INNER 2 |
Definition at line 106 of file nodeMergejoin.c.
#define EXEC_MJ_INITIALIZE_OUTER 1 |
Definition at line 105 of file nodeMergejoin.c.
#define EXEC_MJ_JOINTUPLES 3 |
Definition at line 107 of file nodeMergejoin.c.
#define EXEC_MJ_NEXTINNER 6 |
Definition at line 110 of file nodeMergejoin.c.
#define EXEC_MJ_NEXTOUTER 4 |
Definition at line 108 of file nodeMergejoin.c.
#define EXEC_MJ_SKIP_TEST 7 |
Definition at line 111 of file nodeMergejoin.c.
#define EXEC_MJ_SKIPINNER_ADVANCE 9 |
Definition at line 113 of file nodeMergejoin.c.
#define EXEC_MJ_SKIPOUTER_ADVANCE 8 |
Definition at line 112 of file nodeMergejoin.c.
#define EXEC_MJ_TESTOUTER 5 |
Definition at line 109 of file nodeMergejoin.c.
#define MarkInnerTuple | ( | innerTupleSlot, | |
mergestate | |||
) | ExecCopySlot((mergestate)->mj_MarkedTupleSlot, (innerTupleSlot)) |
Definition at line 151 of file nodeMergejoin.c.
typedef struct MergeJoinClauseData MergeJoinClauseData |
enum MJEvalResult |
Enumerator | |
---|---|
MJEVAL_MATCHABLE | |
MJEVAL_NONMATCHABLE | |
MJEVAL_ENDOFJOIN |
Definition at line 143 of file nodeMergejoin.c.
Definition at line 519 of file nodeMergejoin.c.
References DatumGetBool(), IsA, and lfirst.
Referenced by ExecInitMergeJoin().
void ExecEndMergeJoin | ( | MergeJoinState * | node | ) |
Definition at line 1641 of file nodeMergejoin.c.
References ExecEndNode(), innerPlanState, MJ1_printf, and outerPlanState.
Referenced by ExecEndNode().
MergeJoinState* ExecInitMergeJoin | ( | MergeJoin * | node, |
EState * | estate, | ||
int | eflags | ||
) |
Definition at line 1444 of file nodeMergejoin.c.
References Assert, check_constant_qual(), CreateExprContext(), elog, ereport, errcode(), errmsg(), ERROR, EXEC_FLAG_BACKWARD, EXEC_FLAG_MARK, EXEC_FLAG_REWIND, EXEC_MJ_INITIALIZE_OUTER, ExecAssignExprContext(), ExecAssignProjectionInfo(), ExecGetResultSlotOps(), ExecGetResultType(), ExecInitExtraTupleSlot(), ExecInitNode(), ExecInitNullTupleSlot(), ExecInitQual(), ExecInitResultTupleSlotTL(), ExecMergeJoin(), PlanState::ExecProcNode, Join::inner_unique, innerPlan, innerPlanState, IsA, MergeJoin::join, JOIN_ANTI, JOIN_FULL, JOIN_INNER, JOIN_LEFT, JOIN_RIGHT, JOIN_RIGHT_ANTI, JOIN_SEMI, JoinState::joinqual, Join::joinqual, JoinState::jointype, Join::jointype, MergeJoinState::js, list_length(), makeNode, MergeJoin::mergeclauses, MJ1_printf, MergeJoinState::mj_Clauses, MergeJoinState::mj_ConstFalseJoin, MergeJoinState::mj_ExtraMarks, MergeJoinState::mj_FillInner, MergeJoinState::mj_FillOuter, MergeJoinState::mj_InnerEContext, MergeJoinState::mj_InnerTupleSlot, MergeJoinState::mj_JoinState, MergeJoinState::mj_MarkedTupleSlot, MergeJoinState::mj_MatchedInner, MergeJoinState::mj_MatchedOuter, MergeJoinState::mj_NullInnerTupleSlot, MergeJoinState::mj_NullOuterTupleSlot, MergeJoinState::mj_NumClauses, MergeJoinState::mj_OuterEContext, MergeJoinState::mj_OuterTupleSlot, MergeJoinState::mj_SkipMarkRestore, MJExamineQuals(), NIL, outerPlan, outerPlanState, PlanState::plan, JoinState::ps, PlanState::qual, JoinState::single_match, MergeJoin::skip_mark_restore, PlanState::state, and TTSOpsVirtual.
Referenced by ExecInitNode().
|
static |
Definition at line 599 of file nodeMergejoin.c.
References Assert, castNode, CHECK_FOR_INTERRUPTS, ExprContext::ecxt_innertuple, ExprContext::ecxt_outertuple, elog, ERROR, EXEC_MJ_ENDINNER, EXEC_MJ_ENDOUTER, EXEC_MJ_INITIALIZE_INNER, EXEC_MJ_INITIALIZE_OUTER, EXEC_MJ_JOINTUPLES, EXEC_MJ_NEXTINNER, EXEC_MJ_NEXTOUTER, EXEC_MJ_SKIP_TEST, EXEC_MJ_SKIPINNER_ADVANCE, EXEC_MJ_SKIPOUTER_ADVANCE, EXEC_MJ_TESTOUTER, ExecMarkPos(), ExecProcNode(), ExecProject(), ExecQual(), ExecRestrPos(), innerPlan, innerPlanState, InstrCountFiltered1, InstrCountFiltered2, JOIN_ANTI, JOIN_RIGHT_ANTI, JoinState::joinqual, JoinState::jointype, MergeJoinState::js, MarkInnerTuple, MJ_DEBUG_COMPARE, MJ_DEBUG_PROC_NODE, MJ_DEBUG_QUAL, MJ_dump, MergeJoinState::mj_ExtraMarks, MergeJoinState::mj_FillInner, MergeJoinState::mj_FillOuter, MergeJoinState::mj_InnerTupleSlot, MergeJoinState::mj_JoinState, MergeJoinState::mj_MarkedTupleSlot, MergeJoinState::mj_MatchedInner, MergeJoinState::mj_MatchedOuter, MergeJoinState::mj_OuterTupleSlot, MJ_printf, MergeJoinState::mj_SkipMarkRestore, MJCompare(), MJEVAL_ENDOFJOIN, MJEVAL_MATCHABLE, MJEVAL_NONMATCHABLE, MJEvalInnerValues(), MJEvalOuterValues(), MJFillInner(), MJFillOuter(), outerPlan, outerPlanState, JoinState::ps, PlanState::ps_ExprContext, PlanState::ps_ProjInfo, PlanState::qual, ResetExprContext, JoinState::single_match, and TupIsNull.
Referenced by ExecInitMergeJoin().
void ExecReScanMergeJoin | ( | MergeJoinState * | node | ) |
Definition at line 1657 of file nodeMergejoin.c.
References EXEC_MJ_INITIALIZE_OUTER, ExecClearTuple(), ExecReScan(), innerPlan, innerPlanState, MergeJoinState::mj_InnerTupleSlot, MergeJoinState::mj_JoinState, MergeJoinState::mj_MarkedTupleSlot, MergeJoinState::mj_MatchedInner, MergeJoinState::mj_MatchedOuter, MergeJoinState::mj_OuterTupleSlot, outerPlan, and outerPlanState.
Referenced by ExecReScan().
|
static |
Definition at line 391 of file nodeMergejoin.c.
References ApplySortComparator(), ExprContext::ecxt_per_tuple_memory, i, MergeJoinState::js, MergeJoinClauseData::ldatum, MergeJoinClauseData::lisnull, MemoryContextSwitchTo(), MergeJoinState::mj_Clauses, MergeJoinState::mj_ConstFalseJoin, MergeJoinState::mj_NumClauses, JoinState::ps, PlanState::ps_ExprContext, MergeJoinClauseData::rdatum, ResetExprContext, MergeJoinClauseData::risnull, and MergeJoinClauseData::ssup.
Referenced by ExecMergeJoin().
|
static |
Definition at line 341 of file nodeMergejoin.c.
References ExprContext::ecxt_innertuple, ExprContext::ecxt_per_tuple_memory, ExecEvalExpr(), i, MemoryContextSwitchTo(), MergeJoinState::mj_Clauses, MergeJoinState::mj_FillInner, MergeJoinState::mj_InnerEContext, MergeJoinState::mj_NumClauses, MJEVAL_ENDOFJOIN, MJEVAL_MATCHABLE, MJEVAL_NONMATCHABLE, MergeJoinClauseData::rdatum, ResetExprContext, MergeJoinClauseData::rexpr, MergeJoinClauseData::risnull, MergeJoinClauseData::ssup, SortSupportData::ssup_nulls_first, and TupIsNull.
Referenced by ExecMergeJoin().
|
static |
Definition at line 294 of file nodeMergejoin.c.
References ExprContext::ecxt_outertuple, ExprContext::ecxt_per_tuple_memory, ExecEvalExpr(), i, MergeJoinClauseData::ldatum, MergeJoinClauseData::lexpr, MergeJoinClauseData::lisnull, MemoryContextSwitchTo(), MergeJoinState::mj_Clauses, MergeJoinState::mj_FillOuter, MergeJoinState::mj_NumClauses, MergeJoinState::mj_OuterEContext, MergeJoinState::mj_OuterTupleSlot, MJEVAL_ENDOFJOIN, MJEVAL_MATCHABLE, MJEVAL_NONMATCHABLE, ResetExprContext, MergeJoinClauseData::ssup, SortSupportData::ssup_nulls_first, and TupIsNull.
Referenced by ExecMergeJoin().
|
static |
Definition at line 175 of file nodeMergejoin.c.
References SortSupportData::abbreviate, OpExpr::args, Assert, BTEqualStrategyNumber, BTGreaterStrategyNumber, BTLessStrategyNumber, BTORDER_PROC, BTSORTSUPPORT_PROC, SortSupportData::comparator, CurrentMemoryContext, elog, ERROR, ExecInitExpr(), get_op_opfamily_properties(), get_opfamily_proc(), IsA, MergeJoinClauseData::lexpr, lfirst, linitial, list_length(), lsecond, OidFunctionCall1, OidIsValid, OpExpr::opno, palloc0(), PointerGetDatum(), PrepareSortSupportComparisonShim(), MergeJoinClauseData::rexpr, MergeJoinClauseData::ssup, SortSupportData::ssup_collation, SortSupportData::ssup_cxt, SortSupportData::ssup_nulls_first, and SortSupportData::ssup_reverse.
Referenced by ExecInitMergeJoin().
|
static |
Definition at line 483 of file nodeMergejoin.c.
References ExprContext::ecxt_innertuple, ExprContext::ecxt_outertuple, ExecProject(), ExecQual(), InstrCountFiltered2, MergeJoinState::js, MergeJoinState::mj_InnerTupleSlot, MergeJoinState::mj_NullOuterTupleSlot, MJ_printf, JoinState::ps, PlanState::ps_ExprContext, PlanState::ps_ProjInfo, PlanState::qual, and ResetExprContext.
Referenced by ExecMergeJoin().
|
static |
Definition at line 452 of file nodeMergejoin.c.
References ExprContext::ecxt_innertuple, ExprContext::ecxt_outertuple, ExecProject(), ExecQual(), InstrCountFiltered2, MergeJoinState::js, MergeJoinState::mj_NullInnerTupleSlot, MergeJoinState::mj_OuterTupleSlot, MJ_printf, JoinState::ps, PlanState::ps_ExprContext, PlanState::ps_ProjInfo, PlanState::qual, and ResetExprContext.
Referenced by ExecMergeJoin().