jorisvandenbossche commented on issue #40128:
URL: https://github.com/apache/arrow/issues/40128#issuecomment-1954172837

   I am not sure if we actually have many scalar kernels apart from `cast` that 
would work for dictionary ànd return dictionary?
   
   Checking some non-scalar (vector) kernels, those seem to preserve the 
dictionary correctly for empty input (using `arr` from the top post):
   
   ```
   In [8]: pc.filter(arr[:0], pa.array([], pa.bool_()))
   Out[8]: 
   <pyarrow.lib.DictionaryArray object at 0x7f2f399f2ff0>
   
   -- dictionary:
     [
       "foo",
       "bar"
     ]
   -- indices:
     []
   
   In [9]: pc.take(arr[:0], pa.array([], pa.int64()))
   Out[9]: 
   <pyarrow.lib.DictionaryArray object at 0x7f2f3b048040>
   
   -- dictionary:
     [
       "foo",
       "bar"
     ]
   -- indices:
     []
   ```


-- 
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