[Vectorized] [HashJoin] Opt HashJoin Performance (#8119)

Co-authored-by: lihaopeng <happenlee@hotmail.com>
This commit is contained in:
awakeljw
2022-02-23 10:28:16 +08:00
committed by GitHub
parent 802fcbbb05
commit b1e7343532
11 changed files with 231 additions and 150 deletions

View File

@ -221,9 +221,20 @@ void ColumnVector<T>::insert_range_from(const IColumn& src, size_t start, size_t
template <typename T>
void ColumnVector<T>::insert_indices_from(const IColumn& src, const int* indices_begin, const int* indices_end) {
const Self& src_vec = assert_cast<const Self&>(src);
data.reserve(size() + (indices_end - indices_begin));
for (auto x = indices_begin; x != indices_end; ++x) {
data.push_back_without_reserve(src_vec.get_element(*x));
auto origin_size = size();
auto new_size = indices_end - indices_begin;
data.resize(origin_size + new_size);
for (int i = 0; i < new_size; ++i) {
int offset = indices_begin[i];
if constexpr (std::is_same_v<T, UInt8>) {
// Now Uint8 use to identify null and non null
// 1. nullable column : offset == -1 means is null at the here, set true here
// 2. real data column : offset == -1 what at is meaningless
data[origin_size + i] = (offset == -1) ? T{1} : src_vec.get_element(offset);
} else {
data[origin_size + i] = (offset == -1) ? T{0} : src_vec.get_element(offset);
}
}
}