waynexia commented on code in PR #5542:
URL: https://github.com/apache/arrow-datafusion/pull/5542#discussion_r1133214777


##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -390,6 +390,22 @@ impl<'a, S: SimplifyInfo> ExprRewriter for Simplifier<'a, 
S> {
                 lit(negated)
             }
 
+            // expr IN ((subquery)) -> expr IN (subquery), see ##5529
+            Expr::InList {
+                expr,
+                mut list,
+                negated,
+            } if list.len() == 1
+                && matches!(list.first(), Some(Expr::ScalarSubquery { .. })) =>
+            {
+                let Expr::ScalarSubquery(subquery) = list.remove(0) else { 
unreachable!() };

Review Comment:
   The condition in L399 ensures that only `ScalarSubquery` is allowed, making 
other branches unreachable. Although there is an unstable [rust 
feature](https://github.com/rust-lang/rust/issues/51114) available to simplify 
this, it cannot be used at the moment.



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

Reply via email to