alamb commented on code in PR #5611:
URL: https://github.com/apache/arrow-datafusion/pull/5611#discussion_r1138735683
##########
datafusion/sql/tests/integration_test.rs:
##########
@@ -3252,6 +3252,17 @@ fn test_select_distinct_order_by() {
assert_eq!(err.to_string(), expected);
}
+#[test]
+fn select_order_by_with_cast() {
Review Comment:
I verified this test fails without the change in this PR 👍
---- select_order_by_with_cast stdout ----
thread 'select_order_by_with_cast' panicked at 'assertion failed: `(left ==
right)`
left: `"Sort: first_name AS first_name ASC NULLS LAST\n Projection:
first_name AS first_name\n Projection: person.first_name AS first_name\n
TableScan: person"`,
right: `"Sort: CAST(first_name AS first_name AS Int32) ASC NULLS LAST\n
Projection: first_name AS first_name\n Projection: person.first_name AS
first_name\n TableScan: person"`',
datafusion/sql/tests/integration_test.rs:2433:5
##########
datafusion/expr/src/expr_rewriter/order_by.rs:
##########
@@ -116,7 +116,19 @@ fn rewrite_in_terms_of_projection(
// look for the column named the same as this expr
if let Some(found) = proj_exprs.iter().find(|a|
expr_match(&search_col, a)) {
- return Ok((*found).clone());
+ let found = found.clone();
Review Comment:
Yes I agree this is non ideal -- however I can't think of anything better
--
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]