Skip to content

Commit

Permalink
minor: format table result vec & remove unnecessary semicolon (#2425)
Browse files Browse the repository at this point in the history
  • Loading branch information
WinkerDu authored May 3, 2022
1 parent 55fce43 commit 87940f7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions datafusion-examples/examples/simple_udaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl Accumulator for GeometricMean {
fn update_batch(&mut self, values: &[ArrayRef]) -> Result<()> {
if values.is_empty() {
return Ok(());
};
}
(0..values[0].len()).try_for_each(|index| {
let v = values
.iter()
Expand All @@ -143,7 +143,7 @@ impl Accumulator for GeometricMean {
fn merge_batch(&mut self, states: &[ArrayRef]) -> Result<()> {
if states.is_empty() {
return Ok(());
};
}
(0..states[0].len()).try_for_each(|index| {
let v = states
.iter()
Expand Down
9 changes: 8 additions & 1 deletion datafusion/core/tests/sql/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,14 @@ async fn nested_subquery() -> Result<()> {
) foo";
let actual = execute_to_batches(&ctx, sql).await;
// the purpose of this test is just to make sure the query produces a valid plan
let expected = vec!["+-----+", "| cnt |", "+-----+", "| 0 |", "+-----+"];
#[rustfmt::skip]
let expected = vec![
"+-----+",
"| cnt |",
"+-----+",
"| 0 |",
"+-----+"
];
assert_batches_eq!(expected, &actual);
Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl Accumulator for ApproxPercentileAccumulator {
fn merge_batch(&mut self, states: &[ArrayRef]) -> Result<()> {
if states.is_empty() {
return Ok(());
};
}

let states = (0..states[0].len())
.map(|index| {
Expand Down
4 changes: 2 additions & 2 deletions datafusion/physical-expr/src/aggregate/array_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl Accumulator for ArrayAggAccumulator {
fn update_batch(&mut self, values: &[ArrayRef]) -> Result<()> {
if values.is_empty() {
return Ok(());
};
}
assert!(values.len() == 1, "array_agg can only take 1 param!");
let arr = &values[0];
(0..arr.len()).try_for_each(|index| {
Expand All @@ -127,7 +127,7 @@ impl Accumulator for ArrayAggAccumulator {
fn merge_batch(&mut self, states: &[ArrayRef]) -> Result<()> {
if states.is_empty() {
return Ok(());
};
}
assert!(states.len() == 1, "array_agg states must be singleton!");
let arr = &states[0];
(0..arr.len()).try_for_each(|index| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl Accumulator for DistinctArrayAggAccumulator {
fn merge_batch(&mut self, states: &[ArrayRef]) -> Result<()> {
if states.is_empty() {
return Ok(());
};
}

for array in states {
for j in 0..array.len() {
Expand Down
4 changes: 2 additions & 2 deletions datafusion/physical-expr/src/aggregate/count_distinct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl Accumulator for DistinctCountAccumulator {
fn update_batch(&mut self, values: &[ArrayRef]) -> Result<()> {
if values.is_empty() {
return Ok(());
};
}
(0..values[0].len()).try_for_each(|index| {
let v = values
.iter()
Expand All @@ -175,7 +175,7 @@ impl Accumulator for DistinctCountAccumulator {
fn merge_batch(&mut self, states: &[ArrayRef]) -> Result<()> {
if states.is_empty() {
return Ok(());
};
}
(0..states[0].len()).try_for_each(|index| {
let v = states
.iter()
Expand Down

0 comments on commit 87940f7

Please sign in to comment.