| 1926 | template <bool ignoreNullKeys> |
| 1927 | template <bool hasMatchFlags> |
| 1928 | int32_t HashTable<ignoreNullKeys>::listJoinResultsInternal( |
| 1929 | JoinResultIterator& iter, |
| 1930 | bool includeMisses, |
| 1931 | folly::Range<vector_size_t*> inputRows, |
| 1932 | folly::Range<char**> hits, |
| 1933 | const BaseVector* matchFlags) { |
| 1934 | BOLT_CHECK_LE(inputRows.size(), hits.size()); |
| 1935 | |
| 1936 | if constexpr (!hasMatchFlags) { |
| 1937 | if (!hasDuplicates_) { |
| 1938 | return listJoinResultsNoDuplicates(iter, includeMisses, inputRows, hits); |
| 1939 | } |
| 1940 | } |
| 1941 | const FlatVector<bool>* flags = nullptr; |
| 1942 | if constexpr (hasMatchFlags) { |
| 1943 | flags = matchFlags->as<FlatVector<bool>>(); |
| 1944 | } |
| 1945 | |
| 1946 | size_t numOut = 0; |
| 1947 | auto maxOut = inputRows.size(); |
| 1948 | while (iter.lastRowIndex < iter.rows->size()) { |
| 1949 | if (!iter.nextHit) { |
| 1950 | auto row = (*iter.rows)[iter.lastRowIndex]; |
| 1951 | iter.nextHit = (*iter.hits)[row]; // NOLINT |
| 1952 | if (!iter.nextHit) { |
| 1953 | ++iter.lastRowIndex; |
| 1954 | if (includeMisses) { |
| 1955 | if constexpr (hasMatchFlags) { |
| 1956 | // the probe side has ever matched with build side |
| 1957 | // do not include it |
| 1958 | if (flags->valueAtFast(row)) { |
| 1959 | continue; |
| 1960 | } |
| 1961 | } |
| 1962 | inputRows[numOut] = row; // NOLINT |
| 1963 | hits[numOut] = nullptr; |
| 1964 | ++numOut; |
| 1965 | if (numOut >= maxOut) { |
| 1966 | return numOut; |
| 1967 | } |
| 1968 | } |
| 1969 | continue; |
| 1970 | } |
| 1971 | } |
| 1972 | |
| 1973 | while (iter.nextHit) { |
| 1974 | char* next = nullptr; |
| 1975 | if (nextOffset_) { |
| 1976 | next = nextRow(iter.nextHit); |
| 1977 | if (next) { |
| 1978 | __builtin_prefetch(reinterpret_cast<char*>(next) + nextOffset_); |
| 1979 | } |
| 1980 | } |
| 1981 | inputRows[numOut] = (*iter.rows)[iter.lastRowIndex]; // NOLINT |
| 1982 | hits[numOut] = iter.nextHit; |
| 1983 | ++numOut; |
| 1984 | iter.nextHit = next; |
| 1985 | if (!iter.nextHit) { |
nothing calls this directly
no test coverage detected