Skip to content

Apache DataFusion SQL Query Engine

chores: Add lint rule to enforce string formatting style (#16024)

Lordworms9d06baf45298
diff --git a/Cargo.toml b/Cargo.toml
index aef3a7cbbf..f52ce73397 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -213,6 +213,7 @@ large_futures = "warn"
used_underscore_binding = "warn"
or_fun_call = "warn"
unnecessary_lazy_evaluations = "warn"
+uninlined_format_args = "warn"
[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(tarpaulin)"] }
diff --git a/benchmarks/src/util/options.rs b/benchmarks/src/util/options.rs
index 1b413aa5a8..8780949508 100644
--- a/benchmarks/src/util/options.rs
+++ b/benchmarks/src/util/options.rs
@@ -122,15 +122,14 @@ fn parse_memory_limit(limit: &str) -> Result<usize, String> {
let (number, unit) = limit.split_at(limit.len() - 1);
let number: f64 = number
.parse()
- .map_err(|_| format!("Failed to parse number from memory limit '{}'", limit))?;
+ .map_err(|_| format!("Failed to parse number from memory limit '{limit}'"))?;
match unit {
"K" => Ok((number * 1024.0) as usize),
"M" => Ok((number * 1024.0 * 1024.0) as usize),
"G" => Ok((number * 1024.0 * 1024.0 * 1024.0) as usize),
_ => Err(format!(
- "Unsupported unit '{}' in memory limit '{}'",
- unit, limit
+ "Unsupported unit '{unit}' in memory limit '{limit}'"
)),
}
}
diff --git a/datafusion-examples/examples/advanced_udaf.rs b/datafusion-examples/examples/advanced_udaf.rs
index 9cda726db7..9c29e6b40d 100644
--- a/datafusion-examples/examples/advanced_udaf.rs
+++ b/datafusion-examples/examples/advanced_udaf.rs
@@ -482,7 +482,7 @@ async fn main() -> Result<()> {
ctx.register_udaf(udf.clone());
let sql_df = ctx
- .sql(&format!("SELECT {}(a) FROM t GROUP BY b", udf_name))
+ .sql(&format!("SELECT {udf_name}(a) FROM t GROUP BY b"))
.await?;
sql_df.show().await?;
diff --git a/datafusion-examples/examples/catalog.rs b/datafusion-examples/examples/catalog.rs
index 655438b78b..229867cdfc 100644
--- a/datafusion-examples/examples/catalog.rs
+++ b/datafusion-examples/examples/catalog.rs
@@ -309,7 +309,7 @@ fn prepare_example_data() -> Result<TempDir> {
3,baz"#;
for i in 0..5 {
- let mut file = File::create(path.join(format!("{}.csv", i)))?;
+ let mut file = File::create(path.join(format!("{i}.csv")))?;
file.write_all(content.as_bytes())?;
}
diff --git a/datafusion-examples/examples/dataframe.rs b/datafusion-examples/examples/dataframe.rs
index 6f61c164f4..ea06ee2a11 100644
--- a/datafusion-examples/examples/dataframe.rs
+++ b/datafusion-examples/examples/dataframe.rs
@@ -144,7 +144,7 @@ async fn read_csv(ctx: &SessionContext) -> Result<()> {
// and using the `enable_url_table` refer to local files directly
let dyn_ctx = ctx.clone().enable_url_table();
let csv_df = dyn_ctx
- .sql(&format!("SELECT rating, unixtime FROM '{}'", file_path))
+ .sql(&format!("SELECT rating, unixtime FROM '{file_path}'"))
.await?;
csv_df.show().await?;
diff --git a/datafusion-examples/examples/expr_api.rs b/datafusion-examples/examples/expr_api.rs
index 0dccf2d48d..089b8db6a5 100644
--- a/datafusion-examples/examples/expr_api.rs
+++ b/datafusion-examples/examples/expr_api.rs
@@ -147,8 +147,7 @@ fn evaluate_demo() -> Result<()> {
])) as _;
assert!(
matches!(&result, ColumnarValue::Array(r) if r == &expected_result),
- "result: {:?}",
- result
+ "result: {result:?}"
);
Ok(())
diff --git a/datafusion-examples/examples/function_factory.rs b/datafusion-examples/examples/function_factory.rs
index 06367f5c09..e712f4ea8e 100644
--- a/datafusion-examples/examples/function_factory.rs
+++ b/datafusion-examples/examples/function_factory.rs
@@ -189,8 +189,7 @@ impl ScalarFunctionWrapper {
if let Some(value) = placeholder.strip_prefix('$') {
Ok(value.parse().map(|v: usize| v - 1).map_err(|e| {
DataFusionError::Execution(format!(
- "Placeholder `{}` parsing error: {}!",
- placeholder, e
+ "Placeholder `{placeholder}` parsing error: {e}!"
))
})?)
} else {
diff --git a/datafusion-examples/examples/planner_api.rs b/datafusion-examples/examples/planner_api.rs
index 4943e593bd..55aec7b010 100644
--- a/datafusion-examples/examples/planner_api.rs
+++ b/datafusion-examples/examples/planner_api.rs
@@ -96,7 +96,7 @@ async fn to_physical_plan_step_by_step_demo(
ctx.state().config_options(),
|_, _| (),
)?;
- println!("Analyzed logical plan:\n\n{:?}\n\n", analyzed_logical_plan);
+ println!("Analyzed logical plan:\n\n{analyzed_logical_plan:?}\n\n");
// Optimize the analyzed logical plan
let optimized_logical_plan = ctx.state().optimizer().optimize(
@@ -104,10 +104,7 @@ async fn to_physical_plan_step_by_step_demo(
&ctx.state(),
|_, _| (),
)?;
- println!(
- "Optimized logical plan:\n\n{:?}\n\n",
- optimized_logical_plan
- );
+ println!("Optimized logical plan:\n\n{optimized_logical_plan:?}\n\n");
// Create the physical plan
let physical_plan = ctx
diff --git a/datafusion-examples/examples/sql_dialect.rs b/datafusion-examples/examples/sql_dialect.rs
index 840faa63b1..20b515506f 100644
--- a/datafusion-examples/examples/sql_dialect.rs
+++ b/datafusion-examples/examples/sql_dialect.rs
@@ -34,8 +34,8 @@ async fn main() -> Result<()> {
let my_statement = my_parser.parse_statement()?;
match my_statement {
- MyStatement::DFStatement(s) => println!("df: {}", s),
- MyStatement::MyCopyTo(s) => println!("my_copy: {}", s),
+ MyStatement::DFStatement(s) => println!("df: {s}"),
+ MyStatement::MyCopyTo(s) => println!("my_copy: {s}"),
}
Ok(())
@@ -87,8 +87,8 @@ enum MyStatement {
impl Display for MyStatement {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
- MyStatement::DFStatement(s) => write!(f, "{}", s),
- MyStatement::MyCopyTo(s) => write!(f, "{}", s),
+ MyStatement::DFStatement(s) => write!(f, "{s}"),
+ MyStatement::MyCopyTo(s) => write!(f, "{s}"),
}
}
}
diff --git a/datafusion/catalog-listing/src/helpers.rs b/datafusion/catalog-listing/src/helpers.rs
index 8efb74d4ea..037c69cebd 100644
--- a/datafusion/catalog-listing/src/helpers.rs
+++ b/datafusion/catalog-listing/src/helpers.rs
@@ -507,11 +507,7 @@ where
Some((name, val)) if name == pn => part_values.push(val),
_ => {
debug!(
- "Ignoring file: file_path='{}', table_path='{}', part='{}', partition_col='{}'",
- file_path,
- table_path,
- part,
- pn,
+ "Ignoring file: file_path='{file_path}', table_path='{table_path}', part='{part}', partition_col='{pn}'",
);
return None;
}
diff --git a/datafusion/common/src/config.rs b/datafusion/common/src/config.rs
index d6530931cb..b701b7130b 100644
--- a/datafusion/common/src/config.rs
+++ b/datafusion/common/src/config.rs
@@ -1223,8 +1223,7 @@ impl ConfigField for u8 {
fn set(&mut self, key: &str, value: &str) -> Result<()> {
if value.is_empty() {
return Err(DataFusionError::Configuration(format!(
- "Input string for {} key is empty",
- key
+ "Input string for {key} key is empty"
)));
}
// Check if the string is a valid number
@@ -1236,8 +1235,7 @@ impl ConfigField for u8 {
// Check if the first character is ASCII (single byte)
if bytes.len() > 1 || !value.chars().next().unwrap().is_ascii() {
return Err(DataFusionError::Configuration(format!(
- "Error parsing {} as u8. Non-ASCII string provided",
- value
+ "Error parsing {value} as u8. Non-ASCII string provided"
)));
}
*self = bytes[0];
@@ -2090,7 +2088,7 @@ impl Display for OutputFormat {
OutputFormat::AVRO => "avro",
OutputFormat::ARROW => "arrow",
};
- write!(f, "{}", out)
+ write!(f, "{out}")
}
}
diff --git a/datafusion/common/src/dfschema.rs b/datafusion/common/src/dfschema.rs
index a4fa502189..804e14bf72 100644
--- a/datafusion/common/src/dfschema.rs
+++ b/datafusion/common/src/dfschema.rs
@@ -1088,7 +1088,7 @@ impl SchemaExt for Schema {
pub fn qualified_name(qualifier: Option<&TableReference>, name: &str) -> String {
match qualifier {
- Some(q) => format!("{}.{}", q, name),
+ Some(q) => format!("{q}.{name}"),
None => name.to_string(),
}
}
diff --git a/datafusion/common/src/error.rs b/datafusion/common/src/error.rs
index be1d33e8e7..0b13bde2c0 100644
--- a/datafusion/common/src/error.rs
+++ b/datafusion/common/src/error.rs
@@ -945,7 +945,7 @@ pub fn add_possible_columns_to_diag(
.collect();
for name in field_names {
- diagnostic.add_note(format!("possible column {}", name), None);
+ diagnostic.add_note(format!("possible column {name}"), None);
}
}
@@ -1138,7 +1138,7 @@ mod test {
let generic_error_2: GenericError = Box::new(external_error_1);
let external_error_2: DataFusionError = generic_error_2.into();
- println!("{}", external_error_2);
+ println!("{external_error_2}");
assert!(external_error_2
.to_string()
.starts_with("External error: io error"));
diff --git a/datafusion/common/src/file_options/parquet_writer.rs b/datafusion/common/src/file_options/parquet_writer.rs
index 3e33466edf..07e763f0ee 100644
--- a/datafusion/common/src/file_options/parquet_writer.rs
+++ b/datafusion/common/src/file_options/parquet_writer.rs
@@ -330,8 +330,7 @@ fn split_compression_string(str_setting: &str) -> Result<(String, Option<u32>)>
let level = &rh[..rh.len() - 1].parse::<u32>().map_err(|_| {
DataFusionError::Configuration(format!(
"Could not parse compression string. \
- Got codec: {} and unknown level from {}",
- codec, str_setting
+ Got codec: {codec} and unknown level from {str_setting}"
))
})?;
Ok((codec.to_owned(), Some(*level)))
diff --git a/datafusion/common/src/functional_dependencies.rs b/datafusion/common/src/functional_dependencies.rs
index c4f2805f82..77e00d6dcd 100644
--- a/datafusion/common/src/functional_dependencies.rs
+++ b/datafusion/common/src/functional_dependencies.rs
@@ -113,7 +113,7 @@ impl Display for Constraints {
let pk = self
.inner
.iter()
- .map(|c| format!("{:?}", c))
+ .map(|c| format!("{c:?}"))
.collect::<Vec<_>>();
let pk = pk.join(", ");
write!(f, "constraints=[{pk}]")
diff --git a/datafusion/common/src/lib.rs b/datafusion/common/src/lib.rs
index b137624532..2576ab4312 100644
--- a/datafusion/common/src/lib.rs
+++ b/datafusion/common/src/lib.rs
@@ -185,9 +185,7 @@ mod tests {
let expected_prefix = expected_prefix.as_ref();
assert!(
actual.starts_with(expected_prefix),
- "Expected '{}' to start with '{}'",
- actual,
- expected_prefix
+ "Expected '{actual}' to start with '{expected_prefix}'"
);
}
}
diff --git a/datafusion/common/src/parsers.rs b/datafusion/common/src/parsers.rs
index c73c8a55f1..41571ebb85 100644
--- a/datafusion/common/src/parsers.rs
+++ b/datafusion/common/src/parsers.rs
@@ -64,7 +64,7 @@ impl Display for CompressionTypeVariant {
Self::ZSTD => "ZSTD",
Self::UNCOMPRESSED => "",
};
- write!(f, "{}", str)
+ write!(f, "{str}")
}
}
diff --git a/datafusion/common/src/scalar/mod.rs b/datafusion/common/src/scalar/mod.rs
index 5c020d1f63..484fa2afa5 100644
--- a/datafusion/common/src/scalar/mod.rs
+++ b/datafusion/common/src/scalar/mod.rs
@@ -3814,7 +3814,7 @@ impl fmt::Display for ScalarValue {
array_value_to_string(arr.column(0), i).unwrap();
let value =
array_value_to_string(arr.column(1), i).unwrap();
- buffer.push_back(format!("{}:{}", key, value));
+ buffer.push_back(format!("{key}:{value}"));
}
format!(
"{{{}}}",
@@ -3833,7 +3833,7 @@ impl fmt::Display for ScalarValue {
)?
}
ScalarValue::Union(val, _fields, _mode) => match val {
- Some((id, val)) => write!(f, "{}:{}", id, val)?,
+ Some((id, val)) => write!(f, "{id}:{val}")?,
None => write!(f, "NULL")?,
},
ScalarValue::Dictionary(_k, v) => write!(f, "{v}")?,
@@ -4010,7 +4010,7 @@ impl fmt::Debug for ScalarValue {
write!(f, "DurationNanosecond(\"{self}\")")
}
ScalarValue::Union(val, _fields, _mode) => match val {
- Some((id, val)) => write!(f, "Union {}:{}", id, val),
+ Some((id, val)) => write!(f, "Union {id}:{val}"),
None => write!(f, "Union(NULL)"),
},
ScalarValue::Dictionary(k, v) => write!(f, "Dictionary({k:?}, {v:?})"),
diff --git a/datafusion/common/src/stats.rs b/datafusion/common/src/stats.rs
index 82e9f23a72..c67b35a263 100644
--- a/datafusion/common/src/stats.rs
+++ b/datafusion/common/src/stats.rs
@@ -233,8 +233,8 @@ impl Precision<ScalarValue> {
impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> Debug for Precision<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
- Precision::Exact(inner) => write!(f, "Exact({:?})", inner),
- Precision::Inexact(inner) => write!(f, "Inexact({:?})", inner),
+ Precision::Exact(inner) => write!(f, "Exact({inner:?})"),
+ Precision::Inexact(inner) => write!(f, "Inexact({inner:?})"),
Precision::Absent => write!(f, "Absent"),
}
}
@@ -243,8 +243,8 @@ impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> Debug for Precision<T> {
impl<T: Debug + Clone + PartialEq + Eq + PartialOrd> Display for Precision<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
- Precision::Exact(inner) => write!(f, "Exact({:?})", inner),
- Precision::Inexact(inner) => write!(f, "Inexact({:?})", inner),
+ Precision::Exact(inner) => write!(f, "Exact({inner:?})"),
+ Precision::Inexact(inner) => write!(f, "Inexact({inner:?})"),
Precision::Absent => write!(f, "Absent"),
}
}
@@ -572,7 +572,7 @@ impl Display for Statistics {
.iter()
.enumerate()
.map(|(i, cs)| {
- let s = format!("(Col[{}]:", i);
+ let s = format!("(Col[{i}]:");
let s = if cs.min_value != Precision::Absent {
format!("{} Min={}", s, cs.min_value)
} else {
diff --git a/datafusion/common/src/tree_node.rs b/datafusion/common/src/tree_node.rs
index c70389b631..cf51dadf6b 100644
--- a/datafusion/common/src/tree_node.rs
+++ b/datafusion/common/src/tree_node.rs
@@ -2354,7 +2354,7 @@ pub(crate) mod tests {
fn test_large_tree() {
let mut item = TestTreeNode::new_leaf("initial".to_string());
for i in 0..3000 {
- item = TestTreeNode::new(vec![item], format!("parent-{}", i));
+ item = TestTreeNode::new(vec![item], format!("parent-{i}"));
}
let mut visitor =
diff --git a/datafusion/core/benches/dataframe.rs b/datafusion/core/benches/dataframe.rs
index 832553ebed..12eb34719e 100644
--- a/datafusion/core/benches/dataframe.rs
+++ b/datafusion/core/benches/dataframe.rs
@@ -32,7 +32,7 @@ use tokio::runtime::Runtime;
fn create_context(field_count: u32) -> datafusion_common::Result<Arc<SessionContext>> {
let mut fields = vec![];
for i in 0..field_count {
- fields.push(Field::new(format!("str{}", i), DataType::Utf8, true))
+ fields.push(Field::new(format!("str{i}"), DataType::Utf8, true))
}
let schema = Arc::new(Schema::new(fields));
@@ -49,8 +49,8 @@ fn run(column_count: u32, ctx: Arc<SessionContext>, rt: &Runtime) {
let mut data_frame = ctx.table("t").await.unwrap();
for i in 0..column_count {
- let field_name = &format!("str{}", i);
- let new_field_name = &format!("newstr{}", i);
+ let field_name = &format!("str{i}");
+ let new_field_name = &format!("newstr{i}");
data_frame = data_frame
.with_column_renamed(field_name, new_field_name)
diff --git a/datafusion/core/benches/distinct_query_sql.rs b/datafusion/core/benches/distinct_query_sql.rs
index c7056aab86..c1ef559926 100644
--- a/datafusion/core/benches/distinct_query_sql.rs
+++ b/datafusion/core/benches/distinct_query_sql.rs
@@ -154,7 +154,7 @@ fn criterion_benchmark_limited_distinct_sampled(c: &mut Criterion) {
let sql =
format!("select DISTINCT trace_id from traces group by trace_id limit {limit};");
c.bench_function(
- format!("distinct query with {} partitions and {} samples per partition with limit {}", partitions, samples, limit).as_str(),
+ format!("distinct query with {partitions} partitions and {samples} samples per partition with limit {limit}").as_str(),
|b| b.iter(|| {
let (plan, ctx) = rt.block_on(
create_context_sampled_data(sql.as_str(), partitions, samples)
@@ -168,7 +168,7 @@ fn criterion_benchmark_limited_distinct_sampled(c: &mut Criterion) {
let sql =
format!("select DISTINCT trace_id from traces group by trace_id limit {limit};");
c.bench_function(
- format!("distinct query with {} partitions and {} samples per partition with limit {}", partitions, samples, limit).as_str(),
+ format!("distinct query with {partitions} partitions and {samples} samples per partition with limit {limit}").as_str(),
|b| b.iter(|| {
let (plan, ctx) = rt.block_on(
create_context_sampled_data(sql.as_str(), partitions, samples)
@@ -182,7 +182,7 @@ fn criterion_benchmark_limited_distinct_sampled(c: &mut Criterion) {
let sql =
format!("select DISTINCT trace_id from traces group by trace_id limit {limit};");
c.bench_function(
- format!("distinct query with {} partitions and {} samples per partition with limit {}", partitions, samples, limit).as_str(),
+ format!("distinct query with {partitions} partitions and {samples} samples per partition with limit {limit}").as_str(),
|b| b.iter(|| {
let (plan, ctx) = rt.block_on(
create_context_sampled_data(sql.as_str(), partitions, samples)
diff --git a/datafusion/core/benches/spm.rs b/datafusion/core/benches/spm.rs
index 63b06f20cd..8613525cb2 100644
--- a/datafusion/core/benches/spm.rs
+++ b/datafusion/core/benches/spm.rs
@@ -125,8 +125,7 @@ fn criterion_benchmark(c: &mut Criterion) {
for &batch_count in &batch_counts {
for &partition_count in &partition_counts {
let description = format!(
- "{}_batch_count_{}_partition_count_{}",
- cardinality_label, batch_count, partition_count
+ "{cardinality_label}_batch_count_{batch_count}_partition_count_{partition_count}"
);
run_bench(
c,
diff --git a/datafusion/core/benches/sql_planner.rs b/datafusion/core/benches/sql_planner.rs
index 49cc830d58..6dc953f56b 100644
--- a/datafusion/core/benches/sql_planner.rs
+++ b/datafusion/core/benches/sql_planner.rs
@@ -136,10 +136,10 @@ fn benchmark_with_param_values_many_columns(
if i > 0 {
aggregates.push_str(", ");
}
- aggregates.push_str(format!("MAX(a{})", i).as_str());
+ aggregates.push_str(format!("MAX(a{i})").as_str());
}
// SELECT max(attr0), ..., max(attrN) FROM t1.
- let query = format!("SELECT {} FROM t1", aggregates);
+ let query = format!("SELECT {aggregates} FROM t1");
let statement = ctx.state().sql_to_statement(&query, "Generic").unwrap();
let plan =
rt.block_on(async { ctx.state().statement_to_plan(statement).await.unwrap() });
@@ -164,7 +164,7 @@ fn register_union_order_table(ctx: &SessionContext, num_columns: usize, num_rows
.map(|j| j as u64 * 100 + i)
.collect::<Vec<_>>(),
));
- (format!("c{}", i), array)
+ (format!("c{i}"), array)
});
let batch = RecordBatch::try_from_iter(iter).unwrap();
let schema = batch.schema();
@@ -172,7 +172,7 @@ fn register_union_order_table(ctx: &SessionContext, num_columns: usize, num_rows
// tell DataFusion that the table is sorted by all columns
let sort_order = (0..num_columns)
- .map(|i| col(format!("c{}", i)).sort(true, true))
+ .map(|i| col(format!("c{i}")).sort(true, true))
.collect::<Vec<_>>();
// create the table
@@ -208,12 +208,12 @@ fn union_orderby_query(n: usize) -> String {
})
.collect::<Vec<_>>()
.join(", ");
- query.push_str(&format!("(SELECT {} FROM t ORDER BY c{})", select_list, i));
+ query.push_str(&format!("(SELECT {select_list} FROM t ORDER BY c{i})"));
}
query.push_str(&format!(
"\nORDER BY {}",
(0..n)
- .map(|i| format!("c{}", i))
+ .map(|i| format!("c{i}"))
.collect::<Vec<_>>()
.join(", ")
));
@@ -293,9 +293,9 @@ fn criterion_benchmark(c: &mut Criterion) {
if i > 0 {
aggregates.push_str(", ");
}
- aggregates.push_str(format!("MAX(a{})", i).as_str());
+ aggregates.push_str(format!("MAX(a{i})").as_str());
}
- let query = format!("SELECT {} FROM t1", aggregates);
+ let query = format!("SELECT {aggregates} FROM t1");
b.iter(|| {
physical_plan(&ctx, &rt, &query);
});
@@ -402,7 +402,7 @@ fn criterion_benchmark(c: &mut Criterion) {
for q in tpch_queries {
let sql =
std::fs::read_to_string(format!("{benchmarks_path}queries/{q}.sql")).unwrap();
- c.bench_function(&format!("physical_plan_tpch_{}", q), |b| {
+ c.bench_function(&format!("physical_plan_tpch_{q}"), |b| {
b.iter(|| physical_plan(&tpch_ctx, &rt, &sql))
});
}
diff --git a/datafusion/core/src/bin/print_functions_docs.rs b/datafusion/core/src/bin/print_functions_docs.rs
index 7afb90282a..1044717aaf 100644
--- a/datafusion/core/src/bin/print_functions_docs.rs
+++ b/datafusion/core/src/bin/print_functions_docs.rs
@@ -46,7 +46,7 @@ fn main() -> Result<()> {
"scalar" => print_scalar_docs(),
"window" => print_window_docs(),
_ => {
- panic!("Unknown function type: {}", function_type)
+ panic!("Unknown function type: {function_type}")
}
}?;
@@ -92,7 +92,7 @@ fn print_window_docs() -> Result<String> {
fn save_doc_code_text(documentation: &Documentation, name: &str) {
let attr_text = documentation.to_doc_attribute();
- let file_path = format!("{}.txt", name);
+ let file_path = format!("{name}.txt");
if std::path::Path::new(&file_path).exists() {
std::fs::remove_file(&file_path).unwrap();
}
@@ -215,16 +215,15 @@ fn print_docs(
r#"
#### Example
-{}
-"#,
- example
+{example}
+"#
);
}
if let Some(alt_syntax) = &documentation.alternative_syntax {
let _ = writeln!(docs, "#### Alternative Syntax\n");
for syntax in alt_syntax {
- let _ = writeln!(docs, "```sql\n{}\n```", syntax);
+ let _ = writeln!(docs, "```sql\n{syntax}\n```");
}
}
diff --git a/datafusion/core/src/bin/print_runtime_config_docs.rs b/datafusion/core/src/bin/print_runtime_config_docs.rs
index f374a5acb7..31425da73d 100644
--- a/datafusion/core/src/bin/print_runtime_config_docs.rs
+++ b/datafusion/core/src/bin/print_runtime_config_docs.rs
@@ -19,5 +19,5 @@ use datafusion_execution::runtime_env::RuntimeEnvBuilder;
fn main() {
let docs = RuntimeEnvBuilder::generate_config_markdown();
- println!("{}", docs);
+ println!("{docs}");
}
diff --git a/datafusion/core/src/datasource/file_format/csv.rs b/datafusion/core/src/datasource/file_format/csv.rs
index 0c26d7bdb1..efec07abbc 100644
--- a/datafusion/core/src/datasource/file_format/csv.rs
+++ b/datafusion/core/src/datasource/file_format/csv.rs
@@ -1026,7 +1026,7 @@ mod tests {
for _ in 0..batch_count {
let output = deserializer.next()?;
let DeserializerOutput::RecordBatch(batch) = output else {
- panic!("Expected RecordBatch, got {:?}", output);
+ panic!("Expected RecordBatch, got {output:?}");
};
all_batches = concat_batches(&schema, &[all_batches, batch])?;
}
@@ -1064,7 +1064,7 @@ mod tests {
for _ in 0..batch_count {
let output = deserializer.next()?;
let DeserializerOutput::RecordBatch(batch) = output else {
- panic!("Expected RecordBatch, got {:?}", output);
+ panic!("Expected RecordBatch, got {output:?}");
};
all_batches = concat_batches(&schema, &[all_batches, batch])?;
}
@@ -1145,18 +1145,14 @@ mod tests {
fn csv_line(line_number: usize) -> Bytes {
let (int_value, float_value, bool_value, char_value) = csv_values(line_number);
- format!(
- "{},{},{},{}\n",
- int_value, float_value, bool_value, char_value
- )
- .into()
+ format!("{int_value},{float_value},{bool_value},{char_value}\n").into()
}
fn csv_values(line_number: usize) -> (i32, f64, bool, String) {
let int_value = line_number as i32;
let float_value = line_number as f64;
let bool_value = line_number % 2 == 0;
- let char_value = format!("{}-string", line_number);
+ let char_value = format!("{line_number}-string");
(int_value, float_value, bool_value, char_value)
}
diff --git a/datafusion/core/src/datasource/file_format/json.rs b/datafusion/core/src/datasource/file_format/json.rs
index 48c604efac..34d3d64f07 100644
--- a/datafusion/core/src/datasource/file_format/json.rs
+++ b/datafusion/core/src/datasource/file_format/json.rs
@@ -278,7 +278,7 @@ mod tests {
for _ in 0..3 {
let output = deserializer.next()?;
let DeserializerOutput::RecordBatch(batch) = output else {
- panic!("Expected RecordBatch, got {:?}", output);
+ panic!("Expected RecordBatch, got {output:?}");
};
all_batches = concat_batches(&schema, &[all_batches, batch])?
}
@@ -318,7 +318,7 @@ mod tests {
for _ in 0..2 {
let output = deserializer.next()?;
let DeserializerOutput::RecordBatch(batch) = output else {
- panic!("Expected RecordBatch, got {:?}", output);
+ panic!("Expected RecordBatch, got {output:?}");
};
all_batches = concat_batches(&schema, &[all_batches, batch])?
}
diff --git a/datafusion/core/src/datasource/file_format/parquet.rs b/datafusion/core/src/datasource/file_format/parquet.rs
index 9b78398f31..ff0812ce49 100644
--- a/datafusion/core/src/datasource/file_format/parquet.rs
+++ b/datafusion/core/src/datasource/file_format/parquet.rs
@@ -1320,7 +1320,7 @@ mod tests {
#[tokio::test]
async fn parquet_sink_write_with_extension() -> Result<()> {
let filename = "test_file.custom_ext";
- let file_path = format!("file:///path/to/{}", filename);
+ let file_path = format!("file:///path/to/{filename}");
let parquet_sink = create_written_parquet_sink(file_path.as_str()).await?;
// assert written to proper path
@@ -1535,8 +1535,7 @@ mod tests {
let prefix = path_parts[0].as_ref();
assert!(
expected_partitions.contains(prefix),
- "expected path prefix to match partition, instead found {:?}",
- prefix
+ "expected path prefix to match partition, instead found {prefix:?}"
);
expected_partitions.remove(prefix);
diff --git a/datafusion/core/src/datasource/listing/table.rs b/datafusion/core/src/datasource/listing/table.rs
index 9d1afdafad..61e34baebe 100644
--- a/datafusion/core/src/datasource/listing/table.rs
+++ b/datafusion/core/src/datasource/listing/table.rs
@@ -1705,7 +1705,7 @@ mod tests {
// more files than meta_fetch_concurrency (32)
let files: Vec<String> =
- (0..64).map(|i| format!("bucket/key1/file{}", i)).collect();
+ (0..64).map(|i| format!("bucket/key1/file{i}")).collect();
// Collect references to each string
let file_refs: Vec<&str> = files.iter().map(|s| s.as_str()).collect();
assert_list_files_for_exact_paths(file_refs.as_slice(), 5, 5, Some("")).await?;
@@ -1878,7 +1878,7 @@ mod tests {
let table_paths = files
.iter()
- .map(|t| ListingTableUrl::parse(format!("test:///{}", t)).unwrap())
+ .map(|t| ListingTableUrl::parse(format!("test:///{t}")).unwrap())
.collect();
let config = ListingTableConfig::new_with_multi_paths(table_paths)
.with_listing_options(opt)
@@ -2425,7 +2425,7 @@ mod tests {
#[tokio::test]
async fn test_infer_options_compressed_csv() -> Result<()> {
let testdata = crate::test_util::arrow_test_data();
- let filename = format!("{}/csv/aggregate_test_100.csv.gz", testdata);
+ let filename = format!("{testdata}/csv/aggregate_test_100.csv.gz");
let table_path = ListingTableUrl::parse(filename).unwrap();
let ctx = SessionContext::new();
diff --git a/datafusion/core/src/execution/context/mod.rs b/datafusion/core/src/execution/context/mod.rs
index ecc3bd2990..5ef666b61e 100644
--- a/datafusion/core/src/execution/context/mod.rs
+++ b/datafusion/core/src/execution/context/mod.rs
@@ -1069,8 +1069,7 @@ impl SessionContext {
}
_ => {
return Err(DataFusionError::Plan(format!(
- "Unknown runtime configuration: {}",
- variable
+ "Unknown runtime configuration: {variable}"
)))
}
}
@@ -1091,8 +1090,7 @@ impl SessionContext {
let (number, unit) = limit.split_at(limit.len() - 1);
let number: f64 = number.parse().map_err(|_| {
DataFusionError::Plan(format!(
- "Failed to parse number from memory limit '{}'",
- limit
+ "Failed to parse number from memory limit '{limit}'"
))
})?;
@@ -1101,8 +1099,7 @@ impl SessionContext {
"M" => Ok((number * 1024.0 * 1024.0) as usize),
"G" => Ok((number * 1024.0 * 1024.0 * 1024.0) as usize),
_ => Err(DataFusionError::Plan(format!(
- "Unsupported unit '{}' in memory limit '{}'",
- unit, limit
+ "Unsupported unit '{unit}' in memory limit '{limit}'"
))),
}
}
diff --git a/datafusion/core/src/execution/context/parquet.rs b/datafusion/core/src/execution/context/parquet.rs
index 6ec9796fe9..a7c4887b24 100644
--- a/datafusion/core/src/execution/context/parquet.rs
+++ b/datafusion/core/src/execution/context/parquet.rs
@@ -286,7 +286,7 @@ mod tests {
let expected_path = binding[0].as_str();
assert_eq!(
read_df.unwrap_err().strip_backtrace(),
- format!("Execution error: File path '{}' does not match the expected extension '.parquet'", expected_path)
+ format!("Execution error: File path '{expected_path}' does not match the expected extension '.parquet'")
);
// Read the dataframe from 'output3.parquet.snappy.parquet' with the correct file extension.
diff --git a/datafusion/core/src/physical_planner.rs b/datafusion/core/src/physical_planner.rs
index be24206c67..5319929470 100644
--- a/datafusion/core/src/physical_planner.rs
+++ b/datafusion/core/src/physical_planner.rs
@@ -522,7 +522,7 @@ impl DefaultPhysicalPlanner {
Some("true") => true,
Some("false") => false,
Some(value) =>
- return Err(DataFusionError::Configuration(format!("provided value for 'execution.keep_partition_by_columns' was not recognized: \"{}\"", value))),
+ return Err(DataFusionError::Configuration(format!("provided value for 'execution.keep_partition_by_columns' was not recognized: \"{value}\""))),
};
let sink_format = file_type_to_format(file_type)?
@@ -694,7 +694,7 @@ impl DefaultPhysicalPlanner {
}
return internal_err!("Physical input schema should be the same as the one converted from logical input schema. Differences: {}", differences
.iter()
- .map(|s| format!("\n\t- {}", s))
+ .map(|s| format!("\n\t- {s}"))
.join(""));
}
@@ -1952,7 +1952,7 @@ impl DefaultPhysicalPlanner {
"Optimized physical plan:\n{}\n",
displayable(new_plan.as_ref()).indent(false)
);
- trace!("Detailed optimized physical plan:\n{:?}", new_plan);
+ trace!("Detailed optimized physical plan:\n{new_plan:?}");
Ok(new_plan)
}
diff --git a/datafusion/core/src/test/object_store.rs b/datafusion/core/src/test/object_store.rs
index 8b19658bb1..ed8474bbfc 100644
--- a/datafusion/core/src/test/object_store.rs
+++ b/datafusion/core/src/test/object_store.rs
@@ -148,7 +148,7 @@ impl ObjectStore for BlockingObjectStore {
"{} barrier wait timed out for {location}",
BlockingObjectStore::NAME
);
- log::error!("{}", error_message);
+ log::error!("{error_message}");
return Err(Error::Generic {
store: BlockingObjectStore::NAME,
source: error_message.into(),
diff --git a/datafusion/core/tests/dataframe/mod.rs b/datafusion/core/tests/dataframe/mod.rs
index 1855a51204..827808d923 100644
--- a/datafusion/core/tests/dataframe/mod.rs
+++ b/datafusion/core/tests/dataframe/mod.rs
@@ -5079,7 +5079,7 @@ async fn write_partitioned_parquet_results() -> Result<()> {
.await?;
// Explicitly read the parquet file at c2=123 to verify the physical files are partitioned
- let partitioned_file = format!("{out_dir}/c2=123", out_dir = out_dir);
+ let partitioned_file = format!("{out_dir}/c2=123");
let filter_df = ctx
.read_parquet(&partitioned_file, ParquetReadOptions::default())
.await?;
diff --git a/datafusion/core/tests/execution/logical_plan.rs b/datafusion/core/tests/execution/logical_plan.rs
index fdee6fd5db..97bb2a727b 100644
--- a/datafusion/core/tests/execution/logical_plan.rs
+++ b/datafusion/core/tests/execution/logical_plan.rs
@@ -96,7 +96,7 @@ where
T: Debug,
{
let [element] = elements else {
- panic!("Expected exactly one element, got {:?}", elements);
+ panic!("Expected exactly one element, got {elements:?}");
};
element
}
diff --git a/datafusion/core/tests/expr_api/mod.rs b/datafusion/core/tests/expr_api/mod.rs
index aef10379da..a9cf7f04bb 100644
--- a/datafusion/core/tests/expr_api/mod.rs
+++ b/datafusion/core/tests/expr_api/mod.rs
@@ -358,8 +358,7 @@ async fn evaluate_agg_test(expr: Expr, expected_lines: Vec<&str>) {
assert_eq!(
expected_lines, actual_lines,
- "\n\nexpected:\n\n{:#?}\nactual:\n\n{:#?}\n\n",
- expected_lines, actual_lines
+ "\n\nexpected:\n\n{expected_lines:#?}\nactual:\n\n{actual_lines:#?}\n\n"
);
}
@@ -379,8 +378,7 @@ fn evaluate_expr_test(expr: Expr, expected_lines: Vec<&str>) {
assert_eq!(
expected_lines, actual_lines,
- "\n\nexpected:\n\n{:#?}\nactual:\n\n{:#?}\n\n",
- expected_lines, actual_lines
+ "\n\nexpected:\n\n{expected_lines:#?}\nactual:\n\n{actual_lines:#?}\n\n"
);
}
diff --git a/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/fuzzer.rs b/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/fuzzer.rs
index 58688ce7ee..f3708ff85e 100644
--- a/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/fuzzer.rs
+++ b/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/fuzzer.rs
@@ -197,10 +197,7 @@ impl AggregationFuzzer {
while let Some(join_handle) = join_set.join_next().await {
// propagate errors
join_handle.map_err(|e| {
- DataFusionError::Internal(format!(
- "AggregationFuzzer task error: {:?}",
- e
- ))
+ DataFusionError::Internal(format!("AggregationFuzzer task error: {e:?}"))
})??;
}
Ok(())
diff --git a/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/query_builder.rs b/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/query_builder.rs
index df4730214f..274bc761ac 100644
--- a/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/query_builder.rs
+++ b/datafusion/core/tests/fuzz_cases/aggregation_fuzzer/query_builder.rs
@@ -295,7 +295,7 @@ impl QueryBuilder {
let idx = rng.gen_range(0..self.aggregate_functions.len());
let (function_name, is_distinct) = &self.aggregate_functions[idx];
let argument = self.random_argument();
- let alias = format!("col{}", alias_gen);
+ let alias = format!("col{alias_gen}");
let distinct = if *is_distinct { "DISTINCT " } else { "" };
alias_gen += 1;
@@ -344,7 +344,7 @@ impl QueryBuilder {
let mut result = String::from_str(" order by ").unwrap();
for col in selected_columns {
let order = if rng.gen_bool(0.5) { "ASC" } else { "DESC" };
- result.push_str(&format!("{} {},", col, order));
+ result.push_str(&format!("{col} {order},"));
}
result.strip_suffix(",").unwrap().to_string()
diff --git a/datafusion/core/tests/fuzz_cases/equivalence/ordering.rs b/datafusion/core/tests/fuzz_cases/equivalence/ordering.rs
index 769deef118..d12d0a130c 100644
--- a/datafusion/core/tests/fuzz_cases/equivalence/ordering.rs
+++ b/datafusion/core/tests/fuzz_cases/equivalence/ordering.rs
@@ -69,16 +69,14 @@ fn test_ordering_satisfy_with_equivalence_random() -> Result<()> {
table_data_with_properties.clone(),
)?;
let err_msg = format!(
- "Error in test case requirement:{:?}, expected: {:?}, eq_properties {}",
- requirement, expected, eq_properties
+ "Error in test case requirement:{requirement:?}, expected: {expected:?}, eq_properties {eq_properties}"
);
// Check whether ordering_satisfy API result and
// experimental result matches.
assert_eq!(
eq_properties.ordering_satisfy(requirement.as_ref()),
expected,
- "{}",
- err_msg
+ "{err_msg}"
);
}
}
@@ -141,8 +139,7 @@ fn test_ordering_satisfy_with_equivalence_complex_random() -> Result<()> {
table_data_with_properties.clone(),
)?;
let err_msg = format!(
- "Error in test case requirement:{:?}, expected: {:?}, eq_properties: {}",
- requirement, expected, eq_properties,
+ "Error in test case requirement:{requirement:?}, expected: {expected:?}, eq_properties: {eq_properties}",
);
// Check whether ordering_satisfy API result and
// experimental result matches.
@@ -150,8 +147,7 @@ fn test_ordering_satisfy_with_equivalence_complex_random() -> Result<()> {
assert_eq!(
eq_properties.ordering_satisfy(requirement.as_ref()),
(expected | false),
- "{}",
- err_msg
+ "{err_msg}"
);
}
}
diff --git a/datafusion/core/tests/fuzz_cases/equivalence/projection.rs b/datafusion/core/tests/fuzz_cases/equivalence/projection.rs
index a3fa1157b3..38e66387a0 100644
--- a/datafusion/core/tests/fuzz_cases/equivalence/projection.rs
+++ b/datafusion/core/tests/fuzz_cases/equivalence/projection.rs
@@ -82,8 +82,7 @@ fn project_orderings_random() -> Result<()> {
// Make sure each ordering after projection is valid.
for ordering in projected_eq.oeq_class().iter() {
let err_msg = format!(
- "Error in test case ordering:{:?}, eq_properties {}, proj_exprs: {:?}",
- ordering, eq_properties, proj_exprs,
+ "Error in test case ordering:{ordering:?}, eq_properties {eq_properties}, proj_exprs: {proj_exprs:?}",
);
// Since ordered section satisfies schema, we expect
// that result will be same after sort (e.g sort was unnecessary).
@@ -178,16 +177,14 @@ fn ordering_satisfy_after_projection_random() -> Result<()> {
projected_batch.clone(),
)?;
let err_msg = format!(
- "Error in test case requirement:{:?}, expected: {:?}, eq_properties: {}, projected_eq: {}, projection_mapping: {:?}",
- requirement, expected, eq_properties, projected_eq, projection_mapping
+ "Error in test case requirement:{requirement:?}, expected: {expected:?}, eq_properties: {eq_properties}, projected_eq: {projected_eq}, projection_mapping: {projection_mapping:?}"
);
// Check whether ordering_satisfy API result and
// experimental result matches.
assert_eq!(
projected_eq.ordering_satisfy(requirement.as_ref()),
expected,
- "{}",
- err_msg
+ "{err_msg}"
);
}
}
diff --git a/datafusion/core/tests/fuzz_cases/equivalence/properties.rs b/datafusion/core/tests/fuzz_cases/equivalence/properties.rs
index 593e1c6c2d..9a21464157 100644
--- a/datafusion/core/tests/fuzz_cases/equivalence/properties.rs
+++ b/datafusion/core/tests/fuzz_cases/equivalence/properties.rs
@@ -84,10 +84,9 @@ fn test_find_longest_permutation_random() -> Result<()> {
);
let err_msg = format!(
- "Error in test case ordering:{:?}, eq_properties: {}",
- ordering, eq_properties
+ "Error in test case ordering:{ordering:?}, eq_properties: {eq_properties}"
);
- assert_eq!(ordering.len(), indices.len(), "{}", err_msg);
+ assert_eq!(ordering.len(), indices.len(), "{err_msg}");
// Since ordered section satisfies schema, we expect
// that result will be same after sort (e.g sort was unnecessary).
assert!(
diff --git a/datafusion/core/tests/fuzz_cases/join_fuzz.rs b/datafusion/core/tests/fuzz_cases/join_fuzz.rs
index 5178714ddb..0c410c54ac 100644
--- a/datafusion/core/tests/fuzz_cases/join_fuzz.rs
+++ b/datafusion/core/tests/fuzz_cases/join_fuzz.rs
@@ -569,7 +569,7 @@ impl JoinFuzzTestCase {
std::fs::remove_dir_all(fuzz_debug).unwrap_or(());
std::fs::create_dir_all(fuzz_debug).unwrap();
let out_dir_name = &format!("{fuzz_debug}/batch_size_{batch_size}");
- println!("Test result data mismatch found. HJ rows {}, SMJ rows {}, NLJ rows {}", hj_rows, smj_rows, nlj_rows);
+ println!("Test result data mismatch found. HJ rows {hj_rows}, SMJ rows {smj_rows}, NLJ rows {nlj_rows}");
println!("The debug is ON. Input data will be saved to {out_dir_name}");
Self::save_partitioned_batches_as_parquet(
@@ -585,9 +585,9 @@ impl JoinFuzzTestCase {
if join_tests.contains(&NljHj) && nlj_rows != hj_rows {
println!("=============== HashJoinExec ==================");
- hj_formatted_sorted.iter().for_each(|s| println!("{}", s));
+ hj_formatted_sorted.iter().for_each(|s| println!("{s}"));
println!("=============== NestedLoopJoinExec ==================");
- nlj_formatted_sorted.iter().for_each(|s| println!("{}", s));
+ nlj_formatted_sorted.iter().for_each(|s| println!("{s}"));
Self::save_partitioned_batches_as_parquet(
&nlj_collected,
@@ -603,9 +603,9 @@ impl JoinFuzzTestCase {
if join_tests.contains(&HjSmj) && smj_rows != hj_rows {
println!("=============== HashJoinExec ==================");
- hj_formatted_sorted.iter().for_each(|s| println!("{}", s));
+ hj_formatted_sorted.iter().for_each(|s| println!("{s}"));
println!("=============== SortMergeJoinExec ==================");
- smj_formatted_sorted.iter().for_each(|s| println!("{}", s));
+ smj_formatted_sorted.iter().for_each(|s| println!("{s}"));
Self::save_partitioned_batches_as_parquet(
&hj_collected,
@@ -621,10 +621,10 @@ impl JoinFuzzTestCase {
}
if join_tests.contains(&NljHj) {
- let err_msg_rowcnt = format!("NestedLoopJoinExec and HashJoinExec produced different row counts, batch_size: {}", batch_size);
+ let err_msg_rowcnt = format!("NestedLoopJoinExec and HashJoinExec produced different row counts, batch_size: {batch_size}");
assert_eq!(nlj_rows, hj_rows, "{}", err_msg_rowcnt.as_str());
- let err_msg_contents = format!("NestedLoopJoinExec and HashJoinExec produced different results, batch_size: {}", batch_size);
+ let err_msg_contents = format!("NestedLoopJoinExec and HashJoinExec produced different results, batch_size: {batch_size}");
// row level compare if any of joins returns the result
// the reason is different formatting when there is no rows
for (i, (nlj_line, hj_line)) in nlj_formatted_sorted
@@ -695,7 +695,7 @@ impl JoinFuzzTestCase {
std::fs::create_dir_all(out_path).unwrap();
input.iter().enumerate().for_each(|(idx, batch)| {
- let file_path = format!("{out_path}/file_{}.parquet", idx);
+ let file_path = format!("{out_path}/file_{idx}.parquet");
let mut file = std::fs::File::create(&file_path).unwrap();
println!(
"{}: Saving batch idx {} rows {} to parquet {}",
diff --git a/datafusion/core/tests/fuzz_cases/pruning.rs b/datafusion/core/tests/fuzz_cases/pruning.rs
index 5202d8e5f4..b7cf606870 100644
--- a/datafusion/core/tests/fuzz_cases/pruning.rs
+++ b/datafusion/core/tests/fuzz_cases/pruning.rs
@@ -90,42 +90,42 @@ async fn test_utf8_not_like() {
#[tokio::test]
async fn test_utf8_like_prefix() {
- Utf8Test::new(|value| col("a").like(lit(format!("%{}", value))))
+ Utf8Test::new(|value| col("a").like(lit(format!("%{value}"))))
.run()
.await;
}
#[tokio::test]
async fn test_utf8_like_suffix() {
- Utf8Test::new(|value| col("a").like(lit(format!("{}%", value))))
+ Utf8Test::new(|value| col("a").like(lit(format!("{value}%"))))
.run()
.await;
}
#[tokio::test]
async fn test_utf8_not_like_prefix() {
- Utf8Test::new(|value| col("a").not_like(lit(format!("%{}", value))))
+ Utf8Test::new(|value| col("a").not_like(lit(format!("%{value}"))))
.run()
.await;
}
#[tokio::test]
async fn test_utf8_not_like_ecsape() {
- Utf8Test::new(|value| col("a").not_like(lit(format!("\\%{}%", value))))
+ Utf8Test::new(|value| col("a").not_like(lit(format!("\\%{value}%"))))
.run()
.await;
}
#[tokio::test]
async fn test_utf8_not_like_suffix() {
- Utf8Test::new(|value| col("a").not_like(lit(format!("{}%", value))))
+ Utf8Test::new(|value| col("a").not_like(lit(format!("{value}%"))))
.run()
.await;
}
#[tokio::test]
async fn test_utf8_not_like_suffix_one() {
- Utf8Test::new(|value| col("a").not_like(lit(format!("{}_", value))))
+ Utf8Test::new(|value| col("a").not_like(lit(format!("{value}_"))))
.run()
.await;
}
diff --git a/datafusion/core/tests/fuzz_cases/record_batch_generator.rs b/datafusion/core/tests/fuzz_cases/record_batch_generator.rs
index 9a62a6397d..baeb198f7e 100644
--- a/datafusion/core/tests/fuzz_cases/record_batch_generator.rs
+++ b/datafusion/core/tests/fuzz_cases/record_batch_generator.rs
@@ -636,8 +636,8 @@ mod tests {
let batch1 = gen1.generate().unwrap();
let batch2 = gen2.generate().unwrap();
- let batch1_formatted = format!("{:?}", batch1);
- let batch2_formatted = format!("{:?}", batch2);
+ let batch1_formatted = format!("{batch1:?}");
+ let batch2_formatted = format!("{batch2:?}");
assert_eq!(batch1_formatted, batch2_formatted);
}
diff --git a/datafusion/core/tests/fuzz_cases/sort_preserving_repartition_fuzz.rs b/datafusion/core/tests/fuzz_cases/sort_preserving_repartition_fuzz.rs
index 06b93d41af..76dc2b8051 100644
--- a/datafusion/core/tests/fuzz_cases/sort_preserving_repartition_fuzz.rs
+++ b/datafusion/core/tests/fuzz_cases/sort_preserving_repartition_fuzz.rs
@@ -261,7 +261,7 @@ mod sp_repartition_fuzz_tests {
let res = concat_batches(&res[0].schema(), &res)?;
for ordering in eq_properties.oeq_class().iter() {
- let err_msg = format!("error in eq properties: {:?}", eq_properties);
+ let err_msg = format!("error in eq properties: {eq_properties:?}");
let sort_columns = ordering
.iter()
.map(|sort_expr| sort_expr.evaluate_to_sort_column(&res))
@@ -273,7 +273,7 @@ mod sp_repartition_fuzz_tests {
let sorted_columns = lexsort(&sort_columns, None)?;
// Make sure after merging ordering is still valid.
- assert_eq!(orig_columns.len(), sorted_columns.len(), "{}", err_msg);
+ assert_eq!(orig_columns.len(), sorted_columns.len(), "{err_msg}");
assert!(
izip!(orig_columns.into_iter(), sorted_columns.into_iter())
.all(|(lhs, rhs)| { lhs == rhs }),
diff --git a/datafusion/core/tests/fuzz_cases/sort_query_fuzz.rs b/datafusion/core/tests/fuzz_cases/sort_query_fuzz.rs
index 1319d48173..0a305b8d5c 100644
--- a/datafusion/core/tests/fuzz_cases/sort_query_fuzz.rs
+++ b/datafusion/core/tests/fuzz_cases/sort_query_fuzz.rs
@@ -211,13 +211,12 @@ impl SortQueryFuzzer {
let config_seed = self.runner_rng.gen();
println!(
- "[SortQueryFuzzer] Round {}, Query {} (Config {})",
- round, query_i, config_i
+ "[SortQueryFuzzer] Round {round}, Query {query_i} (Config {config_i})"
);
println!(" Seeds:");
- println!(" init_seed = {}", init_seed);
- println!(" query_seed = {}", query_seed);
- println!(" config_seed = {}", config_seed);
+ println!(" init_seed = {init_seed}");
+ println!(" query_seed = {query_seed}");
+ println!(" config_seed = {config_seed}");
let results = self
.test_gen
@@ -435,7 +434,7 @@ impl SortFuzzerTestGenerator {
let mut clause = col.name.clone();
if rng.gen_bool(0.5) {
let order = if rng.gen_bool(0.5) { "ASC" } else { "DESC" };
- clause.push_str(&format!(" {}", order));
+ clause.push_str(&format!(" {order}"));
}
if rng.gen_bool(0.5) {
let nulls = if rng.gen_bool(0.5) {
@@ -443,7 +442,7 @@ impl SortFuzzerTestGenerator {
} else {
"NULLS LAST"
};
- clause.push_str(&format!(" {}", nulls));
+ clause.push_str(&format!(" {nulls}"));
}
order_by_clauses.push(clause);
}
@@ -463,7 +462,7 @@ impl SortFuzzerTestGenerator {
None
};
- let limit_clause = limit.map_or(String::new(), |l| format!(" LIMIT {}", l));
+ let limit_clause = limit.map_or(String::new(), |l| format!(" LIMIT {l}"));
let query = format!(
"SELECT * FROM {} ORDER BY {}{}",
@@ -522,13 +521,10 @@ impl SortFuzzerTestGenerator {
println!(" Config: ");
println!(" Dataset size: {}", human_readable_size(dataset_size));
- println!(" Number of partitions: {}", num_partitions);
+ println!(" Number of partitions: {num_partitions}");
println!(" Batch size: {}", init_state.approx_batch_num_rows / 2);
- println!(" Memory limit: {}", memory_limit_str);
- println!(
- " Per partition memory limit: {}",
- per_partition_limit_str
- );
+ println!(" Memory limit: {memory_limit_str}");
+ println!(" Per partition memory limit: {per_partition_limit_str}");
println!(
" Sort spill reservation bytes: {}",
human_readable_size(sort_spill_reservation_bytes)
@@ -575,7 +571,7 @@ impl SortFuzzerTestGenerator {
self.init_partitioned_staggered_batches(dataset_seed);
let (query_str, limit) = self.generate_random_query(query_seed);
println!(" Query:");
- println!(" {}", query_str);
+ println!(" {query_str}");
// ==== Execute the query ====
diff --git a/datafusion/core/tests/fuzz_cases/window_fuzz.rs b/datafusion/core/tests/fuzz_cases/window_fuzz.rs
index 6b166dd327..08a4b4fcb1 100644
--- a/datafusion/core/tests/fuzz_cases/window_fuzz.rs
+++ b/datafusion/core/tests/fuzz_cases/window_fuzz.rs
@@ -728,7 +728,7 @@ async fn run_window_test(
for (line1, line2) in
usual_formatted_sorted.iter().zip(running_formatted_sorted)
{
- println!("{:?} --- {:?}", line1, line2);
+ println!("{line1:?} --- {line2:?}");
}
unreachable!();
}
diff --git a/datafusion/core/tests/memory_limit/mod.rs b/datafusion/core/tests/memory_limit/mod.rs
index 3a4817941f..5957919824 100644
--- a/datafusion/core/tests/memory_limit/mod.rs
+++ b/datafusion/core/tests/memory_limit/mod.rs
@@ -603,7 +603,7 @@ async fn test_disk_spill_limit_not_reached() -> Result<()> {
let spill_count = plan.metrics().unwrap().spill_count().unwrap();
let spilled_bytes = plan.metrics().unwrap().spilled_bytes().unwrap();
- println!("spill count {}, spill bytes {}", spill_count, spilled_bytes);
+ println!("spill count {spill_count}, spill bytes {spilled_bytes}");
assert!(spill_count > 0);
assert!((spilled_bytes as u64) < disk_spill_limit);
diff --git a/datafusion/core/tests/optimizer/mod.rs b/datafusion/core/tests/optimizer/mod.rs
index 585540bd58..2daed4fe36 100644
--- a/datafusion/core/tests/optimizer/mod.rs
+++ b/datafusion/core/tests/optimizer/mod.rs
@@ -116,7 +116,7 @@ fn concat_ws_literals() -> Result<()> {
fn quick_test(sql: &str, expected_plan: &str) {
let plan = test_sql(sql).unwrap();
- assert_eq!(expected_plan, format!("{}", plan));
+ assert_eq!(expected_plan, format!("{plan}"));
}
fn test_sql(sql: &str) -> Result<LogicalPlan> {
@@ -342,8 +342,7 @@ where
let expected = lit(ScalarValue::from(expected_value.clone()));
assert_eq!(
output, expected,
- "{} simplified to {}, but expected {}",
- expr, output, expected
+ "{expr} simplified to {output}, but expected {expected}"
);
}
}
@@ -352,8 +351,7 @@ fn validate_unchanged_cases(rewriter: &mut GuaranteeRewriter, cases: &[Expr]) {
let output = expr.clone().rewrite(rewriter).data().unwrap();
assert_eq!(
&output, expr,
- "{} was simplified to {}, but expected it to be unchanged",
- expr, output
+ "{expr} was simplified to {output}, but expected it to be unchanged"
);
}
}
diff --git a/datafusion/core/tests/parquet/file_statistics.rs b/datafusion/core/tests/parquet/file_statistics.rs
index 0b76a67792..db1c78cb1d 100644
--- a/datafusion/core/tests/parquet/file_statistics.rs
+++ b/datafusion/core/tests/parquet/file_statistics.rs
@@ -165,7 +165,7 @@ async fn load_table_stats_with_session_level_cache() {
async fn list_files_with_session_level_cache() {
let p_name = "alltypes_plain.parquet";
let testdata = datafusion::test_util::parquet_test_data();
- let filename = format!("{}/{}", testdata, p_name);
+ let filename = format!("{testdata}/{p_name}");
let temp_path1 = tempdir()
.unwrap()
@@ -173,7 +173,7 @@ async fn list_files_with_session_level_cache() {
.into_os_string()
.into_string()
.unwrap();
- let temp_filename1 = format!("{}/{}", temp_path1, p_name);
+ let temp_filename1 = format!("{temp_path1}/{p_name}");
let temp_path2 = tempdir()
.unwrap()
@@ -181,7 +181,7 @@ async fn list_files_with_session_level_cache() {
.into_os_string()
.into_string()
.unwrap();
- let temp_filename2 = format!("{}/{}", temp_path2, p_name);
+ let temp_filename2 = format!("{temp_path2}/{p_name}");
fs::copy(filename.clone(), temp_filename1).expect("panic");
fs::copy(filename, temp_filename2).expect("panic");
diff --git a/datafusion/core/tests/physical_optimizer/enforce_distribution.rs b/datafusion/core/tests/physical_optimizer/enforce_distribution.rs
index 64aa799324..4034800c30 100644
--- a/datafusion/core/tests/physical_optimizer/enforce_distribution.rs
+++ b/datafusion/core/tests/physical_optimizer/enforce_distribution.rs
@@ -531,8 +531,7 @@ impl TestConfig {
assert_eq!(
&expected_lines, &actual_lines,
- "\n\nexpected:\n\n{:#?}\nactual:\n\n{:#?}\n\n",
- expected_lines, actual_lines
+ "\n\nexpected:\n\n{expected_lines:#?}\nactual:\n\n{actual_lines:#?}\n\n"
);
Ok(optimized)
diff --git a/datafusion/core/tests/physical_optimizer/filter_pushdown/util.rs b/datafusion/core/tests/physical_optimizer/filter_pushdown/util.rs
index 811aba495a..393322a7f3 100644
--- a/datafusion/core/tests/physical_optimizer/filter_pushdown/util.rs
+++ b/datafusion/core/tests/physical_optimizer/filter_pushdown/util.rs
@@ -210,7 +210,7 @@ impl FileSource for TestSource {
.map(|p| format!(", predicate={p}"))
.unwrap_or_default();
- write!(f, "{}{}", support, predicate_string)
+ write!(f, "{support}{predicate_string}")
}
DisplayFormatType::TreeRender => {
if let Some(predicate) = &self.predicate {
diff --git a/datafusion/core/tests/physical_optimizer/partition_statistics.rs b/datafusion/core/tests/physical_optimizer/partition_statistics.rs
index 8ac583c715..a741f518a4 100644
--- a/datafusion/core/tests/physical_optimizer/partition_statistics.rs
+++ b/datafusion/core/tests/physical_optimizer/partition_statistics.rs
@@ -177,8 +177,7 @@ mod test {
for i in 0..actual_stats.len() {
assert_eq!(
actual_stats[i], expected_stats[i],
- "Partition {} data doesn't match statistics",
- i
+ "Partition {i} data doesn't match statistics"
);
}
diff --git a/datafusion/core/tests/physical_optimizer/test_utils.rs b/datafusion/core/tests/physical_optimizer/test_utils.rs
index 0e36e83014..955486a310 100644
--- a/datafusion/core/tests/physical_optimizer/test_utils.rs
+++ b/datafusion/core/tests/physical_optimizer/test_utils.rs
@@ -600,8 +600,7 @@ pub fn assert_plan_matches_expected(
assert_eq!(
&expected_lines, &actual_lines,
- "\n\nexpected:\n\n{:#?}\nactual:\n\n{:#?}\n\n",
- expected_lines, actual_lines
+ "\n\nexpected:\n\n{expected_lines:#?}\nactual:\n\n{actual_lines:#?}\n\n"
);
Ok(())
diff --git a/datafusion/core/tests/tracing/mod.rs b/datafusion/core/tests/tracing/mod.rs
index 787dd9f4f3..df8a28c021 100644
--- a/datafusion/core/tests/tracing/mod.rs
+++ b/datafusion/core/tests/tracing/mod.rs
@@ -55,9 +55,9 @@ async fn test_tracer_injection() {
let untraced_result = SpawnedTask::spawn(run_query()).join().await;
if let Err(e) = untraced_result {
// Check if the error message contains the expected error.
- assert!(e.is_panic(), "Expected a panic, but got: {:?}", e);
+ assert!(e.is_panic(), "Expected a panic, but got: {e:?}");
assert_contains!(e.to_string(), "Task ID not found in spawn graph");
- info!("Caught expected panic: {}", e);
+ info!("Caught expected panic: {e}");
} else {
panic!("Expected the task to panic, but it completed successfully");
};
@@ -94,7 +94,7 @@ async fn run_query() {
ctx.register_object_store(&url, traceable_store.clone());
// Register a listing table from the test data directory.
- let table_path = format!("test://{}/", test_data);
+ let table_path = format!("test://{test_data}/");
ctx.register_listing_table("alltypes", &table_path, listing_options, None, None)
.await
.expect("Failed to register table");
diff --git a/datafusion/core/tests/user_defined/user_defined_scalar_functions.rs b/datafusion/core/tests/user_defined/user_defined_scalar_functions.rs
index fbef524440..b5960ae5bd 100644
--- a/datafusion/core/tests/user_defined/user_defined_scalar_functions.rs
+++ b/datafusion/core/tests/user_defined/user_defined_scalar_functions.rs
@@ -1009,8 +1009,7 @@ impl ScalarFunctionWrapper {
if let Some(value) = placeholder.strip_prefix('$') {
Ok(value.parse().map(|v: usize| v - 1).map_err(|e| {
DataFusionError::Execution(format!(
- "Placeholder `{}` parsing error: {}!",
- placeholder, e
+ "Placeholder `{placeholder}` parsing error: {e}!"
))
})?)
} else {
@@ -1165,7 +1164,7 @@ async fn create_scalar_function_from_sql_statement_postgres_syntax() -> Result<(
match ctx.sql(sql).await {
Ok(_) => {}
Err(e) => {
- panic!("Error creating function: {}", e);
+ panic!("Error creating function: {e}");
}
}
diff --git a/datafusion/core/tests/user_defined/user_defined_window_functions.rs b/datafusion/core/tests/user_defined/user_defined_window_functions.rs
index 7c56507acd..b3a3900c50 100644
--- a/datafusion/core/tests/user_defined/user_defined_window_functions.rs
+++ b/datafusion/core/tests/user_defined/user_defined_window_functions.rs
@@ -735,9 +735,7 @@ fn test_default_expressions() -> Result<()> {
assert_eq!(
input_exprs.len(),
ret_exprs.len(),
- "\nInput expressions: {:?}\nReturned expressions: {:?}",
- input_exprs,
- ret_exprs
+ "\nInput expressions: {input_exprs:?}\nReturned expressions: {ret_exprs:?}"
);
// Compares each returned expression with original input expressions
diff --git a/datafusion/datasource-avro/src/avro_to_arrow/arrow_array_reader.rs b/datafusion/datasource-avro/src/avro_to_arrow/arrow_array_reader.rs
index 18b3aba39a..caaf60d634 100644
--- a/datafusion/datasource-avro/src/avro_to_arrow/arrow_array_reader.rs
+++ b/datafusion/datasource-avro/src/avro_to_arrow/arrow_array_reader.rs
@@ -117,7 +117,7 @@ impl<R: Read> AvroArrowArrayReader<'_, R> {
AvroSchema::Record(RecordSchema { fields, lookup, .. }) => {
lookup.iter().for_each(|(field_name, pos)| {
schema_lookup
- .insert(format!("{}.{}", parent_field_name, field_name), *pos);
+ .insert(format!("{parent_field_name}.{field_name}"), *pos);
});
for field in fields {
@@ -131,7 +131,7 @@ impl<R: Read> AvroArrowArrayReader<'_, R> {
}
}
AvroSchema::Array(schema) => {
- let sub_parent_field_name = format!("{}.element", parent_field_name);
+ let sub_parent_field_name = format!("{parent_field_name}.element");
Self::child_schema_lookup(
&sub_parent_field_name,
&schema.items,
diff --git a/datafusion/datasource-parquet/src/file_format.rs b/datafusion/datasource-parquet/src/file_format.rs
index bc8f84b874..83013e5c97 100644
--- a/datafusion/datasource-parquet/src/file_format.rs
+++ b/datafusion/datasource-parquet/src/file_format.rs
@@ -913,7 +913,7 @@ pub fn statistics_from_parquet_meta_calc(
.ok();
}
Err(e) => {
- debug!("Failed to create statistics converter: {}", e);
+ debug!("Failed to create statistics converter: {e}");
null_counts_array[idx] = Precision::Exact(num_rows);
}
}
@@ -1136,9 +1136,8 @@ impl FileSink for ParquetSink {
parquet_props.clone(),
)
.await?;
- let mut reservation =
- MemoryConsumer::new(format!("ParquetSink[{}]", path))
- .register(context.memory_pool());
+ let mut reservation = MemoryConsumer::new(format!("ParquetSink[{path}]"))
+ .register(context.memory_pool());
file_write_tasks.spawn(async move {
while let Some(batch) = rx.recv().await {
writer.write(&batch).await?;
diff --git a/datafusion/datasource-parquet/src/opener.rs b/datafusion/datasource-parquet/src/opener.rs
index 481c66e634..376b403361 100644
--- a/datafusion/datasource-parquet/src/opener.rs
+++ b/datafusion/datasource-parquet/src/opener.rs
@@ -229,8 +229,7 @@ impl FileOpener for ParquetOpener {
Ok(None) => {}
Err(e) => {
debug!(
- "Ignoring error building row filter for '{:?}': {}",
- predicate, e
+ "Ignoring error building row filter for '{predicate:?}': {e}"
);
}
};
diff --git a/datafusion/datasource-parquet/src/page_filter.rs b/datafusion/datasource-parquet/src/page_filter.rs
index 148527998a..d4f486fae0 100644
--- a/datafusion/datasource-parquet/src/page_filter.rs
+++ b/datafusion/datasource-parquet/src/page_filter.rs
@@ -333,7 +333,7 @@ fn prune_pages_in_one_row_group(
assert_eq!(page_row_counts.len(), values.len());
let mut sum_row = *page_row_counts.first().unwrap();
let mut selected = *values.first().unwrap();
- trace!("Pruned to {:?} using {:?}", values, pruning_stats);
+ trace!("Pruned to {values:?} using {pruning_stats:?}");
for (i, &f) in values.iter().enumerate().skip(1) {
if f == selected {
sum_row += *page_row_counts.get(i).unwrap();
diff --git a/datafusion/datasource-parquet/src/row_group_filter.rs b/datafusion/datasource-parquet/src/row_group_filter.rs
index 13418cdeee..f6411d6e61 100644
--- a/datafusion/datasource-parquet/src/row_group_filter.rs
+++ b/datafusion/datasource-parquet/src/row_group_filter.rs
@@ -1265,7 +1265,7 @@ mod tests {
let expr = col(r#""String""#).in_list(
(1..25)
- .map(|i| lit(format!("Hello_Not_Exists{}", i)))
+ .map(|i| lit(format!("Hello_Not_Exists{i}")))
.collect::<Vec<_>>(),
false,
);
diff --git a/datafusion/datasource-parquet/src/source.rs b/datafusion/datasource-parquet/src/source.rs
index 13518562ca..13684db8ea 100644
--- a/datafusion/datasource-parquet/src/source.rs
+++ b/datafusion/datasource-parquet/src/source.rs
@@ -555,7 +555,7 @@ impl FileSource for ParquetSource {
.map(|p| format!(", predicate={p}"))
.unwrap_or_default();
- write!(f, "{}", predicate_string)?;
+ write!(f, "{predicate_string}")?;
// Try to build a the pruning predicates.
// These are only generated here because it's useful to have *some*
@@ -577,7 +577,7 @@ impl FileSource for ParquetSource {
let mut guarantees = pruning_predicate
.literal_guarantees()
.iter()
- .map(|item| format!("{}", item))
+ .map(|item| format!("{item}"))
.collect_vec();
guarantees.sort();
writeln!(
diff --git a/datafusion/datasource/benches/split_groups_by_statistics.rs b/datafusion/datasource/benches/split_groups_by_statistics.rs
index f7c5e1b44a..3876b0b121 100644
--- a/datafusion/datasource/benches/split_groups_by_statistics.rs
+++ b/datafusion/datasource/benches/split_groups_by_statistics.rs
@@ -55,7 +55,7 @@ pub fn compare_split_groups_by_statistics_algorithms(c: &mut Criterion) {
group.bench_with_input(
BenchmarkId::new(
"original",
- format!("files={},overlap={:.1}", num_files, overlap),
+ format!("files={num_files},overlap={overlap:.1}"),
),
&(
file_groups.clone(),
@@ -77,8 +77,8 @@ pub fn compare_split_groups_by_statistics_algorithms(c: &mut Criterion) {
for &tp in &target_partitions {
group.bench_with_input(
BenchmarkId::new(
- format!("v2_partitions={}", tp),
- format!("files={},overlap={:.1}", num_files, overlap),
+ format!("v2_partitions={tp}"),
+ format!("files={num_files},overlap={overlap:.1}"),
),
&(
file_groups.clone(),
diff --git a/datafusion/datasource/src/file_groups.rs b/datafusion/datasource/src/file_groups.rs
index bc9f5f1b78..8bfadbef77 100644
--- a/datafusion/datasource/src/file_groups.rs
+++ b/datafusion/datasource/src/file_groups.rs
@@ -963,8 +963,8 @@ mod test {
(Some(_), None) => panic!("Expected Some, got None"),
(None, Some(_)) => panic!("Expected None, got Some"),
(Some(expected), Some(actual)) => {
- let expected_string = format!("{:#?}", expected);
- let actual_string = format!("{:#?}", actual);
+ let expected_string = format!("{expected:#?}");
+ let actual_string = format!("{actual:#?}");
assert_eq!(expected_string, actual_string);
}
}
diff --git a/datafusion/datasource/src/file_scan_config.rs b/datafusion/datasource/src/file_scan_config.rs
index 92e2f8ec60..0788ee87ba 100644
--- a/datafusion/datasource/src/file_scan_config.rs
+++ b/datafusion/datasource/src/file_scan_config.rs
@@ -2498,10 +2498,7 @@ mod tests {
avg_files_per_partition
);
- println!(
- "Distribution - min files: {}, max files: {}",
- min_size, max_size
- );
+ println!("Distribution - min files: {min_size}, max files: {max_size}");
}
}
diff --git a/datafusion/datasource/src/memory.rs b/datafusion/datasource/src/memory.rs
index 93ead62d3d..54cea71843 100644
--- a/datafusion/datasource/src/memory.rs
+++ b/datafusion/datasource/src/memory.rs
@@ -97,9 +97,7 @@ impl DataSource for MemorySourceConfig {
let output_ordering = self
.sort_information
.first()
- .map(|output_ordering| {
- format!(", output_ordering={}", output_ordering)
- })
+ .map(|output_ordering| format!(", output_ordering={output_ordering}"))
.unwrap_or_default();
let eq_properties = self.eq_properties();
@@ -107,12 +105,12 @@ impl DataSource for MemorySourceConfig {
let constraints = if constraints.is_empty() {
String::new()
} else {
- format!(", {}", constraints)
+ format!(", {constraints}")
};
let limit = self
.fetch
- .map_or(String::new(), |limit| format!(", fetch={}", limit));
+ .map_or(String::new(), |limit| format!(", fetch={limit}"));
if self.show_sizes {
write!(
f,
@@ -1053,10 +1051,7 @@ mod tests {
partition_cnt: Option<usize>,
) {
let should_exist = if let Some(partition_cnt) = partition_cnt {
- format!(
- "new datasource should exist and have {:?} partitions",
- partition_cnt
- )
+ format!("new datasource should exist and have {partition_cnt:?} partitions")
} else {
"new datasource should not exist".into()
};
@@ -1066,9 +1061,7 @@ mod tests {
assert_eq!(
actual,
partition_cnt,
- "partitioned datasrc does not match expected, we expected {}, instead found {:?}",
- should_exist,
- actual
+ "partitioned datasrc does not match expected, we expected {should_exist}, instead found {actual:?}"
);
}
diff --git a/datafusion/datasource/src/mod.rs b/datafusion/datasource/src/mod.rs
index 3e44851d14..9e83adc6b9 100644
--- a/datafusion/datasource/src/mod.rs
+++ b/datafusion/datasource/src/mod.rs
@@ -379,7 +379,7 @@ pub fn generate_test_files(num_files: usize, overlap_factor: f64) -> Vec<FileGro
let file = PartitionedFile {
object_meta: ObjectMeta {
- location: Path::from(format!("file_{}.parquet", i)),
+ location: Path::from(format!("file_{i}.parquet")),
last_modified: chrono::Utc::now(),
size: 1000,
e_tag: None,
diff --git a/datafusion/datasource/src/write/demux.rs b/datafusion/datasource/src/write/demux.rs
index b1ec3ee397..0ac0e5dc53 100644
--- a/datafusion/datasource/src/write/demux.rs
+++ b/datafusion/datasource/src/write/demux.rs
@@ -225,7 +225,7 @@ fn generate_file_path(
if !single_file_output {
base_output_path
.prefix()
- .child(format!("{}_{}.{}", write_id, part_idx, file_extension))
+ .child(format!("{write_id}_{part_idx}.{file_extension}"))
} else {
base_output_path.prefix().to_owned()
}
@@ -556,5 +556,5 @@ fn compute_hive_style_file_path(
file_path = file_path.child(format!("{}={}", partition_by[j].0, part_key[j]));
}
- file_path.child(format!("{}.{}", write_id, file_extension))
+ file_path.child(format!("{write_id}.{file_extension}"))
}
diff --git a/datafusion/doc/src/lib.rs b/datafusion/doc/src/lib.rs
index 68ed1e2352..f9b916c2b3 100644
--- a/datafusion/doc/src/lib.rs
+++ b/datafusion/doc/src/lib.rs
@@ -93,7 +93,7 @@ impl Documentation {
self.doc_section.label,
self.doc_section
.description
- .map(|s| format!(", description = \"{}\"", s))
+ .map(|s| format!(", description = \"{s}\""))
.unwrap_or_default(),
)
.as_ref(),
@@ -110,7 +110,7 @@ impl Documentation {
&self
.sql_example
.clone()
- .map(|s| format!("\n sql_example = r#\"{}\"#,", s))
+ .map(|s| format!("\n sql_example = r#\"{s}\"#,"))
.unwrap_or_default(),
);
@@ -120,7 +120,7 @@ impl Documentation {
args.iter().for_each(|(name, value)| {
if value.contains(st_arg_token) {
if name.starts_with("The ") {
- result.push_str(format!("\n standard_argument(\n name = \"{}\"),", name).as_ref());
+ result.push_str(format!("\n standard_argument(\n name = \"{name}\"),").as_ref());
} else {
result.push_str(format!("\n standard_argument(\n name = \"{}\",\n prefix = \"{}\"\n ),", name, value.replace(st_arg_token, "")).as_ref());
}
@@ -132,7 +132,7 @@ impl Documentation {
if let Some(args) = self.arguments.clone() {
args.iter().for_each(|(name, value)| {
if !value.contains(st_arg_token) {
- result.push_str(format!("\n argument(\n name = \"{}\",\n description = \"{}\"\n ),", name, value).as_ref());
+ result.push_str(format!("\n argument(\n name = \"{name}\",\n description = \"{value}\"\n ),").as_ref());
}
});
}
@@ -140,7 +140,7 @@ impl Documentation {
if let Some(alt_syntax) = self.alternative_syntax.clone() {
alt_syntax.iter().for_each(|syntax| {
result.push_str(
- format!("\n alternative_syntax = \"{}\",", syntax).as_ref(),
+ format!("\n alternative_syntax = \"{syntax}\",").as_ref(),
);
});
}
@@ -148,8 +148,7 @@ impl Documentation {
// Related UDFs
if let Some(related_udf) = self.related_udfs.clone() {
related_udf.iter().for_each(|udf| {
- result
- .push_str(format!("\n related_udf(name = \"{}\"),", udf).as_ref());
+ result.push_str(format!("\n related_udf(name = \"{udf}\"),").as_ref());
});
}
diff --git a/datafusion/execution/src/disk_manager.rs b/datafusion/execution/src/disk_manager.rs
index 555b44ad5c..9d492e7ef9 100644
--- a/datafusion/execution/src/disk_manager.rs
+++ b/datafusion/execution/src/disk_manager.rs
@@ -103,8 +103,7 @@ impl DiskManager {
DiskManagerConfig::NewSpecified(conf_dirs) => {
let local_dirs = create_local_dirs(conf_dirs)?;
debug!(
- "Created local dirs {:?} as DataFusion working directory",
- local_dirs
+ "Created local dirs {local_dirs:?} as DataFusion working directory"
);
Ok(Arc::new(Self {
local_dirs: Mutex::new(Some(local_dirs)),
diff --git a/datafusion/execution/src/memory_pool/pool.rs b/datafusion/execution/src/memory_pool/pool.rs
index e623246eb9..c975b69fd9 100644
--- a/datafusion/execution/src/memory_pool/pool.rs
+++ b/datafusion/execution/src/memory_pool/pool.rs
@@ -430,7 +430,7 @@ fn provide_top_memory_consumers_to_error_msg(
error_msg: String,
top_consumers: String,
) -> String {
- format!("Additional allocation failed with top memory consumers (across reservations) as: {}. Error: {}", top_consumers, error_msg)
+ format!("Additional allocation failed with top memory consumers (across reservations) as: {top_consumers}. Error: {error_msg}")
}
#[cfg(test)]
@@ -546,8 +546,7 @@ mod tests {
&res,
Err(DataFusionError::ResourcesExhausted(ref e)) if e.to_string().contains(&expected)
),
- "should provide list of top memory consumers, instead found {:?}",
- res
+ "should provide list of top memory consumers, instead found {res:?}"
);
}
@@ -569,7 +568,7 @@ mod tests {
&res,
Err(DataFusionError::ResourcesExhausted(ref e)) if e.to_string().contains(&expected)
),
- "should provide proper error when no reservations have been made yet, instead found {:?}", res
+ "should provide proper error when no reservations have been made yet, instead found {res:?}"
);
// API: multiple registrations using the same hashed consumer,
@@ -587,8 +586,7 @@ mod tests {
&res,
Err(DataFusionError::ResourcesExhausted(ref e)) if e.to_string().contains(&expected)
),
- "should provide proper error for 2 consumers, instead found {:?}",
- res
+ "should provide proper error for 2 consumers, instead found {res:?}"
);
// Test: will accumulate size changes per consumer, not per reservation
@@ -600,7 +598,7 @@ mod tests {
&res,
Err(DataFusionError::ResourcesExhausted(ref e)) if e.to_string().contains(&expected)
),
- "should provide proper error for 2 consumers(one foo=20 bytes, another foo=10 bytes, available=70), instead found {:?}", res
+ "should provide proper error for 2 consumers(one foo=20 bytes, another foo=10 bytes, available=70), instead found {res:?}"
);
// Test: different hashed consumer, (even with the same name),
@@ -615,7 +613,7 @@ mod tests {
&res,
Err(DataFusionError::ResourcesExhausted(ref e)) if e.to_string().contains(&expected)
),
- "should provide proper error with 3 separate consumers(1 = 20 bytes, 2 = 10 bytes, 3 = 0 bytes), instead found {:?}", res
+ "should provide proper error with 3 separate consumers(1 = 20 bytes, 2 = 10 bytes, 3 = 0 bytes), instead found {res:?}"
);
}
@@ -636,8 +634,7 @@ mod tests {
&res,
Err(DataFusionError::ResourcesExhausted(ref e)) if e.to_string().contains(&expected)
),
- "should provide proper error with both consumers, instead found {:?}",
- res
+ "should provide proper error with both consumers, instead found {res:?}"
);
// Test: unregister one
@@ -650,7 +647,7 @@ mod tests {
&res,
Err(DataFusionError::ResourcesExhausted(ref e)) if e.to_string().contains(&expected_consumers)
),
- "should provide proper error with only 1 consumer left registered, instead found {:?}", res
+ "should provide proper error with only 1 consumer left registered, instead found {res:?}"
);
// Test: actual message we see is the `available is 70`. When it should be `available is 90`.
@@ -662,7 +659,7 @@ mod tests {
&res,
Err(DataFusionError::ResourcesExhausted(ref e)) if e.to_string().contains(expected_90_available)
),
- "should find that the inner pool will still count all bytes for the deregistered consumer until the reservation is dropped, instead found {:?}", res
+ "should find that the inner pool will still count all bytes for the deregistered consumer until the reservation is dropped, instead found {res:?}"
);
// Test: the registration needs to free itself (or be dropped),
@@ -674,7 +671,7 @@ mod tests {
&res,
Err(DataFusionError::ResourcesExhausted(ref e)) if e.to_string().contains(expected_90_available)
),
- "should correctly account the total bytes after reservation is free, instead found {:?}", res
+ "should correctly account the total bytes after reservation is free, instead found {res:?}"
);
}
@@ -720,8 +717,7 @@ mod tests {
let res = downcasted.report_top(2);
assert_eq!(
res, expected,
- "should provide list of top memory consumers, instead found {:?}",
- res
+ "should provide list of top memory consumers, instead found {res:?}"
);
}
}
diff --git a/datafusion/expr-common/src/columnar_value.rs b/datafusion/expr-common/src/columnar_value.rs
index cb7cbdbac2..a21ad5bbbc 100644
--- a/datafusion/expr-common/src/columnar_value.rs
+++ b/datafusion/expr-common/src/columnar_value.rs
@@ -237,7 +237,7 @@ impl fmt::Display for ColumnarValue {
};
if let Ok(formatted) = formatted {
- write!(f, "{}", formatted)
+ write!(f, "{formatted}")
} else {
write!(f, "Error formatting columnar value")
}
diff --git a/datafusion/expr-common/src/interval_arithmetic.rs b/datafusion/expr-common/src/interval_arithmetic.rs
index 4aac98d672..d656c676bd 100644
--- a/datafusion/expr-common/src/interval_arithmetic.rs
+++ b/datafusion/expr-common/src/interval_arithmetic.rs
@@ -1696,9 +1696,9 @@ impl Display for NullableInterval {
match self {
Self::Null { .. } => write!(f, "NullableInterval: {{NULL}}"),
Self::MaybeNull { values } => {
- write!(f, "NullableInterval: {} U {{NULL}}", values)
+ write!(f, "NullableInterval: {values} U {{NULL}}")
}
- Self::NotNull { values } => write!(f, "NullableInterval: {}", values),
+ Self::NotNull { values } => write!(f, "NullableInterval: {values}"),
}
}
}
@@ -2719,8 +2719,8 @@ mod tests {
),
];
for (first, second, expected) in possible_cases {
- println!("{}", first);
- println!("{}", second);
+ println!("{first}");
+ println!("{second}");
assert_eq!(first.union(second)?, expected)
}
@@ -3717,14 +3717,14 @@ mod tests {
#[test]
fn test_interval_display() {
let interval = Interval::make(Some(0.25_f32), Some(0.50_f32)).unwrap();
- assert_eq!(format!("{}", interval), "[0.25, 0.5]");
+ assert_eq!(format!("{interval}"), "[0.25, 0.5]");
let interval = Interval::try_new(
ScalarValue::Float32(Some(f32::NEG_INFINITY)),
ScalarValue::Float32(Some(f32::INFINITY)),
)
.unwrap();
- assert_eq!(format!("{}", interval), "[NULL, NULL]");
+ assert_eq!(format!("{interval}"), "[NULL, NULL]");
}
macro_rules! capture_mode_change {
diff --git a/datafusion/expr-common/src/signature.rs b/datafusion/expr-common/src/signature.rs
index 3f09d0dcac..5e1705d8ff 100644
--- a/datafusion/expr-common/src/signature.rs
+++ b/datafusion/expr-common/src/signature.rs
@@ -969,8 +969,7 @@ mod tests {
for case in positive_cases {
assert!(
case.supports_zero_argument(),
- "Expected {:?} to support zero arguments",
- case
+ "Expected {case:?} to support zero arguments"
);
}
@@ -989,8 +988,7 @@ mod tests {
for case in negative_cases {
assert!(
!case.supports_zero_argument(),
- "Expected {:?} not to support zero arguments",
- case
+ "Expected {case:?} not to support zero arguments"
);
}
}
diff --git a/datafusion/expr-common/src/statistics.rs b/datafusion/expr-common/src/statistics.rs
index 7e0bc88087..14f2f331ef 100644
--- a/datafusion/expr-common/src/statistics.rs
+++ b/datafusion/expr-common/src/statistics.rs
@@ -1559,18 +1559,14 @@ mod tests {
assert_eq!(
new_generic_from_binary_op(&op, &dist_a, &dist_b)?.range()?,
apply_operator(&op, a, b)?,
- "Failed for {:?} {op} {:?}",
- dist_a,
- dist_b
+ "Failed for {dist_a:?} {op} {dist_b:?}"
);
}
for op in [Gt, GtEq, Lt, LtEq, Eq, NotEq] {
assert_eq!(
create_bernoulli_from_comparison(&op, &dist_a, &dist_b)?.range()?,
apply_operator(&op, a, b)?,
- "Failed for {:?} {op} {:?}",
- dist_a,
- dist_b
+ "Failed for {dist_a:?} {op} {dist_b:?}"
);
}
}
diff --git a/datafusion/expr/src/expr.rs b/datafusion/expr/src/expr.rs
index b8e4204a9c..f773da8162 100644
--- a/datafusion/expr/src/expr.rs
+++ b/datafusion/expr/src/expr.rs
@@ -2458,7 +2458,7 @@ impl Display for SchemaDisplay<'_> {
write!(f, "{name}")
}
Err(e) => {
- write!(f, "got error from schema_name {}", e)
+ write!(f, "got error from schema_name {e}")
}
}
}
@@ -2609,7 +2609,7 @@ impl Display for SchemaDisplay<'_> {
write!(f, "{name}")
}
Err(e) => {
- write!(f, "got error from schema_name {}", e)
+ write!(f, "got error from schema_name {e}")
}
}
}
@@ -2647,7 +2647,7 @@ impl Display for SchemaDisplay<'_> {
write!(f, "{name}")
}
Err(e) => {
- write!(f, "got error from window_function_schema_name {}", e)
+ write!(f, "got error from window_function_schema_name {e}")
}
}
}
@@ -2668,7 +2668,7 @@ impl Display for SchemaDisplay<'_> {
)?;
if let Some(null_treatment) = null_treatment {
- write!(f, " {}", null_treatment)?;
+ write!(f, " {null_treatment}")?;
}
if !partition_by.is_empty() {
@@ -2862,7 +2862,7 @@ impl Display for SqlDisplay<'_> {
write!(f, "{name}")
}
Err(e) => {
- write!(f, "got error from schema_name {}", e)
+ write!(f, "got error from schema_name {e}")
}
}
}
@@ -3024,10 +3024,10 @@ impl Display for Expr {
WindowFunctionDefinition::AggregateUDF(fun) => {
match fun.window_function_display_name(params) {
Ok(name) => {
- write!(f, "{}", name)
+ write!(f, "{name}")
}
Err(e) => {
- write!(f, "got error from window_function_display_name {}", e)
+ write!(f, "got error from window_function_display_name {e}")
}
}
}
@@ -3043,7 +3043,7 @@ impl Display for Expr {
fmt_function(f, &fun.to_string(), false, args, true)?;
if let Some(nt) = null_treatment {
- write!(f, "{}", nt)?;
+ write!(f, "{nt}")?;
}
if !partition_by.is_empty() {
@@ -3064,10 +3064,10 @@ impl Display for Expr {
Expr::AggregateFunction(AggregateFunction { func, params }) => {
match func.display_name(params) {
Ok(name) => {
- write!(f, "{}", name)
+ write!(f, "{name}")
}
Err(e) => {
- write!(f, "got error from display_name {}", e)
+ write!(f, "got error from display_name {e}")
}
}
}
diff --git a/datafusion/expr/src/logical_plan/builder.rs b/datafusion/expr/src/logical_plan/builder.rs
index d4d45226d3..be2c236c52 100644
--- a/datafusion/expr/src/logical_plan/builder.rs
+++ b/datafusion/expr/src/logical_plan/builder.rs
@@ -1513,7 +1513,7 @@ pub fn change_redundant_column(fields: &Fields) -> Vec<Field> {
// Loop until we find a name that hasn't been used
while seen.contains(&new_name) {
*count += 1;
- new_name = format!("{}:{}", base_name, count);
+ new_name = format!("{base_name}:{count}");
}
seen.insert(new_name.clone());
@@ -2624,7 +2624,7 @@ mod tests {
// Check unnested struct field is a scalar
let field = plan
.schema()
- .field_with_name(None, &format!("struct_singular.{}", field_name))
+ .field_with_name(None, &format!("struct_singular.{field_name}"))
.unwrap();
assert_eq!(&DataType::UInt32, field.data_type());
}
@@ -2707,7 +2707,7 @@ mod tests {
for field_name in &["a", "b"] {
let field = plan
.schema()
- .field_with_name(None, &format!("struct_singular.{}", field_name))
+ .field_with_name(None, &format!("struct_singular.{field_name}"))
.unwrap();
assert_eq!(&DataType::UInt32, field.data_type());
}
diff --git a/datafusion/expr/src/logical_plan/display.rs b/datafusion/expr/src/logical_plan/display.rs
index 14758b61e8..73c1a5304f 100644
--- a/datafusion/expr/src/logical_plan/display.rs
+++ b/datafusion/expr/src/logical_plan/display.rs
@@ -341,7 +341,7 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> {
let eclipse = if values.len() > 5 { "..." } else { "" };
- let values_str = format!("{}{}", str_values, eclipse);
+ let values_str = format!("{str_values}{eclipse}");
json!({
"Node Type": "Values",
"Values": values_str
@@ -429,7 +429,7 @@ impl<'a, 'b> PgJsonVisitor<'a, 'b> {
}) => {
let op_str = options
.iter()
- .map(|(k, v)| format!("{}={}", k, v))
+ .map(|(k, v)| format!("{k}={v}"))
.collect::<Vec<_>>()
.join(", ");
json!({
diff --git a/datafusion/expr/src/logical_plan/plan.rs b/datafusion/expr/src/logical_plan/plan.rs
index edf5f1126b..30d5f43f3a 100644
--- a/datafusion/expr/src/logical_plan/plan.rs
+++ b/datafusion/expr/src/logical_plan/plan.rs
@@ -1721,7 +1721,7 @@ impl LogicalPlan {
LogicalPlan::RecursiveQuery(RecursiveQuery {
is_distinct, ..
}) => {
- write!(f, "RecursiveQuery: is_distinct={}", is_distinct)
+ write!(f, "RecursiveQuery: is_distinct={is_distinct}")
}
LogicalPlan::Values(Values { ref values, .. }) => {
let str_values: Vec<_> = values
@@ -1964,7 +1964,7 @@ impl LogicalPlan {
};
write!(
f,
- "Limit: skip={}, fetch={}", skip_str,fetch_str,
+ "Limit: skip={skip_str}, fetch={fetch_str}",
)
}
LogicalPlan::Subquery(Subquery { .. }) => {
@@ -2860,7 +2860,7 @@ impl Union {
// Generate unique field name
let name = if let Some(count) = name_counts.get_mut(&base_name) {
*count += 1;
- format!("{}_{}", base_name, count)
+ format!("{base_name}_{count}")
} else {
name_counts.insert(base_name.clone(), 0);
base_name
@@ -3657,7 +3657,7 @@ fn calc_func_dependencies_for_project(
.unwrap_or(vec![]))
}
_ => {
- let name = format!("{}", expr);
+ let name = format!("{expr}");
Ok(input_fields
.iter()
.position(|item| *item == name)
@@ -5280,12 +5280,7 @@ digraph {
)?;
let fields = join.schema.fields();
- assert_eq!(
- fields.len(),
- 6,
- "Expected 6 fields for {:?} join",
- join_type
- );
+ assert_eq!(fields.len(), 6, "Expected 6 fields for {join_type:?} join");
for (i, field) in fields.iter().enumerate() {
let expected_nullable = match (i, &join_type) {
diff --git a/datafusion/expr/src/logical_plan/statement.rs b/datafusion/expr/src/logical_plan/statement.rs
index 82acebee3d..9491143f37 100644
--- a/datafusion/expr/src/logical_plan/statement.rs
+++ b/datafusion/expr/src/logical_plan/statement.rs
@@ -123,7 +123,7 @@ impl Statement {
)
}
Statement::Deallocate(Deallocate { name }) => {
- write!(f, "Deallocate: {}", name)
+ write!(f, "Deallocate: {name}")
}
}
}
diff --git a/datafusion/expr/src/udaf.rs b/datafusion/expr/src/udaf.rs
index 9750743381..9ab532240d 100644
--- a/datafusion/expr/src/udaf.rs
+++ b/datafusion/expr/src/udaf.rs
@@ -460,7 +460,7 @@ pub trait AggregateUDFImpl: Debug + Send + Sync {
))?;
if let Some(null_treatment) = null_treatment {
- schema_name.write_fmt(format_args!(" {}", null_treatment))?;
+ schema_name.write_fmt(format_args!(" {null_treatment}"))?;
}
if let Some(filter) = filter {
@@ -505,7 +505,7 @@ pub trait AggregateUDFImpl: Debug + Send + Sync {
))?;
if let Some(null_treatment) = null_treatment {
- schema_name.write_fmt(format_args!(" {}", null_treatment))?;
+ schema_name.write_fmt(format_args!(" {null_treatment}"))?;
}
if let Some(filter) = filter {
@@ -549,7 +549,7 @@ pub trait AggregateUDFImpl: Debug + Send + Sync {
))?;
if let Some(null_treatment) = null_treatment {
- schema_name.write_fmt(format_args!(" {}", null_treatment))?;
+ schema_name.write_fmt(format_args!(" {null_treatment}"))?;
}
if !partition_by.is_empty() {
@@ -596,7 +596,7 @@ pub trait AggregateUDFImpl: Debug + Send + Sync {
))?;
if let Some(nt) = null_treatment {
- display_name.write_fmt(format_args!(" {}", nt))?;
+ display_name.write_fmt(format_args!(" {nt}"))?;
}
if let Some(fe) = filter {
display_name.write_fmt(format_args!(" FILTER (WHERE {fe})"))?;
@@ -643,7 +643,7 @@ pub trait AggregateUDFImpl: Debug + Send + Sync {
))?;
if let Some(null_treatment) = null_treatment {
- display_name.write_fmt(format_args!(" {}", null_treatment))?;
+ display_name.write_fmt(format_args!(" {null_treatment}"))?;
}
if !partition_by.is_empty() {
diff --git a/datafusion/ffi/src/arrow_wrappers.rs b/datafusion/ffi/src/arrow_wrappers.rs
index a18e6df59b..eb1f34b3d9 100644
--- a/datafusion/ffi/src/arrow_wrappers.rs
+++ b/datafusion/ffi/src/arrow_wrappers.rs
@@ -36,7 +36,7 @@ impl From<SchemaRef> for WrappedSchema {
let ffi_schema = match FFI_ArrowSchema::try_from(value.as_ref()) {
Ok(s) => s,
Err(e) => {
- error!("Unable to convert DataFusion Schema to FFI_ArrowSchema in FFI_PlanProperties. {}", e);
+ error!("Unable to convert DataFusion Schema to FFI_ArrowSchema in FFI_PlanProperties. {e}");
FFI_ArrowSchema::empty()
}
};
@@ -50,7 +50,7 @@ impl From<WrappedSchema> for SchemaRef {
let schema = match Schema::try_from(&value.0) {
Ok(s) => s,
Err(e) => {
- error!("Unable to convert from FFI_ArrowSchema to DataFusion Schema in FFI_PlanProperties. {}", e);
+ error!("Unable to convert from FFI_ArrowSchema to DataFusion Schema in FFI_PlanProperties. {e}");
Schema::empty()
}
};
diff --git a/datafusion/ffi/src/plan_properties.rs b/datafusion/ffi/src/plan_properties.rs
index 3592c16b8f..479696e388 100644
--- a/datafusion/ffi/src/plan_properties.rs
+++ b/datafusion/ffi/src/plan_properties.rs
@@ -321,7 +321,7 @@ mod tests {
let foreign_props: PlanProperties = local_props_ptr.try_into()?;
- assert!(format!("{:?}", foreign_props) == format!("{:?}", original_props));
+ assert!(format!("{foreign_props:?}") == format!("{original_props:?}"));
Ok(())
}
diff --git a/datafusion/ffi/src/tests/async_provider.rs b/datafusion/ffi/src/tests/async_provider.rs
index cf05d59630..60434a7dda 100644
--- a/datafusion/ffi/src/tests/async_provider.rs
+++ b/datafusion/ffi/src/tests/async_provider.rs
@@ -260,7 +260,7 @@ impl Stream for AsyncTestRecordBatchStream {
if let Err(e) = this.batch_request.try_send(true) {
return std::task::Poll::Ready(Some(Err(DataFusionError::Execution(
- format!("Unable to send batch request, {}", e),
+ format!("Unable to send batch request, {e}"),
))));
}
@@ -270,7 +270,7 @@ impl Stream for AsyncTestRecordBatchStream {
None => std::task::Poll::Ready(None),
},
Err(e) => std::task::Poll::Ready(Some(Err(DataFusionError::Execution(
- format!("Unable receive record batch: {}", e),
+ format!("Unable to receive record batch: {e}"),
)))),
}
}
diff --git a/datafusion/ffi/src/udtf.rs b/datafusion/ffi/src/udtf.rs
index 1e06247546..08bc4d0cd8 100644
--- a/datafusion/ffi/src/udtf.rs
+++ b/datafusion/ffi/src/udtf.rs
@@ -243,21 +243,21 @@ mod tests {
ScalarValue::Utf8(s) => {
let s_vec = vec![s.to_owned(); num_rows];
(
- Field::new(format!("field-{}", idx), DataType::Utf8, true),
+ Field::new(format!("field-{idx}"), DataType::Utf8, true),
Arc::new(StringArray::from(s_vec)) as ArrayRef,
)
}
ScalarValue::UInt64(v) => {
let v_vec = vec![v.to_owned(); num_rows];
(
- Field::new(format!("field-{}", idx), DataType::UInt64, true),
+ Field::new(format!("field-{idx}"), DataType::UInt64, true),
Arc::new(UInt64Array::from(v_vec)) as ArrayRef,
)
}
ScalarValue::Float64(v) => {
let v_vec = vec![v.to_owned(); num_rows];
(
- Field::new(format!("field-{}", idx), DataType::Float64, true),
+ Field::new(format!("field-{idx}"), DataType::Float64, true),
Arc::new(Float64Array::from(v_vec)) as ArrayRef,
)
}
diff --git a/datafusion/ffi/src/util.rs b/datafusion/ffi/src/util.rs
index 6b9f373939..f199d1523c 100644
--- a/datafusion/ffi/src/util.rs
+++ b/datafusion/ffi/src/util.rs
@@ -138,7 +138,7 @@ mod tests {
assert!(returned_err_result.is_err());
assert!(
returned_err_result.unwrap_err().to_string()
- == format!("Execution error: {}", ERROR_VALUE)
+ == format!("Execution error: {ERROR_VALUE}")
);
let ok_result: Result<String, DataFusionError> = Ok(VALID_VALUE.to_string());
@@ -151,7 +151,7 @@ mod tests {
let returned_err_r_result = wrap_result(err_result);
assert!(
returned_err_r_result
- == RResult::RErr(format!("Execution error: {}", ERROR_VALUE).into())
+ == RResult::RErr(format!("Execution error: {ERROR_VALUE}").into())
);
}
}
diff --git a/datafusion/functions-aggregate/src/bit_and_or_xor.rs b/datafusion/functions-aggregate/src/bit_and_or_xor.rs
index 50ab50abc9..1a9312ba1e 100644
--- a/datafusion/functions-aggregate/src/bit_and_or_xor.rs
+++ b/datafusion/functions-aggregate/src/bit_and_or_xor.rs
@@ -205,7 +205,7 @@ enum BitwiseOperationType {
impl Display for BitwiseOperationType {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- write!(f, "{:?}", self)
+ write!(f, "{self:?}")
}
}
diff --git a/datafusion/functions-aggregate/src/lib.rs b/datafusion/functions-aggregate/src/lib.rs
index 7944280291..b5bb69f6da 100644
--- a/datafusion/functions-aggregate/src/lib.rs
+++ b/datafusion/functions-aggregate/src/lib.rs
@@ -220,8 +220,7 @@ mod tests {
for alias in func.aliases() {
assert!(
names.insert(alias.to_string().to_lowercase()),
- "duplicate function name: {}",
- alias
+ "duplicate function name: {alias}"
);
}
}
diff --git a/datafusion/functions-nested/src/extract.rs b/datafusion/functions-nested/src/extract.rs
index bb84801f98..95bf5a7341 100644
--- a/datafusion/functions-nested/src/extract.rs
+++ b/datafusion/functions-nested/src/extract.rs
@@ -238,8 +238,7 @@ where
{
let index: O = index.try_into().map_err(|_| {
DataFusionError::Execution(format!(
- "array_element got invalid index: {}",
- index
+ "array_element got invalid index: {index}"
))
})?;
// 0 ~ len - 1
diff --git a/datafusion/functions-nested/src/lib.rs b/datafusion/functions-nested/src/lib.rs
index c9a61d98cd..b05b53d2d8 100644
--- a/datafusion/functions-nested/src/lib.rs
+++ b/datafusion/functions-nested/src/lib.rs
@@ -201,8 +201,7 @@ mod tests {
for alias in func.aliases() {
assert!(
names.insert(alias.to_string().to_lowercase()),
- "duplicate function name: {}",
- alias
+ "duplicate function name: {alias}"
);
}
}
diff --git a/datafusion/functions/benches/character_length.rs b/datafusion/functions/benches/character_length.rs
index fb56b6dd5b..270ee57f64 100644
--- a/datafusion/functions/benches/character_length.rs
+++ b/datafusion/functions/benches/character_length.rs
@@ -41,7 +41,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
c.bench_function(
- &format!("character_length_StringArray_ascii_str_len_{}", str_len),
+ &format!("character_length_StringArray_ascii_str_len_{str_len}"),
|b| {
b.iter(|| {
black_box(character_length.invoke_with_args(ScalarFunctionArgs {
@@ -63,7 +63,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
c.bench_function(
- &format!("character_length_StringArray_utf8_str_len_{}", str_len),
+ &format!("character_length_StringArray_utf8_str_len_{str_len}"),
|b| {
b.iter(|| {
black_box(character_length.invoke_with_args(ScalarFunctionArgs {
@@ -85,7 +85,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
c.bench_function(
- &format!("character_length_StringViewArray_ascii_str_len_{}", str_len),
+ &format!("character_length_StringViewArray_ascii_str_len_{str_len}"),
|b| {
b.iter(|| {
black_box(character_length.invoke_with_args(ScalarFunctionArgs {
@@ -107,7 +107,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
c.bench_function(
- &format!("character_length_StringViewArray_utf8_str_len_{}", str_len),
+ &format!("character_length_StringViewArray_utf8_str_len_{str_len}"),
|b| {
b.iter(|| {
black_box(character_length.invoke_with_args(ScalarFunctionArgs {
diff --git a/datafusion/functions/benches/cot.rs b/datafusion/functions/benches/cot.rs
index e7ceeca5e9..634768b3f0 100644
--- a/datafusion/functions/benches/cot.rs
+++ b/datafusion/functions/benches/cot.rs
@@ -40,7 +40,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- c.bench_function(&format!("cot f32 array: {}", size), |b| {
+ c.bench_function(&format!("cot f32 array: {size}"), |b| {
b.iter(|| {
black_box(
cot_fn
@@ -63,7 +63,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- c.bench_function(&format!("cot f64 array: {}", size), |b| {
+ c.bench_function(&format!("cot f64 array: {size}"), |b| {
b.iter(|| {
black_box(
cot_fn
diff --git a/datafusion/functions/benches/find_in_set.rs b/datafusion/functions/benches/find_in_set.rs
index 6e60692fc5..787a93ea5d 100644
--- a/datafusion/functions/benches/find_in_set.rs
+++ b/datafusion/functions/benches/find_in_set.rs
@@ -158,7 +158,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.map(|arg| Field::new("a", arg.data_type().clone(), true))
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- group.bench_function(format!("string_len_{}", str_len), |b| {
+ group.bench_function(format!("string_len_{str_len}"), |b| {
b.iter(|| {
black_box(find_in_set.invoke_with_args(ScalarFunctionArgs {
args: args.clone(),
@@ -175,7 +175,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.map(|arg| Field::new("a", arg.data_type().clone(), true))
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- group.bench_function(format!("string_view_len_{}", str_len), |b| {
+ group.bench_function(format!("string_view_len_{str_len}"), |b| {
b.iter(|| {
black_box(find_in_set.invoke_with_args(ScalarFunctionArgs {
args: args.clone(),
@@ -196,7 +196,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.map(|arg| Field::new("a", arg.data_type().clone(), true))
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- group.bench_function(format!("string_len_{}", str_len), |b| {
+ group.bench_function(format!("string_len_{str_len}"), |b| {
b.iter(|| {
black_box(find_in_set.invoke_with_args(ScalarFunctionArgs {
args: args.clone(),
@@ -213,7 +213,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.map(|arg| Field::new("a", arg.data_type().clone(), true))
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- group.bench_function(format!("string_view_len_{}", str_len), |b| {
+ group.bench_function(format!("string_view_len_{str_len}"), |b| {
b.iter(|| {
black_box(find_in_set.invoke_with_args(ScalarFunctionArgs {
args: args.clone(),
diff --git a/datafusion/functions/benches/initcap.rs b/datafusion/functions/benches/initcap.rs
index ecfafa31ee..fbec2c4b28 100644
--- a/datafusion/functions/benches/initcap.rs
+++ b/datafusion/functions/benches/initcap.rs
@@ -57,7 +57,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
c.bench_function(
- format!("initcap string view shorter than 12 [size={}]", size).as_str(),
+ format!("initcap string view shorter than 12 [size={size}]").as_str(),
|b| {
b.iter(|| {
black_box(initcap.invoke_with_args(ScalarFunctionArgs {
@@ -72,7 +72,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let args = create_args::<i32>(size, 16, true);
c.bench_function(
- format!("initcap string view longer than 12 [size={}]", size).as_str(),
+ format!("initcap string view longer than 12 [size={size}]").as_str(),
|b| {
b.iter(|| {
black_box(initcap.invoke_with_args(ScalarFunctionArgs {
@@ -86,7 +86,7 @@ fn criterion_benchmark(c: &mut Criterion) {
);
let args = create_args::<i32>(size, 16, false);
- c.bench_function(format!("initcap string [size={}]", size).as_str(), |b| {
+ c.bench_function(format!("initcap string [size={size}]").as_str(), |b| {
b.iter(|| {
black_box(initcap.invoke_with_args(ScalarFunctionArgs {
args: args.clone(),
diff --git a/datafusion/functions/benches/isnan.rs b/datafusion/functions/benches/isnan.rs
index d1b4412118..abbf8ef789 100644
--- a/datafusion/functions/benches/isnan.rs
+++ b/datafusion/functions/benches/isnan.rs
@@ -39,7 +39,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- c.bench_function(&format!("isnan f32 array: {}", size), |b| {
+ c.bench_function(&format!("isnan f32 array: {size}"), |b| {
b.iter(|| {
black_box(
isnan
@@ -61,7 +61,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.map(|(idx, arg)| Field::new(format!("arg_{idx}"), arg.data_type(), true))
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- c.bench_function(&format!("isnan f64 array: {}", size), |b| {
+ c.bench_function(&format!("isnan f64 array: {size}"), |b| {
b.iter(|| {
black_box(
isnan
diff --git a/datafusion/functions/benches/iszero.rs b/datafusion/functions/benches/iszero.rs
index 3abe776d02..b35099738d 100644
--- a/datafusion/functions/benches/iszero.rs
+++ b/datafusion/functions/benches/iszero.rs
@@ -40,7 +40,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- c.bench_function(&format!("iszero f32 array: {}", size), |b| {
+ c.bench_function(&format!("iszero f32 array: {size}"), |b| {
b.iter(|| {
black_box(
iszero
@@ -64,7 +64,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- c.bench_function(&format!("iszero f64 array: {}", size), |b| {
+ c.bench_function(&format!("iszero f64 array: {size}"), |b| {
b.iter(|| {
black_box(
iszero
diff --git a/datafusion/functions/benches/lower.rs b/datafusion/functions/benches/lower.rs
index 9cab9abbbb..5a21fbf52e 100644
--- a/datafusion/functions/benches/lower.rs
+++ b/datafusion/functions/benches/lower.rs
@@ -44,7 +44,7 @@ fn create_args2(size: usize) -> Vec<ColumnarValue> {
let mut items = Vec::with_capacity(size);
items.push("农历新年".to_string());
for i in 1..size {
- items.push(format!("DATAFUSION {}", i));
+ items.push(format!("DATAFUSION {i}"));
}
let array = Arc::new(StringArray::from(items)) as ArrayRef;
vec![ColumnarValue::Array(array)]
@@ -58,11 +58,11 @@ fn create_args3(size: usize) -> Vec<ColumnarValue> {
let mut items = Vec::with_capacity(size);
let half = size / 2;
for i in 0..half {
- items.push(format!("DATAFUSION {}", i));
+ items.push(format!("DATAFUSION {i}"));
}
items.push("Ⱦ".to_string());
for i in half + 1..size {
- items.push(format!("DATAFUSION {}", i));
+ items.push(format!("DATAFUSION {i}"));
}
let array = Arc::new(StringArray::from(items)) as ArrayRef;
vec![ColumnarValue::Array(array)]
@@ -131,7 +131,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- c.bench_function(&format!("lower_all_values_are_ascii: {}", size), |b| {
+ c.bench_function(&format!("lower_all_values_are_ascii: {size}"), |b| {
b.iter(|| {
let args_cloned = args.clone();
black_box(lower.invoke_with_args(ScalarFunctionArgs {
@@ -151,20 +151,17 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- c.bench_function(
- &format!("lower_the_first_value_is_nonascii: {}", size),
- |b| {
- b.iter(|| {
- let args_cloned = args.clone();
- black_box(lower.invoke_with_args(ScalarFunctionArgs {
- args: args_cloned,
- arg_fields: arg_fields.clone(),
- number_rows: size,
- return_field: &Field::new("f", DataType::Utf8, true),
- }))
- })
- },
- );
+ c.bench_function(&format!("lower_the_first_value_is_nonascii: {size}"), |b| {
+ b.iter(|| {
+ let args_cloned = args.clone();
+ black_box(lower.invoke_with_args(ScalarFunctionArgs {
+ args: args_cloned,
+ arg_fields: arg_fields.clone(),
+ number_rows: size,
+ return_field: &Field::new("f", DataType::Utf8, true),
+ }))
+ })
+ });
let args = create_args3(size);
let arg_fields_owned = args
@@ -175,7 +172,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
c.bench_function(
- &format!("lower_the_middle_value_is_nonascii: {}", size),
+ &format!("lower_the_middle_value_is_nonascii: {size}"),
|b| {
b.iter(|| {
let args_cloned = args.clone();
@@ -210,8 +207,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
c.bench_function(
- &format!("lower_all_values_are_ascii_string_views: size: {}, str_len: {}, null_density: {}, mixed: {}",
- size, str_len, null_density, mixed),
+ &format!("lower_all_values_are_ascii_string_views: size: {size}, str_len: {str_len}, null_density: {null_density}, mixed: {mixed}"),
|b| b.iter(|| {
let args_cloned = args.clone();
black_box(lower.invoke_with_args(ScalarFunctionArgs{
@@ -225,8 +221,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let args = create_args4(size, str_len, *null_density, mixed);
c.bench_function(
- &format!("lower_all_values_are_ascii_string_views: size: {}, str_len: {}, null_density: {}, mixed: {}",
- size, str_len, null_density, mixed),
+ &format!("lower_all_values_are_ascii_string_views: size: {size}, str_len: {str_len}, null_density: {null_density}, mixed: {mixed}"),
|b| b.iter(|| {
let args_cloned = args.clone();
black_box(lower.invoke_with_args(ScalarFunctionArgs{
diff --git a/datafusion/functions/benches/nullif.rs b/datafusion/functions/benches/nullif.rs
index 0e04ad34a9..f754d0cbb9 100644
--- a/datafusion/functions/benches/nullif.rs
+++ b/datafusion/functions/benches/nullif.rs
@@ -40,7 +40,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- c.bench_function(&format!("nullif scalar array: {}", size), |b| {
+ c.bench_function(&format!("nullif scalar array: {size}"), |b| {
b.iter(|| {
black_box(
nullif
diff --git a/datafusion/functions/benches/repeat.rs b/datafusion/functions/benches/repeat.rs
index a29dc49404..310e934f3a 100644
--- a/datafusion/functions/benches/repeat.rs
+++ b/datafusion/functions/benches/repeat.rs
@@ -80,17 +80,14 @@ fn criterion_benchmark(c: &mut Criterion) {
for size in [1024, 4096] {
// REPEAT 3 TIMES
let repeat_times = 3;
- let mut group = c.benchmark_group(format!("repeat {} times", repeat_times));
+ let mut group = c.benchmark_group(format!("repeat {repeat_times} times"));
group.sampling_mode(SamplingMode::Flat);
group.sample_size(10);
group.measurement_time(Duration::from_secs(10));
let args = create_args::<i32>(size, 32, repeat_times, true);
group.bench_function(
- format!(
- "repeat_string_view [size={}, repeat_times={}]",
- size, repeat_times
- ),
+ format!("repeat_string_view [size={size}, repeat_times={repeat_times}]"),
|b| {
b.iter(|| {
let args_cloned = args.clone();
@@ -101,10 +98,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let args = create_args::<i32>(size, 32, repeat_times, false);
group.bench_function(
- format!(
- "repeat_string [size={}, repeat_times={}]",
- size, repeat_times
- ),
+ format!("repeat_string [size={size}, repeat_times={repeat_times}]"),
|b| {
b.iter(|| {
let args_cloned = args.clone();
@@ -115,10 +109,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let args = create_args::<i64>(size, 32, repeat_times, false);
group.bench_function(
- format!(
- "repeat_large_string [size={}, repeat_times={}]",
- size, repeat_times
- ),
+ format!("repeat_large_string [size={size}, repeat_times={repeat_times}]"),
|b| {
b.iter(|| {
let args_cloned = args.clone();
@@ -131,17 +122,14 @@ fn criterion_benchmark(c: &mut Criterion) {
// REPEAT 30 TIMES
let repeat_times = 30;
- let mut group = c.benchmark_group(format!("repeat {} times", repeat_times));
+ let mut group = c.benchmark_group(format!("repeat {repeat_times} times"));
group.sampling_mode(SamplingMode::Flat);
group.sample_size(10);
group.measurement_time(Duration::from_secs(10));
let args = create_args::<i32>(size, 32, repeat_times, true);
group.bench_function(
- format!(
- "repeat_string_view [size={}, repeat_times={}]",
- size, repeat_times
- ),
+ format!("repeat_string_view [size={size}, repeat_times={repeat_times}]"),
|b| {
b.iter(|| {
let args_cloned = args.clone();
@@ -152,10 +140,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let args = create_args::<i32>(size, 32, repeat_times, false);
group.bench_function(
- format!(
- "repeat_string [size={}, repeat_times={}]",
- size, repeat_times
- ),
+ format!("repeat_string [size={size}, repeat_times={repeat_times}]"),
|b| {
b.iter(|| {
let args_cloned = args.clone();
@@ -166,10 +151,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let args = create_args::<i64>(size, 32, repeat_times, false);
group.bench_function(
- format!(
- "repeat_large_string [size={}, repeat_times={}]",
- size, repeat_times
- ),
+ format!("repeat_large_string [size={size}, repeat_times={repeat_times}]"),
|b| {
b.iter(|| {
let args_cloned = args.clone();
@@ -182,17 +164,14 @@ fn criterion_benchmark(c: &mut Criterion) {
// REPEAT overflow
let repeat_times = 1073741824;
- let mut group = c.benchmark_group(format!("repeat {} times", repeat_times));
+ let mut group = c.benchmark_group(format!("repeat {repeat_times} times"));
group.sampling_mode(SamplingMode::Flat);
group.sample_size(10);
group.measurement_time(Duration::from_secs(10));
let args = create_args::<i32>(size, 2, repeat_times, false);
group.bench_function(
- format!(
- "repeat_string overflow [size={}, repeat_times={}]",
- size, repeat_times
- ),
+ format!("repeat_string overflow [size={size}, repeat_times={repeat_times}]"),
|b| {
b.iter(|| {
let args_cloned = args.clone();
diff --git a/datafusion/functions/benches/reverse.rs b/datafusion/functions/benches/reverse.rs
index 102a4396a6..c45572b9ee 100644
--- a/datafusion/functions/benches/reverse.rs
+++ b/datafusion/functions/benches/reverse.rs
@@ -41,7 +41,7 @@ fn criterion_benchmark(c: &mut Criterion) {
false,
);
c.bench_function(
- &format!("reverse_StringArray_ascii_str_len_{}", str_len),
+ &format!("reverse_StringArray_ascii_str_len_{str_len}"),
|b| {
b.iter(|| {
black_box(reverse.invoke_with_args(ScalarFunctionArgs {
@@ -63,8 +63,7 @@ fn criterion_benchmark(c: &mut Criterion) {
gen_string_array(N_ROWS, str_len, NULL_DENSITY, NORMAL_UTF8_DENSITY, false);
c.bench_function(
&format!(
- "reverse_StringArray_utf8_density_{}_str_len_{}",
- NORMAL_UTF8_DENSITY, str_len
+ "reverse_StringArray_utf8_density_{NORMAL_UTF8_DENSITY}_str_len_{str_len}"
),
|b| {
b.iter(|| {
@@ -91,7 +90,7 @@ fn criterion_benchmark(c: &mut Criterion) {
true,
);
c.bench_function(
- &format!("reverse_StringViewArray_ascii_str_len_{}", str_len),
+ &format!("reverse_StringViewArray_ascii_str_len_{str_len}"),
|b| {
b.iter(|| {
black_box(reverse.invoke_with_args(ScalarFunctionArgs {
@@ -113,8 +112,7 @@ fn criterion_benchmark(c: &mut Criterion) {
gen_string_array(N_ROWS, str_len, NULL_DENSITY, NORMAL_UTF8_DENSITY, true);
c.bench_function(
&format!(
- "reverse_StringViewArray_utf8_density_{}_str_len_{}",
- NORMAL_UTF8_DENSITY, str_len
+ "reverse_StringViewArray_utf8_density_{NORMAL_UTF8_DENSITY}_str_len_{str_len}"
),
|b| {
b.iter(|| {
diff --git a/datafusion/functions/benches/signum.rs b/datafusion/functions/benches/signum.rs
index 0cd8b9451f..2cfc9ce103 100644
--- a/datafusion/functions/benches/signum.rs
+++ b/datafusion/functions/benches/signum.rs
@@ -40,7 +40,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- c.bench_function(&format!("signum f32 array: {}", size), |b| {
+ c.bench_function(&format!("signum f32 array: {size}"), |b| {
b.iter(|| {
black_box(
signum
@@ -65,7 +65,7 @@ fn criterion_benchmark(c: &mut Criterion) {
.collect::<Vec<_>>();
let arg_fields = arg_fields_owned.iter().collect::<Vec<_>>();
- c.bench_function(&format!("signum f64 array: {}", size), |b| {
+ c.bench_function(&format!("signum f64 array: {size}"), |b| {
b.iter(|| {
black_box(
signum
diff --git a/datafusion/functions/benches/strpos.rs b/datafusion/functions/benches/strpos.rs
index 894f2cdb65..5dcc326a97 100644
--- a/datafusion/functions/benches/strpos.rs
+++ b/datafusion/functions/benches/strpos.rs
@@ -112,7 +112,7 @@ fn criterion_benchmark(c: &mut Criterion) {
// StringArray ASCII only
let args_string_ascii = gen_string_array(n_rows, str_len, 0.1, 0.0, false);
c.bench_function(
- &format!("strpos_StringArray_ascii_str_len_{}", str_len),
+ &format!("strpos_StringArray_ascii_str_len_{str_len}"),
|b| {
b.iter(|| {
black_box(strpos.invoke_with_args(ScalarFunctionArgs {
@@ -131,28 +131,25 @@ fn criterion_benchmark(c: &mut Criterion) {
// StringArray UTF8
let args_string_utf8 = gen_string_array(n_rows, str_len, 0.1, 0.5, false);
- c.bench_function(
- &format!("strpos_StringArray_utf8_str_len_{}", str_len),
- |b| {
- b.iter(|| {
- black_box(strpos.invoke_with_args(ScalarFunctionArgs {
- args: args_string_utf8.clone(),
- arg_fields: vec![&Field::new(
- "a",
- args_string_utf8[0].data_type(),
- true,
- )],
- number_rows: n_rows,
- return_field: &Field::new("f", DataType::Int32, true),
- }))
- })
- },
- );
+ c.bench_function(&format!("strpos_StringArray_utf8_str_len_{str_len}"), |b| {
+ b.iter(|| {
+ black_box(strpos.invoke_with_args(ScalarFunctionArgs {
+ args: args_string_utf8.clone(),
+ arg_fields: vec![&Field::new(
+ "a",
+ args_string_utf8[0].data_type(),
+ true,
+ )],
+ number_rows: n_rows,
+ return_field: &Field::new("f", DataType::Int32, true),
+ }))
+ })
+ });
// StringViewArray ASCII only
let args_string_view_ascii = gen_string_array(n_rows, str_len, 0.1, 0.0, true);
c.bench_function(
- &format!("strpos_StringViewArray_ascii_str_len_{}", str_len),
+ &format!("strpos_StringViewArray_ascii_str_len_{str_len}"),
|b| {
b.iter(|| {
black_box(strpos.invoke_with_args(ScalarFunctionArgs {
@@ -172,7 +169,7 @@ fn criterion_benchmark(c: &mut Criterion) {
// StringViewArray UTF8
let args_string_view_utf8 = gen_string_array(n_rows, str_len, 0.1, 0.5, true);
c.bench_function(
- &format!("strpos_StringViewArray_utf8_str_len_{}", str_len),
+ &format!("strpos_StringViewArray_utf8_str_len_{str_len}"),
|b| {
b.iter(|| {
black_box(strpos.invoke_with_args(ScalarFunctionArgs {
diff --git a/datafusion/functions/benches/substr.rs b/datafusion/functions/benches/substr.rs
index e01e1c6d5b..76e82e112e 100644
--- a/datafusion/functions/benches/substr.rs
+++ b/datafusion/functions/benches/substr.rs
@@ -126,19 +126,18 @@ fn criterion_benchmark(c: &mut Criterion) {
let args = create_args_without_count::<i32>(size, len, true, true);
group.bench_function(
- format!("substr_string_view [size={}, strlen={}]", size, len),
+ format!("substr_string_view [size={size}, strlen={len}]"),
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
);
let args = create_args_without_count::<i32>(size, len, false, false);
- group.bench_function(
- format!("substr_string [size={}, strlen={}]", size, len),
- |b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
- );
+ group.bench_function(format!("substr_string [size={size}, strlen={len}]"), |b| {
+ b.iter(|| black_box(invoke_substr_with_args(args.clone(), size)))
+ });
let args = create_args_without_count::<i64>(size, len, true, false);
group.bench_function(
- format!("substr_large_string [size={}, strlen={}]", size, len),
+ format!("substr_large_string [size={size}, strlen={len}]"),
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
);
@@ -153,28 +152,19 @@ fn criterion_benchmark(c: &mut Criterion) {
let args = create_args_with_count::<i32>(size, len, count, true);
group.bench_function(
- format!(
- "substr_string_view [size={}, count={}, strlen={}]",
- size, count, len,
- ),
+ format!("substr_string_view [size={size}, count={count}, strlen={len}]",),
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
);
let args = create_args_with_count::<i32>(size, len, count, false);
group.bench_function(
- format!(
- "substr_string [size={}, count={}, strlen={}]",
- size, count, len,
- ),
+ format!("substr_string [size={size}, count={count}, strlen={len}]",),
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
);
let args = create_args_with_count::<i64>(size, len, count, false);
group.bench_function(
- format!(
- "substr_large_string [size={}, count={}, strlen={}]",
- size, count, len,
- ),
+ format!("substr_large_string [size={size}, count={count}, strlen={len}]",),
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
);
@@ -189,28 +179,19 @@ fn criterion_benchmark(c: &mut Criterion) {
let args = create_args_with_count::<i32>(size, len, count, true);
group.bench_function(
- format!(
- "substr_string_view [size={}, count={}, strlen={}]",
- size, count, len,
- ),
+ format!("substr_string_view [size={size}, count={count}, strlen={len}]",),
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
);
let args = create_args_with_count::<i32>(size, len, count, false);
group.bench_function(
- format!(
- "substr_string [size={}, count={}, strlen={}]",
- size, count, len,
- ),
+ format!("substr_string [size={size}, count={count}, strlen={len}]",),
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
);
let args = create_args_with_count::<i64>(size, len, count, false);
group.bench_function(
- format!(
- "substr_large_string [size={}, count={}, strlen={}]",
- size, count, len,
- ),
+ format!("substr_large_string [size={size}, count={count}, strlen={len}]",),
|b| b.iter(|| black_box(invoke_substr_with_args(args.clone(), size))),
);
diff --git a/datafusion/functions/benches/to_hex.rs b/datafusion/functions/benches/to_hex.rs
index 5ab49cb96c..ba104457a1 100644
--- a/datafusion/functions/benches/to_hex.rs
+++ b/datafusion/functions/benches/to_hex.rs
@@ -30,7 +30,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let i32_array = Arc::new(create_primitive_array::<Int32Type>(size, 0.2));
let batch_len = i32_array.len();
let i32_args = vec![ColumnarValue::Array(i32_array)];
- c.bench_function(&format!("to_hex i32 array: {}", size), |b| {
+ c.bench_function(&format!("to_hex i32 array: {size}"), |b| {
b.iter(|| {
let args_cloned = i32_args.clone();
black_box(
@@ -47,7 +47,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let i64_array = Arc::new(create_primitive_array::<Int64Type>(size, 0.2));
let batch_len = i64_array.len();
let i64_args = vec![ColumnarValue::Array(i64_array)];
- c.bench_function(&format!("to_hex i64 array: {}", size), |b| {
+ c.bench_function(&format!("to_hex i64 array: {size}"), |b| {
b.iter(|| {
let args_cloned = i64_args.clone();
black_box(
diff --git a/datafusion/functions/benches/trunc.rs b/datafusion/functions/benches/trunc.rs
index 26e4b5f234..e55e4dcd08 100644
--- a/datafusion/functions/benches/trunc.rs
+++ b/datafusion/functions/benches/trunc.rs
@@ -33,7 +33,7 @@ fn criterion_benchmark(c: &mut Criterion) {
for size in [1024, 4096, 8192] {
let f32_array = Arc::new(create_primitive_array::<Float32Type>(size, 0.2));
let f32_args = vec![ColumnarValue::Array(f32_array)];
- c.bench_function(&format!("trunc f32 array: {}", size), |b| {
+ c.bench_function(&format!("trunc f32 array: {size}"), |b| {
b.iter(|| {
black_box(
trunc
@@ -49,7 +49,7 @@ fn criterion_benchmark(c: &mut Criterion) {
});
let f64_array = Arc::new(create_primitive_array::<Float64Type>(size, 0.2));
let f64_args = vec![ColumnarValue::Array(f64_array)];
- c.bench_function(&format!("trunc f64 array: {}", size), |b| {
+ c.bench_function(&format!("trunc f64 array: {size}"), |b| {
b.iter(|| {
black_box(
trunc
diff --git a/datafusion/functions/src/datetime/date_trunc.rs b/datafusion/functions/src/datetime/date_trunc.rs
index 331c4e093e..3d29dc45a9 100644
--- a/datafusion/functions/src/datetime/date_trunc.rs
+++ b/datafusion/functions/src/datetime/date_trunc.rs
@@ -471,7 +471,7 @@ fn parse_tz(tz: &Option<Arc<str>>) -> Result<Option<Tz>> {
tz.as_ref()
.map(|tz| {
Tz::from_str(tz).map_err(|op| {
- DataFusionError::Execution(format!("failed on timezone {tz}: {:?}", op))
+ DataFusionError::Execution(format!("failed on timezone {tz}: {op:?}"))
})
})
.transpose()
diff --git a/datafusion/functions/src/datetime/to_date.rs b/datafusion/functions/src/datetime/to_date.rs
index 0963593276..372d0e7be9 100644
--- a/datafusion/functions/src/datetime/to_date.rs
+++ b/datafusion/functions/src/datetime/to_date.rs
@@ -447,7 +447,7 @@ mod tests {
let expected = Date32Type::parse_formatted("2020-09-08", "%Y-%m-%d");
assert_eq!(date_val, expected, "to_date created wrong value");
}
- _ => panic!("Conversion of {} failed", date_str),
+ _ => panic!("Conversion of {date_str} failed"),
}
}
}
@@ -465,11 +465,10 @@ mod tests {
let expected = Date32Type::parse_formatted("2024-12-31", "%Y-%m-%d");
assert_eq!(
date_val, expected,
- "to_date created wrong value for {}",
- date_str
+ "to_date created wrong value for {date_str}"
);
}
- _ => panic!("Conversion of {} failed", date_str),
+ _ => panic!("Conversion of {date_str} failed"),
}
}
@@ -482,10 +481,7 @@ mod tests {
invoke_to_date_with_args(vec![ColumnarValue::Scalar(date_scalar)], 1);
if let Ok(ColumnarValue::Scalar(ScalarValue::Date32(_))) = to_date_result {
- panic!(
- "Conversion of {} succeeded, but should have failed, ",
- date_str
- );
+ panic!("Conversion of {date_str} succeeded, but should have failed. ");
}
}
}
diff --git a/datafusion/functions/src/encoding/inner.rs b/datafusion/functions/src/encoding/inner.rs
index 51e8c69688..9a7b491057 100644
--- a/datafusion/functions/src/encoding/inner.rs
+++ b/datafusion/functions/src/encoding/inner.rs
@@ -310,7 +310,7 @@ fn hex_decode(input: &[u8], buf: &mut [u8]) -> Result<usize> {
let out_len = input.len() / 2;
let buf = &mut buf[..out_len];
hex::decode_to_slice(input, buf).map_err(|e| {
- DataFusionError::Internal(format!("Failed to decode from hex: {}", e))
+ DataFusionError::Internal(format!("Failed to decode from hex: {e}"))
})?;
Ok(out_len)
}
@@ -319,7 +319,7 @@ fn base64_decode(input: &[u8], buf: &mut [u8]) -> Result<usize> {
general_purpose::STANDARD_NO_PAD
.decode_slice(input, buf)
.map_err(|e| {
- DataFusionError::Internal(format!("Failed to decode from base64: {}", e))
+ DataFusionError::Internal(format!("Failed to decode from base64: {e}"))
})
}
@@ -419,15 +419,13 @@ impl Encoding {
.decode(value)
.map_err(|e| {
DataFusionError::Internal(format!(
- "Failed to decode value using base64: {}",
- e
+ "Failed to decode value using base64: {e}"
))
})?
}
Self::Hex => hex::decode(value).map_err(|e| {
DataFusionError::Internal(format!(
- "Failed to decode value using hex: {}",
- e
+ "Failed to decode value using hex: {e}"
))
})?,
};
@@ -447,15 +445,13 @@ impl Encoding {
.decode(value)
.map_err(|e| {
DataFusionError::Internal(format!(
- "Failed to decode value using base64: {}",
- e
+ "Failed to decode value using base64: {e}"
))
})?
}
Self::Hex => hex::decode(value).map_err(|e| {
DataFusionError::Internal(format!(
- "Failed to decode value using hex: {}",
- e
+ "Failed to decode value using hex: {e}"
))
})?,
};
diff --git a/datafusion/functions/src/lib.rs b/datafusion/functions/src/lib.rs
index b65c4c5432..51cd5df806 100644
--- a/datafusion/functions/src/lib.rs
+++ b/datafusion/functions/src/lib.rs
@@ -209,8 +209,7 @@ mod tests {
for alias in func.aliases() {
assert!(
names.insert(alias.to_string().to_lowercase()),
- "duplicate function name: {}",
- alias
+ "duplicate function name: {alias}"
);
}
}
diff --git a/datafusion/functions/src/regex/regexpcount.rs b/datafusion/functions/src/regex/regexpcount.rs
index d536d3531a..8f53bf8eb1 100644
--- a/datafusion/functions/src/regex/regexpcount.rs
+++ b/datafusion/functions/src/regex/regexpcount.rs
@@ -577,15 +577,12 @@ fn compile_regex(regex: &str, flags: Option<&str>) -> Result<Regex, ArrowError>
"regexp_count() does not support global flag".to_string(),
));
}
- format!("(?{}){}", flags, regex)
+ format!("(?{flags}){regex}")
}
};
Regex::new(&pattern).map_err(|_| {
- ArrowError::ComputeError(format!(
- "Regular expression did not compile: {}",
- pattern
- ))
+ ArrowError::ComputeError(format!("Regular expression did not compile: {pattern}"))
})
}
diff --git a/datafusion/functions/src/string/starts_with.rs b/datafusion/functions/src/string/starts_with.rs
index 71df83352f..a59d7080a5 100644
--- a/datafusion/functions/src/string/starts_with.rs
+++ b/datafusion/functions/src/string/starts_with.rs
@@ -141,7 +141,7 @@ impl ScalarUDFImpl for StartsWithFunc {
| ScalarValue::LargeUtf8(Some(pattern))
| ScalarValue::Utf8View(Some(pattern)) => {
let escaped_pattern = pattern.replace("%", "\\%");
- let like_pattern = format!("{}%", escaped_pattern);
+ let like_pattern = format!("{escaped_pattern}%");
Expr::Literal(ScalarValue::Utf8(Some(like_pattern)))
}
_ => return Ok(ExprSimplifyResult::Original(args)),
diff --git a/datafusion/optimizer/benches/projection_unnecessary.rs b/datafusion/optimizer/benches/projection_unnecessary.rs
index 100ee97542..ee7889eb33 100644
--- a/datafusion/optimizer/benches/projection_unnecessary.rs
+++ b/datafusion/optimizer/benches/projection_unnecessary.rs
@@ -41,7 +41,7 @@ fn is_projection_unnecessary_old(
fn create_plan_with_many_exprs(num_exprs: usize) -> (LogicalPlan, Vec<Expr>) {
// Create schema with many fields
let fields = (0..num_exprs)
- .map(|i| Field::new(format!("col{}", i), DataType::Int32, false))
+ .map(|i| Field::new(format!("col{i}"), DataType::Int32, false))
.collect::<Vec<_>>();
let schema = Schema::new(fields);
@@ -53,7 +53,7 @@ fn create_plan_with_many_exprs(num_exprs: usize) -> (LogicalPlan, Vec<Expr>) {
// Create projection expressions (just column references)
let exprs = (0..num_exprs)
- .map(|i| Expr::Column(Column::new(None::<TableReference>, format!("col{}", i))))
+ .map(|i| Expr::Column(Column::new(None::<TableReference>, format!("col{i}"))))
.collect();
(table_scan, exprs)
diff --git a/datafusion/optimizer/src/analyzer/type_coercion.rs b/datafusion/optimizer/src/analyzer/type_coercion.rs
index 860e041bb4..aaf63c9546 100644
--- a/datafusion/optimizer/src/analyzer/type_coercion.rs
+++ b/datafusion/optimizer/src/analyzer/type_coercion.rs
@@ -1143,17 +1143,14 @@ mod test {
match analyzer.execute_and_check(plan, &options, |_, _| {}) {
Ok(succeeded_plan) => {
panic!(
- "Expected a type coercion error, but analysis succeeded: \n{:#?}",
- succeeded_plan
+ "Expected a type coercion error, but analysis succeeded: \n{succeeded_plan:#?}"
);
}
Err(e) => {
let msg = e.to_string();
assert!(
msg.contains(expected_substr),
- "Error did not contain expected substring.\n expected to find: `{}`\n actual error: `{}`",
- expected_substr,
- msg
+ "Error did not contain expected substring.\n expected to find: `{expected_substr}`\n actual error: `{msg}`"
);
}
}
diff --git a/datafusion/optimizer/src/optimizer.rs b/datafusion/optimizer/src/optimizer.rs
index b40121dbfe..43f5b13850 100644
--- a/datafusion/optimizer/src/optimizer.rs
+++ b/datafusion/optimizer/src/optimizer.rs
@@ -413,7 +413,7 @@ impl Optimizer {
previous_plans.insert(LogicalPlanSignature::new(&new_plan));
if !plan_is_fresh {
// plan did not change, so no need to continue trying to optimize
- debug!("optimizer pass {} did not make changes", i);
+ debug!("optimizer pass {i} did not make changes");
break;
}
i += 1;
diff --git a/datafusion/optimizer/src/simplify_expressions/guarantees.rs b/datafusion/optimizer/src/simplify_expressions/guarantees.rs
index 4700ab97b5..2c11632ad6 100644
--- a/datafusion/optimizer/src/simplify_expressions/guarantees.rs
+++ b/datafusion/optimizer/src/simplify_expressions/guarantees.rs
@@ -244,8 +244,7 @@ mod tests {
let expected = lit(ScalarValue::from(expected_value.clone()));
assert_eq!(
output, expected,
- "{} simplified to {}, but expected {}",
- expr, output, expected
+ "{expr} simplified to {output}, but expected {expected}"
);
}
}
@@ -255,8 +254,7 @@ mod tests {
let output = expr.clone().rewrite(rewriter).data().unwrap();
assert_eq!(
&output, expr,
- "{} was simplified to {}, but expected it to be unchanged",
- expr, output
+ "{expr} was simplified to {output}, but expected it to be unchanged"
);
}
}
diff --git a/datafusion/optimizer/src/simplify_expressions/regex.rs b/datafusion/optimizer/src/simplify_expressions/regex.rs
index ab25c77f0b..ec6485bf4b 100644
--- a/datafusion/optimizer/src/simplify_expressions/regex.rs
+++ b/datafusion/optimizer/src/simplify_expressions/regex.rs
@@ -255,9 +255,9 @@ fn partial_anchored_literal_to_like(v: &[Hir]) -> Option<String> {
};
if match_begin {
- Some(format!("{}%", lit))
+ Some(format!("{lit}%"))
} else {
- Some(format!("%{}", lit))
+ Some(format!("%{lit}"))
}
}
diff --git a/datafusion/optimizer/src/single_distinct_to_groupby.rs b/datafusion/optimizer/src/single_distinct_to_groupby.rs
index acafc7d922..50783a2143 100644
--- a/datafusion/optimizer/src/single_distinct_to_groupby.rs
+++ b/datafusion/optimizer/src/single_distinct_to_groupby.rs
@@ -206,7 +206,7 @@ impl OptimizerRule for SingleDistinctToGroupBy {
// if the aggregate function is not distinct, we need to rewrite it like two phase aggregation
} else {
index += 1;
- let alias_str = format!("alias{}", index);
+ let alias_str = format!("alias{index}");
inner_aggr_exprs.push(
Expr::AggregateFunction(AggregateFunction::new_udf(
Arc::clone(&func),
diff --git a/datafusion/optimizer/src/utils.rs b/datafusion/optimizer/src/utils.rs
index 41c40ec06d..135f37dd98 100644
--- a/datafusion/optimizer/src/utils.rs
+++ b/datafusion/optimizer/src/utils.rs
@@ -241,7 +241,7 @@ mod tests {
let join_cols_of_predicate = std::iter::once(&column_a);
let actual =
is_restrict_null_predicate(predicate.clone(), join_cols_of_predicate)?;
- assert_eq!(actual, expected, "{}", predicate);
+ assert_eq!(actual, expected, "{predicate}");
}
Ok(())
diff --git a/datafusion/physical-expr-common/src/physical_expr.rs b/datafusion/physical-expr-common/src/physical_expr.rs
index 685398c352..b0c02f8761 100644
--- a/datafusion/physical-expr-common/src/physical_expr.rs
+++ b/datafusion/physical-expr-common/src/physical_expr.rs
@@ -446,10 +446,10 @@ where
let mut iter = self.0.clone();
write!(f, "[")?;
if let Some(expr) = iter.next() {
- write!(f, "{}", expr)?;
+ write!(f, "{expr}")?;
}
for expr in iter {
- write!(f, ", {}", expr)?;
+ write!(f, ", {expr}")?;
}
write!(f, "]")?;
Ok(())
diff --git a/datafusion/physical-expr-common/src/sort_expr.rs b/datafusion/physical-expr-common/src/sort_expr.rs
index ee57560368..a1227c7f11 100644
--- a/datafusion/physical-expr-common/src/sort_expr.rs
+++ b/datafusion/physical-expr-common/src/sort_expr.rs
@@ -267,10 +267,10 @@ pub fn format_physical_sort_requirement_list(
let mut iter = self.0.iter();
write!(f, "[")?;
if let Some(expr) = iter.next() {
- write!(f, "{}", expr)?;
+ write!(f, "{expr}")?;
}
for expr in iter {
- write!(f, ", {}", expr)?;
+ write!(f, ", {expr}")?;
}
write!(f, "]")?;
Ok(())
@@ -510,7 +510,7 @@ impl Display for LexOrdering {
} else {
write!(f, ", ")?;
}
- write!(f, "{}", sort_expr)?;
+ write!(f, "{sort_expr}")?;
}
Ok(())
}
diff --git a/datafusion/physical-expr/benches/binary_op.rs b/datafusion/physical-expr/benches/binary_op.rs
index 216d8a520e..5b0f700fdb 100644
--- a/datafusion/physical-expr/benches/binary_op.rs
+++ b/datafusion/physical-expr/benches/binary_op.rs
@@ -215,7 +215,7 @@ fn benchmark_binary_op_in_short_circuit(c: &mut Criterion) {
// Each scenario when the test operator is `and`
{
for (name, batch) in batches_and.into_iter() {
- c.bench_function(&format!("short_circuit/and/{}", name), |b| {
+ c.bench_function(&format!("short_circuit/and/{name}"), |b| {
b.iter(|| expr_and.evaluate(black_box(&batch)).unwrap())
});
}
@@ -223,7 +223,7 @@ fn benchmark_binary_op_in_short_circuit(c: &mut Criterion) {
// Each scenario when the test operator is `or`
{
for (name, batch) in batches_or.into_iter() {
- c.bench_function(&format!("short_circuit/or/{}", name), |b| {
+ c.bench_function(&format!("short_circuit/or/{name}"), |b| {
b.iter(|| expr_or.evaluate(black_box(&batch)).unwrap())
});
}
diff --git a/datafusion/physical-expr/src/equivalence/class.rs b/datafusion/physical-expr/src/equivalence/class.rs
index 13a3c79a47..98b1299a2e 100644
--- a/datafusion/physical-expr/src/equivalence/class.rs
+++ b/datafusion/physical-expr/src/equivalence/class.rs
@@ -166,7 +166,7 @@ impl ConstExpr {
} else {
write!(f, ",")?;
}
- write!(f, "{}", const_expr)?;
+ write!(f, "{const_expr}")?;
}
Ok(())
}
@@ -184,7 +184,7 @@ impl Display for ConstExpr {
}
AcrossPartitions::Uniform(value) => {
if let Some(val) = value {
- write!(f, "(uniform: {})", val)?;
+ write!(f, "(uniform: {val})")?;
} else {
write!(f, "(uniform: unknown)")?;
}
@@ -747,10 +747,10 @@ impl Display for EquivalenceGroup {
write!(f, "[")?;
let mut iter = self.iter();
if let Some(cls) = iter.next() {
- write!(f, "{}", cls)?;
+ write!(f, "{cls}")?;
}
for cls in iter {
- write!(f, ", {}", cls)?;
+ write!(f, ", {cls}")?;
}
write!(f, "]")
}
@@ -798,12 +798,11 @@ mod tests {
eq_groups.bridge_classes();
let eq_groups = eq_groups.classes;
let err_msg = format!(
- "error in test entries: {:?}, expected: {:?}, actual:{:?}",
- entries, expected, eq_groups
+ "error in test entries: {entries:?}, expected: {expected:?}, actual:{eq_groups:?}"
);
- assert_eq!(eq_groups.len(), expected.len(), "{}", err_msg);
+ assert_eq!(eq_groups.len(), expected.len(), "{err_msg}");
for idx in 0..eq_groups.len() {
- assert_eq!(&eq_groups[idx], &expected[idx], "{}", err_msg);
+ assert_eq!(&eq_groups[idx], &expected[idx], "{err_msg}");
}
}
Ok(())
@@ -1040,8 +1039,7 @@ mod tests {
let actual = eq_group.exprs_equal(&left, &right);
assert_eq!(
actual, expected,
- "{}: Failed comparing {:?} and {:?}, expected {}, got {}",
- description, left, right, expected, actual
+ "{description}: Failed comparing {left:?} and {right:?}, expected {expected}, got {actual}"
);
}
diff --git a/datafusion/physical-expr/src/equivalence/mod.rs b/datafusion/physical-expr/src/equivalence/mod.rs
index e94d2bad57..ef98b48122 100644
--- a/datafusion/physical-expr/src/equivalence/mod.rs
+++ b/datafusion/physical-expr/src/equivalence/mod.rs
@@ -97,8 +97,7 @@ mod tests {
"ASC" => sort_expr.asc(),
"DESC" => sort_expr.desc(),
_ => panic!(
- "unknown sort options. Expected 'ASC' or 'DESC', got {}",
- options
+ "unknown sort options. Expected 'ASC' or 'DESC', got {options}"
),
}
}
diff --git a/datafusion/physical-expr/src/equivalence/ordering.rs b/datafusion/physical-expr/src/equivalence/ordering.rs
index 0efd46ad91..819f8905bd 100644
--- a/datafusion/physical-expr/src/equivalence/ordering.rs
+++ b/datafusion/physical-expr/src/equivalence/ordering.rs
@@ -329,10 +329,10 @@ impl Display for OrderingEquivalenceClass {
write!(f, "[")?;
let mut iter = self.orderings.iter();
if let Some(ordering) = iter.next() {
- write!(f, "[{}]", ordering)?;
+ write!(f, "[{ordering}]")?;
}
for ordering in iter {
- write!(f, ", [{}]", ordering)?;
+ write!(f, ", [{ordering}]")?;
}
write!(f, "]")?;
Ok(())
@@ -684,8 +684,7 @@ mod tests {
assert_eq!(
eq_properties.ordering_satisfy(reqs.as_ref()),
expected,
- "{}",
- err_msg
+ "{err_msg}"
);
}
@@ -739,13 +738,12 @@ mod tests {
for (reqs, expected) in test_cases {
let err_msg =
- format!("error in test reqs: {:?}, expected: {:?}", reqs, expected,);
+ format!("error in test reqs: {reqs:?}, expected: {expected:?}",);
let reqs = convert_to_sort_exprs(&reqs);
assert_eq!(
eq_properties.ordering_satisfy(reqs.as_ref()),
expected,
- "{}",
- err_msg
+ "{err_msg}"
);
}
@@ -978,10 +976,9 @@ mod tests {
let actual = OrderingEquivalenceClass::new(orderings.clone());
let actual = actual.orderings;
let err_msg = format!(
- "orderings: {:?}, expected: {:?}, actual :{:?}",
- orderings, expected, actual
+ "orderings: {orderings:?}, expected: {expected:?}, actual :{actual:?}"
);
- assert_eq!(actual.len(), expected.len(), "{}", err_msg);
+ assert_eq!(actual.len(), expected.len(), "{err_msg}");
for elem in actual {
assert!(expected.contains(&elem), "{}", err_msg);
}
diff --git a/datafusion/physical-expr/src/equivalence/projection.rs b/datafusion/physical-expr/src/equivalence/projection.rs
index a33339091c..efbb50bc40 100644
--- a/datafusion/physical-expr/src/equivalence/projection.rs
+++ b/datafusion/physical-expr/src/equivalence/projection.rs
@@ -634,11 +634,10 @@ mod tests {
let orderings = projected_eq.oeq_class();
let err_msg = format!(
- "test_idx: {:?}, actual: {:?}, expected: {:?}, projection_mapping: {:?}",
- idx, orderings, expected, projection_mapping
+ "test_idx: {idx:?}, actual: {orderings:?}, expected: {expected:?}, projection_mapping: {projection_mapping:?}"
);
- assert_eq!(orderings.len(), expected.len(), "{}", err_msg);
+ assert_eq!(orderings.len(), expected.len(), "{err_msg}");
for expected_ordering in &expected {
assert!(orderings.contains(expected_ordering), "{}", err_msg)
}
@@ -822,11 +821,10 @@ mod tests {
let orderings = projected_eq.oeq_class();
let err_msg = format!(
- "test idx: {:?}, actual: {:?}, expected: {:?}, projection_mapping: {:?}",
- idx, orderings, expected, projection_mapping
+ "test idx: {idx:?}, actual: {orderings:?}, expected: {expected:?}, projection_mapping: {projection_mapping:?}"
);
- assert_eq!(orderings.len(), expected.len(), "{}", err_msg);
+ assert_eq!(orderings.len(), expected.len(), "{err_msg}");
for expected_ordering in &expected {
assert!(orderings.contains(expected_ordering), "{}", err_msg)
}
@@ -968,11 +966,10 @@ mod tests {
let orderings = projected_eq.oeq_class();
let err_msg = format!(
- "actual: {:?}, expected: {:?}, projection_mapping: {:?}",
- orderings, expected, projection_mapping
+ "actual: {orderings:?}, expected: {expected:?}, projection_mapping: {projection_mapping:?}"
);
- assert_eq!(orderings.len(), expected.len(), "{}", err_msg);
+ assert_eq!(orderings.len(), expected.len(), "{err_msg}");
for expected_ordering in &expected {
assert!(orderings.contains(expected_ordering), "{}", err_msg)
}
diff --git a/datafusion/physical-expr/src/equivalence/properties/dependency.rs b/datafusion/physical-expr/src/equivalence/properties/dependency.rs
index 8b17db0484..39a01391e3 100644
--- a/datafusion/physical-expr/src/equivalence/properties/dependency.rs
+++ b/datafusion/physical-expr/src/equivalence/properties/dependency.rs
@@ -39,10 +39,10 @@ impl Display for Dependencies {
write!(f, "[")?;
let mut iter = self.inner.iter();
if let Some(dep) = iter.next() {
- write!(f, "{}", dep)?;
+ write!(f, "{dep}")?;
}
for dep in iter {
- write!(f, ", {}", dep)?;
+ write!(f, ", {dep}")?;
}
write!(f, "]")
}
@@ -279,7 +279,7 @@ impl DependencyNode {
impl Display for DependencyNode {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some(target) = &self.target_sort_expr {
- write!(f, "(target: {}, ", target)?;
+ write!(f, "(target: {target}, ")?;
} else {
write!(f, "(")?;
}
@@ -764,7 +764,7 @@ mod tests {
"expr:{:?}, expected: {:?}, actual: {:?}, leading_orderings: {leading_orderings:?}",
expr, expected, expr_props.sort_properties
);
- assert_eq!(expr_props.sort_properties, expected, "{}", err_msg);
+ assert_eq!(expr_props.sort_properties, expected, "{err_msg}");
}
Ok(())
@@ -1735,9 +1735,7 @@ mod tests {
for ordering in &satisfied_orderings {
assert!(
!eq_properties.ordering_satisfy(ordering),
- "{}: ordering {:?} should not be satisfied before adding constraints",
- name,
- ordering
+ "{name}: ordering {ordering:?} should not be satisfied before adding constraints"
);
}
@@ -1752,9 +1750,7 @@ mod tests {
for ordering in &satisfied_orderings {
assert!(
eq_properties.ordering_satisfy(ordering),
- "{}: ordering {:?} should be satisfied after adding constraints",
- name,
- ordering
+ "{name}: ordering {ordering:?} should be satisfied after adding constraints"
);
}
@@ -1762,9 +1758,7 @@ mod tests {
for ordering in &unsatisfied_orderings {
assert!(
!eq_properties.ordering_satisfy(ordering),
- "{}: ordering {:?} should not be satisfied after adding constraints",
- name,
- ordering
+ "{name}: ordering {ordering:?} should not be satisfied after adding constraints"
);
}
}
diff --git a/datafusion/physical-expr/src/equivalence/properties/joins.rs b/datafusion/physical-expr/src/equivalence/properties/joins.rs
index 7944e89d03..344cf54a57 100644
--- a/datafusion/physical-expr/src/equivalence/properties/joins.rs
+++ b/datafusion/physical-expr/src/equivalence/properties/joins.rs
@@ -218,13 +218,11 @@ mod tests {
);
let err_msg =
format!("expected: {:?}, actual:{:?}", expected, &join_eq.oeq_class);
- assert_eq!(join_eq.oeq_class.len(), expected.len(), "{}", err_msg);
+ assert_eq!(join_eq.oeq_class.len(), expected.len(), "{err_msg}");
for ordering in join_eq.oeq_class {
assert!(
expected.contains(&ordering),
- "{}, ordering: {:?}",
- err_msg,
- ordering
+ "{err_msg}, ordering: {ordering:?}"
);
}
}
diff --git a/datafusion/physical-expr/src/expressions/dynamic_filters.rs b/datafusion/physical-expr/src/expressions/dynamic_filters.rs
index c0a3285f0e..9785203a70 100644
--- a/datafusion/physical-expr/src/expressions/dynamic_filters.rs
+++ b/datafusion/physical-expr/src/expressions/dynamic_filters.rs
@@ -75,7 +75,7 @@ impl Eq for DynamicFilterPhysicalExpr {}
impl Display for DynamicFilterPhysicalExpr {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let inner = self.current().expect("Failed to get current expression");
- write!(f, "DynamicFilterPhysicalExpr [ {} ]", inner)
+ write!(f, "DynamicFilterPhysicalExpr [ {inner} ]")
}
}
diff --git a/datafusion/physical-optimizer/src/pruning.rs b/datafusion/physical-optimizer/src/pruning.rs
index ba8530a53c..40d93d4647 100644
--- a/datafusion/physical-optimizer/src/pruning.rs
+++ b/datafusion/physical-optimizer/src/pruning.rs
@@ -991,11 +991,7 @@ fn build_statistics_record_batch<S: PruningStatistics>(
let mut options = RecordBatchOptions::default();
options.row_count = Some(statistics.num_containers());
- trace!(
- "Creating statistics batch for {:#?} with {:#?}",
- required_columns,
- arrays
- );
+ trace!("Creating statistics batch for {required_columns:#?} with {arrays:#?}");
RecordBatch::try_new_with_options(schema, arrays, &options).map_err(|err| {
plan_datafusion_err!("Can not create statistics record batch: {err}")
@@ -2340,8 +2336,7 @@ mod tests {
let was_new = fields.insert(field);
if !was_new {
panic!(
- "Duplicate field in required schema: {:?}. Previous fields:\n{:#?}",
- field, fields
+ "Duplicate field in required schema: {field:?}. Previous fields:\n{fields:#?}"
);
}
}
@@ -2846,8 +2841,8 @@ mod tests {
let predicate_expr =
test_build_predicate_expression(&expr, &schema, &mut required_columns);
assert_eq!(predicate_expr.to_string(), expected_expr);
- println!("required_columns: {:#?}", required_columns); // for debugging assertions below
- // c1 < 1 should add c1_min
+ println!("required_columns: {required_columns:#?}"); // for debugging assertions below
+ // c1 < 1 should add c1_min
let c1_min_field = Field::new("c1_min", DataType::Int32, false);
assert_eq!(
required_columns.columns[0],
@@ -5173,7 +5168,7 @@ mod tests {
statistics: &TestStatistics,
expected: &[bool],
) {
- println!("Pruning with expr: {}", expr);
+ println!("Pruning with expr: {expr}");
let expr = logical2physical(&expr, schema);
let p = PruningPredicate::try_new(expr, Arc::<Schema>::clone(schema)).unwrap();
let result = p.prune(statistics).unwrap();
diff --git a/datafusion/physical-plan/benches/partial_ordering.rs b/datafusion/physical-plan/benches/partial_ordering.rs
index 422826abcc..22d18dd248 100644
--- a/datafusion/physical-plan/benches/partial_ordering.rs
+++ b/datafusion/physical-plan/benches/partial_ordering.rs
@@ -40,7 +40,7 @@ fn bench_new_groups(c: &mut Criterion) {
// Test with 1, 2, 4, and 8 order indices
for num_columns in [1, 2, 4, 8] {
let fields: Vec<Field> = (0..num_columns)
- .map(|i| Field::new(format!("col{}", i), DataType::Int32, false))
+ .map(|i| Field::new(format!("col{i}"), DataType::Int32, false))
.collect();
let schema = Schema::new(fields);
@@ -49,14 +49,14 @@ fn bench_new_groups(c: &mut Criterion) {
(0..num_columns)
.map(|i| {
PhysicalSortExpr::new(
- col(&format!("col{}", i), &schema).unwrap(),
+ col(&format!("col{i}"), &schema).unwrap(),
SortOptions::default(),
)
})
.collect(),
);
- group.bench_function(format!("order_indices_{}", num_columns), |b| {
+ group.bench_function(format!("order_indices_{num_columns}"), |b| {
let batch_group_values = create_test_arrays(num_columns);
let group_indices: Vec<usize> = (0..BATCH_SIZE).collect();
diff --git a/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs b/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs
index ac96a98edf..dee482cab1 100644
--- a/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs
+++ b/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs
@@ -1756,11 +1756,9 @@ mod tests {
(i, actual_line),
(i, expected_line),
"Inconsistent result\n\n\
- Actual batch:\n{}\n\
- Expected batch:\n{}\n\
+ Actual batch:\n{formatted_actual_batch}\n\
+ Expected batch:\n{formatted_expected_batch}\n\
",
- formatted_actual_batch,
- formatted_expected_batch,
);
}
}
diff --git a/datafusion/physical-plan/src/aggregates/group_values/row.rs b/datafusion/physical-plan/src/aggregates/group_values/row.rs
index 75c0e32491..aa9eee5157 100644
--- a/datafusion/physical-plan/src/aggregates/group_values/row.rs
+++ b/datafusion/physical-plan/src/aggregates/group_values/row.rs
@@ -82,7 +82,7 @@ impl GroupValuesRows {
pub fn try_new(schema: SchemaRef) -> Result<Self> {
// Print a debugging message, so it is clear when the (slower) fallback
// GroupValuesRows is used.
- debug!("Creating GroupValuesRows for schema: {}", schema);
+ debug!("Creating GroupValuesRows for schema: {schema}");
let row_converter = RowConverter::new(
schema
.fields()
diff --git a/datafusion/physical-plan/src/aggregates/topk/hash_table.rs b/datafusion/physical-plan/src/aggregates/topk/hash_table.rs
index ae44eb35e6..47052fd525 100644
--- a/datafusion/physical-plan/src/aggregates/topk/hash_table.rs
+++ b/datafusion/physical-plan/src/aggregates/topk/hash_table.rs
@@ -461,7 +461,7 @@ mod tests {
let (_heap_idxs, map_idxs): (Vec<_>, Vec<_>) = heap_to_map.into_iter().unzip();
let ids = unsafe { map.take_all(map_idxs) };
assert_eq!(
- format!("{:?}", ids),
+ format!("{ids:?}"),
r#"[Some("1"), Some("2"), Some("3"), Some("4"), Some("5")]"#
);
assert_eq!(map.len(), 0, "Map should have been cleared!");
diff --git a/datafusion/physical-plan/src/aggregates/topk/heap.rs b/datafusion/physical-plan/src/aggregates/topk/heap.rs
index 8b4b07d211..ce47504daf 100644
--- a/datafusion/physical-plan/src/aggregates/topk/heap.rs
+++ b/datafusion/physical-plan/src/aggregates/topk/heap.rs
@@ -348,7 +348,7 @@ impl<VAL: ValueType> TopKHeap<VAL> {
prefix, connector, hi.val, idx, hi.map_idx
));
let new_prefix = if is_tail { "" } else { "│ " };
- let child_prefix = format!("{}{}", prefix, new_prefix);
+ let child_prefix = format!("{prefix}{new_prefix}");
let left_idx = idx * 2 + 1;
let right_idx = idx * 2 + 2;
@@ -372,7 +372,7 @@ impl<VAL: ValueType> Display for TopKHeap<VAL> {
if !self.heap.is_empty() {
self._tree_print(0, String::new(), true, &mut output);
}
- write!(f, "{}", output)
+ write!(f, "{output}")
}
}
diff --git a/datafusion/physical-plan/src/display.rs b/datafusion/physical-plan/src/display.rs
index 5a44f8735c..f555755dd2 100644
--- a/datafusion/physical-plan/src/display.rs
+++ b/datafusion/physical-plan/src/display.rs
@@ -395,7 +395,7 @@ impl ExecutionPlanVisitor for IndentVisitor<'_, '_> {
}
if self.show_statistics {
let stats = plan.partition_statistics(None).map_err(|_e| fmt::Error)?;
- write!(self.f, ", statistics=[{}]", stats)?;
+ write!(self.f, ", statistics=[{stats}]")?;
}
if self.show_schema {
write!(
@@ -480,7 +480,7 @@ impl ExecutionPlanVisitor for GraphvizVisitor<'_, '_> {
let statistics = if self.show_statistics {
let stats = plan.partition_statistics(None).map_err(|_e| fmt::Error)?;
- format!("statistics=[{}]", stats)
+ format!("statistics=[{stats}]")
} else {
"".to_string()
};
@@ -495,7 +495,7 @@ impl ExecutionPlanVisitor for GraphvizVisitor<'_, '_> {
self.f,
id,
&label,
- Some(&format!("{}{}{}", metrics, delimiter, statistics)),
+ Some(&format!("{metrics}{delimiter}{statistics}")),
)?;
if let Some(parent_node_id) = self.parents.last() {
@@ -686,7 +686,7 @@ impl TreeRenderVisitor<'_, '_> {
&render_text,
Self::NODE_RENDER_WIDTH - 2,
);
- write!(self.f, "{}", render_text)?;
+ write!(self.f, "{render_text}")?;
if render_y == halfway_point && node.child_positions.len() > 1 {
write!(self.f, "{}", Self::LMIDDLE)?;
@@ -856,10 +856,10 @@ impl TreeRenderVisitor<'_, '_> {
if str.is_empty() {
str = key.to_string();
} else if !is_multiline && total_size < available_width {
- str = format!("{}: {}", key, str);
+ str = format!("{key}: {str}");
is_inlined = true;
} else {
- str = format!("{}:\n{}", key, str);
+ str = format!("{key}:\n{str}");
}
if is_inlined && was_inlined {
@@ -902,7 +902,7 @@ impl TreeRenderVisitor<'_, '_> {
let render_width = source.chars().count();
if render_width > max_render_width {
let truncated = &source[..max_render_width - 3];
- format!("{}...", truncated)
+ format!("{truncated}...")
} else {
let total_spaces = max_render_width - render_width;
let half_spaces = total_spaces / 2;
@@ -1041,17 +1041,17 @@ pub fn display_orderings(f: &mut Formatter, orderings: &[LexOrdering]) -> fmt::R
} else {
", output_orderings=["
};
- write!(f, "{}", start)?;
+ write!(f, "{start}")?;
for (idx, ordering) in
orderings.iter().enumerate().filter(|(_, o)| !o.is_empty())
{
match idx {
- 0 => write!(f, "[{}]", ordering)?,
- _ => write!(f, ", [{}]", ordering)?,
+ 0 => write!(f, "[{ordering}]")?,
+ _ => write!(f, ", [{ordering}]")?,
}
}
let end = if orderings.len() == 1 { "" } else { "]" };
- write!(f, "{}", end)?;
+ write!(f, "{end}")?;
}
}
diff --git a/datafusion/physical-plan/src/filter.rs b/datafusion/physical-plan/src/filter.rs
index b99bef38f3..13129e382d 100644
--- a/datafusion/physical-plan/src/filter.rs
+++ b/datafusion/physical-plan/src/filter.rs
@@ -483,8 +483,7 @@ impl ExecutionPlan for FilterExec {
let index_in_input_schema =
inverse_projection.get(&index).ok_or_else(|| {
DataFusionError::Internal(format!(
- "Column {} not found in projection",
- index
+ "Column {index} not found in projection"
))
})?;
Transformed::yes(Arc::new(Column::new(
diff --git a/datafusion/physical-plan/src/joins/hash_join.rs b/datafusion/physical-plan/src/joins/hash_join.rs
index 3a2c193101..6eb435d558 100644
--- a/datafusion/physical-plan/src/joins/hash_join.rs
+++ b/datafusion/physical-plan/src/joins/hash_join.rs
@@ -664,7 +664,7 @@ impl DisplayAs for HashJoinExec {
let on = self
.on
.iter()
- .map(|(c1, c2)| format!("({}, {})", c1, c2))
+ .map(|(c1, c2)| format!("({c1}, {c2})"))
.collect::<Vec<String>>()
.join(", ");
write!(
@@ -686,7 +686,7 @@ impl DisplayAs for HashJoinExec {
if *self.join_type() != JoinType::Inner {
writeln!(f, "join_type={:?}", self.join_type)?;
}
- writeln!(f, "on={}", on)
+ writeln!(f, "on={on}")
}
}
}
@@ -4001,10 +4001,7 @@ mod tests {
assert_eq!(
batches.len(),
expected_batch_count,
- "expected {} output batches for {} join with batch_size = {}",
- expected_batch_count,
- join_type,
- batch_size
+ "expected {expected_batch_count} output batches for {join_type} join with batch_size = {batch_size}"
);
let expected = match join_type {
diff --git a/datafusion/physical-plan/src/joins/nested_loop_join.rs b/datafusion/physical-plan/src/joins/nested_loop_join.rs
index f913bcaa94..c3178f0d1f 100644
--- a/datafusion/physical-plan/src/joins/nested_loop_join.rs
+++ b/datafusion/physical-plan/src/joins/nested_loop_join.rs
@@ -1670,11 +1670,7 @@ pub(crate) mod tests {
.into_iter()
.zip(prev_values)
.all(|(current, prev)| current >= prev),
- "batch_index: {} row: {} current: {:?}, prev: {:?}",
- batch_index,
- row,
- current_values,
- prev_values
+ "batch_index: {batch_index} row: {row} current: {current_values:?}, prev: {prev_values:?}"
);
prev_values = current_values;
}
diff --git a/datafusion/physical-plan/src/joins/sort_merge_join.rs b/datafusion/physical-plan/src/joins/sort_merge_join.rs
index 4ad0d434c1..07e48224af 100644
--- a/datafusion/physical-plan/src/joins/sort_merge_join.rs
+++ b/datafusion/physical-plan/src/joins/sort_merge_join.rs
@@ -352,7 +352,7 @@ impl DisplayAs for SortMergeJoinExec {
let on = self
.on
.iter()
- .map(|(c1, c2)| format!("({}, {})", c1, c2))
+ .map(|(c1, c2)| format!("({c1}, {c2})"))
.collect::<Vec<String>>()
.join(", ");
write!(
@@ -379,7 +379,7 @@ impl DisplayAs for SortMergeJoinExec {
if self.join_type() != JoinType::Inner {
writeln!(f, "join_type={:?}", self.join_type)?;
}
- writeln!(f, "on={}", on)
+ writeln!(f, "on={on}")
}
}
}
diff --git a/datafusion/physical-plan/src/joins/symmetric_hash_join.rs b/datafusion/physical-plan/src/joins/symmetric_hash_join.rs
index 0dcb42169e..819a3302b0 100644
--- a/datafusion/physical-plan/src/joins/symmetric_hash_join.rs
+++ b/datafusion/physical-plan/src/joins/symmetric_hash_join.rs
@@ -372,7 +372,7 @@ impl DisplayAs for SymmetricHashJoinExec {
let on = self
.on
.iter()
- .map(|(c1, c2)| format!("({}, {})", c1, c2))
+ .map(|(c1, c2)| format!("({c1}, {c2})"))
.collect::<Vec<String>>()
.join(", ");
write!(
@@ -395,7 +395,7 @@ impl DisplayAs for SymmetricHashJoinExec {
if *self.join_type() != JoinType::Inner {
writeln!(f, "join_type={:?}", self.join_type)?;
}
- writeln!(f, "on={}", on)
+ writeln!(f, "on={on}")
}
}
}
diff --git a/datafusion/physical-plan/src/joins/utils.rs b/datafusion/physical-plan/src/joins/utils.rs
index ce1860d205..4be1437424 100644
--- a/datafusion/physical-plan/src/joins/utils.rs
+++ b/datafusion/physical-plan/src/joins/utils.rs
@@ -2242,8 +2242,7 @@ mod tests {
assert_eq!(
output_cardinality, expected,
- "failure for join_type: {}",
- join_type
+ "failure for join_type: {join_type}"
);
}
diff --git a/datafusion/physical-plan/src/limit.rs b/datafusion/physical-plan/src/limit.rs
index 80c393eec4..2224f85cc1 100644
--- a/datafusion/physical-plan/src/limit.rs
+++ b/datafusion/physical-plan/src/limit.rs
@@ -110,7 +110,7 @@ impl DisplayAs for GlobalLimitExec {
}
DisplayFormatType::TreeRender => {
if let Some(fetch) = self.fetch {
- writeln!(f, "limit={}", fetch)?;
+ writeln!(f, "limit={fetch}")?;
}
write!(f, "skip={}", self.skip)
}
@@ -164,10 +164,7 @@ impl ExecutionPlan for GlobalLimitExec {
partition: usize,
context: Arc<TaskContext>,
) -> Result<SendableRecordBatchStream> {
- trace!(
- "Start GlobalLimitExec::execute for partition: {}",
- partition
- );
+ trace!("Start GlobalLimitExec::execute for partition: {partition}");
// GlobalLimitExec has a single output partition
if 0 != partition {
return internal_err!("GlobalLimitExec invalid partition {partition}");
diff --git a/datafusion/physical-plan/src/recursive_query.rs b/datafusion/physical-plan/src/recursive_query.rs
index 7268735ea4..210db90c3c 100644
--- a/datafusion/physical-plan/src/recursive_query.rs
+++ b/datafusion/physical-plan/src/recursive_query.rs
@@ -184,8 +184,7 @@ impl ExecutionPlan for RecursiveQueryExec {
// TODO: we might be able to handle multiple partitions in the future.
if partition != 0 {
return Err(DataFusionError::Internal(format!(
- "RecursiveQueryExec got an invalid partition {} (expected 0)",
- partition
+ "RecursiveQueryExec got an invalid partition {partition} (expected 0)"
)));
}
diff --git a/datafusion/physical-plan/src/repartition/mod.rs b/datafusion/physical-plan/src/repartition/mod.rs
index c86a37697a..ee5be01e29 100644
--- a/datafusion/physical-plan/src/repartition/mod.rs
+++ b/datafusion/physical-plan/src/repartition/mod.rs
@@ -121,7 +121,7 @@ impl RepartitionExecState {
let mut channels = HashMap::with_capacity(txs.len());
for (partition, (tx, rx)) in txs.into_iter().zip(rxs).enumerate() {
let reservation = Arc::new(Mutex::new(
- MemoryConsumer::new(format!("{}[{partition}]", name))
+ MemoryConsumer::new(format!("{name}[{partition}]"))
.register(context.memory_pool()),
));
channels.insert(partition, (tx, rx, reservation));
@@ -517,11 +517,10 @@ impl DisplayAs for RepartitionExec {
self.input.output_partitioning().partition_count();
let output_partition_count = self.partitioning().partition_count();
let input_to_output_partition_str =
- format!("{} -> {}", input_partition_count, output_partition_count);
+ format!("{input_partition_count} -> {output_partition_count}");
writeln!(
f,
- "partition_count(in->out)={}",
- input_to_output_partition_str
+ "partition_count(in->out)={input_to_output_partition_str}"
)?;
if self.preserve_order {
@@ -632,9 +631,7 @@ impl ExecutionPlan for RepartitionExec {
};
trace!(
- "Before returning stream in {}::execute for partition: {}",
- name,
- partition
+ "Before returning stream in {name}::execute for partition: {partition}"
);
if preserve_order {
@@ -656,7 +653,7 @@ impl ExecutionPlan for RepartitionExec {
// input partitions to this partition:
let fetch = None;
let merge_reservation =
- MemoryConsumer::new(format!("{}[Merge {partition}]", name))
+ MemoryConsumer::new(format!("{name}[Merge {partition}]"))
.register(context.memory_pool());
StreamingMergeBuilder::new()
.with_streams(input_streams)
diff --git a/datafusion/physical-plan/src/sorts/partial_sort.rs b/datafusion/physical-plan/src/sorts/partial_sort.rs
index 6d7f64ebfb..78f898a2d7 100644
--- a/datafusion/physical-plan/src/sorts/partial_sort.rs
+++ b/datafusion/physical-plan/src/sorts/partial_sort.rs
@@ -296,10 +296,7 @@ impl ExecutionPlan for PartialSortExec {
let input = self.input.execute(partition, Arc::clone(&context))?;
- trace!(
- "End PartialSortExec's input.execute for partition: {}",
- partition
- );
+ trace!("End PartialSortExec's input.execute for partition: {partition}");
// Make sure common prefix length is larger than 0
// Otherwise, we should use SortExec.
diff --git a/datafusion/physical-plan/src/sorts/sort.rs b/datafusion/physical-plan/src/sorts/sort.rs
index bf7d69b62f..635b93b81b 100644
--- a/datafusion/physical-plan/src/sorts/sort.rs
+++ b/datafusion/physical-plan/src/sorts/sort.rs
@@ -1223,7 +1223,7 @@ impl ExecutionPlan for SortExec {
let execution_options = &context.session_config().options().execution;
- trace!("End SortExec's input.execute for partition: {}", partition);
+ trace!("End SortExec's input.execute for partition: {partition}");
let requirement = &LexRequirement::from(self.expr.clone());
@@ -1660,15 +1660,13 @@ mod tests {
let err = result.unwrap_err();
assert!(
matches!(err, DataFusionError::Context(..)),
- "Assertion failed: expected a Context error, but got: {:?}",
- err
+ "Assertion failed: expected a Context error, but got: {err:?}"
);
// Assert that the context error is wrapping a resources exhausted error.
assert!(
matches!(err.find_root(), DataFusionError::ResourcesExhausted(_)),
- "Assertion failed: expected a ResourcesExhausted error, but got: {:?}",
- err
+ "Assertion failed: expected a ResourcesExhausted error, but got: {err:?}"
);
Ok(())
diff --git a/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs b/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs
index da346d8f8a..6930473360 100644
--- a/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs
+++ b/datafusion/physical-plan/src/sorts/sort_preserving_merge.rs
@@ -267,10 +267,7 @@ impl ExecutionPlan for SortPreservingMergeExec {
partition: usize,
context: Arc<TaskContext>,
) -> Result<SendableRecordBatchStream> {
- trace!(
- "Start SortPreservingMergeExec::execute for partition: {}",
- partition
- );
+ trace!("Start SortPreservingMergeExec::execute for partition: {partition}");
if 0 != partition {
return internal_err!(
"SortPreservingMergeExec invalid partition {partition}"
@@ -279,8 +276,7 @@ impl ExecutionPlan for SortPreservingMergeExec {
let input_partitions = self.input.output_partitioning().partition_count();
trace!(
- "Number of input partitions of SortPreservingMergeExec::execute: {}",
- input_partitions
+ "Number of input partitions of SortPreservingMergeExec::execute: {input_partitions}"
);
let schema = self.schema();
diff --git a/datafusion/physical-plan/src/test.rs b/datafusion/physical-plan/src/test.rs
index cb0b060d27..4d5244e0e1 100644
--- a/datafusion/physical-plan/src/test.rs
+++ b/datafusion/physical-plan/src/test.rs
@@ -87,9 +87,7 @@ impl DisplayAs for TestMemoryExec {
let output_ordering = self
.sort_information
.first()
- .map(|output_ordering| {
- format!(", output_ordering={}", output_ordering)
- })
+ .map(|output_ordering| format!(", output_ordering={output_ordering}"))
.unwrap_or_default();
let eq_properties = self.eq_properties();
@@ -97,12 +95,12 @@ impl DisplayAs for TestMemoryExec {
let constraints = if constraints.is_empty() {
String::new()
} else {
- format!(", {}", constraints)
+ format!(", {constraints}")
};
let limit = self
.fetch
- .map_or(String::new(), |limit| format!(", fetch={}", limit));
+ .map_or(String::new(), |limit| format!(", fetch={limit}"));
if self.show_sizes {
write!(
f,
@@ -458,7 +456,7 @@ pub fn make_partition_utf8(sz: i32) -> RecordBatch {
let seq_start = 0;
let seq_end = sz;
let values = (seq_start..seq_end)
- .map(|i| format!("test_long_string_that_is_roughly_42_bytes_{}", i))
+ .map(|i| format!("test_long_string_that_is_roughly_42_bytes_{i}"))
.collect::<Vec<_>>();
let schema = Arc::new(Schema::new(vec![Field::new("i", DataType::Utf8, true)]));
let mut string_array = arrow::array::StringArray::from(values);
diff --git a/datafusion/physical-plan/src/tree_node.rs b/datafusion/physical-plan/src/tree_node.rs
index 69b0a16531..78ba984ed1 100644
--- a/datafusion/physical-plan/src/tree_node.rs
+++ b/datafusion/physical-plan/src/tree_node.rs
@@ -94,7 +94,7 @@ impl<T: Default> PlanContext<T> {
impl<T: Display> Display for PlanContext<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
let node_string = displayable(self.plan.as_ref()).one_line();
- write!(f, "Node plan: {}", node_string)?;
+ write!(f, "Node plan: {node_string}")?;
write!(f, "Node data: {}", self.data)?;
write!(f, "")
}
diff --git a/datafusion/physical-plan/src/union.rs b/datafusion/physical-plan/src/union.rs
index bdae97f5d1..9db12a760e 100644
--- a/datafusion/physical-plan/src/union.rs
+++ b/datafusion/physical-plan/src/union.rs
@@ -248,7 +248,7 @@ impl ExecutionPlan for UnionExec {
}
}
- warn!("Error in Union: Partition {} not found", partition);
+ warn!("Error in Union: Partition {partition} not found");
exec_err!("Partition {partition} not found in Union")
}
@@ -481,7 +481,7 @@ impl ExecutionPlan for InterleaveExec {
)));
}
- warn!("Error in InterleaveExec: Partition {} not found", partition);
+ warn!("Error in InterleaveExec: Partition {partition} not found");
exec_err!("Partition {partition} not found in InterleaveExec")
}
@@ -924,7 +924,7 @@ mod tests {
// Check whether orderings are same.
let lhs_orderings = lhs.oeq_class();
let rhs_orderings = rhs.oeq_class();
- assert_eq!(lhs_orderings.len(), rhs_orderings.len(), "{}", err_msg);
+ assert_eq!(lhs_orderings.len(), rhs_orderings.len(), "{err_msg}");
for rhs_ordering in rhs_orderings.iter() {
assert!(lhs_orderings.contains(rhs_ordering), "{}", err_msg);
}
diff --git a/datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs b/datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs
index 1ea02adafe..6751f9b202 100644
--- a/datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs
+++ b/datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs
@@ -278,7 +278,7 @@ impl DisplayAs for BoundedWindowAggExec {
writeln!(f, "select_list={}", g.join(", "))?;
let mode = &self.input_order_mode;
- writeln!(f, "mode={:?}", mode)?;
+ writeln!(f, "mode={mode:?}")?;
}
}
Ok(())
@@ -1357,8 +1357,7 @@ mod tests {
WindowFrameBound::Following(ScalarValue::UInt64(Some(n_future_range as u64))),
);
let fn_name = format!(
- "{}({:?}) PARTITION BY: [{:?}], ORDER BY: [{:?}]",
- window_fn, args, partitionby_exprs, orderby_exprs
+ "{window_fn}({args:?}) PARTITION BY: [{partitionby_exprs:?}], ORDER BY: [{orderby_exprs:?}]"
);
let input_order_mode = InputOrderMode::Linear;
Ok(Arc::new(BoundedWindowAggExec::try_new(
diff --git a/datafusion/spark/src/function/math/hex.rs b/datafusion/spark/src/function/math/hex.rs
index 5cce882cce..74ec7641b3 100644
--- a/datafusion/spark/src/function/math/hex.rs
+++ b/datafusion/spark/src/function/math/hex.rs
@@ -138,7 +138,7 @@ impl ScalarUDFImpl for SparkHex {
}
fn hex_int64(num: i64) -> String {
- format!("{:X}", num)
+ format!("{num:X}")
}
#[inline(always)]
diff --git a/datafusion/sql/src/expr/function.rs b/datafusion/sql/src/expr/function.rs
index 535300427a..97ff7bf199 100644
--- a/datafusion/sql/src/expr/function.rs
+++ b/datafusion/sql/src/expr/function.rs
@@ -461,7 +461,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
let mut diagnostic =
Diagnostic::new_error(format!("Invalid function '{name}'"), span);
diagnostic
- .add_note(format!("Possible function '{}'", suggested_func_name), None);
+ .add_note(format!("Possible function '{suggested_func_name}'"), None);
plan_err!("Invalid function '{name}'.\nDid you mean '{suggested_func_name}'?"; diagnostic=diagnostic)
} else {
internal_err!("No functions registered with this context.")
diff --git a/datafusion/sql/src/expr/value.rs b/datafusion/sql/src/expr/value.rs
index be4a45a257..b77f5eaf45 100644
--- a/datafusion/sql/src/expr/value.rs
+++ b/datafusion/sql/src/expr/value.rs
@@ -131,10 +131,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
// Check if the placeholder is in the parameter list
let param_type = param_data_types.get(idx);
// Data type of the parameter
- debug!(
- "type of param {} param_data_types[idx]: {:?}",
- param, param_type
- );
+ debug!("type of param {param} param_data_types[idx]: {param_type:?}");
Ok(Expr::Placeholder(Placeholder::new(
param,
diff --git a/datafusion/sql/src/parser.rs b/datafusion/sql/src/parser.rs
index f3e94bfc5e..9731eebad1 100644
--- a/datafusion/sql/src/parser.rs
+++ b/datafusion/sql/src/parser.rs
@@ -147,7 +147,7 @@ impl fmt::Display for CopyToStatement {
write!(f, "COPY {source} TO {target}")?;
if let Some(file_type) = stored_as {
- write!(f, " STORED AS {}", file_type)?;
+ write!(f, " STORED AS {file_type}")?;
}
if !partitioned_by.is_empty() {
write!(f, " PARTITIONED BY ({})", partitioned_by.join(", "))?;
diff --git a/datafusion/sql/src/planner.rs b/datafusion/sql/src/planner.rs
index 3325c98aa7..73d136d7d1 100644
--- a/datafusion/sql/src/planner.rs
+++ b/datafusion/sql/src/planner.rs
@@ -816,7 +816,7 @@ impl std::fmt::Display for IdentTaker {
if !first {
write!(f, ".")?;
}
- write!(f, "{}", ident)?;
+ write!(f, "{ident}")?;
first = false;
}
diff --git a/datafusion/sql/src/relation/mod.rs b/datafusion/sql/src/relation/mod.rs
index dee855f8c0..88a32a2183 100644
--- a/datafusion/sql/src/relation/mod.rs
+++ b/datafusion/sql/src/relation/mod.rs
@@ -92,7 +92,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
.build(),
(None, Err(e)) => {
let e = e.with_diagnostic(Diagnostic::new_error(
- format!("table '{}' not found", table_ref),
+ format!("table '{table_ref}' not found"),
Span::try_from_sqlparser_span(relation_span),
));
Err(e)
diff --git a/datafusion/sql/src/set_expr.rs b/datafusion/sql/src/set_expr.rs
index 78c63d7db7..5b65e1c045 100644
--- a/datafusion/sql/src/set_expr.rs
+++ b/datafusion/sql/src/set_expr.rs
@@ -96,7 +96,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
return Ok(());
}
let diagnostic = Diagnostic::new_error(
- format!("{} queries have different number of columns", op),
+ format!("{op} queries have different number of columns"),
set_expr_span,
)
.with_note(
diff --git a/datafusion/sql/src/statement.rs b/datafusion/sql/src/statement.rs
index 1f1c235fee..7fae48aac2 100644
--- a/datafusion/sql/src/statement.rs
+++ b/datafusion/sql/src/statement.rs
@@ -1609,7 +1609,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
// If config does not belong to any namespace, assume it is
// a format option and apply the format prefix for backwards
// compatibility.
- let renamed_key = format!("format.{}", key);
+ let renamed_key = format!("format.{key}");
options_map.insert(renamed_key.to_lowercase(), value_string);
} else {
options_map.insert(key.to_lowercase(), value_string);
diff --git a/datafusion/sql/src/unparser/ast.rs b/datafusion/sql/src/unparser/ast.rs
index 117971af76..3a294cb06a 100644
--- a/datafusion/sql/src/unparser/ast.rs
+++ b/datafusion/sql/src/unparser/ast.rs
@@ -705,9 +705,9 @@ impl fmt::Display for BuilderError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::UninitializedField(ref field) => {
- write!(f, "`{}` must be initialized", field)
+ write!(f, "`{field}` must be initialized")
}
- Self::ValidationError(ref error) => write!(f, "{}", error),
+ Self::ValidationError(ref error) => write!(f, "{error}"),
}
}
}
diff --git a/datafusion/sql/src/unparser/expr.rs b/datafusion/sql/src/unparser/expr.rs
index fe00c832f8..41cb811d19 100644
--- a/datafusion/sql/src/unparser/expr.rs
+++ b/datafusion/sql/src/unparser/expr.rs
@@ -1133,16 +1133,16 @@ impl Unparser<'_> {
ScalarValue::Float16(None) => Ok(ast::Expr::value(ast::Value::Null)),
ScalarValue::Float32(Some(f)) => {
let f_val = match f.fract() {
- 0.0 => format!("{:.1}", f),
- _ => format!("{}", f),
+ 0.0 => format!("{f:.1}"),
+ _ => format!("{f}"),
};
Ok(ast::Expr::value(ast::Value::Number(f_val, false)))
}
ScalarValue::Float32(None) => Ok(ast::Expr::value(ast::Value::Null)),
ScalarValue::Float64(Some(f)) => {
let f_val = match f.fract() {
- 0.0 => format!("{:.1}", f),
- _ => format!("{}", f),
+ 0.0 => format!("{f:.1}"),
+ _ => format!("{f}"),
};
Ok(ast::Expr::value(ast::Value::Number(f_val, false)))
}
@@ -2228,7 +2228,7 @@ mod tests {
for (expr, expected) in tests {
let ast = expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
assert_eq!(actual, expected);
}
@@ -2246,7 +2246,7 @@ mod tests {
let expr = col("a").gt(lit(4));
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = r#"('a' > 4)"#;
assert_eq!(actual, expected);
@@ -2262,7 +2262,7 @@ mod tests {
let expr = col("a").gt(lit(4));
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = r#"(a > 4)"#;
assert_eq!(actual, expected);
@@ -2286,7 +2286,7 @@ mod tests {
});
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = format!(r#"CAST(a AS {identifier})"#);
assert_eq!(actual, expected);
@@ -2311,7 +2311,7 @@ mod tests {
});
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = format!(r#"CAST(a AS {identifier})"#);
assert_eq!(actual, expected);
@@ -2333,7 +2333,7 @@ mod tests {
let unparser = Unparser::new(&dialect);
let ast = unparser.sort_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
assert_eq!(actual, expected);
}
@@ -2583,7 +2583,7 @@ mod tests {
});
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = format!(r#"CAST(a AS {identifier})"#);
assert_eq!(actual, expected);
@@ -2639,7 +2639,7 @@ mod tests {
.call(vec![Expr::Literal(ScalarValue::new_utf8(unit)), col("x")]);
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
assert_eq!(actual, expected);
}
@@ -2666,7 +2666,7 @@ mod tests {
});
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = format!(r#"CAST(a AS {identifier})"#);
assert_eq!(actual, expected);
@@ -2694,7 +2694,7 @@ mod tests {
});
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = format!(r#"CAST(a AS {identifier})"#);
assert_eq!(actual, expected);
@@ -2733,7 +2733,7 @@ mod tests {
});
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = format!(r#"CAST(a AS {identifier})"#);
assert_eq!(actual, expected);
@@ -2762,7 +2762,7 @@ mod tests {
));
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = format!(r#"CAST('2025-01-31 01:05:49.123' AS {identifier})"#);
assert_eq!(actual, expected);
@@ -2789,7 +2789,7 @@ mod tests {
});
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = format!(r#"CAST(a AS {identifier})"#);
assert_eq!(actual, expected);
@@ -2815,7 +2815,7 @@ mod tests {
});
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = expected.to_string();
assert_eq!(actual, expected);
@@ -2872,7 +2872,7 @@ mod tests {
});
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = format!(r#"round(CAST("a" AS {identifier}), 2)"#);
assert_eq!(actual, expected);
@@ -3052,7 +3052,7 @@ mod tests {
let expr = cast(col("a"), DataType::Utf8View);
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = r#"CAST(a AS CHAR)"#.to_string();
assert_eq!(actual, expected);
@@ -3060,7 +3060,7 @@ mod tests {
let expr = col("a").eq(lit(ScalarValue::Utf8View(Some("hello".to_string()))));
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = r#"(a = 'hello')"#.to_string();
assert_eq!(actual, expected);
@@ -3068,7 +3068,7 @@ mod tests {
let expr = col("a").is_not_null();
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = r#"a IS NOT NULL"#.to_string();
assert_eq!(actual, expected);
@@ -3076,7 +3076,7 @@ mod tests {
let expr = col("a").is_null();
let ast = unparser.expr_to_sql(&expr)?;
- let actual = format!("{}", ast);
+ let actual = format!("{ast}");
let expected = r#"a IS NULL"#.to_string();
assert_eq!(actual, expected);
diff --git a/datafusion/sql/src/unparser/plan.rs b/datafusion/sql/src/unparser/plan.rs
index 1401a153b0..4209734138 100644
--- a/datafusion/sql/src/unparser/plan.rs
+++ b/datafusion/sql/src/unparser/plan.rs
@@ -991,8 +991,7 @@ impl Unparser<'_> {
if let Expr::Alias(Alias { expr, .. }) = expr {
if let Expr::Column(Column { name, .. }) = expr.as_ref() {
if let Some(prefix) = name.strip_prefix(UNNEST_PLACEHOLDER) {
- if prefix.starts_with(&format!("({}(", OUTER_REFERENCE_COLUMN_PREFIX))
- {
+ if prefix.starts_with(&format!("({OUTER_REFERENCE_COLUMN_PREFIX}(")) {
return Some(UnnestInputType::OuterReference);
}
return Some(UnnestInputType::Scalar);
diff --git a/datafusion/sql/src/utils.rs b/datafusion/sql/src/utils.rs
index 8be45f3d8c..8496be1d7f 100644
--- a/datafusion/sql/src/utils.rs
+++ b/datafusion/sql/src/utils.rs
@@ -398,9 +398,9 @@ impl RecursiveUnnestRewriter<'_> {
// Full context, we are trying to plan the execution as InnerProjection->Unnest->OuterProjection
// inside unnest execution, each column inside the inner projection
// will be transformed into new columns. Thus we need to keep track of these placeholding column names
- let placeholder_name = format!("{UNNEST_PLACEHOLDER}({})", inner_expr_name);
+ let placeholder_name = format!("{UNNEST_PLACEHOLDER}({inner_expr_name})");
let post_unnest_name =
- format!("{UNNEST_PLACEHOLDER}({},depth={})", inner_expr_name, level);
+ format!("{UNNEST_PLACEHOLDER}({inner_expr_name},depth={level})");
// This is due to the fact that unnest transformation should keep the original
// column name as is, to comply with group by and order by
let placeholder_column = Column::from_name(placeholder_name.clone());
@@ -680,7 +680,7 @@ mod tests {
"{}=>[{}]",
i.0,
vec.iter()
- .map(|i| format!("{}", i))
+ .map(|i| format!("{i}"))
.collect::<Vec<String>>()
.join(", ")
),
diff --git a/datafusion/sql/tests/cases/diagnostic.rs b/datafusion/sql/tests/cases/diagnostic.rs
index e2e4ada903..b3fc5dea9e 100644
--- a/datafusion/sql/tests/cases/diagnostic.rs
+++ b/datafusion/sql/tests/cases/diagnostic.rs
@@ -379,7 +379,7 @@ fn test_syntax_error() -> Result<()> {
Some(diag) => {
let diag = diag.clone();
assert_snapshot!(diag.message, @"Expected: ',' or ')' after partition definition, found: int at Line: 1, Column: 77");
- println!("{:?}", spans);
+ println!("{spans:?}");
assert_eq!(diag.span, Some(spans["int"]));
Ok(())
}
diff --git a/datafusion/substrait/src/logical_plan/consumer/utils.rs b/datafusion/substrait/src/logical_plan/consumer/utils.rs
index 8ffbd8bf60..a267971ff8 100644
--- a/datafusion/substrait/src/logical_plan/consumer/utils.rs
+++ b/datafusion/substrait/src/logical_plan/consumer/utils.rs
@@ -342,7 +342,7 @@ impl NameTracker {
false => {
let mut counter = 0;
loop {
- let candidate_name = format!("{}__temp__{}", name, counter);
+ let candidate_name = format!("{name}__temp__{counter}");
if self.seen_names.insert(candidate_name.clone()) {
return (candidate_name, NameTrackerStatus::SeenBefore);
}
diff --git a/datafusion/substrait/tests/cases/consumer_integration.rs b/datafusion/substrait/tests/cases/consumer_integration.rs
index bdeeeb585c..f32920d53d 100644
--- a/datafusion/substrait/tests/cases/consumer_integration.rs
+++ b/datafusion/substrait/tests/cases/consumer_integration.rs
@@ -44,7 +44,7 @@ mod tests {
let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto)?;
let plan = from_substrait_plan(&ctx.state(), &proto).await?;
ctx.state().create_physical_plan(&plan).await?;
- Ok(format!("{}", plan))
+ Ok(format!("{plan}"))
}
#[tokio::test]
@@ -501,7 +501,7 @@ mod tests {
let ctx = add_plan_schemas_to_ctx(SessionContext::new(), &proto)?;
let plan = from_substrait_plan(&ctx.state(), &proto).await?;
ctx.state().create_physical_plan(&plan).await?;
- Ok(format!("{}", plan))
+ Ok(format!("{plan}"))
}
#[tokio::test]
diff --git a/datafusion/substrait/tests/cases/emit_kind_tests.rs b/datafusion/substrait/tests/cases/emit_kind_tests.rs
index 88db2bc34d..e916b4cb0e 100644
--- a/datafusion/substrait/tests/cases/emit_kind_tests.rs
+++ b/datafusion/substrait/tests/cases/emit_kind_tests.rs
@@ -126,8 +126,8 @@ mod tests {
let plan1str = format!("{plan}");
let plan2str = format!("{plan2}");
- println!("{}", plan1str);
- println!("{}", plan2str);
+ println!("{plan1str}");
+ println!("{plan2str}");
assert_eq!(plan1str, plan2str);
Ok(())