Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

[NSE-1125] Add status check for hashing GetOrInsert #1126

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -850,16 +850,16 @@ class HashAggregateKernel::Impl {
auto aggr_key_validity = !typed_key_in->IsNull(i);

if (aggr_key_validity) {
aggr_hash_table_->GetOrInsert(
aggr_key, [](int) {}, [](int) {}, &(indices[i]));
RETURN_NOT_OK(aggr_hash_table_->GetOrInsert(
aggr_key, [](int) {}, [](int) {}, &(indices[i])));
} else {
indices[i] = aggr_hash_table_->GetOrInsertNull([](int) {}, [](int) {});
}
}
} else {
for (int i = 0; i < length; i++) {
aggr_hash_table_->GetOrInsert(
typed_key_in->GetView(i), [](int) {}, [](int) {}, &(indices[i]));
RETURN_NOT_OK(aggr_hash_table_->GetOrInsert(
typed_key_in->GetView(i), [](int) {}, [](int) {}, &(indices[i])));
}
}

Expand Down Expand Up @@ -997,9 +997,9 @@ class HashAggregateKernel::Impl {
}

// FIXME(): all keys are null?
aggr_hash_table_->GetOrInsert(
RETURN_NOT_OK(aggr_hash_table_->GetOrInsert(
aggr_key_unsafe_row->data, aggr_key_unsafe_row->cursor, [](int) {},
[](int) {}, &(indices[i]));
[](int) {}, &(indices[i])));
}
} else {
if (typed_key_in->null_count() > 0) {
Expand All @@ -1009,16 +1009,16 @@ class HashAggregateKernel::Impl {
if (typed_key_in->IsNull(i)) {
indices[i] = aggr_hash_table_->GetOrInsertNull([](int) {}, [](int) {});
} else {
aggr_hash_table_->GetOrInsert(
aggr_key, [](int) {}, [](int) {}, &(indices[i]));
RETURN_NOT_OK(aggr_hash_table_->GetOrInsert(
aggr_key, [](int) {}, [](int) {}, &(indices[i])));
}
}
} else {
for (int i = 0; i < length; i++) {
aggr_key = typed_key_in->GetView(i);

aggr_hash_table_->GetOrInsert(
aggr_key, [](int) {}, [](int) {}, &(indices[i]));
RETURN_NOT_OK(aggr_hash_table_->GetOrInsert(
aggr_key, [](int) {}, [](int) {}, &(indices[i])));
}
}
}
Expand Down Expand Up @@ -1161,8 +1161,8 @@ class HashAggregateKernel::Impl {
if (!aggr_key_validity) {
memo_index = aggr_hash_table_->GetOrInsertNull([](int) {}, [](int) {});
} else {
aggr_hash_table_->GetOrInsert(
aggr_key, [](int) {}, [](int) {}, &memo_index);
RETURN_NOT_OK(aggr_hash_table_->GetOrInsert(
aggr_key, [](int) {}, [](int) {}, &memo_index));
}

if (memo_index > max_group_id_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,18 @@ class EncodeArrayTypedImpl : public EncodeArrayKernel::Impl {
int memo_index = 0;
if (typed_array->null_count() == 0) {
for (; cur_id < typed_array->length(); cur_id++) {
hash_table_->GetOrInsert(typed_array->GetView(cur_id), insert_on_found,
insert_on_not_found, &memo_index);
RETURN_NOT_OK(hash_table_->GetOrInsert(typed_array->GetView(cur_id),
insert_on_found, insert_on_not_found,
&memo_index));
}
} else {
for (; cur_id < typed_array->length(); cur_id++) {
if (typed_array->IsNull(cur_id)) {
hash_table_->GetOrInsertNull(insert_on_found, insert_on_not_found);
} else {
hash_table_->GetOrInsert(typed_array->GetView(cur_id), insert_on_found,
insert_on_not_found, &memo_index);
RETURN_NOT_OK(hash_table_->GetOrInsert(typed_array->GetView(cur_id),
insert_on_found, insert_on_not_found,
&memo_index));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1127,8 +1127,8 @@ class TypedProberImpl : public CodeGenBase {
int memo_index = 0;
if (typed_array->null_count() == 0) {
for (; cur_id_ < typed_array->length(); cur_id_++) {
hash_table_->GetOrInsert(typed_array->GetView(cur_id_), [](int32_t){},
[](int32_t){}, &memo_index);
RETURN_NOT_OK(hash_table_->GetOrInsert(typed_array->GetView(cur_id_), [](int32_t){},
[](int32_t){}, &memo_index));
if (memo_index < num_items_) {
insert_on_found(memo_index);
} else {
Expand All @@ -1140,9 +1140,9 @@ class TypedProberImpl : public CodeGenBase {
if (typed_array->IsNull(cur_id_)) {
hash_table_->GetOrInsertNull([](int32_t){}, [](int32_t){});
} else {
hash_table_->GetOrInsert(typed_array->GetView(cur_id_),
RETURN_NOT_OK(hash_table_->GetOrInsert(typed_array->GetView(cur_id_),
[](int32_t){}, [](int32_t){},
&memo_index);
&memo_index));
if (memo_index < num_items_) {
insert_on_found(memo_index);
} else {
Expand Down