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

viirya pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark-connect-rust.git


The following commit(s) were added to refs/heads/master by this push:
     new c3528f62 [SPARK-61626][CONNECT][BUILD] Make clippy a blocking CI gate
c3528f62 is described below

commit c3528f62a5e1ec27745caf341f0defd45f96e73f
Author: Liang-Chi Hsieh <[email protected]>
AuthorDate: Thu Nov 12 23:18:31 2026 -0800

    [SPARK-61626][CONNECT][BUILD] Make clippy a blocking CI gate
    
    ### What changes were proposed in this pull request?
    
    Make clippy a blocking CI gate.
    
    - **Workspace lint table.** The root `Cargo.toml` gains 
`[workspace.lints.clippy]`, and every member sets `lints.workspace = true`. It 
allows, once and with a reason each, the four lints this codebase triggers by 
design:
      - `too_many_arguments`: public functions mirror PySpark signatures.
      - `result_large_err`: `SparkError` carries a `tonic::Status` and is the 
error type of the whole public API.
      - `field_reassign_with_default`: `let mut m = Msg::default(); m.field = 
...;` is how prost messages are filled.
      - `should_implement_trait`: `Column::add`/`sub`/`not`/... and 
`SaveMode::from_str` are named after their PySpark counterparts, and the 
`std::ops` traits are implemented alongside.
    - **`pyspark-rs`.** It inherits the workspace table. Its own levels 
(`warnings = "deny"`, `non_snake_case = "allow"`) move from `[lints.rust]` in 
its manifest to `#![deny(warnings)]` / `#![allow(non_snake_case)]` in `lib.rs`, 
because a manifest cannot both inherit the workspace table and add to it.
    - **The remaining findings are fixed**, with no behavior change. Nearly all 
are in tests (`assert_eq!` with a literal bool, redundant `.into_iter()`, 
borrows and closures, misplaced doc comments, test literals that clippy reads 
as approximations of PI or E). Two tests keep such a literal under a targeted 
`#[allow(clippy::approx_constant)]` with a comment: one value is fixed by a 
golden file, the other is the SQL text under test.
    - **CI.** The lint job installs the `wasm32-unknown-unknown` target and 
runs `cargo clippy --workspace --all-targets -- -D warnings`, then `cargo 
clippy -p apache-spark-connect --all-targets -- -D warnings`. The workspace run 
builds `apache-spark-connect` with `wasm-udf` on (feature unification through 
`examples/wasm-udfs`); the second run covers the default feature set.
    - **Docs.** `AGENTS.md` section 7 and `docs/contributing.md` no longer 
describe clippy as advisory.
    
    Findings before the change, with the toolchain CI uses (stable, 1.99.1):
    
    | Lint | Count | Handling |
    |---|---|---|
    | `field_reassign_with_default` | 236 | allowed in the workspace table |
    | `result_large_err` | 129 | allowed in the workspace table |
    | `too_many_arguments` | 4 | allowed in the workspace table |
    | `should_implement_trait` | 7 | allowed in the workspace table |
    | `approx_constant` | 15 | fixed, 2 targeted allows |
    | `bool_assert_comparison` | 10 | fixed |
    | `useless_conversion` | 8 | fixed |
    | others (12 lints) | 16 | fixed |
    
    The generated `dispatch_generated.rs` and the generated proto code had no 
findings and are untouched, and so is `scripts/gen_fn_dispatch.py`.
    
    ### Why are the changes needed?
    
    The clippy step ran `cargo clippy --workspace --all-targets || true`, so 
findings never failed CI and several hundred accumulated. The step did not even 
reach the lints: `--workspace` builds `examples/wasm-udfs` (a path dependency 
of the `examples` member), whose build script needs the 
`wasm32-unknown-unknown` target that the lint job did not install, and `|| 
true` hid that failure too.
    
    One of the findings shows the kind of thing the gate catches: 
`reader.lines().flatten()` in the golden-file loader of 
`tests/catalog_golden.rs` loops forever if reading keeps failing 
(`lines_filter_map_ok`); it is now `map_while(Result::ok)`.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    With stable 1.99.1:
    
    - `cargo clippy --workspace --all-targets -- -D warnings` and `cargo clippy 
-p apache-spark-connect --all-targets -- -D warnings` exit 0.
    - `cargo fmt --all --check`.
    - `cargo test -p apache-spark-connect --release --lib`, `--release 
--no-run` and `--release --features wasm-udf --no-run`.
    - `cargo test -p apache-spark-connect-core --release` and `cargo test -p 
apache-spark-connect --release`.
    - The Python offline tests against the rebuilt extension 
(`tests/test_dropin_offline.py tests/test_arrow_handoff.py 
tests/test_ml_offline.py`, `TZ=UTC`): 3317 passed, 8 skipped.
    
    `tests/e2e_functions.rs` changes one assertion to `round(1.23456, 2) == 
1.23`; it needs a Connect server, so CI is what runs it.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Code (Claude Fable 5.2)
    
    Closes #628 from viirya/clippy-blocking-gate-5499ff.
    
    Authored-by: Liang-Chi Hsieh <[email protected]>
    Signed-off-by: Liang-Chi Hsieh <[email protected]>
---
 .github/workflows/lint.yml                    | 15 +++++++++++----
 AGENTS.md                                     |  2 +-
 Cargo.toml                                    | 18 ++++++++++++++++++
 crates/pyspark-rs/Cargo.toml                  | 11 +++++------
 crates/pyspark-rs/src/column.rs               |  6 +-----
 crates/pyspark-rs/src/dataframe.rs            |  2 +-
 crates/pyspark-rs/src/group.rs                |  2 +-
 crates/pyspark-rs/src/lib.rs                  |  4 ++++
 crates/pyspark-rs/src/session.rs              |  2 +-
 crates/pyspark-rs/src/types.rs                |  2 --
 crates/spark-connect-build/Cargo.toml         |  3 +++
 crates/spark-connect-core/Cargo.toml          |  3 +++
 crates/spark-connect-macros/Cargo.toml        |  3 +++
 crates/spark-connect-proto/Cargo.toml         |  3 +++
 crates/spark-connect/Cargo.toml               |  3 +++
 crates/spark-connect/src/catalog.rs           |  1 -
 crates/spark-connect/src/column.rs            |  2 +-
 crates/spark-connect/src/dataframe.rs         | 12 ++++++------
 crates/spark-connect/src/expression.rs        | 16 ++++++++--------
 crates/spark-connect/src/ml.rs                | 16 ++++++++--------
 crates/spark-connect/src/row.rs               |  5 ++---
 crates/spark-connect/src/session.rs           |  4 ++--
 crates/spark-connect/src/tvf.rs               |  2 +-
 crates/spark-connect/src/types.rs             |  7 ++++---
 crates/spark-connect/src/udf.rs               |  4 ++--
 crates/spark-connect/src/wasm_udf.rs          |  2 +-
 crates/spark-connect/tests/catalog_golden.rs  |  2 +-
 crates/spark-connect/tests/e2e_functions.rs   |  4 ++--
 crates/spark-connect/tests/e2e_integration.rs |  2 ++
 crates/spark-connect/tests/golden_test.rs     |  2 ++
 crates/spark-connect/tests/ml_extra_golden.rs |  2 +-
 crates/spark-connect/tests/ml_golden.rs       |  4 ----
 crates/spark-connect/tests/test_conf_tvf.rs   |  6 +++---
 docs/contributing.md                          | 13 ++++++++-----
 examples/Cargo.toml                           |  3 +++
 35 files changed, 115 insertions(+), 73 deletions(-)

diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 1bfc7b86..4982bd92 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -44,6 +44,9 @@ jobs:
           rustup toolchain install stable --profile minimal
           rustup default stable
           rustup component add rustfmt clippy
+          # `--workspace` reaches `examples/wasm-udfs` (a path dependency of 
the `examples`
+          # member), whose build script compiles its UDFs to WASM.
+          rustup target add wasm32-unknown-unknown
       - name: Cache cargo & target
         uses: actions/cache@v4
         with:
@@ -58,10 +61,14 @@ jobs:
           sudo apt-get update && sudo apt-get install -y protobuf-compiler
       - name: rustfmt (check) - blocking
         run: cargo fmt --all --check
-      - name: clippy - advisory
-        # Advisory for now: the tree still carries pre-existing warnings. This 
surfaces
-        # them in the log without blocking. Tighten to `-- -D warnings` once 
cleaned.
-        run: cargo clippy --workspace --all-targets || true
+      - name: clippy - blocking
+        # Any finding fails the job. Lints this codebase triggers by design 
are allowed once,
+        # with a reason, in `[workspace.lints.clippy]` of the root Cargo.toml. 
The workspace
+        # run builds `apache-spark-connect` with `wasm-udf` on (feature 
unification through
+        # `examples/wasm-udfs`); the second run covers the default feature set.
+        run: |
+          cargo clippy --workspace --all-targets -- -D warnings
+          cargo clippy -p apache-spark-connect --all-targets -- -D warnings
       - name: Tooling unit tests
         run: python3 -m unittest discover -s scripts/tests
       - name: LICENSE-binary and NOTICE-binary are up to date
diff --git a/AGENTS.md b/AGENTS.md
index dd85c6d3..19b91d57 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -265,7 +265,7 @@ cargo test -p apache-spark-connect --release --lib
 cargo test -p apache-spark-connect --release --no-run              # compiles 
ALL integration tests
 cargo test -p apache-spark-connect --release --features wasm-udf --no-run
 cargo fmt --all --check                                            # BLOCKING 
CI gate
-cargo clippy --workspace --all-targets                             # advisory 
(|| true in CI), but fix errors
+cargo clippy --workspace --all-targets -- -D warnings              # BLOCKING 
CI gate (needs the wasm32-unknown-unknown target)
 ```
 Then re-run the step-2 diff (0 user-facing gaps) and the parity gate
 `scripts/run_official_tests.py` (runs the official connect suite through our 
Rust
diff --git a/Cargo.toml b/Cargo.toml
index 542a134d..b4865f73 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -61,6 +61,24 @@ repository = "https://github.com/apache/spark-connect-rust";
 homepage = "https://spark.apache.org/";
 authors = ["Apache Spark <[email protected]>"]
 
+# Lints shared by every workspace crate (each one sets `lints.workspace = 
true`). CI runs
+# `cargo clippy --workspace --all-targets -- -D warnings`, so anything clippy 
reports fails the
+# build. The lints below are allowed here, once, because this codebase 
triggers them by design;
+# a targeted `#[allow]` elsewhere needs a comment saying why.
+[workspace.lints.clippy]
+# Public functions mirror PySpark signatures (`csv(...)`, 
`applyInPandas(...)`), whose
+# parameter lists are long.
+too_many_arguments = "allow"
+# `SparkError` carries a `tonic::Status` and is the error type of the whole 
public API;
+# boxing it would change that API.
+result_large_err = "allow"
+# Protobuf messages have many optional fields: `let mut m = Msg::default(); 
m.field = ...;`
+# is the idiomatic way to fill a prost message, and reads better than nested 
struct updates.
+field_reassign_with_default = "allow"
+# `Column::add`/`sub`/`not`/... and `SaveMode::from_str` are public methods 
named after their
+# PySpark counterparts; the matching `std::ops` traits are implemented 
alongside them.
+should_implement_trait = "allow"
+
 [workspace.dependencies]
 # gRPC / protobuf.
 tonic = { version = "0.14" }
diff --git a/crates/pyspark-rs/Cargo.toml b/crates/pyspark-rs/Cargo.toml
index bf84891d..8ae8e569 100644
--- a/crates/pyspark-rs/Cargo.toml
+++ b/crates/pyspark-rs/Cargo.toml
@@ -12,12 +12,11 @@ publish = false
 name = "_pyspark"
 crate-type = ["cdylib"]
 
-# Warnings are errors for this crate in every build (CI builds it via several 
workflows
-# that don't all set RUSTFLAGS=-D warnings). `non_snake_case` stays allowed: 
these classes
-# expose PySpark's camelCase public API verbatim (see the crate-level note in 
lib.rs).
-[lints.rust]
-warnings = "deny"
-non_snake_case = "allow"
+# The clippy allow list is the workspace's. This crate's own lint levels 
(warnings are errors
+# in every build; `non_snake_case` is allowed) are crate attributes at the top 
of src/lib.rs,
+# because a manifest cannot both inherit the workspace table and add to it.
+[lints]
+workspace = true
 
 [dependencies]
 spark-connect = { package = "apache-spark-connect", path = "../spark-connect" }
diff --git a/crates/pyspark-rs/src/column.rs b/crates/pyspark-rs/src/column.rs
index 1d387fe1..0a65ea23 100644
--- a/crates/pyspark-rs/src/column.rs
+++ b/crates/pyspark-rs/src/column.rs
@@ -749,11 +749,7 @@ impl PyColumn {
                     .iter()
                     .map(|(condition, value)| Ok((column(condition)?, 
column(value)?)))
                     .collect::<PyResult<Vec<_>>>()?;
-                let else_value = case_when
-                    .else_expr
-                    .as_ref()
-                    .map(|else_expr| column(else_expr))
-                    .transpose()?;
+                let else_value = 
case_when.else_expr.as_ref().map(column).transpose()?;
                 (Some(branches), else_value)
             }
             _ => (None, None),
diff --git a/crates/pyspark-rs/src/dataframe.rs 
b/crates/pyspark-rs/src/dataframe.rs
index faf49350..8caea1ff 100644
--- a/crates/pyspark-rs/src/dataframe.rs
+++ b/crates/pyspark-rs/src/dataframe.rs
@@ -2385,7 +2385,7 @@ impl PyDataFrame {
                         "exprs should not be empty",
                     ));
                 }
-                let expressions = crate::group::dict_aggregates(&dict)?;
+                let expressions = crate::group::dict_aggregates(dict)?;
                 return Ok(PyDataFrame::new(self.dataframe.agg(expressions)));
             }
         }
diff --git a/crates/pyspark-rs/src/group.rs b/crates/pyspark-rs/src/group.rs
index 5349c962..44d23c48 100644
--- a/crates/pyspark-rs/src/group.rs
+++ b/crates/pyspark-rs/src/group.rs
@@ -150,7 +150,7 @@ impl PyGroupedData {
         // Dict form: {column_name: aggregate_function_name} -> 
func(col(name)) per entry.
         if exprs.len() == 1 {
             if let Ok(dict) = exprs[0].cast::<pyo3::types::PyDict>() {
-                let agg_exprs = dict_aggregates(&dict)?;
+                let agg_exprs = dict_aggregates(dict)?;
                 let df = self.grouped_data.agg(agg_exprs);
                 return Ok(PyDataFrame::new(df));
             }
diff --git a/crates/pyspark-rs/src/lib.rs b/crates/pyspark-rs/src/lib.rs
index 02d96a9c..6dd9725f 100644
--- a/crates/pyspark-rs/src/lib.rs
+++ b/crates/pyspark-rs/src/lib.rs
@@ -4,6 +4,10 @@
 //! camelCase public API (e.g. `toPandas`, `withColumn`, `containsNull`), so 
the Rust method,
 //! field, and argument names must match the Python names verbatim — renaming 
them would change
 //! the user-facing API.
+//!
+//! Warnings are errors for this crate in every build: CI builds it via 
several workflows that
+//! don't all set `RUSTFLAGS=-D warnings`.
+#![deny(warnings)]
 #![allow(non_snake_case)]
 
 use pyo3::prelude::*;
diff --git a/crates/pyspark-rs/src/session.rs b/crates/pyspark-rs/src/session.rs
index cfae0960..b0e9c53e 100644
--- a/crates/pyspark-rs/src/session.rs
+++ b/crates/pyspark-rs/src/session.rs
@@ -1585,7 +1585,7 @@ impl PySparkSession {
                         }
                         let values = values
                             .iter()
-                            .map(|v| Ok(py_to_value(v)?))
+                            .map(|v| py_to_value(v))
                             .collect::<PyResult<Vec<Value>>>()?;
                         if let Some(columns) = native_columns.as_mut() {
                             columns[i] = values;
diff --git a/crates/pyspark-rs/src/types.rs b/crates/pyspark-rs/src/types.rs
index 1be0deeb..860b770a 100644
--- a/crates/pyspark-rs/src/types.rs
+++ b/crates/pyspark-rs/src/types.rs
@@ -2618,8 +2618,6 @@ impl PyStructType {
         simple_string_with_udts(py, &self.current_data_type(py)?)
     }
 
-    /// `StructType.typeName()` == "struct".
-
     /// Field names, as a copy of the `names` list. Mirrors 
`StructType.fieldNames()`, which is
     /// `list(self.names)`: it does not follow an edit of `fields`.
     #[pyo3(name = "fieldNames")]
diff --git a/crates/spark-connect-build/Cargo.toml 
b/crates/spark-connect-build/Cargo.toml
index d1826698..4e5632fc 100644
--- a/crates/spark-connect-build/Cargo.toml
+++ b/crates/spark-connect-build/Cargo.toml
@@ -23,5 +23,8 @@ rust-version.workspace = true
 license.workspace = true
 description = "build.rs helper that compiles Rust WASM UDFs for the Spark 
Connect client"
 
+[lints]
+workspace = true
+
 [lib]
 name = "spark_connect_build"
diff --git a/crates/spark-connect-core/Cargo.toml 
b/crates/spark-connect-core/Cargo.toml
index 151ddc04..b783cdee 100644
--- a/crates/spark-connect-core/Cargo.toml
+++ b/crates/spark-connect-core/Cargo.toml
@@ -9,6 +9,9 @@ homepage.workspace = true
 authors.workspace = true
 description = "Spark Connect client transport: gRPC channel, retries, 
reattach, artifacts, config, errors"
 
+[lints]
+workspace = true
+
 [lib]
 name = "spark_connect_core"
 
diff --git a/crates/spark-connect-macros/Cargo.toml 
b/crates/spark-connect-macros/Cargo.toml
index 1f694ca0..98c45af0 100644
--- a/crates/spark-connect-macros/Cargo.toml
+++ b/crates/spark-connect-macros/Cargo.toml
@@ -23,6 +23,9 @@ rust-version.workspace = true
 license.workspace = true
 description = "Procedural macros for the Rust Spark Connect client (e.g. 
#[spark_wasm_udf])"
 
+[lints]
+workspace = true
+
 [lib]
 name = "spark_connect_macros"
 proc-macro = true
diff --git a/crates/spark-connect-proto/Cargo.toml 
b/crates/spark-connect-proto/Cargo.toml
index 21281e7b..3e1a8043 100644
--- a/crates/spark-connect-proto/Cargo.toml
+++ b/crates/spark-connect-proto/Cargo.toml
@@ -9,6 +9,9 @@ homepage.workspace = true
 authors.workspace = true
 description = "Generated Spark Connect protobuf/gRPC types (spark.connect.*)"
 
+[lints]
+workspace = true
+
 [lib]
 name = "spark_connect_proto"
 
diff --git a/crates/spark-connect/Cargo.toml b/crates/spark-connect/Cargo.toml
index 648d04fc..cefbdc8a 100644
--- a/crates/spark-connect/Cargo.toml
+++ b/crates/spark-connect/Cargo.toml
@@ -9,6 +9,9 @@ homepage.workspace = true
 authors.workspace = true
 description = "Pure-Rust Spark Connect DataFrame client mirroring the PySpark 
API surface"
 
+[lints]
+workspace = true
+
 [lib]
 name = "spark_connect"
 
diff --git a/crates/spark-connect/src/catalog.rs 
b/crates/spark-connect/src/catalog.rs
index 96c2ecc9..5d978e22 100644
--- a/crates/spark-connect/src/catalog.rs
+++ b/crates/spark-connect/src/catalog.rs
@@ -943,7 +943,6 @@ impl Catalog {
         self.execute_catalog_as_dataframe(&catalog_msg)
     }
 
-    /// Helper: execute a catalog operation and return results as Rows.
     // ---- Typed catalog results (mirror pyspark's 
List[Table]/List[Database]/... ) ----
     // Each reuses the DataFrame-returning method, collects the rows, and 
parses them
     // into the metadata structs above (column order matches the reference 
client).
diff --git a/crates/spark-connect/src/column.rs 
b/crates/spark-connect/src/column.rs
index b98390df..954f1f19 100644
--- a/crates/spark-connect/src/column.rs
+++ b/crates/spark-connect/src/column.rs
@@ -1041,7 +1041,7 @@ mod tests {
         ));
 
         // Test lit_double
-        let c = lit_double(3.14);
+        let c = lit_double(1.25);
         assert!(matches!(
             c.expr.node(),
             ExpressionNode::Literal(LiteralExpression::Double(_))
diff --git a/crates/spark-connect/src/dataframe.rs 
b/crates/spark-connect/src/dataframe.rs
index 73ca1c6f..7fb80ed7 100644
--- a/crates/spark-connect/src/dataframe.rs
+++ b/crates/spark-connect/src/dataframe.rs
@@ -273,7 +273,7 @@ impl LocalRowIterator {
                     ))
                 };
                 let Some(batch) = batch else {
-                    return 
Some(Err(spark_connect_core::client::wait_aborted().into()));
+                    return 
Some(Err(spark_connect_core::client::wait_aborted()));
                 };
                 if batch.is_none() {
                     // The channel closed: the task ended, or it panicked, 
which then drops its
@@ -5585,7 +5585,7 @@ mod plan_construction_tests {
             replication: 1,
             ..Default::default()
         };
-        assert_eq!(sent(Some(disk.clone())), Some(disk));
+        assert_eq!(sent(Some(disk)), Some(disk));
     }
 
     #[test]
@@ -7035,21 +7035,21 @@ mod plan_construction_tests {
             &df.drop_columns(vec![col("id")], vec!["x"]),
             [
                 &df.drop_columns([col("id")], ["x"]),
-                &df.drop_columns(vec![col("id")].into_iter(), 
["x"].into_iter()),
+                &df.drop_columns(vec![col("id")], ["x"]),
             ],
         );
         same_as(
             &df.with_columns(vec![("p".to_string(), lit(1))]),
             [
                 &df.with_columns([("p", lit(1))]),
-                &df.with_columns(vec![("p", lit(1))].into_iter()),
+                &df.with_columns(vec![("p", lit(1))]),
             ],
         );
         same_as(
             &df.with_columns_renamed(vec![("id".to_string(), 
"x".to_string())]),
             [
                 &df.with_columns_renamed([("id", "x")]),
-                &df.with_columns_renamed(vec![("id", "x")].into_iter()),
+                &df.with_columns_renamed(vec![("id", "x")]),
             ],
         );
         same_as(
@@ -7113,7 +7113,7 @@ mod plan_construction_tests {
                     .agg(aggregates()),
                 &df.grouping_sets_with_columns(
                     (0..1).map(|_| vec![col("id")]),
-                    vec![col("id"), col("id") % lit(2)].into_iter(),
+                    vec![col("id"), col("id") % lit(2)],
                 )
                 .agg(aggregates()),
             ],
diff --git a/crates/spark-connect/src/expression.rs 
b/crates/spark-connect/src/expression.rs
index 71ee6479..aabac5de 100644
--- a/crates/spark-connect/src/expression.rs
+++ b/crates/spark-connect/src/expression.rs
@@ -2128,14 +2128,14 @@ mod tests {
 
     #[test]
     fn test_literal_render_float() {
-        let lit = LiteralExpression::Float(3.14);
-        assert_eq!(lit.render(), "3.140000104904175");
+        let lit = LiteralExpression::Float(1.1);
+        assert_eq!(lit.render(), "1.100000023841858");
     }
 
     #[test]
     fn test_literal_render_double() {
-        let lit = LiteralExpression::Double(2.71828);
-        assert_eq!(lit.render(), "2.71828");
+        let lit = LiteralExpression::Double(1.23456);
+        assert_eq!(lit.render(), "1.23456");
     }
 
     #[test]
@@ -2930,12 +2930,12 @@ mod tests {
 
     #[test]
     fn test_literal_float_to_proto() {
-        let lit = LiteralExpression::Float(3.14);
+        let lit = LiteralExpression::Float(1.1);
         let proto = lit.to_proto();
         assert!(proto.expr_type.is_some());
         if let Some(proto::expression::ExprType::Literal(literal)) = 
proto.expr_type {
             if let Some(proto::expression::literal::LiteralType::Float(f)) = 
literal.literal_type {
-                assert!((f - 3.14).abs() < 0.01);
+                assert!((f - 1.1).abs() < 0.01);
             } else {
                 panic!("Expected float literal type");
             }
@@ -2946,12 +2946,12 @@ mod tests {
 
     #[test]
     fn test_literal_double_to_proto() {
-        let lit = LiteralExpression::Double(2.71828);
+        let lit = LiteralExpression::Double(1.23456);
         let proto = lit.to_proto();
         assert!(proto.expr_type.is_some());
         if let Some(proto::expression::ExprType::Literal(literal)) = 
proto.expr_type {
             if let Some(proto::expression::literal::LiteralType::Double(d)) = 
literal.literal_type {
-                assert!((d - 2.71828).abs() < 0.00001);
+                assert!((d - 1.23456).abs() < 0.00001);
             } else {
                 panic!("Expected double literal type");
             }
diff --git a/crates/spark-connect/src/ml.rs b/crates/spark-connect/src/ml.rs
index 8a0108ff..89402384 100644
--- a/crates/spark-connect/src/ml.rs
+++ b/crates/spark-connect/src/ml.rs
@@ -8598,7 +8598,7 @@ mod tests {
         assert_eq!(defaults.prediction_col(), "prediction");
         assert_eq!(defaults.family(), "gaussian");
         assert_eq!(defaults.link(), None);
-        assert_eq!(defaults.fit_intercept(), true);
+        assert!(defaults.fit_intercept());
         assert_eq!(defaults.max_iter(), 25);
         assert_eq!(defaults.tol(), 1e-06);
         assert_eq!(defaults.reg_param(), 0.0);
@@ -8631,7 +8631,7 @@ mod tests {
         assert_eq!(configured.prediction_col(), "pred");
         assert_eq!(configured.family(), "tweedie");
         assert_eq!(configured.link(), Some("log"));
-        assert_eq!(configured.fit_intercept(), false);
+        assert!(!configured.fit_intercept());
         assert_eq!(configured.max_iter(), 50);
         assert_eq!(configured.tol(), 1e-08);
         assert_eq!(configured.reg_param(), 0.25);
@@ -9378,7 +9378,7 @@ mod tests {
         assert_eq!(tree.min_instances_per_node(), 1);
         assert_eq!(tree.min_info_gain(), 0.0);
         assert_eq!(tree.max_memory_in_mb(), 256);
-        assert_eq!(tree.cache_node_ids(), false);
+        assert!(!tree.cache_node_ids());
         assert_eq!(tree.checkpoint_interval(), 10);
         assert_eq!(tree.impurity(), "variance");
         assert_eq!(tree.feature_subset_strategy(), "all");
@@ -9468,7 +9468,7 @@ mod tests {
         assert_eq!(tree.max_memory_in_mb(), 64);
         assert_eq!(built.max_memory_in_mb(), tree.max_memory_in_mb());
         *tree.params_mut() = 
tree.params().clone().set_param_bool("cacheNodeIds", true);
-        assert_eq!(tree.cache_node_ids(), true);
+        assert!(tree.cache_node_ids());
         assert_eq!(built.cache_node_ids(), tree.cache_node_ids());
         *tree.params_mut() = tree
             .params()
@@ -9569,7 +9569,7 @@ mod tests {
         assert_eq!(tree.min_instances_per_node(), 1);
         assert_eq!(tree.min_info_gain(), 0.0);
         assert_eq!(tree.max_memory_in_mb(), 256);
-        assert_eq!(tree.cache_node_ids(), false);
+        assert!(!tree.cache_node_ids());
         assert_eq!(tree.checkpoint_interval(), 10);
         assert_eq!(tree.impurity(), "variance");
         assert_eq!(tree.feature_subset_strategy(), "all");
@@ -9643,7 +9643,7 @@ mod tests {
         assert_eq!(tree.max_memory_in_mb(), 64);
         assert_eq!(built.max_memory_in_mb(), tree.max_memory_in_mb());
         *tree.params_mut() = 
tree.params().clone().set_param_bool("cacheNodeIds", true);
-        assert_eq!(tree.cache_node_ids(), true);
+        assert!(tree.cache_node_ids());
         assert_eq!(built.cache_node_ids(), tree.cache_node_ids());
         *tree.params_mut() = tree
             .params()
@@ -9945,7 +9945,7 @@ mod tests {
         assert_eq!(tree.min_instances_per_node(), 1);
         assert_eq!(tree.min_info_gain(), 0.0);
         assert_eq!(tree.max_memory_in_mb(), 256);
-        assert_eq!(tree.cache_node_ids(), false);
+        assert!(!tree.cache_node_ids());
         assert_eq!(tree.checkpoint_interval(), 10);
         assert_eq!(tree.impurity(), "variance");
         assert_eq!(tree.seed(), None);
@@ -10007,7 +10007,7 @@ mod tests {
         assert_eq!(tree.max_memory_in_mb(), 64);
         assert_eq!(built.max_memory_in_mb(), tree.max_memory_in_mb());
         *tree.params_mut() = 
tree.params().clone().set_param_bool("cacheNodeIds", true);
-        assert_eq!(tree.cache_node_ids(), true);
+        assert!(tree.cache_node_ids());
         assert_eq!(built.cache_node_ids(), tree.cache_node_ids());
         *tree.params_mut() = tree
             .params()
diff --git a/crates/spark-connect/src/row.rs b/crates/spark-connect/src/row.rs
index 9b8424f7..06c86def 100644
--- a/crates/spark-connect/src/row.rs
+++ b/crates/spark-connect/src/row.rs
@@ -708,10 +708,9 @@ mod tests {
         let i = Value::Integer(42);
         assert_eq!(i.as_i64(), Some(42));
 
-        #[allow(clippy::approx_constant)]
-        let d = Value::Double(3.14);
+        let d = Value::Double(1.25);
 
-        assert_eq!(d.as_f64(), Some(3.14));
+        assert_eq!(d.as_f64(), Some(1.25));
 
         let s = Value::String("test".to_string());
         assert_eq!(s.as_str(), Some("test"));
diff --git a/crates/spark-connect/src/session.rs 
b/crates/spark-connect/src/session.rs
index cafc0732..7236029f 100644
--- a/crates/spark-connect/src/session.rs
+++ b/crates/spark-connect/src/session.rs
@@ -1647,7 +1647,7 @@ fn batch_to_arrow_ipc(batch: 
&arrow::record_batch::RecordBatch) -> Result<Vec<u8
         let mut writer = StreamWriter::try_new(&mut buffer, &batch.schema())
             .map_err(|e| SparkError::connect_msg(format!("Failed to create IPC 
writer: {}", e)))?;
         writer
-            .write(&batch)
+            .write(batch)
             .map_err(|e| SparkError::connect_msg(format!("Failed to write 
batch to IPC: {}", e)))?;
         writer
             .finish()
@@ -3011,7 +3011,7 @@ mod tests {
                 struct_field("missing", DataType::Integer),
             ],
         };
-        let values = vec![
+        let values = [
             Value::Struct(
                 Row::new(
                     vec!["dup".to_string(), "dup".to_string(), 
"other".to_string()],
diff --git a/crates/spark-connect/src/tvf.rs b/crates/spark-connect/src/tvf.rs
index 41e95881..66acf04c 100644
--- a/crates/spark-connect/src/tvf.rs
+++ b/crates/spark-connect/src/tvf.rs
@@ -278,7 +278,7 @@ mod tests {
         );
         let of_iter = spark.tvf().udtf(
             "myudtf",
-            vec![col("a")].into_iter(),
+            vec![col("a")],
             None,
             300,
             vec![],
diff --git a/crates/spark-connect/src/types.rs 
b/crates/spark-connect/src/types.rs
index bdf0610d..d22c2bfc 100644
--- a/crates/spark-connect/src/types.rs
+++ b/crates/spark-connect/src/types.rs
@@ -3284,10 +3284,11 @@ mod tests {
         ];
 
         for case in test_cases {
-            let dt = DataType::from_ddl(case).expect(&format!("Failed to 
parse: {}", case));
+            let dt =
+                DataType::from_ddl(case).unwrap_or_else(|_| panic!("Failed to 
parse: {}", case));
             let simple = dt.simple_string();
-            let dt2 =
-                DataType::from_ddl(&simple).expect(&format!("Failed to 
roundtrip: {}", simple));
+            let dt2 = DataType::from_ddl(&simple)
+                .unwrap_or_else(|_| panic!("Failed to roundtrip: {}", simple));
             assert_eq!(dt, dt2, "Roundtrip failed for: {}", case);
         }
     }
diff --git a/crates/spark-connect/src/udf.rs b/crates/spark-connect/src/udf.rs
index a39ee517..fea01a80 100644
--- a/crates/spark-connect/src/udf.rs
+++ b/crates/spark-connect/src/udf.rs
@@ -201,8 +201,8 @@ mod tests {
         let proto = udf_expr.to_proto();
 
         assert_eq!(proto.function_name, "my_udf");
-        assert_eq!(proto.deterministic, true);
-        assert_eq!(proto.is_distinct, false);
+        assert!(proto.deterministic);
+        assert!(!proto.is_distinct);
         assert_eq!(proto.arguments.len(), 0);
         assert!(proto.function.is_some());
 
diff --git a/crates/spark-connect/src/wasm_udf.rs 
b/crates/spark-connect/src/wasm_udf.rs
index 08814a72..9efe367e 100644
--- a/crates/spark-connect/src/wasm_udf.rs
+++ b/crates/spark-connect/src/wasm_udf.rs
@@ -730,7 +730,7 @@ mod tests {
             .expect("packer should succeed");
         let of_array = f.to_expression([col("x")]).expect("packer should 
succeed");
         let of_iter = f
-            .to_expression(vec![col("x")].into_iter())
+            .to_expression(vec![col("x")])
             .expect("packer should succeed");
         assert_eq!(of_array.arguments, of_vec.arguments);
         assert_eq!(of_iter.arguments, of_vec.arguments);
diff --git a/crates/spark-connect/tests/catalog_golden.rs 
b/crates/spark-connect/tests/catalog_golden.rs
index 1658343d..55ae6313 100644
--- a/crates/spark-connect/tests/catalog_golden.rs
+++ b/crates/spark-connect/tests/catalog_golden.rs
@@ -36,7 +36,7 @@ fn load_golden_cases(path: &str) -> HashMap<String, Vec<u8>> {
 
     if let Ok(file) = File::open(path) {
         let reader = BufReader::new(file);
-        for line in reader.lines().flatten() {
+        for line in reader.lines().map_while(Result::ok) {
             if let Ok(json) = serde_json::from_str::<serde_json::Value>(&line) 
{
                 if let (Some(name), Some(b64)) = (
                     json.get("name").and_then(|v| v.as_str()),
diff --git a/crates/spark-connect/tests/e2e_functions.rs 
b/crates/spark-connect/tests/e2e_functions.rs
index 6decbb1e..084045d4 100644
--- a/crates/spark-connect/tests/e2e_functions.rs
+++ b/crates/spark-connect/tests/e2e_functions.rs
@@ -164,8 +164,8 @@ fn optional_arg_function_variants() {
 
     // round/bround with an explicit scale.
     assert_eq!(
-        v(f::round_scale(lit_double(3.14159), lit(2))).as_f64(),
-        Some(3.14)
+        v(f::round_scale(lit_double(1.23456), lit(2))).as_f64(),
+        Some(1.23)
     );
     assert_eq!(
         v(f::bround_scale(lit_double(2.5), lit(0))).as_f64(),
diff --git a/crates/spark-connect/tests/e2e_integration.rs 
b/crates/spark-connect/tests/e2e_integration.rs
index 4e7b86d6..83c12452 100644
--- a/crates/spark-connect/tests/e2e_integration.rs
+++ b/crates/spark-connect/tests/e2e_integration.rs
@@ -402,6 +402,8 @@ fn test_schema() {
     }
 }
 
+// 3.14159 is the decimal literal of the SQL text under test, not a use of PI.
+#[allow(clippy::approx_constant)]
 #[test]
 fn test_decimal_round() {
     if !should_run() {
diff --git a/crates/spark-connect/tests/golden_test.rs 
b/crates/spark-connect/tests/golden_test.rs
index 647bb7d4..3836b797 100644
--- a/crates/spark-connect/tests/golden_test.rs
+++ b/crates/spark-connect/tests/golden_test.rs
@@ -70,6 +70,8 @@ fn load_goldens() -> HashMap<String, proto::Expression> {
 /// Build the Rust expression for each golden case name we are responsible for.
 /// (Pure `functions.*` cases like upper/concat/coalesce/sum_agg/count_star are
 /// validated in the functions phase, not here.)
+// `lit_double` is 3.14 because the golden file was recorded from PySpark with 
that value.
+#[allow(clippy::approx_constant)]
 fn build(name: &str) -> Option<Expression> {
     let e = match name {
         "col" => col("x").expression().clone(),
diff --git a/crates/spark-connect/tests/ml_extra_golden.rs 
b/crates/spark-connect/tests/ml_extra_golden.rs
index 80b972fe..fb45dd3b 100644
--- a/crates/spark-connect/tests/ml_extra_golden.rs
+++ b/crates/spark-connect/tests/ml_extra_golden.rs
@@ -183,7 +183,7 @@ fn test_ml_extra_golden_coverage() {
     let goldens = load_ml_extra_goldens();
     // If golden file exists, ensure we handle it correctly
     if !goldens.is_empty() {
-        for (name, _rel) in goldens.iter() {
+        for name in goldens.keys() {
             assert!(
                 !name.is_empty(),
                 "Golden relation should have a non-empty name"
diff --git a/crates/spark-connect/tests/ml_golden.rs 
b/crates/spark-connect/tests/ml_golden.rs
index 9974188c..ea1e7fce 100644
--- a/crates/spark-connect/tests/ml_golden.rs
+++ b/crates/spark-connect/tests/ml_golden.rs
@@ -20,11 +20,7 @@ use spark_connect::ml::{MlOperator, OperatorType, Params};
 use spark_connect_proto as proto;
 
 fn normalize_expression(e: &mut proto::Expression) {
-    use proto::expression::ExprType as T;
     e.common = None;
-    if let Some(t) = e.expr_type.as_mut() {
-        if let T::Literal(_) = t {}
-    }
 }
 
 fn load_ml_goldens() -> HashMap<String, proto::Relation> {
diff --git a/crates/spark-connect/tests/test_conf_tvf.rs 
b/crates/spark-connect/tests/test_conf_tvf.rs
index da87f699..d0e0ec3f 100644
--- a/crates/spark-connect/tests/test_conf_tvf.rs
+++ b/crates/spark-connect/tests/test_conf_tvf.rs
@@ -1,6 +1,6 @@
-/// Test suite for RuntimeConf, TVF, and TableArg features.
-///
-/// These tests verify that the Rust implementation matches the PySpark 
reference.
+//! Test suite for RuntimeConf, TVF, and TableArg features.
+//!
+//! These tests verify that the Rust implementation matches the PySpark 
reference.
 
 #[cfg(test)]
 mod tests {
diff --git a/docs/contributing.md b/docs/contributing.md
index 11a3d232..9ae099a3 100644
--- a/docs/contributing.md
+++ b/docs/contributing.md
@@ -207,13 +207,16 @@ python scripts/gen_fn_dispatch.py --pyspark-src 
"$SPARK_HOME/python"
 ## Style
 
 ```bash
-cargo fmt --all                          # format (CI runs it with --check)
-cargo clippy --workspace --all-targets   # lint (advisory in CI)
+cargo fmt --all                                         # format (CI runs it 
with --check)
+cargo clippy --workspace --all-targets -- -D warnings   # lint (blocking in CI)
 ```
 
-Rust CI builds with `RUSTFLAGS="-D warnings"`, so a compiler warning fails it. 
Clippy
-is advisory there: the tree still has findings to clean up (and `pyspark-rs` 
denies
-warnings, so they show as errors), but don't add new ones. CI also fails on 
deferral
+Rust CI builds with `RUSTFLAGS="-D warnings"`, so a compiler warning fails it, 
and so
+does any clippy finding. Clippy over the workspace needs the 
`wasm32-unknown-unknown`
+target (`rustup target add wasm32-unknown-unknown`), because it builds
+`examples/wasm-udfs`. The lints this codebase triggers by design are allowed 
once, with
+a reason, in `[workspace.lints.clippy]` of the root `Cargo.toml`; a targeted 
`#[allow]`
+needs a comment saying why. CI also fails on deferral
 markers such as `TODO`, `FIXME`, `todo!()` or "for now" in `crates/*/src`
 (`bash scripts/audit_no_stubs.sh`). Match the surrounding code, keep changes 
focused,
 and add or update golden tests when you change plan or expression building.
diff --git a/examples/Cargo.toml b/examples/Cargo.toml
index 1c389eb0..261a32ad 100644
--- a/examples/Cargo.toml
+++ b/examples/Cargo.toml
@@ -23,6 +23,9 @@ edition.workspace = true
 license.workspace = true
 publish = false
 
+[lints]
+workspace = true
+
 [[bin]]
 name = "sql"
 path = "src/sql.rs"


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

Reply via email to