Omkar-Wagholikar commented on code in PR #27544:
URL: https://github.com/apache/datafusion/pull/27544#discussion_r4677672941
##########
datafusion/optimizer/src/rewrite_set_comparison.rs:
##########
@@ -105,53 +107,50 @@ fn build_set_comparison_subquery(
Box::new(right_expr),
));
- let true_exists =
- exists_subquery(&subquery,
Expr::IsTrue(Box::new(comparison.clone())))?;
- let null_exists =
- exists_subquery(&subquery,
Expr::IsNull(Box::new(comparison.clone())))?;
-
- let result_expr = match quantifier {
- SetQuantifier::Any => Expr::Case(expr::Case {
- expr: None,
- when_then_expr: vec![
- (Box::new(true_exists), Box::new(lit(true))),
- (
- Box::new(null_exists),
- Box::new(Expr::Literal(ScalarValue::Boolean(None), None)),
- ),
- ],
- else_expr: Some(Box::new(lit(false))),
- }),
- SetQuantifier::All => {
- let false_exists =
- exists_subquery(&subquery,
Expr::IsFalse(Box::new(comparison.clone())))?;
- Expr::Case(expr::Case {
- expr: None,
- when_then_expr: vec![
- (Box::new(false_exists), Box::new(lit(false))),
- (
- Box::new(null_exists),
- Box::new(Expr::Literal(ScalarValue::Boolean(None),
None)),
- ),
- ],
- else_expr: Some(Box::new(lit(true))),
- })
- }
+ let Subquery {
+ subquery: plan,
+ spans,
+ ..
+ } = subquery;
+ let null_exists = exists_subquery(
+ plan.as_ref().clone(),
Review Comment:
I addressed this in the following commit. exists_subquery now takes
Arc<LogicalPlan>. The first call passes Arc::clone(&plan), and the second moves
plan
--
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]