ethan-tyler opened a new pull request, #9220:
URL: https://github.com/apache/arrow-rs/pull/9220

   Fix arrow-cast failing to cast into Dictionary(K, Utf8View) and 
Dictionary(K, BinaryView) even though can_cast_types returns true.
   
   # Which issue does this PR close?
   
   - Closes #9219.
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and 
enhancements and this helps us generate change logs for our releases. You can 
link an issue to this PR using the GitHub syntax.
   -->
   
   # Rationale for this change
   Downstream pipelines may require view-typed schemas (e.g. 
schema_force_view_types) while still dictionary-encoding columns for memory 
efficiency. Even with view types, dictionary encoding can reduce per-row memory 
(1–4 byte keys vs 16-byte views) for low-cardinality columns. Today there's no 
way to materialize Dictionary(K, Utf8View/BinaryView) via arrow-cast.
   
   <!--
   Why are you proposing this change? If this is already explained clearly in 
the issue then this section is not needed.
   Explaining clearly why changes are proposed helps reviewers understand your 
changes and offer better suggestions for fixes.
   -->
   
   # What changes are included in this PR?
   Add Utf8View and BinaryView support in cast_to_dictionary using a two-step 
pack to recast approach:
   
   - Pack to Dictionary(K, Utf8/Binary)
   - Cast dictionary values to Utf8View/BinaryView via existing cast machinery
   
   <!--
   There is no need to duplicate the description in the issue here but it is 
sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are these changes tested?
   - StringArray/StringViewArray to Dictionary(UInt16, Utf8View) (including 
sliced inputs)
   - BinaryArray/BinaryViewArray to Dictionary(UInt16, BinaryView) (including 
sliced inputs)
   - Key overflow for Dictionary(UInt8, Utf8View)
   - Empty and all-null inputs
   
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are 
they covered by existing tests)?
   -->
   
   # Are there any user-facing changes?
   No
   <!--
   If there are user-facing changes then we may require documentation to be 
updated before approving the PR.
   
   If there are any breaking changes to public APIs, please call them out.
   -->
   


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