diff --git a/cpp/src/arrow/array/array_dict.cc b/cpp/src/arrow/array/array_dict.cc index 55e086af30bc2..86f7ac465964b 100644 --- a/cpp/src/arrow/array/array_dict.cc +++ b/cpp/src/arrow/array/array_dict.cc @@ -270,7 +270,7 @@ struct CompactTransposeMapVisitor { AllocateBuffer(dict_length * sizeof(int32_t), pool)); auto* output_map_raw = output_map->mutable_data_as(); int32_t current_index = 0; - for (CType i = 0; i < dict_len; i++) { + for (CType i = 0; i < dict_len; ++i) { if (dict_used[i]) { dict_indices_builder.UnsafeAppend(i); output_map_raw[i] = current_index; @@ -309,7 +309,7 @@ Result> CompactTransposeMap( CompactTransposeMapVisitor visitor{data, pool, nullptr, nullptr}; RETURN_NOT_OK(VisitTypeInline(*dict_type.index_type(), &visitor)); - out_compact_dictionary = visitor.out_compact_dictionary; + out_compact_dictionary = std::move(visitor.out_compact_dictionary); return std::move(visitor.output_map); } } // namespace @@ -520,8 +520,8 @@ struct RecursiveUnifier { Result> DictionaryUnifier::Make( std::shared_ptr value_type, MemoryPool* pool) { - MakeUnifier maker(pool, value_type); - RETURN_NOT_OK(VisitTypeInline(*value_type, &maker)); + MakeUnifier maker(pool, std::move(value_type)); + RETURN_NOT_OK(VisitTypeInline(*maker.value_type, &maker)); return std::move(maker.result); } diff --git a/cpp/src/arrow/array/array_dict.h b/cpp/src/arrow/array/array_dict.h index bf376b51f8c94..24cdd3b59525c 100644 --- a/cpp/src/arrow/array/array_dict.h +++ b/cpp/src/arrow/array/array_dict.h @@ -90,7 +90,10 @@ class ARROW_EXPORT DictionaryArray : public Array { /// \param[in] type the new type object /// \param[in] dictionary the new dictionary /// \param[in] transpose_map transposition array of this array's indices - /// into the target array's indices + /// into the target array's indices. The value of transpose_map should + /// be in the range [0, dictionary->length()). And the dictionary indices + /// at transpose_map[i] should not be out of bounds. + /// /// \param[in] pool a pool to allocate the array data from Result> Transpose( const std::shared_ptr& type, const std::shared_ptr& dictionary,