This is an automated email from the ASF dual-hosted git repository.

viirya pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git


The following commit(s) were added to refs/heads/main by this push:
     new f1bf7979 chore: Make sure all targets in workspace been covered by 
clippy (#702)
f1bf7979 is described below

commit f1bf7979fadffc32f239a87b8f92dc0c1bee0383
Author: Xuanwo <[email protected]>
AuthorDate: Tue Jul 23 05:08:45 2024 +0800

    chore: Make sure all targets in workspace been covered by clippy (#702)
    
    Signed-off-by: Xuanwo <[email protected]>
---
 .github/actions/rust-test/action.yaml              |  2 +-
 .../execution/datafusion/expressions/xxhash64.rs   |  5 ++-
 native/core/src/execution/datafusion/planner.rs    | 48 +++++++++++-----------
 .../src/execution/datafusion/shuffle_writer.rs     |  3 +-
 4 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/.github/actions/rust-test/action.yaml 
b/.github/actions/rust-test/action.yaml
index 3aeba066..a1cde99b 100644
--- a/.github/actions/rust-test/action.yaml
+++ b/.github/actions/rust-test/action.yaml
@@ -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
diff --git a/native/core/src/execution/datafusion/expressions/xxhash64.rs 
b/native/core/src/execution/datafusion/expressions/xxhash64.rs
index 508cfe59..f5a11f66 100644
--- a/native/core/src/execution/datafusion/expressions/xxhash64.rs
+++ b/native/core/src/execution/datafusion/expressions/xxhash64.rs
@@ -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
+                   }))
         }
     }
 }
diff --git a/native/core/src/execution/datafusion/planner.rs 
b/native/core/src/execution/datafusion/planner.rs
index cd37e938..f3bc146d 100644
--- a/native/core/src/execution/datafusion/planner.rs
+++ b/native/core/src/execution/datafusion/planner.rs
@@ -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),
+            })),
+        }
     }
 }
diff --git a/native/core/src/execution/datafusion/shuffle_writer.rs 
b/native/core/src/execution/datafusion/shuffle_writer.rs
index 3b934813..1a1149da 100644
--- a/native/core/src/execution/datafusion/shuffle_writer.rs
+++ b/native/core/src/execution/datafusion/shuffle_writer.rs
@@ -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(


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to