Skip to content
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

Return errors properly from RepartitionExec #521

Merged
merged 1 commit into from Jun 10, 2021

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Jun 7, 2021

Which issue does this PR close?

Closes #437

Rationale for this change

Errors should be returned rather than incorrect results (empty stream). This bug threw me for a loop while debugging something in IOx. See more details on #437

Also, since this operator gets added automatically by the repartition operator, it is likely to affect many/most plans in DataFusion

What changes are included in this PR?

Properly propagate errors from input, and tests for same

Ok(())
});

// In a separate task, wait for each input to be done
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the actual code change (to check for return value in another task). Otherwise the rest of this PR is tests

@@ -308,6 +310,45 @@ impl RepartitionExec {
send_time_nanos: SQLMetric::time_nanos(),
})
}

/// Waits for `input_task` which is consuming one of the inputs to
Copy link
Contributor

@tustvold tustvold Jun 7, 2021

Choose a reason for hiding this comment

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

I wonder if it might be slightly clearer to push the body of the main task into a fallible function, and to then handle propagating any error it returns within the spawned task? i.e. rather than propagating the error through the JoinHandle, make the task that is spawned onto tokio infallible and handle its errors internally??

Edit: I guess the advantage with this approach would be that you could propagate panics as well...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree the approach you describe would be clearer (and avoid needing a separate task) 👍

The reason I did not pull the main body out into its own function was mostly "trying to keep the diff small" (or perhaps my own laziness wanting to avoid having to figure out all the types of the arguments that got captured),

Perhaps that would be a good follow on PR (there is a lot of messiness / duplication for updating counters which I would also kind of like to fix too)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in #538

@codecov-commenter
Copy link

Codecov Report

Merging #521 (76a1d96) into master (767eeb0) will increase coverage by 0.01%.
The diff coverage is 80.17%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #521      +/-   ##
==========================================
+ Coverage   76.07%   76.09%   +0.01%     
==========================================
  Files         156      156              
  Lines       26750    26858     +108     
==========================================
+ Hits        20351    20438      +87     
- Misses       6399     6420      +21     
Impacted Files Coverage Δ
datafusion/src/test/exec.rs 71.21% <65.21%> (-13.79%) ⬇️
datafusion/src/physical_plan/repartition.rs 84.48% <90.00%> (+2.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 767eeb0...76a1d96. Read the comment docs.

@alamb alamb requested review from andygrove and Dandandan June 8, 2021 21:34
@alamb alamb force-pushed the alamb/repartition_swallows_errors branch from 76a1d96 to fda9122 Compare June 9, 2021 18:27
@alamb
Copy link
Contributor Author

alamb commented Jun 9, 2021

Rebased

@alamb alamb merged commit 8f84564 into apache:master Jun 10, 2021
@alamb alamb deleted the alamb/repartition_swallows_errors branch June 10, 2021 14:52
@houqp houqp added bug Something isn't working datafusion Changes in the datafusion crate labels Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datafusion Changes in the datafusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RepartitionExec produces no output if the input stream errors
5 participants