Skip to content

Commit

Permalink
refactor: add 2 pedantic clippy lints for strings (#19614)
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao authored Dec 11, 2024
1 parent 5954c98 commit 119e17e
Show file tree
Hide file tree
Showing 422 changed files with 1,955 additions and 2,060 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ new_without_default = "allow"
# TODO: remove later https://github.com/rust-lang/rust-clippy/issues/12436
mixed_attributes_style = "allow"
too_long_first_doc_paragraph = "allow"
str_to_string = "warn"
string_to_string = "warn"

[workspace.lints.rustdoc]
private_intra_doc_links = "allow"
Expand Down
2 changes: 1 addition & 1 deletion src/batch/benches/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn create_filter_executor(chunk_size: usize, chunk_num: usize) -> BoxedExecutor
Box::new(FilterExecutor::new(
build_from_pretty("(equal:boolean (modulus:int8 $0:int8 2:int8) 0:int8)"),
input,
"FilterBenchmark".to_string(),
"FilterBenchmark".to_owned(),
CHUNK_SIZE,
))
}
Expand Down
2 changes: 1 addition & 1 deletion src/batch/benches/hash_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fn create_hash_agg_executor(
group_key_types,
schema,
input,
"HashAggExecutor".to_string(),
"HashAggExecutor".to_owned(),
CHUNK_SIZE,
MemoryContext::none(),
None,
Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/executor/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ mod tests {
dml_manager,
Box::new(mock_executor),
1024,
"DeleteExecutor".to_string(),
"DeleteExecutor".to_owned(),
false,
0,
));
Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/executor/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ mod tests {
column_subsets,
child: Box::new(mock_executor),
schema: expand_schema,
identity: "ExpandExecutor".to_string(),
identity: "ExpandExecutor".to_owned(),
chunk_size: CHUNK_SIZE,
});
let mut stream = expand_executor.execute();
Expand Down
4 changes: 2 additions & 2 deletions src/batch/src/executor/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ mod tests {
let filter_executor = Box::new(FilterExecutor {
expr: build_from_pretty("(greater_than:boolean $0:int4[] {2}:int4[])"),
child: Box::new(mock_executor),
identity: "FilterExecutor".to_string(),
identity: "FilterExecutor".to_owned(),
chunk_size: CHUNK_SIZE,
});

Expand Down Expand Up @@ -207,7 +207,7 @@ mod tests {
let filter_executor = Box::new(FilterExecutor {
expr: build_from_pretty("(equal:boolean $0:int4 $1:int4)"),
child: Box::new(mock_executor),
identity: "FilterExecutor".to_string(),
identity: "FilterExecutor".to_owned(),
chunk_size: CHUNK_SIZE,
});
let fields = &filter_executor.schema().fields;
Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/executor/generic_exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ mod tests {
fields: vec![Field::unnamed(DataType::Int32)],
},
task_id: TaskId::default(),
identity: "GenericExchangeExecutor2".to_string(),
identity: "GenericExchangeExecutor2".to_owned(),
});

let mut stream = executor.execute();
Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/executor/group_top_n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ mod tests {
with_ties: false,
group_key: vec![2],
group_key_types: vec![DataType::Int32],
identity: "GroupTopNExecutor".to_string(),
identity: "GroupTopNExecutor".to_owned(),
chunk_size: CHUNK_SIZE,
mem_ctx,
})
Expand Down
10 changes: 5 additions & 5 deletions src/batch/src/executor/hash_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ mod tests {
&agg_prost,
src_exec,
TaskId::default(),
"HashAggExecutor".to_string(),
"HashAggExecutor".to_owned(),
CHUNK_SIZE,
mem_context.clone(),
None,
Expand Down Expand Up @@ -892,7 +892,7 @@ mod tests {
&agg_prost,
Box::new(src_exec),
TaskId::default(),
"HashAggExecutor".to_string(),
"HashAggExecutor".to_owned(),
CHUNK_SIZE,
MemoryContext::none(),
None,
Expand Down Expand Up @@ -959,7 +959,7 @@ mod tests {
},
);
for i in 0..10 {
map.entry(i).or_insert_with(|| "i".to_string());
map.entry(i).or_insert_with(|| "i".to_owned());
}

for (k, v) in map {
Expand Down Expand Up @@ -1011,7 +1011,7 @@ mod tests {
&agg_prost,
Box::new(src_exec),
TaskId::default(),
"HashAggExecutor".to_string(),
"HashAggExecutor".to_owned(),
CHUNK_SIZE,
MemoryContext::none(),
None,
Expand Down Expand Up @@ -1105,7 +1105,7 @@ mod tests {
&agg_prost,
src_exec,
TaskId::default(),
"HashAggExecutor".to_string(),
"HashAggExecutor".to_owned(),
CHUNK_SIZE,
mem_context.clone(),
Some(SpillBackend::Memory),
Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/executor/hop_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ mod tests {
schema,
window_slide,
window_size,
"test".to_string(),
"test".to_owned(),
window_start_exprs,
window_end_exprs,
output_indices,
Expand Down
4 changes: 2 additions & 2 deletions src/batch/src/executor/iceberg_scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl IcebergScanExecutor {
.load_table_v2_with_metadata(self.table_meta)
.await?;
let data_types = self.schema.data_types();
let table_name = table.identifier().name().to_string();
let table_name = table.identifier().name().to_owned();

let (mut position_delete_filter, data_file_scan_tasks) =
match Option::take(&mut self.file_scan_tasks) {
Expand Down Expand Up @@ -336,7 +336,7 @@ impl PositionDeleteFilter {
continue;
}
let entry = position_delete_file_path_pos_map
.entry(file_path.to_string())
.entry(file_path.to_owned())
.or_default();
// Split `pos` by `batch_size`, because the data file will also be split by `batch_size`
let delete_vec_index = pos as usize / batch_size;
Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/executor/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ mod tests {
dml_manager,
Box::new(mock_executor),
1024,
"InsertExecutor".to_string(),
"InsertExecutor".to_owned(),
vec![0, 1, 2], // Ignoring insertion order
vec![],
row_id_index,
Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/executor/join/hash_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2625,7 +2625,7 @@ mod tests {
vec![0],
vec![null_safe],
cond,
"HashJoinExecutor".to_string(),
"HashJoinExecutor".to_owned(),
chunk_size,
if test_spill {
Some(SpillBackend::Memory)
Expand Down
6 changes: 3 additions & 3 deletions src/batch/src/executor/join/local_lookup_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl InnerSideExecutorBuilder {
plan: Some(PlanFragment {
root: Some(PlanNode {
children: vec![],
identity: "SeqScan".to_string(),
identity: "SeqScan".to_owned(),
node_body: Some(self.create_row_seq_scan_node(id)?),
}),
exchange_info: Some(ExchangeInfo {
Expand Down Expand Up @@ -229,7 +229,7 @@ impl LookupExecutorBuilder for InnerSideExecutorBuilder {

let plan_node = PlanNode {
children: vec![],
identity: "LocalLookupJoinExchangeExecutor".to_string(),
identity: "LocalLookupJoinExchangeExecutor".to_owned(),
node_body: Some(exchange_node),
};

Expand Down Expand Up @@ -597,7 +597,7 @@ mod tests {
schema: original_schema.clone(),
output_indices: (0..original_schema.len()).collect(),
chunk_size: CHUNK_SIZE,
identity: "TestLookupJoinExecutor".to_string(),
identity: "TestLookupJoinExecutor".to_owned(),
shutdown_rx: ShutdownToken::empty(),
mem_ctx: MemoryContext::none(),
}
Expand Down
4 changes: 2 additions & 2 deletions src/batch/src/executor/limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ mod tests {
child: Box::new(mock_executor),
limit,
offset,
identity: "LimitExecutor2".to_string(),
identity: "LimitExecutor2".to_owned(),
});
let fields = &limit_executor.schema().fields;
assert_eq!(fields[0].data_type, DataType::Int32);
Expand Down Expand Up @@ -309,7 +309,7 @@ mod tests {
child: Box::new(mock_executor),
limit,
offset,
identity: "LimitExecutor2".to_string(),
identity: "LimitExecutor2".to_owned(),
});

let mut results = vec![];
Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/executor/managed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Executor for ManagedExecutor {

#[try_stream(boxed, ok = DataChunk, error = BatchError)]
async fn execute(mut self: Box<Self>) {
let input_desc = self.child.identity().to_string();
let input_desc = self.child.identity().to_owned();
let span = tracing::info_span!("batch_executor", "otel.name" = input_desc);

let mut child_stream = self.child.execute();
Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/executor/merge_sort_exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ mod tests {
fields: vec![Field::unnamed(DataType::Int32)],
},
TaskId::default(),
"MergeSortExchangeExecutor2".to_string(),
"MergeSortExchangeExecutor2".to_owned(),
CHUNK_SIZE,
));

Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ mod tests {
let task_id = &TaskId {
task_id: 1,
stage_id: 1,
query_id: "test_query_id".to_string(),
query_id: "test_query_id".to_owned(),
};
let builder = ExecutorBuilder::new(
&plan_node,
Expand Down
16 changes: 8 additions & 8 deletions src/batch/src/executor/order_by.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ mod tests {
let order_by_executor = Box::new(SortExecutor::new(
Box::new(mock_executor),
Arc::new(column_orders),
"SortExecutor2".to_string(),
"SortExecutor2".to_owned(),
CHUNK_SIZE,
MemoryContext::none(),
None,
Expand Down Expand Up @@ -514,7 +514,7 @@ mod tests {
let order_by_executor = Box::new(SortExecutor::new(
Box::new(mock_executor),
Arc::new(column_orders),
"SortExecutor2".to_string(),
"SortExecutor2".to_owned(),
CHUNK_SIZE,
MemoryContext::none(),
None,
Expand Down Expand Up @@ -566,7 +566,7 @@ mod tests {
let order_by_executor = Box::new(SortExecutor::new(
Box::new(mock_executor),
Arc::new(column_orders),
"SortExecutor2".to_string(),
"SortExecutor2".to_owned(),
CHUNK_SIZE,
MemoryContext::none(),
None,
Expand Down Expand Up @@ -643,7 +643,7 @@ mod tests {
let order_by_executor = Box::new(SortExecutor::new(
Box::new(mock_executor),
Arc::new(column_orders),
"SortExecutor".to_string(),
"SortExecutor".to_owned(),
CHUNK_SIZE,
MemoryContext::none(),
None,
Expand Down Expand Up @@ -725,7 +725,7 @@ mod tests {
let order_by_executor = Box::new(SortExecutor::new(
Box::new(mock_executor),
Arc::new(column_orders),
"SortExecutor".to_string(),
"SortExecutor".to_owned(),
CHUNK_SIZE,
MemoryContext::none(),
None,
Expand Down Expand Up @@ -833,7 +833,7 @@ mod tests {
let order_by_executor = Box::new(SortExecutor::new(
Box::new(mock_executor),
column_orders.into(),
"SortExecutor".to_string(),
"SortExecutor".to_owned(),
CHUNK_SIZE,
MemoryContext::none(),
None,
Expand Down Expand Up @@ -982,7 +982,7 @@ mod tests {
let order_by_executor = Box::new(SortExecutor::new(
Box::new(mock_executor),
Arc::new(column_orders),
"SortExecutor".to_string(),
"SortExecutor".to_owned(),
CHUNK_SIZE,
MemoryContext::none(),
None,
Expand Down Expand Up @@ -1024,7 +1024,7 @@ mod tests {
let order_by_executor = Box::new(SortExecutor::new(
Box::new(mock_executor),
Arc::new(column_orders),
"SortExecutor2".to_string(),
"SortExecutor2".to_owned(),
CHUNK_SIZE,
MemoryContext::for_spill_test(),
Some(SpillBackend::Memory),
Expand Down
6 changes: 3 additions & 3 deletions src/batch/src/executor/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ mod tests {
expr: expr_vec,
child: Box::new(mock_executor),
schema: Schema { fields },
identity: "ProjectExecutor".to_string(),
identity: "ProjectExecutor".to_owned(),
});

let fields = &proj_executor.schema().fields;
Expand All @@ -174,15 +174,15 @@ mod tests {
let values_executor2: Box<dyn Executor> = Box::new(ValuesExecutor::new(
vec![vec![]], // One single row with no column.
Schema::default(),
"ValuesExecutor".to_string(),
"ValuesExecutor".to_owned(),
CHUNK_SIZE,
));

let proj_executor = Box::new(ProjectExecutor {
expr: vec![Box::new(literal)],
child: values_executor2,
schema: schema_unnamed!(DataType::Int32),
identity: "ProjectExecutor2".to_string(),
identity: "ProjectExecutor2".to_owned(),
});
let mut stream = proj_executor.execute();
let chunk = stream.next().await.unwrap().unwrap();
Expand Down
6 changes: 3 additions & 3 deletions src/batch/src/executor/project_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ mod tests {
select_list,
child: Box::new(mock_executor),
schema: Schema { fields },
identity: "ProjectSetExecutor".to_string(),
identity: "ProjectSetExecutor".to_owned(),
chunk_size: CHUNK_SIZE,
});

Expand Down Expand Up @@ -318,15 +318,15 @@ mod tests {
let values_executor2: Box<dyn Executor> = Box::new(ValuesExecutor::new(
vec![vec![]], // One single row with no column.
Schema::default(),
"ValuesExecutor".to_string(),
"ValuesExecutor".to_owned(),
CHUNK_SIZE,
));

let proj_executor = Box::new(ProjectSetExecutor {
select_list: vec![literal.boxed().into(), tf.into()],
child: values_executor2,
schema: schema_unnamed!(DataType::Int32, DataType::Int32),
identity: "ProjectSetExecutor2".to_string(),
identity: "ProjectSetExecutor2".to_owned(),
chunk_size: CHUNK_SIZE,
});
let mut stream = proj_executor.execute();
Expand Down
Loading

0 comments on commit 119e17e

Please sign in to comment.