Copilot commented on code in PR #26215:
URL: https://github.com/apache/datafusion/pull/26215#discussion_r4244196857
##########
datafusion/physical-plan/src/sorts/cursor.rs:
##########
@@ -946,4 +968,28 @@ mod tests {
b.advance();
assert_eq!(a.cmp(&b), Ordering::Less);
}
+
+ /// Verifies the `ArrayValues::has_nulls` fast path is actually taken
+ /// (all null-free cursors) and produces the same ordering as the
+ /// null-aware slow path.
+ #[test]
+ fn test_array_values_has_nulls_fast_path_agrees_with_slow_path() {
+ let options = SortOptions {
+ descending: false,
+ nulls_first: false,
+ };
+
+ // Two null-free cursors -- compare takes the has_nulls fast path.
+ let a = new_primitive(options, ScalarBuffer::from(vec![1i32, 2, 3,
4]), 0);
+ let b = new_primitive(options, ScalarBuffer::from(vec![2i32, 3, 4,
5]), 0);
+ assert!(!a.values.has_nulls);
+ assert!(!b.values.has_nulls);
+ assert_eq!(a.cmp(&b), Ordering::Less);
+
+ // A null-containing cursor forces the slow (null-aware) path, and the
+ // two paths must agree.
+ let c = new_primitive(options, ScalarBuffer::from(vec![i32::MAX, 3i32,
4]), 1);
+ assert!(c.values.has_nulls);
+ assert_eq!(a.cmp(&c), Ordering::Less);
Review Comment:
This test does not currently establish the claimed equivalence: the fast
path compares `1` with `2`, while the slow path compares `1` with `i32::MAX`,
and `descending` is always false. It also never exercises the newly added `eq`
or `eq_to_previous` fast paths. In particular, changing the fast-path
descending behavior would not fail this test as the PR description claims.
Please compare identical logical values through both paths and cover both sort
directions and all three methods.
--
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]