Skip to content

Commit

Permalink
chore: Make sure all targets in workspace been covered by clippy (apa…
Browse files Browse the repository at this point in the history
…che#702)

Signed-off-by: Xuanwo <github@xuanwo.io>
  • Loading branch information
Xuanwo authored Jul 22, 2024
1 parent 4de1adc commit f1bf797
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/actions/rust-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ runs:
shell: bash
run: |
cd native
cargo clippy --color=never -- -D warnings
cargo clippy --color=never --all-targets --workspace -- -D warnings
- name: Check compilation
shell: bash
Expand Down
5 changes: 4 additions & 1 deletion native/core/src/execution/datafusion/expressions/xxhash64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ mod test {
let hash2 = spark_compatible_xxhash64(data, seed);
if hash1 != hash2 {
panic!("input: {} with seed {seed} produced incorrect hash (comet={hash2}, twox-hash={hash1})",
data.iter().map(|byte| format!("{:02x}", byte)).collect::<String>())
data.iter().fold(String::new(), |mut output, byte| {
output.push_str(&format!("{:02x}", byte));
output
}))
}
}
}
48 changes: 25 additions & 23 deletions native/core/src/execution/datafusion/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2060,29 +2060,31 @@ mod tests {
type_id: i32,
lit: spark_expression::Literal,
) -> spark_operator::Operator {
let mut expr = spark_expression::Expr::default();
let left = spark_expression::Expr {
expr_struct: Some(Bound(spark_expression::BoundReference {
index: 0,
datatype: Some(spark_expression::DataType {
type_id,
type_info: None,
}),
})),
};
let right = spark_expression::Expr {
expr_struct: Some(Literal(lit)),
};

let mut left = spark_expression::Expr::default();
left.expr_struct = Some(Bound(spark_expression::BoundReference {
index: 0,
datatype: Some(spark_expression::DataType {
type_id,
type_info: None,
}),
}));
let mut right = spark_expression::Expr::default();
right.expr_struct = Some(Literal(lit));

expr.expr_struct = Some(Eq(Box::new(spark_expression::Equal {
left: Some(Box::new(left)),
right: Some(Box::new(right)),
})));

let mut op = spark_operator::Operator::default();
op.children = vec![child_op];
op.op_struct = Some(OpStruct::Filter(spark_operator::Filter {
predicate: Some(expr),
}));
op
let expr = spark_expression::Expr {
expr_struct: Some(Eq(Box::new(spark_expression::Equal {
left: Some(Box::new(left)),
right: Some(Box::new(right)),
}))),
};

Operator {
children: vec![child_op],
op_struct: Some(OpStruct::Filter(spark_operator::Filter {
predicate: Some(expr),
})),
}
}
}
3 changes: 1 addition & 2 deletions native/core/src/execution/datafusion/shuffle_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1461,8 +1461,7 @@ mod test {
let array = b.finish();
let batch = RecordBatch::try_new(schema.clone(), vec![Arc::new(array)]).unwrap();

let mut batches = Vec::new();
batches.push(batch.clone());
let batches = vec![batch.clone()];

let partitions = &[batches];
let exec = ShuffleWriterExec::try_new(
Expand Down

0 comments on commit f1bf797

Please sign in to comment.