kosiew opened a new pull request, #23218:
URL: https://github.com/apache/datafusion/pull/23218

   ## Which issue does this PR close?
   
   Closes #22688
   
   ## Rationale for this change
   
   This PR completes the migration of the remaining string-producing UDFs to 
the fallible `BulkNullStringArrayBuilder` APIs introduced by earlier work on 
#22688.
   
   Previously, several UDFs still used infallible builder methods 
(`append_value`, `append_placeholder`, `append_with`, and `append_byte_map`), 
which could panic if builder size limits were exceeded. This change propagates 
builder errors through the affected functions so byte array offset overflows 
are returned as `DataFusionError`s instead of panicking, completing the audit 
of the remaining call sites within the scope of this sub-issue.
   
   ## What changes are included in this PR?
   
   * Migrate remaining string and Unicode UDFs to use `try_append_*` builder 
APIs and propagate errors with `?`.
   * Update helper functions to return `Result<()>` where required so builder 
failures can be propagated.
   * Extend `StringViewArrayBuilder` with fallible variants of:
   
     * `try_append_with`
     * `try_append_byte_map`
   * Add shared helper routines for checked conversion of string view metadata 
and overflow validation.
   * Update `StringViewWriter` to track and propagate builder errors instead of 
relying on panics.
   * Retain infallible builder methods as wrappers around the new fallible 
implementations for compatibility, documenting them as infallible variants.
   * Update `BulkNullStringArrayBuilder` to expose fallible `try_append_*` 
methods.
   * Migrate the remaining audited UDFs, including:
   
     * `overlay`
     * `chr`
     * `repeat`
     * `split_part`
     * `uuid`
     * `initcap`
     * `reverse`
     * `substr`
     * `translate`
   
   ## Are these changes tested?
   
   Yes.
   
   This PR adds the following unit tests:
   
   * `string_view_builder_try_append_with_and_byte_map_success_path`
   * `string_view_builder_rejects_long_view_part_overflow`
   
   It also updates existing builder tests to use the new fallible APIs where 
appropriate. Existing UDF tests continue to exercise the migrated 
implementations. 
   
   ## Are there any user-facing changes?
   
   There are no intended user-facing behavioral changes for successful queries.
   
   The observable change is that builder overflow conditions are propagated as 
recoverable `DataFusionError`s instead of relying on panics, completing the 
migration to the fallible builder APIs. This does not introduce a breaking 
public API change. 
   
   ## LLM-generated code disclosure
   
   This PR includes LLM-generated code and comments. All LLM-generated content 
has been manually reviewed.
   


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