Skip to content

Conversation

@jonahgao
Copy link
Member

Which issue does this PR close?

None

Rationale for this change

The nullability of the between expression not only depends on the subexpression but may also depend on the low or high expression.

For example

DataFusion CLI v27.0.0

❯ select 1 between null and 2;
+------------------------------------+
| Int64(1) BETWEEN NULL AND Int64(2) |
+------------------------------------+
|                                    |
+------------------------------------+

❯ select 1 between 1 and null;
+------------------------------------+
| Int64(1) BETWEEN Int64(1) AND NULL |
+------------------------------------+
|                                    |
+------------------------------------+

What changes are included in this PR?

fix incorrect nullability of between expr

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions github-actions bot added the logical-expr Logical plan and expressions label Jun 28, 2023
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jonahgao - this makes sense to me


Expr::Between(Between {
expr, low, high, ..
}) => Ok(expr.nullable(input_schema)?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@jackwener jackwener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, thank you @jonahgao

@jackwener jackwener merged commit 06e22a5 into apache:main Jun 29, 2023
@jonahgao jonahgao deleted the between_nullability branch June 29, 2023 04:32
yukkit pushed a commit to cnosdb/arrow-datafusion that referenced this pull request Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

logical-expr Logical plan and expressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants