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

   ## Which issue does this PR close?
   
   Partial of #21536 — `array_scale` (the list+scalar arithmetic function in 
the vector math series).
   
   ## Rationale for this change
   
   Continues the per-function split requested by @alamb on #21536. Three 
sibling PRs already merged: `cosine_distance` (#21542), `inner_product` 
(#21861), `array_normalize` (#22013). `array_add` is in flight as #22459 by 
@SubhamSinghal.
   
   Adds element-wise scalar multiplication for numeric arrays, returning a list 
of the same shape. Aliased as `list_scale` to match the `array_X` / `list_X` 
precedent in this crate.
   
   ## What changes are included in this PR?
   
   - New scalar UDF `array_scale(array, scalar)` in 
`datafusion/functions-nested/src/array_scale.rs`
   - Module wire-up + registration in `datafusion/functions-nested/src/lib.rs`
   - SLT tests at `datafusion/sqllogictest/test_files/array_scale.slt`
   - Auto-generated function docs entry in 
`docs/source/user-guide/sql/scalar_functions.md`
   
   **Signature:** first arg `List/LargeList/FixedSizeList<numeric>`, second arg 
numeric scalar. Both coerce to `Float64`. Same list-widening rules as the 
binary-op siblings.
   
   **NULL semantics:**
   - NULL row in array → NULL row out
   - NULL scalar → NULL row out (whole-row, because the scalar applies 
uniformly)
   - NULL element at position \`i\` → NULL element at \`i\` out (per-element 
propagation)
   - Empty array → empty array
   
   **Builders:** uses \`OffsetBufferBuilder\` + \`NullBufferBuilder\` per the 
pattern adopted in the round-1 review of #22013.
   
   ## Are these changes tested?
   
   Yes. \`array_scale.slt\` covers:
   - Happy paths (positive, negative, zero, fractional, single-element)
   - NULL propagation at all three levels (NULL row, NULL scalar, NULL element)
   - All list type variants (\`List\`, \`LargeList\`, \`FixedSizeList\`)
   - Numeric inner type coercion (Float32, Int64, integer literals)
   - Multi-row queries with both constant-scalar broadcast and per-row column 
scalar
   - Error paths (non-numeric scalar, non-list first arg, wrong arity)
   - Empty array
   - \`list_scale\` alias
   
   ## Are there any user-facing changes?
   
   Yes — new SQL scalar function \`array_scale(array, scalar)\` and its alias 
\`list_scale\`. Documented in 
\`docs/source/user-guide/sql/scalar_functions.md\`.


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