lyne7-sc opened a new pull request, #23743:
URL: https://github.com/apache/datafusion/pull/23743

   ## Which issue does this PR close?
   
   <!--
   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. For example `Closes #123` 
indicates that this PR will close issue #123.
   -->
   
   - Follow-up to #22905
   - Related to #19458
   - Related to #20935
   
   ## Rationale for this change
   
   <!--
    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.  
   -->
   
   String functions normally materialize `Dictionary(K, Utf8)` inputs before 
evaluation. This loses the dictionary encoding and applies the function to 
every row instead of only the unique dictionary values.
   
   This pr extends the dictionary-preserving implementation from #22905 to 
`ascii`, `bit_length`, and `octet_length`.
   
   ## What changes are included in this PR?
   
   <!--
   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.
   -->
   
   - Preserve dictionary encoding for `ascii`, `bit_length`, and `octet_length`.
   - Preserve return types for regular and nested dictionaries.
   - Add slts and Dictionary cardinality benchmarks.
   
   ## Are these changes tested?
   
   Yes, covered by SLTs.
   
   <!--
   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?
   
   <!--
   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 add the `api 
change` label.
   -->
   
   Yes. These functions now preserve Dictionary encoding in their output: 
`Dictionary(K, Utf8) -> Dictionary(K, Int32)`
   
   ## Benchmarks 
   ```
   group                                                        main            
                       new
   -----                                                        
----------------                       ---
   dictionary_string_functions/cardinality_10/ascii             28.71     
5.0±0.05µs        ? ?/sec    1.00   172.5±12.31ns        ? ?/sec
   dictionary_string_functions/cardinality_10/bit_length        4.01   
698.7±25.75ns        ? ?/sec    1.00    174.1±2.45ns        ? ?/sec
   dictionary_string_functions/cardinality_10/octet_length      3.63   
651.3±58.51ns        ? ?/sec    1.00    179.4±3.27ns        ? ?/sec
   dictionary_string_functions/cardinality_100/ascii            18.92     
4.9±0.03µs        ? ?/sec    1.00    258.6±8.28ns        ? ?/sec
   dictionary_string_functions/cardinality_100/bit_length       3.11   
723.4±27.14ns        ? ?/sec    1.00   232.5±35.47ns        ? ?/sec
   dictionary_string_functions/cardinality_100/octet_length     3.06   
651.6±26.97ns        ? ?/sec    1.00    213.2±6.96ns        ? ?/sec
   dictionary_string_functions/cardinality_1000/ascii           6.32      
4.8±0.03µs        ? ?/sec    1.00   766.7±70.66ns        ? ?/sec
   dictionary_string_functions/cardinality_1000/bit_length      3.06   
776.1±67.85ns        ? ?/sec    1.00    253.9±6.93ns        ? ?/sec
   dictionary_string_functions/cardinality_1000/octet_length    3.10  
807.9±188.65ns        ? ?/sec    1.00   261.0±22.42ns        ? ?/sec
   dictionary_string_functions/cardinality_8192/ascii           1.00      
5.1±0.15µs        ? ?/sec    1.00      5.1±0.24µs        ? ?/sec
   dictionary_string_functions/cardinality_8192/bit_length      1.00   
699.1±17.54ns        ? ?/sec    1.09   763.7±36.57ns        ? ?/sec
   dictionary_string_functions/cardinality_8192/octet_length    1.00   
677.3±62.91ns        ? ?/sec    1.11   750.7±32.56ns        ? ?/sec
   ```


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to