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

minor: format table result vec & remove some unnecessary semicolons #2425

Merged
merged 1 commit into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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