crm26 commented on PR #21542:
URL: https://github.com/apache/datafusion/pull/21542#issuecomment-4282697574

   Thanks @Jefffrey. Round-3 pushed in ce312cc00:
   
   **1. Mixed-type inputs** (`cosine_distance.rs:100`)
   Adopted the pattern from #21704: `coerce_types` now inspects the inputs, and 
when any is `LargeList`, widens both to `LargeList`. `FixedSizeList` is already 
normalized to `List` via `FixedSizedListToList` and then widened if needed. Our 
return type is scalar `Float64` so we inspect the inputs (not `return_type`) to 
detect promotion. After widening, the dispatch in `cosine_distance_inner` only 
ever sees homogeneous pairs — the fallthrough arm is unreachable, so I switched 
it from `exec_err!` to `internal_err!`.
   
   **2. `list_cosine_distance` alias** (`cosine_distance.rs:82`)
   Dropped. The base name isn't `array_cosine_distance`, so the `array_X` → 
`list_X` swap convention doesn't apply. Removed the alias field, 
initialization, and `aliases()` method. `scalar_functions.md` regenerated via 
`./dev/update_function_docs.sh` shows the clean 9-line removal.
   
   **3. Bare NULL input** (`cosine_distance.slt:46`)
   Handled in `coerce_types` — when an input is `Null`, it's coerced to a 
matching list variant of `Float64`. At runtime, the Arrow cast produces an 
all-null list array; `list_array.is_null(row)` is true; the builder appends 
null. `select cosine_distance(NULL, [1.0, 2.0])` now returns `NULL` instead of 
erroring.
   
   **4. Multi-row NULL coverage** (`cosine_distance.slt:88`)
   Applied your suggestion block verbatim — added `(make_array(1.0, 0.0), 
NULL)` to the multi-row VALUES with expected `NULL` at the bottom.
   
   **Additional SLT coverage added proactively:**
   - Mixed `(List, LargeList)` in both orders
   - `(FixedSizeList, FixedSizeList)` and `(FixedSizeList, LargeList)` mixed
   - Float32 and explicit Int64 inner types (coerced to Float64)
   - Bare NULL in each position and both positions
   - Unsupported non-list input (`cosine_distance(1, 2)`) plan-error case
   
   Full validation run clean (fmt, clippy, full + sqlite-extended SLT, CLI, 
doctests, feature-flag checks, `extended_tests` workspace build, rustdoc, 
license, typos, machete, generated-doc regen). Ready for another look.
   


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