From f638df3e4173b07e96cb0fcf944f71d19d4fcd21 Mon Sep 17 00:00:00 2001 From: Matthijs Brobbel Date: Thu, 5 Sep 2024 22:29:43 +0200 Subject: [PATCH 1/2] Fix some clippy warnings (#12346) --- datafusion/functions/benches/repeat.rs | 12 ++++++------ datafusion/functions/benches/substr.rs | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/datafusion/functions/benches/repeat.rs b/datafusion/functions/benches/repeat.rs index 916c8374e5fb..e45313660ea2 100644 --- a/datafusion/functions/benches/repeat.rs +++ b/datafusion/functions/benches/repeat.rs @@ -67,7 +67,7 @@ fn criterion_benchmark(c: &mut Criterion) { let args = create_args::(size, 32, repeat_times, true); group.bench_function( - &format!( + format!( "repeat_string_view [size={}, repeat_times={}]", size, repeat_times ), @@ -76,7 +76,7 @@ fn criterion_benchmark(c: &mut Criterion) { let args = create_args::(size, 32, repeat_times, false); group.bench_function( - &format!( + format!( "repeat_string [size={}, repeat_times={}]", size, repeat_times ), @@ -85,7 +85,7 @@ fn criterion_benchmark(c: &mut Criterion) { let args = create_args::(size, 32, repeat_times, false); group.bench_function( - &format!( + format!( "repeat_large_string [size={}, repeat_times={}]", size, repeat_times ), @@ -103,7 +103,7 @@ fn criterion_benchmark(c: &mut Criterion) { let args = create_args::(size, 32, repeat_times, true); group.bench_function( - &format!( + format!( "repeat_string_view [size={}, repeat_times={}]", size, repeat_times ), @@ -112,7 +112,7 @@ fn criterion_benchmark(c: &mut Criterion) { let args = create_args::(size, 32, repeat_times, false); group.bench_function( - &format!( + format!( "repeat_string [size={}, repeat_times={}]", size, repeat_times ), @@ -121,7 +121,7 @@ fn criterion_benchmark(c: &mut Criterion) { let args = create_args::(size, 32, repeat_times, false); group.bench_function( - &format!( + format!( "repeat_large_string [size={}, repeat_times={}]", size, repeat_times ), diff --git a/datafusion/functions/benches/substr.rs b/datafusion/functions/benches/substr.rs index 14a3389da380..1a696520c3ad 100644 --- a/datafusion/functions/benches/substr.rs +++ b/datafusion/functions/benches/substr.rs @@ -106,19 +106,19 @@ fn criterion_benchmark(c: &mut Criterion) { let args = create_args_without_count::(size, len, true, true); group.bench_function( - &format!("substr_string_view [size={}, strlen={}]", size, len), + format!("substr_string_view [size={}, strlen={}]", size, len), |b| b.iter(|| black_box(substr.invoke(&args))), ); let args = create_args_without_count::(size, len, false, false); group.bench_function( - &format!("substr_string [size={}, strlen={}]", size, len), + format!("substr_string [size={}, strlen={}]", size, len), |b| b.iter(|| black_box(substr.invoke(&args))), ); let args = create_args_without_count::(size, len, true, false); group.bench_function( - &format!("substr_large_string [size={}, strlen={}]", size, len), + format!("substr_large_string [size={}, strlen={}]", size, len), |b| b.iter(|| black_box(substr.invoke(&args))), ); @@ -133,7 +133,7 @@ fn criterion_benchmark(c: &mut Criterion) { let args = create_args_with_count::(size, len, count, true); group.bench_function( - &format!( + format!( "substr_string_view [size={}, count={}, strlen={}]", size, count, len, ), @@ -142,7 +142,7 @@ fn criterion_benchmark(c: &mut Criterion) { let args = create_args_with_count::(size, len, count, false); group.bench_function( - &format!( + format!( "substr_string [size={}, count={}, strlen={}]", size, count, len, ), @@ -151,7 +151,7 @@ fn criterion_benchmark(c: &mut Criterion) { let args = create_args_with_count::(size, len, count, false); group.bench_function( - &format!( + format!( "substr_large_string [size={}, count={}, strlen={}]", size, count, len, ), @@ -169,7 +169,7 @@ fn criterion_benchmark(c: &mut Criterion) { let args = create_args_with_count::(size, len, count, true); group.bench_function( - &format!( + format!( "substr_string_view [size={}, count={}, strlen={}]", size, count, len, ), @@ -178,7 +178,7 @@ fn criterion_benchmark(c: &mut Criterion) { let args = create_args_with_count::(size, len, count, false); group.bench_function( - &format!( + format!( "substr_string [size={}, count={}, strlen={}]", size, count, len, ), @@ -187,7 +187,7 @@ fn criterion_benchmark(c: &mut Criterion) { let args = create_args_with_count::(size, len, count, false); group.bench_function( - &format!( + format!( "substr_large_string [size={}, count={}, strlen={}]", size, count, len, ), From 9d819e1e237f5b10a197bc0a6548c1ad9c4c467c Mon Sep 17 00:00:00 2001 From: Oleks V Date: Thu, 5 Sep 2024 17:28:21 -0700 Subject: [PATCH 2/2] minor: reuse SessionStateBuilder methods for default builder (#12330) --- .../core/src/execution/session_state.rs | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/datafusion/core/src/execution/session_state.rs b/datafusion/core/src/execution/session_state.rs index 90f175b59385..675ac798bf4e 100644 --- a/datafusion/core/src/execution/session_state.rs +++ b/datafusion/core/src/execution/session_state.rs @@ -1035,17 +1035,15 @@ impl SessionStateBuilder { } } - /// Set defaults for table_factories, file formats, expr_planners and builtin - /// scalar and aggregate functions. - pub fn with_default_features(mut self) -> Self { - self.table_factories = Some(SessionStateDefaults::default_table_factories()); - self.file_formats = Some(SessionStateDefaults::default_file_formats()); - self.expr_planners = Some(SessionStateDefaults::default_expr_planners()); - self.scalar_functions = Some(SessionStateDefaults::default_scalar_functions()); - self.aggregate_functions = - Some(SessionStateDefaults::default_aggregate_functions()); - self.window_functions = Some(SessionStateDefaults::default_window_functions()); - self + /// Create default builder with defaults for table_factories, file formats, expr_planners and builtin + /// scalar, aggregate and windows functions. + pub fn with_default_features(self) -> Self { + self.with_table_factories(SessionStateDefaults::default_table_factories()) + .with_file_formats(SessionStateDefaults::default_file_formats()) + .with_expr_planners(SessionStateDefaults::default_expr_planners()) + .with_scalar_functions(SessionStateDefaults::default_scalar_functions()) + .with_aggregate_functions(SessionStateDefaults::default_aggregate_functions()) + .with_window_functions(SessionStateDefaults::default_window_functions()) } /// Set the session id.