Skip to content

Commit cfae8dc

Browse files
authored
[VL] Reduce triple map lookup to single find in dictionary serialization (#11628)
1 parent d1ead09 commit cfae8dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cpp/velox/shuffle/ArrowShuffleDictionaryWriter.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,14 +404,14 @@ arrow::Status ArrowShuffleDictionaryWriter::serialize(arrow::io::OutputStream* o
404404
ARROW_RETURN_NOT_OK(out->Write(bitMap.data(), bitMapSize));
405405

406406
for (auto fieldIdx : dictionaryFields_) {
407+
auto it = dictionaries_.find(fieldIdx);
407408
GLUTEN_DCHECK(
408-
dictionaries_.find(fieldIdx) != dictionaries_.end(),
409+
it != dictionaries_.end(),
409410
"Invalid dictionary field index: " + std::to_string(fieldIdx));
410411

411-
const auto& dictionary = dictionaries_[fieldIdx];
412-
ARROW_RETURN_NOT_OK(dictionary->serialize(out));
412+
ARROW_RETURN_NOT_OK(it->second->serialize(out));
413413

414-
dictionaries_.erase(fieldIdx);
414+
dictionaries_.erase(it);
415415
}
416416

417417
return arrow::Status::OK();

0 commit comments

Comments
 (0)