pitrou commented on PR #37418:
URL: https://github.com/apache/arrow/pull/37418#issuecomment-1735426328

   This doesn't need to be a compute function. There are already dict-related 
utilities in `src/arrow/array/array_dict.h` (including 
`DictionaryArray::Transpose` which is certainly useful here).
   
   So I would recommend something like:
   ```c++
   class DictionaryArray {
     /// Return a transpose map to remove any unused dictionary entries.
     Result<std::vector<int32_t>> Compact() const;
   };
   ```
   
   Or perhaps (similar idea but using the Arrow C++ allocators rather than the 
STL):
   ```c++
   class DictionaryArray {
     /// Return a transpose map to remove any unused dictionary entries.
     /// \result the transpose map as a buffer of int32 values
     Result<std::shared_ptr<Buffer>> Compact() const;
   };
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to