Skip to content

Conversation

@sarahyurick
Copy link
Contributor

Which issue does this PR close?

Closes #3268

Rationale for this change

Hi @andygrove, let me know if this is what you were thinking.

@github-actions github-actions bot added core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules sql SQL Planner labels Aug 26, 2022
@andygrove
Copy link
Member

Thanks @sarahyurick this looks good so far. I created a PR against your branch to fix the protobuf part.

https://github.com/sarahyurick/arrow-datafusion/pull/1/files

@sarahyurick
Copy link
Contributor Author

Awesome, thanks!

@andygrove
Copy link
Member

The final piece here is to update the SQL query planner (datafusion/sql/src/planner.rs) so that we map the SQL expressions to these new Logical Plan expressions instead of to IsDistinctFrom as in:

            SQLExpr::IsTrue(expr) => Ok(Expr::BinaryExpr {
                left: Box::new(self.sql_expr_to_logical_expr(*expr, schema, ctes)?),
                op: Operator::IsNotDistinctFrom,
                right: Box::new(lit(true)),
            }),

@andygrove
Copy link
Member

Actually, one other thing will be to map these new Expr to the same physical plan as Is[Not]DistinctFrom in the physical planner:

  Operator::IsDistinctFrom => {
                match (left_data_type, right_data_type) {
                    // exchange lhs and rhs when lhs is Null, since `binary_array_op` is
                    // always try to down cast array according to $LEFT expression.
                    (DataType::Null, _) => {
                        binary_array_op!(right, left, is_distinct_from)
                    }
                    _ => binary_array_op!(left, right, is_distinct_from),
                }
            }

@andygrove
Copy link
Member

andygrove commented Aug 29, 2022

On second thoughts, let's handle the physical plan side of this as a follow on PR. I filed #3288 to track this.

Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

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

Thanks @sarahyurick. Let's go ahead and merge this and then we can follow up with integrating with the SQL query planner and the physical plan.

@andygrove andygrove merged commit a32c408 into apache:master Aug 30, 2022
@ursabot
Copy link

ursabot commented Aug 30, 2022

Benchmark runs are scheduled for baseline = fb2f0db and contender = a32c408. a32c408 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api change Changes the API exposed to users of the crate core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules sql SQL Planner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce Expr variants for IS [NOT] TRUE / FALSE / UNKNOWN

3 participants