---------------------------------------------------------------- * ExecInitHashJoin * * Init routine for HashJoin node. * ---------------------------------------------------------------- */
| 797 | * ---------------------------------------------------------------- |
| 798 | */ |
| 799 | HashJoinState * |
| 800 | ExecInitHashJoin(HashJoin *node, EState *estate, int eflags) |
| 801 | { |
| 802 | HashJoinState *hjstate; |
| 803 | PlanState *outerState; |
| 804 | HashState *hstate; |
| 805 | Plan *outerNode; |
| 806 | Hash *hashNode; |
| 807 | TupleDesc outerDesc, |
| 808 | innerDesc; |
| 809 | const TupleTableSlotOps *ops; |
| 810 | |
| 811 | /* check for unsupported flags */ |
| 812 | Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK))); |
| 813 | |
| 814 | /* |
| 815 | * create state structure |
| 816 | */ |
| 817 | hjstate = makeNode(HashJoinState); |
| 818 | hjstate->js.ps.plan = (Plan *) node; |
| 819 | hjstate->js.ps.state = estate; |
| 820 | hjstate->reuse_hashtable = (eflags & EXEC_FLAG_REWIND) != 0; |
| 821 | |
| 822 | /* |
| 823 | * If eflag contains EXEC_FLAG_REWIND, |
| 824 | * then this node is not eager free safe. |
| 825 | */ |
| 826 | hjstate->delayEagerFree = (eflags & EXEC_FLAG_REWIND) != 0; |
| 827 | /* |
| 828 | * See ExecHashJoinInitializeDSM() and ExecHashJoinInitializeWorker() |
| 829 | * where this function may be replaced with a parallel version, if we |
| 830 | * managed to launch a parallel query. |
| 831 | */ |
| 832 | if (node->join.plan.parallel_aware) |
| 833 | { |
| 834 | hjstate->js.ps.ExecProcNode = ExecParallelHashJoin; |
| 835 | } |
| 836 | else |
| 837 | { |
| 838 | hjstate->js.ps.ExecProcNode = ExecHashJoin; |
| 839 | } |
| 840 | hjstate->js.jointype = node->join.jointype; |
| 841 | |
| 842 | /* |
| 843 | * Miscellaneous initialization |
| 844 | * |
| 845 | * create expression context for node |
| 846 | */ |
| 847 | ExecAssignExprContext(estate, &hjstate->js.ps); |
| 848 | |
| 849 | if (node->hashqualclauses != NIL) |
| 850 | { |
| 851 | /* CDB: This must be an IS NOT DISTINCT join! */ |
| 852 | Assert(isNotDistinctJoin(node->hashqualclauses)); |
| 853 | hjstate->hj_nonequijoin = true; |
| 854 | } |
| 855 | else |
| 856 | hjstate->hj_nonequijoin = false; |
no test coverage detected