You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Jefffrey (via GitHub)" <gi...@apache.org> on 2025/11/15 09:51:55 UTC
Re: [PR] minor: refactor with `assert_or_internal_err!()` in `datafusion/physical-plan` [datafusion]
Jefffrey commented on code in PR #18730:
URL: https://github.com/apache/datafusion/pull/18730#discussion_r2529737248
##########
datafusion/physical-plan/src/joins/hash_join/exec.rs:
##########
@@ -912,16 +913,19 @@ impl ExecutionPlan for HashJoinExec {
let left_partitions = self.left.output_partitioning().partition_count();
let right_partitions = self.right.output_partitioning().partition_count();
- if self.mode == PartitionMode::Partitioned && left_partitions != right_partitions
- {
- return internal_err!(
+ if self.mode == PartitionMode::Partitioned {
+ assert_eq_or_internal_err!(
Review Comment:
If we're gonna do this refactor we should refactor this entire `if` statement away, instead of only moving half the condition inside it
##########
datafusion/physical-plan/src/test.rs:
##########
@@ -317,12 +318,13 @@ impl TestMemoryExec {
.map(|field| field.name() != col.name())
.unwrap_or(true)
});
- if let Some(col) = ambiguous_column {
- return internal_err!(
- "Column {:?} is not found in the original schema of the TestMemoryExec",
- col
- );
- }
+ assert_or_internal_err!(
+ ambiguous_column.is_none(),
+ "Column {:?} is not found in the original schema of the TestMemoryExec",
+ ambiguous_column
+ .as_ref()
+ .expect("checked by assert_or_internal_err!")
Review Comment:
Just unwrap it, expect here adds unnecessary noise
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org