-
Notifications
You must be signed in to change notification settings - Fork 1.5k
refactor: replace unwrap_or
with unwrap_or_else
for improved lazy…
#15841
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
Conversation
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 @NevroHelios , I triggered the CI, will review after ci passes
Thanks for your update @xudong963. I noticed a few checks have failed. I will look into the issues and push the updates shortly. |
…`unwrap_or_else` for better lazy evaluation
Hi @xudong963 |
This PR seems to have some CI failures Please mark it as ready for review when it is ready for another look |
Thank you for this PR @NevroHelios |
Hi @alamb, apologies for the delay, I had exams recently. I've run the tests locally and everything looks good now. When you get a chance, could you please re-trigger the CI? Thanks! |
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.
Thanks @NevroHelios -- this looks like a good set of changes. Thank you -- let's see how the CI goes.
I had one question about one of the changes, but otherwise this looks good to me
I pushed the updates. Could you please run the ci again? @alamb |
benchmarks/src/util/options.rs
Outdated
if let Some(sort_spill_reservation_bytes) = self.sort_spill_reservation_bytes { | ||
config = | ||
config.with_sort_spill_reservation_bytes(sort_spill_reservation_bytes); |
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.
Why was the part removed?
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 agree it looks like a mistake
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.
During the copiler errors I updated this config but later I restored most parts but I believe I mistakenly overlooked these lines during the process. Thanks for points that out. I will push the updates shortly.
Hi. I pushed the updates. Could you please re run the CI? @alamb |
Is there anything else I am missing or need to add? @alamb @xudong963 |
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 @NevroHelios -- there are just a few more things (remove the use of cloned
) and this will be good to go
datafusion/physical-optimizer/src/enforce_sorting/replace_with_order_preserving_variants.rs
Outdated
Show resolved
Hide resolved
datafusion/physical-optimizer/src/enforce_sorting/replace_with_order_preserving_variants.rs
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
🤖 |
🤖: Benchmark completed Details
|
Hi @alamb |
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 @NevroHelios -- this now looks good to me. Thank you for sticking with it
.output_ordering() | ||
.unwrap_or(&LexOrdering::default()) | ||
.clone(), | ||
input.plan.output_ordering().cloned().unwrap_or_default(), |
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.
the original code clones the output ordering too so this looks equivalent to me
Thank you very much @NevroHelios |
… evaluation
Which issue does this PR close?
Eliminate the function call in xxx_or (e.g. unwrap_or("".to_string()) #15802
xxx_or (e.g. unwrap_or("".to_string())
#15802Rationale for this change
As per the issue explained I updated the function call
unwrap_or
withunwrap_or_else
Are these changes tested?
I build and tested the code locally with
cargo build --workspace -j1
andcargo test --workspace -j1
@xudong963