MCPcopy Create free account
hub / github.com/apache/cloudberry / SpillCurrentBatch

Function SpillCurrentBatch

src/backend/executor/nodeHashjoin.c:1863–1888  ·  view source on GitHub ↗

* In our hybrid hash join we either spill when we increase number of batches * or when we re-spill. As we go, we normally destroy the batch file of the * batch that we have already processed. But if we need to support re-scanning * of the outer tuples, without also re-scanning the inner side, we need to * save the current hash for the next re-scan, instead. */

Source from the content-addressed store, hash-verified

1861 * save the current hash for the next re-scan, instead.
1862 */
1863static void
1864SpillCurrentBatch(HashJoinState *node)
1865{
1866 HashJoinTable hashtable = node->hj_HashTable;
1867 int curbatch = hashtable->curbatch;
1868 HashJoinTuple tuple;
1869 int i;
1870
1871 Assert(hashtable->innerBatchFile[curbatch] == NULL);
1872
1873 for (i = 0; i < hashtable->nbuckets; i++)
1874 {
1875 /* don't need to consider parallel hashjoins which use shared tuplestores instead of raw files */
1876 tuple = hashtable->buckets.unshared[i];
1877
1878 while (tuple != NULL)
1879 {
1880 ExecHashJoinSaveTuple(NULL, HJTUPLE_MINTUPLE(tuple),
1881 tuple->hashvalue,
1882 hashtable,
1883 &hashtable->innerBatchFile[curbatch],
1884 hashtable->bfCxt);
1885 tuple = tuple->next.unshared;
1886 }
1887 }
1888}
1889
1890static bool
1891ExecHashJoinReloadHashTable(HashJoinState *hjstate)

Callers 1

ExecHashJoinNewBatchFunction · 0.85

Calls 1

ExecHashJoinSaveTupleFunction · 0.85

Tested by

no test coverage detected