Skip to content

Commit b9e2aa7

Browse files
committed
fix: formatting in datafusion/ directory
1 parent e9e76a6 commit b9e2aa7

File tree

23 files changed

+62
-133
lines changed

23 files changed

+62
-133
lines changed

datafusion-examples/examples/planner_api.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ async fn to_physical_plan_step_by_step_demo(
104104
&ctx.state(),
105105
|_, _| (),
106106
)?;
107-
println!(
108-
"Optimized logical plan:\n\n{optimized_logical_plan:?}\n\n"
109-
);
107+
println!("Optimized logical plan:\n\n{optimized_logical_plan:?}\n\n");
110108

111109
// Create the physical plan
112110
let physical_plan = ctx

datafusion/core/src/datasource/file_format/csv.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,10 +1145,7 @@ mod tests {
11451145

11461146
fn csv_line(line_number: usize) -> Bytes {
11471147
let (int_value, float_value, bool_value, char_value) = csv_values(line_number);
1148-
format!(
1149-
"{int_value},{float_value},{bool_value},{char_value}\n"
1150-
)
1151-
.into()
1148+
format!("{int_value},{float_value},{bool_value},{char_value}\n").into()
11521149
}
11531150

11541151
fn csv_values(line_number: usize) -> (i32, f64, bool, String) {

datafusion/core/tests/fuzz_cases/aggregation_fuzzer/fuzzer.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,7 @@ impl AggregationFuzzer {
197197
while let Some(join_handle) = join_set.join_next().await {
198198
// propagate errors
199199
join_handle.map_err(|e| {
200-
DataFusionError::Internal(format!(
201-
"AggregationFuzzer task error: {e:?}"
202-
))
200+
DataFusionError::Internal(format!("AggregationFuzzer task error: {e:?}"))
203201
})??;
204202
}
205203
Ok(())

datafusion/core/tests/fuzz_cases/sort_query_fuzz.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,9 +524,7 @@ impl SortFuzzerTestGenerator {
524524
println!(" Number of partitions: {num_partitions}");
525525
println!(" Batch size: {}", init_state.approx_batch_num_rows / 2);
526526
println!(" Memory limit: {memory_limit_str}");
527-
println!(
528-
" Per partition memory limit: {per_partition_limit_str}"
529-
);
527+
println!(" Per partition memory limit: {per_partition_limit_str}");
530528
println!(
531529
" Sort spill reservation bytes: {}",
532530
human_readable_size(sort_spill_reservation_bytes)

datafusion/datasource-parquet/src/file_format.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,9 +1136,8 @@ impl FileSink for ParquetSink {
11361136
parquet_props.clone(),
11371137
)
11381138
.await?;
1139-
let mut reservation =
1140-
MemoryConsumer::new(format!("ParquetSink[{path}]"))
1141-
.register(context.memory_pool());
1139+
let mut reservation = MemoryConsumer::new(format!("ParquetSink[{path}]"))
1140+
.register(context.memory_pool());
11421141
file_write_tasks.spawn(async move {
11431142
while let Some(batch) = rx.recv().await {
11441143
writer.write(&batch).await?;

datafusion/datasource/src/file_scan_config.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2498,9 +2498,7 @@ mod tests {
24982498
avg_files_per_partition
24992499
);
25002500

2501-
println!(
2502-
"Distribution - min files: {min_size}, max files: {max_size}"
2503-
);
2501+
println!("Distribution - min files: {min_size}, max files: {max_size}");
25042502
}
25052503
}
25062504

datafusion/datasource/src/memory.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,7 @@ impl DataSource for MemorySourceConfig {
399399
let output_ordering = self
400400
.sort_information
401401
.first()
402-
.map(|output_ordering| {
403-
format!(", output_ordering={output_ordering}")
404-
})
402+
.map(|output_ordering| format!(", output_ordering={output_ordering}"))
405403
.unwrap_or_default();
406404

407405
let eq_properties = self.eq_properties();

datafusion/doc/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ impl Documentation {
148148
// Related UDFs
149149
if let Some(related_udf) = self.related_udfs.clone() {
150150
related_udf.iter().for_each(|udf| {
151-
result
152-
.push_str(format!("\n related_udf(name = \"{udf}\"),").as_ref());
151+
result.push_str(format!("\n related_udf(name = \"{udf}\"),").as_ref());
153152
});
154153
}
155154

datafusion/expr/src/logical_plan/plan.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5280,11 +5280,7 @@ digraph {
52805280
)?;
52815281

52825282
let fields = join.schema.fields();
5283-
assert_eq!(
5284-
fields.len(),
5285-
6,
5286-
"Expected 6 fields for {join_type:?} join"
5287-
);
5283+
assert_eq!(fields.len(), 6, "Expected 6 fields for {join_type:?} join");
52885284

52895285
for (i, field) in fields.iter().enumerate() {
52905286
let expected_nullable = match (i, &join_type) {

datafusion/functions/benches/lower.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -151,20 +151,17 @@ fn criterion_benchmark(c: &mut Criterion) {
151151
.collect::<Vec<_>>();
152152
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
153153

154-
c.bench_function(
155-
&format!("lower_the_first_value_is_nonascii: {size}"),
156-
|b| {
157-
b.iter(|| {
158-
let args_cloned = args.clone();
159-
black_box(lower.invoke_with_args(ScalarFunctionArgs {
160-
args: args_cloned,
161-
arg_fields: arg_fields.clone(),
162-
number_rows: size,
163-
return_field: &Field::new("f", DataType::Utf8, true),
164-
}))
165-
})
166-
},
167-
);
154+
c.bench_function(&format!("lower_the_first_value_is_nonascii: {size}"), |b| {
155+
b.iter(|| {
156+
let args_cloned = args.clone();
157+
black_box(lower.invoke_with_args(ScalarFunctionArgs {
158+
args: args_cloned,
159+
arg_fields: arg_fields.clone(),
160+
number_rows: size,
161+
return_field: &Field::new("f", DataType::Utf8, true),
162+
}))
163+
})
164+
});
168165

169166
let args = create_args3(size);
170167
let arg_fields_owned = args

datafusion/functions/benches/repeat.rs

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,7 @@ fn criterion_benchmark(c: &mut Criterion) {
8787

8888
let args = create_args::<i32>(size, 32, repeat_times, true);
8989
group.bench_function(
90-
format!(
91-
"repeat_string_view [size={size}, repeat_times={repeat_times}]"
92-
),
90+
format!("repeat_string_view [size={size}, repeat_times={repeat_times}]"),
9391
|b| {
9492
b.iter(|| {
9593
let args_cloned = args.clone();
@@ -100,9 +98,7 @@ fn criterion_benchmark(c: &mut Criterion) {
10098

10199
let args = create_args::<i32>(size, 32, repeat_times, false);
102100
group.bench_function(
103-
format!(
104-
"repeat_string [size={size}, repeat_times={repeat_times}]"
105-
),
101+
format!("repeat_string [size={size}, repeat_times={repeat_times}]"),
106102
|b| {
107103
b.iter(|| {
108104
let args_cloned = args.clone();
@@ -113,9 +109,7 @@ fn criterion_benchmark(c: &mut Criterion) {
113109

114110
let args = create_args::<i64>(size, 32, repeat_times, false);
115111
group.bench_function(
116-
format!(
117-
"repeat_large_string [size={size}, repeat_times={repeat_times}]"
118-
),
112+
format!("repeat_large_string [size={size}, repeat_times={repeat_times}]"),
119113
|b| {
120114
b.iter(|| {
121115
let args_cloned = args.clone();
@@ -135,9 +129,7 @@ fn criterion_benchmark(c: &mut Criterion) {
135129

136130
let args = create_args::<i32>(size, 32, repeat_times, true);
137131
group.bench_function(
138-
format!(
139-
"repeat_string_view [size={size}, repeat_times={repeat_times}]"
140-
),
132+
format!("repeat_string_view [size={size}, repeat_times={repeat_times}]"),
141133
|b| {
142134
b.iter(|| {
143135
let args_cloned = args.clone();
@@ -148,9 +140,7 @@ fn criterion_benchmark(c: &mut Criterion) {
148140

149141
let args = create_args::<i32>(size, 32, repeat_times, false);
150142
group.bench_function(
151-
format!(
152-
"repeat_string [size={size}, repeat_times={repeat_times}]"
153-
),
143+
format!("repeat_string [size={size}, repeat_times={repeat_times}]"),
154144
|b| {
155145
b.iter(|| {
156146
let args_cloned = args.clone();
@@ -161,9 +151,7 @@ fn criterion_benchmark(c: &mut Criterion) {
161151

162152
let args = create_args::<i64>(size, 32, repeat_times, false);
163153
group.bench_function(
164-
format!(
165-
"repeat_large_string [size={size}, repeat_times={repeat_times}]"
166-
),
154+
format!("repeat_large_string [size={size}, repeat_times={repeat_times}]"),
167155
|b| {
168156
b.iter(|| {
169157
let args_cloned = args.clone();
@@ -183,9 +171,7 @@ fn criterion_benchmark(c: &mut Criterion) {
183171

184172
let args = create_args::<i32>(size, 2, repeat_times, false);
185173
group.bench_function(
186-
format!(
187-
"repeat_string overflow [size={size}, repeat_times={repeat_times}]"
188-
),
174+
format!("repeat_string overflow [size={size}, repeat_times={repeat_times}]"),
189175
|b| {
190176
b.iter(|| {
191177
let args_cloned = args.clone();

datafusion/functions/benches/strpos.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,23 +131,20 @@ fn criterion_benchmark(c: &mut Criterion) {
131131

132132
// StringArray UTF8
133133
let args_string_utf8 = gen_string_array(n_rows, str_len, 0.1, 0.5, false);
134-
c.bench_function(
135-
&format!("strpos_StringArray_utf8_str_len_{str_len}"),
136-
|b| {
137-
b.iter(|| {
138-
black_box(strpos.invoke_with_args(ScalarFunctionArgs {
139-
args: args_string_utf8.clone(),
140-
arg_fields: vec![&Field::new(
141-
"a",
142-
args_string_utf8[0].data_type(),
143-
true,
144-
)],
145-
number_rows: n_rows,
146-
return_field: &Field::new("f", DataType::Int32, true),
147-
}))
148-
})
149-
},
150-
);
134+
c.bench_function(&format!("strpos_StringArray_utf8_str_len_{str_len}"), |b| {
135+
b.iter(|| {
136+
black_box(strpos.invoke_with_args(ScalarFunctionArgs {
137+
args: args_string_utf8.clone(),
138+
arg_fields: vec![&Field::new(
139+
"a",
140+
args_string_utf8[0].data_type(),
141+
true,
142+
)],
143+
number_rows: n_rows,
144+
return_field: &Field::new("f", DataType::Int32, true),
145+
}))
146+
})
147+
});
151148

152149
// StringViewArray ASCII only
153150
let args_string_view_ascii = gen_string_array(n_rows, str_len, 0.1, 0.0, true);

datafusion/functions/benches/substr.rs

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,9 @@ fn criterion_benchmark(c: &mut Criterion) {
131131
);
132132

133133
let args = create_args_without_count::<i32>(size, len, false, false);
134-
group.bench_function(
135-
format!("substr_string [size={size}, strlen={len}]"),
136-
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
137-
);
134+
group.bench_function(format!("substr_string [size={size}, strlen={len}]"), |b| {
135+
b.iter(|| black_box(invoke_substr_with_args(args.clone(), size)))
136+
});
138137

139138
let args = create_args_without_count::<i64>(size, len, true, false);
140139
group.bench_function(
@@ -153,25 +152,19 @@ fn criterion_benchmark(c: &mut Criterion) {
153152

154153
let args = create_args_with_count::<i32>(size, len, count, true);
155154
group.bench_function(
156-
format!(
157-
"substr_string_view [size={size}, count={count}, strlen={len}]",
158-
),
155+
format!("substr_string_view [size={size}, count={count}, strlen={len}]",),
159156
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
160157
);
161158

162159
let args = create_args_with_count::<i32>(size, len, count, false);
163160
group.bench_function(
164-
format!(
165-
"substr_string [size={size}, count={count}, strlen={len}]",
166-
),
161+
format!("substr_string [size={size}, count={count}, strlen={len}]",),
167162
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
168163
);
169164

170165
let args = create_args_with_count::<i64>(size, len, count, false);
171166
group.bench_function(
172-
format!(
173-
"substr_large_string [size={size}, count={count}, strlen={len}]",
174-
),
167+
format!("substr_large_string [size={size}, count={count}, strlen={len}]",),
175168
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
176169
);
177170

@@ -186,25 +179,19 @@ fn criterion_benchmark(c: &mut Criterion) {
186179

187180
let args = create_args_with_count::<i32>(size, len, count, true);
188181
group.bench_function(
189-
format!(
190-
"substr_string_view [size={size}, count={count}, strlen={len}]",
191-
),
182+
format!("substr_string_view [size={size}, count={count}, strlen={len}]",),
192183
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
193184
);
194185

195186
let args = create_args_with_count::<i32>(size, len, count, false);
196187
group.bench_function(
197-
format!(
198-
"substr_string [size={size}, count={count}, strlen={len}]",
199-
),
188+
format!("substr_string [size={size}, count={count}, strlen={len}]",),
200189
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
201190
);
202191

203192
let args = create_args_with_count::<i64>(size, len, count, false);
204193
group.bench_function(
205-
format!(
206-
"substr_large_string [size={size}, count={count}, strlen={len}]",
207-
),
194+
format!("substr_large_string [size={size}, count={count}, strlen={len}]",),
208195
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
209196
);
210197

datafusion/functions/src/datetime/to_date.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,7 @@ mod tests {
481481
invoke_to_date_with_args(vec![ColumnarValue::Scalar(date_scalar)], 1);
482482

483483
if let Ok(ColumnarValue::Scalar(ScalarValue::Date32(_))) = to_date_result {
484-
panic!(
485-
"Conversion of {date_str} succeeded, but should have failed, "
486-
);
484+
panic!("Conversion of {date_str} succeeded, but should have failed, ");
487485
}
488486
}
489487
}

datafusion/functions/src/regex/regexpcount.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,7 @@ fn compile_regex(regex: &str, flags: Option<&str>) -> Result<Regex, ArrowError>
582582
};
583583

584584
Regex::new(&pattern).map_err(|_| {
585-
ArrowError::ComputeError(format!(
586-
"Regular expression did not compile: {pattern}"
587-
))
585+
ArrowError::ComputeError(format!("Regular expression did not compile: {pattern}"))
588586
})
589587
}
590588

datafusion/physical-optimizer/src/pruning.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -984,9 +984,7 @@ fn build_statistics_record_batch<S: PruningStatistics>(
984984
let mut options = RecordBatchOptions::default();
985985
options.row_count = Some(statistics.num_containers());
986986

987-
trace!(
988-
"Creating statistics batch for {required_columns:#?} with {arrays:#?}"
989-
);
987+
trace!("Creating statistics batch for {required_columns:#?} with {arrays:#?}");
990988

991989
RecordBatch::try_new_with_options(schema, arrays, &options).map_err(|err| {
992990
plan_datafusion_err!("Can not create statistics record batch: {err}")
@@ -2824,7 +2822,7 @@ mod tests {
28242822
test_build_predicate_expression(&expr, &schema, &mut required_columns);
28252823
assert_eq!(predicate_expr.to_string(), expected_expr);
28262824
println!("required_columns: {required_columns:#?}"); // for debugging assertions below
2827-
// c1 < 1 should add c1_min
2825+
// c1 < 1 should add c1_min
28282826
let c1_min_field = Field::new("c1_min", DataType::Int32, false);
28292827
assert_eq!(
28302828
required_columns.columns[0],

datafusion/physical-plan/src/limit.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ impl ExecutionPlan for GlobalLimitExec {
164164
partition: usize,
165165
context: Arc<TaskContext>,
166166
) -> Result<SendableRecordBatchStream> {
167-
trace!(
168-
"Start GlobalLimitExec::execute for partition: {partition}"
169-
);
167+
trace!("Start GlobalLimitExec::execute for partition: {partition}");
170168
// GlobalLimitExec has a single output partition
171169
if 0 != partition {
172170
return internal_err!("GlobalLimitExec invalid partition {partition}");

datafusion/physical-plan/src/sorts/partial_sort.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,7 @@ impl ExecutionPlan for PartialSortExec {
296296

297297
let input = self.input.execute(partition, Arc::clone(&context))?;
298298

299-
trace!(
300-
"End PartialSortExec's input.execute for partition: {partition}"
301-
);
299+
trace!("End PartialSortExec's input.execute for partition: {partition}");
302300

303301
// Make sure common prefix length is larger than 0
304302
// Otherwise, we should use SortExec.

datafusion/physical-plan/src/sorts/sort_preserving_merge.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,7 @@ impl ExecutionPlan for SortPreservingMergeExec {
267267
partition: usize,
268268
context: Arc<TaskContext>,
269269
) -> Result<SendableRecordBatchStream> {
270-
trace!(
271-
"Start SortPreservingMergeExec::execute for partition: {partition}"
272-
);
270+
trace!("Start SortPreservingMergeExec::execute for partition: {partition}");
273271
if 0 != partition {
274272
return internal_err!(
275273
"SortPreservingMergeExec invalid partition {partition}"

0 commit comments

Comments
 (0)