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

[NSE-479] optimize sort materialization #480

Merged
merged 9 commits into from
Sep 9, 2021
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 @@ -495,7 +495,8 @@ class ArrayAppender<DataType, enable_if_decimal<DataType>> : public AppenderBase
return arrow::Status::OK();
}
arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id) override {
if (has_null_ && cached_arr_[array_id]->IsNull(item_id)) {
if (has_null_ && cached_arr_[array_id]->null_count() > 0 &&
cached_arr_[array_id]->IsNull(item_id)) {
RETURN_NOT_OK(builder_->AppendNull());
} else {
RETURN_NOT_OK(builder_->Append(cached_arr_[array_id]->GetView(item_id)));
Expand All @@ -506,7 +507,8 @@ class ArrayAppender<DataType, enable_if_decimal<DataType>> : public AppenderBase
arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id,
int repeated) override {
if (repeated == 0) return arrow::Status::OK();
if (has_null_ && cached_arr_[array_id]->IsNull(item_id)) {
if (has_null_ && cached_arr_[array_id]->null_count() > 0 &&
cached_arr_[array_id]->IsNull(item_id)) {
RETURN_NOT_OK(builder_->AppendNulls(repeated));
} else {
auto val = cached_arr_[array_id]->GetView(item_id);
Expand All @@ -519,7 +521,8 @@ class ArrayAppender<DataType, enable_if_decimal<DataType>> : public AppenderBase

arrow::Status Append(const std::vector<ArrayItemIndex>& index_list) {
for (auto tmp : index_list) {
if (has_null_ && cached_arr_[tmp.array_id]->IsNull(tmp.id)) {
if (has_null_ && cached_arr_[tmp.array_id]->null_count() > 0 &&
cached_arr_[tmp.array_id]->IsNull(tmp.id)) {
RETURN_NOT_OK(builder_->AppendNull());
} else {
RETURN_NOT_OK(builder_->Append(cached_arr_[tmp.array_id]->GetView(tmp.id)));
Expand Down Expand Up @@ -1030,7 +1033,8 @@ class UnsafeArrayAppender<DataType, enable_if_decimal<DataType>> : public Append
return arrow::Status::OK();
}
arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id) override {
if (has_null_ && cached_arr_[array_id]->IsNull(item_id)) {
if (has_null_ && cached_arr_[array_id]->null_count() > 0 &&
cached_arr_[array_id]->IsNull(item_id)) {
builder_->UnsafeAppendNull();
} else {
builder_->UnsafeAppend(cached_arr_[array_id]->GetView(item_id));
Expand All @@ -1041,7 +1045,8 @@ class UnsafeArrayAppender<DataType, enable_if_decimal<DataType>> : public Append
arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id,
int repeated) override {
if (repeated == 0) return arrow::Status::OK();
if (has_null_ && cached_arr_[array_id]->IsNull(item_id)) {
if (has_null_ && cached_arr_[array_id]->null_count() > 0 &&
cached_arr_[array_id]->IsNull(item_id)) {
RETURN_NOT_OK(builder_->AppendNulls(repeated));
} else {
auto val = cached_arr_[array_id]->GetView(item_id);
Expand All @@ -1054,7 +1059,8 @@ class UnsafeArrayAppender<DataType, enable_if_decimal<DataType>> : public Append

arrow::Status Append(const std::vector<ArrayItemIndex>& index_list) {
for (auto tmp : index_list) {
if (has_null_ && cached_arr_[tmp.array_id]->IsNull(tmp.id)) {
if (has_null_ && cached_arr_[tmp.array_id]->null_count() > 0 &&
cached_arr_[tmp.array_id]->IsNull(tmp.id)) {
RETURN_NOT_OK(builder_->AppendNull());
} else {
RETURN_NOT_OK(builder_->Append(cached_arr_[tmp.array_id]->GetView(tmp.id)));
Expand Down
Loading