Discussion:
ProcExecNode II
(too old to reply)
j***@uwaterloo.ca
2011-02-27 23:31:07 UTC
Permalink
In continuing to attempt to use ExecProcNode to retrieve a tuple, I have
indeed tried to "use ExecProcNode on the child nodes (which is the inner
or outer relation in this case) and not on the Hash Join Node."

However when attempting to call ExecProcNode on a child node such as a
PlanState outerNode = outerPlanState(node); etc. I still find that
ExecProcNode uses the switch-case loop to call ExecHash (which is still
not what we want it to do). So even though I am calling ExecProcNode on a
non-HashJoin node it still seems to give me the same result.

I did notice that this changed if I were to change the optimizer so that
both inputs for each hash join operator will NOT be hash nodes. However,
that is exactly what we were told not to do, we were told to make sure
that they were both hashnodes in createplan.c, which I did in a few short
lines with the following:

Hash *outer_hash_plan;
.
.
.
hash_plan = make_hash(inner_plan);
outer_hash_plan = make_hash(outer_plan);
join_plan = make_hashjoin(tlist, joinclauses, otherclauses, hashclauses,
(Plan *) outer_hash_plan, (Plan *) hash_plan, best_path->jpath.jointype);


Am I incorrect in doing so? I believe I was simply following the
instructions given to us... but it has simply led me to unexpected
results?
Ken Salem
2011-02-27 23:45:40 UTC
Permalink
Please do not post your solution code on the newsgroup!

There's some confusion here, but I'm not sure I understand the
source of it.
ExecProcNode is a generic function that any node can call to get
a tuple from its child (or from one of its children), regardless of
the type of the child. As you've discovered, all it does is test
the type of the child and then call the type-specific Exec* function
for the child.

ExecHashJoin uses ExecProcNode, to get tuples from its children, which
should be hash nodes. In those cases, ExecProcNode will end up
invoking ExecHash.

Similarly, ExecHash will use ExecProcNode to get tuples from its child.
The type of the child depends on the specific plan and on which
hash node in the plan is making the call.

Looking at your previous post, you seem to be concerned that
ExecProcNode called from ExecHash is invoking ExecHash.
This could conceivably happen, if a hash node had another hash
node as a child. However, I don't think that there are any
circumstances under which the optimizer would generate such a
plan. ExecProcNode from ExecHash might end up invoking
ExecHashJoin, though...this will happen in the test query that I posted,
since its plan uses several different hash joins.

I'm not sure whether this is helping. If not, pls try again or
stop by during office hours tomorrow.

-KMS
Post by j***@uwaterloo.ca
In continuing to attempt to use ExecProcNode to retrieve a tuple, I have
indeed tried to "use ExecProcNode on the child nodes (which is the inner
or outer relation in this case) and not on the Hash Join Node."
However when attempting to call ExecProcNode on a child node such as a
PlanState outerNode = outerPlanState(node); etc. I still find that
ExecProcNode uses the switch-case loop to call ExecHash (which is still
not what we want it to do). So even though I am calling ExecProcNode on a
non-HashJoin node it still seems to give me the same result.
I did notice that this changed if I were to change the optimizer so that
both inputs for each hash join operator will NOT be hash nodes. However,
that is exactly what we were told not to do, we were told to make sure
that they were both hashnodes in createplan.c, which I did in a few short
Hash *outer_hash_plan;
.
.
.
hash_plan = make_hash(inner_plan);
outer_hash_plan = make_hash(outer_plan);
join_plan = make_hashjoin(tlist, joinclauses, otherclauses, hashclauses,
(Plan *) outer_hash_plan, (Plan *) hash_plan, best_path->jpath.jointype);
Am I incorrect in doing so? I believe I was simply following the
instructions given to us... but it has simply led me to unexpected
results?
Loading...