[SPARK-62434] Remove unnecessary comments and express their intent in code #630
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.46) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 456 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.366
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #630"
general
weight: 0.35
dongjoon-hyun
What changes were proposed in this pull request?
This PR aims to remove unnecessary comments from the hand-written sources of the
SparkConnectmodule and to express the intent of some of them in code instead.1. Remove comments which narrate or duplicate the code:
// MARK:banners, file-level prose blocks, section labels, aTODO, a commented-out line of code, and///doc comments on non-public symbols. Generated sources (.pb.swift,base.grpc.swift,_generated.swift) and the vendored Apache Arrow sources are not touched.2. Keep the license headers, the doc comments of public APIs, and the comments which state what the code cannot express, e.g., security constraints, concurrency invariants, and server-side contracts.
3. Express the intent of the removed comments in code.
-
DataFrame.rdd()andSparkSession.sparkContextthrowSparkConnectError.unsupportedOperationwith the error class and SQLSTATE, which were written only in the comments. The doc comments oferrorClassandsqlStateare updated because they are no longer provided only by the server.-
SparkConnectClientparses and validates thesession_idparameter of the connection string like the other parameters, andSparkSessionuses it instead of a separate regex. The Scala client also parses it inSparkConnectClient.Builder.- Apache Spark 4.3.0 (2026-10-27)
SparkConnectClient.Builder.parseURIParams- Rename
isOperationNotFoundtoisOperationOrSessionNotFoundbecause it also matchesINVALID_HANDLE.SESSION_NOT_FOUND, renamepolynomialtoieee8023PolynomialinCRC32, and name the parity checkhasOtherwiseinColumn.isChainableCaseWhen.Why are the changes needed?
Comments which narrate the code drift from it over time, while the code itself can carry the same information. For example,
rdd()threw anUnsupportedOperationerror without any details although its comment described the error class and SQLSTATE. In addition, thesession_idparameter was handled in two places:SparkConnectClientskipped it andSparkSessionparsed it again with a regex.Does this PR introduce _any_ user-facing change?
Yes, the following are minor user-facing changes compared to the latest release, 0.8.0 (2026-11-09).
DataFrame.rdd()andSparkSession.sparkContextthrow errors with details. The existing call sites likecatch SparkConnectError.UnsupportedOperationand#expect(throws: SparkConnectError.UnsupportedOperation)work as before becauseSparkConnectErrorequality compares only the cases.session_idparameter of the connection string is handled like the other parameters.- The key is case-insensitive. Previously,
sc://localhost/;SESSION_ID=<uuid>was silently ignored and a random session ID was used.- When
session_idis repeated, every value is validated and the last one is used like the Scala client. Previously, only the first one was validated and used.How was this patch tested?
Pass the CIs with the updated test cases.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5.5