Repository navigation
feat: support for AnyExpression #2549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,6 +99,15 @@ pub enum Expr { | |
| /// Right-hand side of the expression | ||
| right: Box<Expr>, | ||
| }, | ||
| /// A binary expression such as "age > 21" | ||
| AnyExpr { | ||
| /// Left-hand side of the expression | ||
| left: Box<Expr>, | ||
| /// The comparison operator | ||
| op: Operator, | ||
| /// Right-hand side of the expression | ||
| right: Box<Expr>, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm guessing supporting an arbitrary subquery here is a future extension?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The definition of |
||
| }, | ||
| /// Negation of an expression. The expression's type must be a boolean to make sense. | ||
| Not(Box<Expr>), | ||
| /// Whether an expression is not Null. This expression is never null. | ||
|
|
@@ -302,6 +311,7 @@ impl Expr { | |
| Expr::AggregateUDF { .. } => "AggregateUDF", | ||
| Expr::Alias(..) => "Alias", | ||
| Expr::Between { .. } => "Between", | ||
| Expr::AnyExpr { .. } => "AnyExpr", | ||
| Expr::BinaryExpr { .. } => "BinaryExpr", | ||
| Expr::Case { .. } => "Case", | ||
| Expr::Cast { .. } => "Cast", | ||
|
|
@@ -524,6 +534,9 @@ impl fmt::Debug for Expr { | |
| Expr::BinaryExpr { left, op, right } => { | ||
| write!(f, "{:?} {} {:?}", left, op, right) | ||
| } | ||
| Expr::AnyExpr { left, op, right } => { | ||
| write!(f, "{:?} {} ANY({:?})", left, op, right) | ||
| } | ||
| Expr::Sort { | ||
| expr, | ||
| asc, | ||
|
|
@@ -707,6 +720,11 @@ fn create_name(e: &Expr, input_schema: &DFSchema) -> Result<String> { | |
| let right = create_name(right, input_schema)?; | ||
| Ok(format!("{} {} {}", left, op, right)) | ||
| } | ||
| Expr::AnyExpr { left, op, right } => { | ||
| let left = create_name(left, input_schema)?; | ||
| let right = create_name(right, input_schema)?; | ||
| Ok(format!("{} {} ANY({})", left, op, right)) | ||
| } | ||
| Expr::Case { | ||
| expr, | ||
| when_then_expr, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth testing what happens if
NULLis in the list?