|
|
|
@ -7,7 +7,7 @@ |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* IDENTIFICATION |
|
|
|
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.14 1999/02/22 05:26:18 momjian Exp $ |
|
|
|
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.15 1999/04/03 00:18:27 tgl Exp $ |
|
|
|
|
* |
|
|
|
|
*------------------------------------------------------------------------- |
|
|
|
|
*/ |
|
|
|
@ -29,19 +29,20 @@ static HashInfo *match_hashop_hashinfo(Oid hashop, List *hashinfo_list); |
|
|
|
|
* hash operator. |
|
|
|
|
* |
|
|
|
|
* 'restrictinfo_list' is the list of restrictinfo nodes |
|
|
|
|
* 'inner_relid' is the relid of the inner join relation |
|
|
|
|
* 'inner_relids' is the list of relids in the inner join relation |
|
|
|
|
* (used to determine whether a join var is inner or outer) |
|
|
|
|
* |
|
|
|
|
* Returns the new list of hashinfo nodes. |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
List * |
|
|
|
|
group_clauses_by_hashop(List *restrictinfo_list, |
|
|
|
|
int inner_relid) |
|
|
|
|
Relids inner_relids) |
|
|
|
|
{ |
|
|
|
|
List *hashinfo_list = NIL; |
|
|
|
|
RestrictInfo *restrictinfo = (RestrictInfo *) NULL; |
|
|
|
|
List *i = NIL; |
|
|
|
|
Oid hashjoinop = 0; |
|
|
|
|
RestrictInfo *restrictinfo; |
|
|
|
|
List *i; |
|
|
|
|
Oid hashjoinop; |
|
|
|
|
|
|
|
|
|
foreach(i, restrictinfo_list) |
|
|
|
|
{ |
|
|
|
@ -54,23 +55,21 @@ group_clauses_by_hashop(List *restrictinfo_list, |
|
|
|
|
*/ |
|
|
|
|
if (hashjoinop) |
|
|
|
|
{ |
|
|
|
|
HashInfo *xhashinfo = (HashInfo *) NULL; |
|
|
|
|
Expr *clause = restrictinfo->clause; |
|
|
|
|
Var *leftop = get_leftop(clause); |
|
|
|
|
Var *rightop = get_rightop(clause); |
|
|
|
|
JoinKey *joinkey = (JoinKey *) NULL; |
|
|
|
|
HashInfo *xhashinfo; |
|
|
|
|
JoinKey *joinkey; |
|
|
|
|
|
|
|
|
|
xhashinfo = match_hashop_hashinfo(hashjoinop, hashinfo_list); |
|
|
|
|
|
|
|
|
|
if (inner_relid == leftop->varno) |
|
|
|
|
joinkey = makeNode(JoinKey); |
|
|
|
|
if (intMember(leftop->varno, inner_relids)) |
|
|
|
|
{ |
|
|
|
|
joinkey = makeNode(JoinKey); |
|
|
|
|
joinkey->outer = rightop; |
|
|
|
|
joinkey->inner = leftop; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
joinkey = makeNode(JoinKey); |
|
|
|
|
joinkey->outer = leftop; |
|
|
|
|
joinkey->inner = rightop; |
|
|
|
|
} |
|
|
|
@ -79,16 +78,15 @@ group_clauses_by_hashop(List *restrictinfo_list, |
|
|
|
|
{ |
|
|
|
|
xhashinfo = makeNode(HashInfo); |
|
|
|
|
xhashinfo->hashop = hashjoinop; |
|
|
|
|
|
|
|
|
|
xhashinfo->jmethod.jmkeys = NIL; |
|
|
|
|
xhashinfo->jmethod.clauses = NIL; |
|
|
|
|
|
|
|
|
|
hashinfo_list = lcons(xhashinfo, hashinfo_list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
xhashinfo->jmethod.clauses = lcons(clause, xhashinfo->jmethod.clauses); |
|
|
|
|
|
|
|
|
|
xhashinfo->jmethod.jmkeys = lcons(joinkey, xhashinfo->jmethod.jmkeys); |
|
|
|
|
xhashinfo->jmethod.clauses = lcons(clause, |
|
|
|
|
xhashinfo->jmethod.clauses); |
|
|
|
|
xhashinfo->jmethod.jmkeys = lcons(joinkey, |
|
|
|
|
xhashinfo->jmethod.jmkeys); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return hashinfo_list; |
|
|
|
|