diff --git a/cpp/src/arrow/array/array_dict.cc b/cpp/src/arrow/array/array_dict.cc index 5116f26ade7f6..2044c3ba892fe 100644 --- a/cpp/src/arrow/array/array_dict.cc +++ b/cpp/src/arrow/array/array_dict.cc @@ -248,7 +248,8 @@ struct CompactTransposeMapVistor { return Status::IndexError( "Index out of bounds while compacting dictionary array: ", current_index, "(dictionary is ", dict_length, " long) at position ", i); - } else if (!dict_used[current_index]) { + } + if (dict_used[current_index]) continue; dict_used[current_index] = true; dict_used_count++;