edubraqd commented on code in PR #24916:
URL: https://github.com/apache/datafusion/pull/24916#discussion_r4015105258
##########
datafusion/optimizer/src/analyzer/type_coercion.rs:
##########
@@ -1099,7 +1099,9 @@ fn coerce_frame_bound(
}
}
-fn extract_window_frame_target_type(col_type: &DataType) -> Result<DataType> {
+/// The type that RANGE frame offsets are coerced to for an ORDER BY column of
+/// `col_type`, or `None` if the type does not support RANGE frames.
Review Comment:
Right, `is_nested()` was the wrong predicate. Done in 3c5ef2e.
The guard now mirrors what `compare_op` in arrow-ord does: unwrap one
run-end-encoded layer, then one dictionary layer, and accept only if what is
left is a flat type. That is `list_element_comparable`, and `is_list_of_nested`
became `is_list_of_uncomparable` on top of it. So `List<Dictionary<Int32,
Dictionary<Int8, Utf8>>>`, `List<Dictionary<REE<..>>>` and `List<REE<REE<..>>>`
are rejected at planning, while `List<Dictionary<Utf8>>` and
`List<REE<Dictionary<Utf8>>>` still pass, matching the kernels.
Tests:
- a unit test in `type_coercion.rs` over the accepted and rejected element
types (flat, one encoding layer, nested, two encoding layers);
- two `window.slt` cases: `ORDER BY d, l` with `l` a list of doubly
dictionary-encoded strings is a planning error, and the same with a single
dictionary layer runs.
Side note from reading the kernel: for a `Dictionary<Dictionary<..>>`
element `compare_op` does not return an error, it reaches the `unreachable!()`
arm of `downcast_primitive_array!` after the single unwrap. That is an arrow-rs
matter; I will open an issue there separately, it does not change this PR.
--
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]