summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/executor/execExpr.h1
-rw-r--r--src/include/executor/executor.h34
-rw-r--r--src/include/executor/nodeAgg.h14
-rw-r--r--src/include/nodes/execnodes.h27
4 files changed, 40 insertions, 36 deletions
diff --git a/src/include/executor/execExpr.h b/src/include/executor/execExpr.h
index 117fc892f4..0cab431f65 100644
--- a/src/include/executor/execExpr.h
+++ b/src/include/executor/execExpr.h
@@ -148,6 +148,7 @@ typedef enum ExprEvalOp
/* evaluate assorted special-purpose expression types */
EEOP_IOCOERCE,
EEOP_DISTINCT,
+ EEOP_NOT_DISTINCT,
EEOP_NULLIF,
EEOP_SQLVALUEFUNCTION,
EEOP_CURRENTOFEXPR,
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index 1d824eff36..621e7c3dc4 100644
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -113,26 +113,19 @@ extern bool execCurrentOf(CurrentOfExpr *cexpr,
/*
* prototypes from functions in execGrouping.c
*/
-extern bool execTuplesMatch(TupleTableSlot *slot1,
- TupleTableSlot *slot2,
- int numCols,
- AttrNumber *matchColIdx,
- FmgrInfo *eqfunctions,
- MemoryContext evalContext);
-extern bool execTuplesUnequal(TupleTableSlot *slot1,
- TupleTableSlot *slot2,
- int numCols,
- AttrNumber *matchColIdx,
- FmgrInfo *eqfunctions,
- MemoryContext evalContext);
-extern FmgrInfo *execTuplesMatchPrepare(int numCols,
- Oid *eqOperators);
+extern ExprState *execTuplesMatchPrepare(TupleDesc desc,
+ int numCols,
+ AttrNumber *keyColIdx,
+ Oid *eqOperators,
+ PlanState *parent);
extern void execTuplesHashPrepare(int numCols,
Oid *eqOperators,
- FmgrInfo **eqFunctions,
+ Oid **eqFuncOids,
FmgrInfo **hashFunctions);
-extern TupleHashTable BuildTupleHashTable(int numCols, AttrNumber *keyColIdx,
- FmgrInfo *eqfunctions,
+extern TupleHashTable BuildTupleHashTable(PlanState *parent,
+ TupleDesc inputDesc,
+ int numCols, AttrNumber *keyColIdx,
+ Oid *eqfuncoids,
FmgrInfo *hashfunctions,
long nbuckets, Size additionalsize,
MemoryContext tablecxt,
@@ -142,7 +135,7 @@ extern TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable,
bool *isnew);
extern TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable,
TupleTableSlot *slot,
- FmgrInfo *eqfunctions,
+ ExprState *eqcomp,
FmgrInfo *hashfunctions);
/*
@@ -257,6 +250,11 @@ extern ExprState *ExecInitCheck(List *qual, PlanState *parent);
extern List *ExecInitExprList(List *nodes, PlanState *parent);
extern ExprState *ExecBuildAggTrans(AggState *aggstate, struct AggStatePerPhaseData *phase,
bool doSort, bool doHash);
+extern ExprState *ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc,
+ int numCols,
+ AttrNumber *keyColIdx,
+ Oid *eqfunctions,
+ PlanState *parent);
extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList,
ExprContext *econtext,
TupleTableSlot *slot,
diff --git a/src/include/executor/nodeAgg.h b/src/include/executor/nodeAgg.h
index 3b06db86fd..aa6ebaaf97 100644
--- a/src/include/executor/nodeAgg.h
+++ b/src/include/executor/nodeAgg.h
@@ -102,11 +102,12 @@ typedef struct AggStatePerTransData
bool *sortNullsFirst;
/*
- * fmgr lookup data for input columns' equality operators --- only
- * set/used when aggregate has DISTINCT flag. Note that these are in
- * order of sort column index, not parameter index.
+ * Comparators for input columns --- only set/used when aggregate has
+ * DISTINCT flag. equalfnOne version is used for single-column
+ * commparisons, equalfnMulti for the case of multiple columns.
*/
- FmgrInfo *equalfns; /* array of length numDistinctCols */
+ FmgrInfo equalfnOne;
+ ExprState *equalfnMulti;
/*
* initial value from pg_aggregate entry
@@ -270,7 +271,8 @@ typedef struct AggStatePerPhaseData
int numsets; /* number of grouping sets (or 0) */
int *gset_lengths; /* lengths of grouping sets */
Bitmapset **grouped_cols; /* column groupings for rollup */
- FmgrInfo *eqfunctions; /* per-grouping-field equality fns */
+ ExprState **eqfunctions; /* expression returning equality, indexed by
+ * nr of cols to compare */
Agg *aggnode; /* Agg node for phase data */
Sort *sortnode; /* Sort node for input ordering for phase */
@@ -290,7 +292,7 @@ typedef struct AggStatePerHashData
TupleHashIterator hashiter; /* for iterating through hash table */
TupleTableSlot *hashslot; /* slot for loading hash table */
FmgrInfo *hashfunctions; /* per-grouping-field hash fns */
- FmgrInfo *eqfunctions; /* per-grouping-field equality fns */
+ Oid *eqfuncoids; /* per-grouping-field equality fns */
int numCols; /* number of hash key columns */
int numhashGrpCols; /* number of columns in hash table */
int largestGrpColIdx; /* largest col required for hashing */
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 286d55be03..a953820f43 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -594,10 +594,10 @@ typedef struct ExecAuxRowMark
* Normally these are the only functions used, but FindTupleHashEntry()
* supports searching a hashtable using cross-data-type hashing. For that,
* the caller must supply hash functions for the LHS datatype as well as
- * the cross-type equality operators to use. in_hash_funcs and cur_eq_funcs
+ * the cross-type equality operators to use. in_hash_funcs and cur_eq_func
* are set to point to the caller's function arrays while doing such a search.
* During LookupTupleHashEntry(), they point to tab_hash_funcs and
- * tab_eq_funcs respectively.
+ * tab_eq_func respectively.
* ----------------------------------------------------------------
*/
typedef struct TupleHashEntryData *TupleHashEntry;
@@ -625,7 +625,7 @@ typedef struct TupleHashTableData
int numCols; /* number of columns in lookup key */
AttrNumber *keyColIdx; /* attr numbers of key columns */
FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */
- FmgrInfo *tab_eq_funcs; /* equality functions for table datatype(s) */
+ ExprState *tab_eq_func; /* comparator for table datatype(s) */
MemoryContext tablecxt; /* memory context containing table */
MemoryContext tempcxt; /* context for function evaluations */
Size entrysize; /* actual size to make each hash entry */
@@ -633,8 +633,9 @@ typedef struct TupleHashTableData
/* The following fields are set transiently for each table search: */
TupleTableSlot *inputslot; /* current input tuple's slot */
FmgrInfo *in_hash_funcs; /* hash functions for input datatype(s) */
- FmgrInfo *cur_eq_funcs; /* equality functions for input vs. table */
+ ExprState *cur_eq_func; /* comparator for for input vs. table */
uint32 hash_iv; /* hash-function IV */
+ ExprContext *exprcontext; /* expression context */
} TupleHashTableData;
typedef tuplehash_iterator TupleHashIterator;
@@ -781,6 +782,7 @@ typedef struct SubPlanState
HeapTuple curTuple; /* copy of most recent tuple from subplan */
Datum curArray; /* most recent array from ARRAY() subplan */
/* these are used when hashing the subselect's output: */
+ TupleDesc descRight; /* subselect desc after projection */
ProjectionInfo *projLeft; /* for projecting lefthand exprs */
ProjectionInfo *projRight; /* for projecting subselect output */
TupleHashTable hashtable; /* hash table for no-nulls subselect rows */
@@ -791,10 +793,12 @@ typedef struct SubPlanState
MemoryContext hashtempcxt; /* temp memory context for hash tables */
ExprContext *innerecontext; /* econtext for computing inner tuples */
AttrNumber *keyColIdx; /* control data for hash tables */
+ Oid *tab_eq_funcoids;/* equality func oids for table datatype(s) */
FmgrInfo *tab_hash_funcs; /* hash functions for table datatype(s) */
FmgrInfo *tab_eq_funcs; /* equality functions for table datatype(s) */
FmgrInfo *lhs_hash_funcs; /* hash functions for lefthand datatype(s) */
FmgrInfo *cur_eq_funcs; /* equality functions for LHS vs. table */
+ ExprState *cur_eq_comp; /* equality comparator for LHS vs. table */
} SubPlanState;
/* ----------------
@@ -1067,7 +1071,7 @@ typedef struct RecursiveUnionState
Tuplestorestate *working_table;
Tuplestorestate *intermediate_table;
/* Remaining fields are unused in UNION ALL case */
- FmgrInfo *eqfunctions; /* per-grouping-field equality fns */
+ Oid *eqfuncoids; /* per-grouping-field equality fns */
FmgrInfo *hashfunctions; /* per-grouping-field hash fns */
MemoryContext tempContext; /* short-term context for comparisons */
TupleHashTable hashtable; /* hash table for tuples already seen */
@@ -1795,7 +1799,7 @@ typedef struct SortState
typedef struct GroupState
{
ScanState ss; /* its first field is NodeTag */
- FmgrInfo *eqfunctions; /* per-field lookup data for equality fns */
+ ExprState *eqfunction; /* equality function */
bool grp_done; /* indicates completion of Group scan */
} GroupState;
@@ -1885,8 +1889,8 @@ typedef struct WindowAggState
WindowStatePerFunc perfunc; /* per-window-function information */
WindowStatePerAgg peragg; /* per-plain-aggregate information */
- FmgrInfo *partEqfunctions; /* equality funcs for partition columns */
- FmgrInfo *ordEqfunctions; /* equality funcs for ordering columns */
+ ExprState *partEqfunction; /* equality funcs for partition columns */
+ ExprState *ordEqfunction; /* equality funcs for ordering columns */
Tuplestorestate *buffer; /* stores rows of current partition */
int current_ptr; /* read pointer # for current row */
int framehead_ptr; /* read pointer # for frame head, if used */
@@ -1964,8 +1968,7 @@ typedef struct WindowAggState
typedef struct UniqueState
{
PlanState ps; /* its first field is NodeTag */
- FmgrInfo *eqfunctions; /* per-field lookup data for equality fns */
- MemoryContext tempContext; /* short-term context for comparisons */
+ ExprState *eqfunction; /* tuple equality qual */
} UniqueState;
/* ----------------
@@ -2079,11 +2082,11 @@ typedef struct SetOpStatePerGroupData *SetOpStatePerGroup;
typedef struct SetOpState
{
PlanState ps; /* its first field is NodeTag */
- FmgrInfo *eqfunctions; /* per-grouping-field equality fns */
+ ExprState *eqfunction; /* equality comparator */
+ Oid *eqfuncoids; /* per-grouping-field equality fns */
FmgrInfo *hashfunctions; /* per-grouping-field hash fns */
bool setop_done; /* indicates completion of output scan */
long numOutput; /* number of dups left to output */
- MemoryContext tempContext; /* short-term context for comparisons */
/* these fields are used in SETOP_SORTED mode: */
SetOpStatePerGroup pergroup; /* per-group working state */
HeapTuple grp_firstTuple; /* copy of first tuple of current group */