* 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. */
| 1861 | * save the current hash for the next re-scan, instead. |
| 1862 | */ |
| 1863 | static void |
| 1864 | SpillCurrentBatch(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 | |
| 1890 | static bool |
| 1891 | ExecHashJoinReloadHashTable(HashJoinState *hjstate) |
no test coverage detected