aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeHashjoin.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-06-22 22:04:55 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-06-22 22:04:55 +0000
commitbff0422b6c8f65b2f8210d8690a7f63f8d6e2782 (patch)
treea3ec649b7c6251efdae2be1b923462979ad7184e /src/backend/executor/nodeHashjoin.c
parent0dda75f6eb4bb9d65a7c2ad729fbf21d616c1bb1 (diff)
downloadpostgresql-bff0422b6c8f65b2f8210d8690a7f63f8d6e2782.tar.gz
postgresql-bff0422b6c8f65b2f8210d8690a7f63f8d6e2782.zip
Revise hash join and hash aggregation code to use the same datatype-
specific hash functions used by hash indexes, rather than the old not-datatype-aware ComputeHashFunc routine. This makes it safe to do hash joining on several datatypes that previously couldn't use hashing. The sets of datatypes that are hash indexable and hash joinable are now exactly the same, whereas before each had some that weren't in the other.
Diffstat (limited to 'src/backend/executor/nodeHashjoin.c')
-rw-r--r--src/backend/executor/nodeHashjoin.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index 17585b2f0fc..9a0071f0180 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.51 2003/05/30 20:23:10 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.52 2003/06/22 22:04:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -117,7 +117,8 @@ ExecHashJoin(HashJoinState *node)
* create the hash table
*/
Assert(hashtable == NULL);
- hashtable = ExecHashTableCreate((Hash *) hashNode->ps.plan);
+ hashtable = ExecHashTableCreate((Hash *) hashNode->ps.plan,
+ node->hj_HashOperators);
node->hj_HashTable = hashtable;
/*
@@ -305,6 +306,7 @@ ExecInitHashJoin(HashJoin *node, EState *estate)
Plan *outerNode;
Hash *hashNode;
List *hclauses;
+ List *hoperators;
List *hcl;
/*
@@ -406,8 +408,9 @@ ExecInitHashJoin(HashJoin *node, EState *estate)
/*
* The planner already made a list of the inner hashkeys for us,
- * but we also need a list of the outer hashkeys. Each list of
- * exprs must then be prepared for execution.
+ * but we also need a list of the outer hashkeys, as well as a list
+ * of the hash operator OIDs. Both lists of exprs must then be prepared
+ * for execution.
*/
hjstate->hj_InnerHashKeys = (List *)
ExecInitExpr((Expr *) hashNode->hashkeys,
@@ -416,13 +419,19 @@ ExecInitHashJoin(HashJoin *node, EState *estate)
hjstate->hj_InnerHashKeys;
hclauses = NIL;
+ hoperators = NIL;
foreach(hcl, node->hashclauses)
{
- hclauses = lappend(hclauses, get_leftop(lfirst(hcl)));
+ OpExpr *hclause = (OpExpr *) lfirst(hcl);
+
+ Assert(IsA(hclause, OpExpr));
+ hclauses = lappend(hclauses, get_leftop((Expr *) hclause));
+ hoperators = lappendo(hoperators, hclause->opno);
}
hjstate->hj_OuterHashKeys = (List *)
ExecInitExpr((Expr *) hclauses,
(PlanState *) hjstate);
+ hjstate->hj_HashOperators = hoperators;
hjstate->js.ps.ps_OuterTupleSlot = NULL;
hjstate->js.ps.ps_TupFromTlist = false;