Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-44866: [C++] Minor enhance the doc and impl of DictionaryArray::Transpose #44867

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions cpp/src/arrow/array/array_dict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ struct CompactTransposeMapVisitor {
AllocateBuffer(dict_length * sizeof(int32_t), pool));
auto* output_map_raw = output_map->mutable_data_as<int32_t>();
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;
Expand Down Expand Up @@ -309,7 +309,7 @@ Result<std::unique_ptr<Buffer>> 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
Expand Down Expand Up @@ -520,8 +520,8 @@ struct RecursiveUnifier {

Result<std::unique_ptr<DictionaryUnifier>> DictionaryUnifier::Make(
std::shared_ptr<DataType> 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);
}

Expand Down
5 changes: 4 additions & 1 deletion cpp/src/arrow/array/array_dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::shared_ptr<Array>> Transpose(
const std::shared_ptr<DataType>& type, const std::shared_ptr<Array>& dictionary,
Expand Down
Loading