-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
derive(Debug)
for Expr
#6708
derive(Debug)
for Expr
#6708
Conversation
So I had a quick look at the outputs: I think the changes to the sqllogictests (e.g. |
Ok
Case 2 I find the reason. I will update right now. |
@@ -1040,7 +1040,7 @@ mod test { | |||
let empty = empty_with_type(DataType::Int64); | |||
let plan = LogicalPlan::Projection(Projection::try_new(vec![expr], empty)?); | |||
let expected = | |||
"Projection: a IN ([CAST(Int32(1) AS Int64), CAST(Int8(4) AS Int64), Int64(8)]) AS a IN (Map { iter: Iter([Int32(1), Int8(4), Int64(8)]) })\ | |||
"Projection: a IN ([CAST(Int32(1) AS Int64), CAST(Int8(4) AS Int64), Int64(8)]) AS a IN (Map { iter: Iter([Literal(Int32(1)), Literal(Int8(4)), Literal(Int64(8))]) })\ | |||
\n EmptyRelation"; |
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.
I think this test case should not change, but current I failed to past this test case.
When I change the code 0ef94 to use Display
I got failed by Projection: a IN ([CAST(Int32(1) AS Int64), CAST(Int8(4) AS Int64), Int64(8)])
missing Alias
.
I current could not find a good way to solve it.
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.
Which alias?
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.
AS a IN (Map { iter: Iter([Int32(1), Int8(4), Int64(8)]) })\
is missing,I debug find it's a alias.
|
||
let expected = match join_type { | ||
// Should include 3 RepartitionExecs | ||
JoinType::Inner | JoinType::Left | JoinType::LeftSemi | JoinType::LeftAnti => vec![ | ||
top_join_plan.as_str(), | ||
join_plan.as_str(), | ||
"RepartitionExec: partitioning=Hash([Column { name: \"a\", index: 0 }], 10), input_partitions=1", | ||
"RepartitionExec: partitioning=Hash([a@0], 10), input_partitions=1", |
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.
this certainly looks nicer 👍
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.
Thank you @parkma99 -- this is looking great and is very appreciated.
I can try and help with the formatting tomorrow if you are still having problems
@@ -79,7 +79,7 @@ use std::sync::Arc; | |||
/// assert_eq!(binary_expr.op, Operator::Eq); | |||
/// } | |||
/// ``` | |||
#[derive(Clone, PartialEq, Eq, Hash)] | |||
#[derive(Clone, PartialEq, Eq, Hash, Debug)] |
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.
❤️
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
write!(f, "{self:?}") | ||
} | ||
#[macro_export] |
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.
Given how common this functionality is I wonder if we could move this macro (or maybe make a function as I don't see any benefit in making it a macro) in datafusion_util
and use it more around the codebase.
Just a thought
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.
I think making a function and moving to datafusin_util
is a good option.
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.
I can give it a try maybe after this PR is merged
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.
I tried #6739 -- it isn't great -- any thoughts appreciated
Hello @alamb , I would like to pass all tests in my local machine, but got some error.
When I run command
ProductName: macOS
|
That looks like you either have to increase your ulimit to increase the number of open files, or perhaps you can reduce the parallelism of the tests: $ cargo test -- --test-threads=1 |
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.
This looks awesome @parkma99 -- thank you so much for making it happen
It is a big step forward for DataFusion usability I think
------------AggregateExec: mode=Partial, gby=[cntrycode@0 as cntrycode], aggr=[COUNT(UInt8(1)), SUM(custsale.c_acctbal)] | ||
--------------ProjectionExec: expr=[substr(c_phone@0, 1, 2) as cntrycode, c_acctbal@1 as c_acctbal] | ||
----------------NestedLoopJoinExec: join_type=Inner, filter=BinaryExpr { left: CastExpr { expr: Column { name: "c_acctbal", index: 0 }, cast_type: Decimal128(19, 6), cast_options: CastOptions { safe: false, format_options: FormatOptions { safe: true, null: "", date_format: None, datetime_format: None, timestamp_format: None, timestamp_tz_format: None, time_format: None } } }, op: Gt, right: Column { name: "AVG(customer.c_acctbal)", index: 1 } } | ||
----------------NestedLoopJoinExec: join_type=Inner, filter=CAST(c_acctbal@0 AS Decimal128(19, 6)) > AVG(customer.c_acctbal)@1 |
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.
this is really much nicer 👍
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
write!(f, "{self:?}") | ||
} | ||
#[macro_export] |
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.
I can give it a try maybe after this PR is merged
Which issue does this PR close?
Closes #6677
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?